AllRelationsAction();

    public static final BaseAction CopyOptionPopupMenu1Action = new CopyOptionPopupMenuAction(CopyOptionPopupMenuAction.MAP_OPTION, KeyEvent.VK_M);
    public static final BaseAction CopyOptionPopupMenu2Action = new CopyOptionPopupMenuAction(CopyOptionPopupMenuAction.COPY_OPTION, KeyEvent.VK_C);
    public static final BaseAction CopyOptionPopupMenu3Action = new CopyOptionPopupMenuAction(CopyOptionPopupMenuAction.MOVE_OPTION, KeyEvent.VK_V);
    public static final BaseAction CopyOptionPopupMenu4Action = new CopyOptionPopupMenuAction(CopyOptionPopupMenuAction.CANCEL_OPTION, KeyEvent.VK_E);

    public static final BaseAction AddImplAction = new AddImplAction();
//    public static final BaseAction RemoveImplAction = new RemoveImplAction();
    public static final BaseAction AddItfAction = new AddItfAction();
//    public static final BaseAction RemoveItfAction = new RemoveItfAction();
    public static final BaseAction RemoveImplOrItfAction = new RemoveImplOrItfAction();
    public static final BaseAction ExecuteImplAction = new ExecuteImplAction();
    public static final BaseAction EditCellConfigAction = new EditCellConfigAction();

    public static final BaseAction SwitchEvaluationModeAction = new SwitchEvaluationModeAction();
    public static final BaseAction RunEvaluationAction = new RunEvaluationAction();
    public static final BaseAction StopEvaluationAction = new StopEvaluationAction();

    public static final BaseAction SwitchCellWrapAction = new SwitchCellWrapAction();
    public static final BaseAction SwitchNavigationPanelAction = new SwitchNavigationPanelAction();
    public static final BaseAction UseLargerCellAction = new UseLargerCellAction();
    public static final BaseAction UseSmallerCellAction = new UseSmallerCellAction();
    public static final BaseAction SwitchTypeAndUnitQueryModeAction = new SwitchTypeAndUnitQueryModeAction();
    public static final BaseAction StartTypeAndUnitQueryModeAction = new StartTypeAndUnitQueryModeAction();
    public static final BaseAction ExitTypeAndUnitQueryModeAction = new ExitTypeAndUnitQueryModeAction();

    public static final BaseAction SwitchDebugConsoleAction = new SwitchDebugConsoleAction();

    public static ComponentReference compRef = null;

    static abstract class BaseAction extends AbstractAction {
        protected ComponentReference compRef;
        public BaseAction(String text, ImageIcon icon, String desc, Integer mnemonic, KeyStroke accelerator) {
            super(text, icon);
            putValue(SHORT_DESCRIPTION, desc);
            putValue(MNEMONIC_KEY, mnemonic);
            putValue(ACCELERATOR_KEY, accelerator);
        }
        public void setComponentReference(ComponentReference compRef) {
            this.compRef = compRef;
        }
        abstract public void actionPerformed(ActionEvent e);
    }

    static class NewModelAction extends BaseAction {
        public NewModelAction() {
            super("New Model...", UIUtil.createImageIcon("images/New.gif"), "create a new model", new Integer(KeyEvent.VK_N), KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            compRef.getModelEditor().createNewModel();
        }
    }

    static class EditModelAction extends BaseAction {
        public EditModelAction() {
            super("Edit Model Name and Description...", null, "edit model name and description", null, null);
        }

        public void actionPerformed(ActionEvent e) {
            compRef.getModelEditor().editModel();
        }
    }

    static class OpenAction extends BaseAction {

        public OpenAction() {
            super("Open...", UIUtil.createImageIcon("images/Open.gif"), "open a new catalog model", new Integer(KeyEvent.VK_O), KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            compRef.getModelEditor().openModelFromFile();
        }
    }

    static class SaveAction extends BaseAction {
        public SaveAction() {
            super("Save", UIUtil.createImageIcon("images/Save.gif"), "save the current model to disk", new Integer(KeyEvent.VK_S), KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            compRef.getImplementationEditor().closeScriptEditor(true);
            if (compRef.getModelEditor().getFilePath() == null) {
                compRef.getModelEditor().saveModelAsNewFile();
            } else {
                compRef.getModelEditor().saveModelAsCurrentFile();
            }
        }
    }

    static class SaveAsAction extends BaseAction {
        public SaveAsAction() {
            super("Save As...", UIUtil.createImageIcon("images/SaveAs.gif"), "save the current model as a different name", new Integer(KeyEvent.VK_A), KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0));
        }

        public void actionPerformed(ActionEvent e) {
            compRef.getModelEditor().saveModelAsNewFile();
        }
    }



    static class CloseAction extends BaseAction {
        public CloseAction() {
            super("Close", UIUtil.createImageIcon("images/Close.gif"), "close the current model", new Integer(KeyEvent.VK_C), null);
        }

        public void actionPerformed(ActionEvent e) {
            compRef.getModelEditor().closeModel();
        }
    }

    static class ExitAction extends BaseAction {
        public ExitAction() {
            super("Exit", null, "quit catalog model editor", new Integer(KeyEvent.VK_X), KeyStroke.getKeyStroke(KeyEvent.VK_F4, ActionEvent.ALT_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            compRef.getModelEditor().quitEditor();
        }
    }

    static class AddRelationAction extends BaseAction {
        public AddRelationAction() {
            super("Add Relation...", UIUtil.createImageIcon("images/AddRelation.gif"), "add relation", new Integer(KeyEvent.VK_A), KeyStroke.getKeyStroke(KeyEvent.VK_I, ActionEvent.CTRL_MASK));
        }

        public void actionPerformed(ActionEvent e) {
            compRef.getImplementationEditor().closeScriptEditor(true);
            compRef.getImplementationEditor().getRelationEditor().addRelation();
        }
    }

    static class DeleteRelationOrCellAction extends BaseAction {
        public DeleteRelationOrCellAction() {
            super("Delete Selected Relations or Cells...", UIUtil.createImageIcon("images/RemoveRelation.gif"), "delete selected relations or cells", new Integer(KeyEvent.VK_D), KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0));
        }

        public void actionPerformed(ActionEvent e) {
            compRef.getRelationEditor().removeRelationOrCell();
        }
    }

    static class EditInterfaceAction extends BaseAction {
        public EditInterfaceAction() {
            super("Edit Interface...", UIUtil.createImageIcon("images/Draw.gif"), "edit interface", new Integer(KeyEvent.VK_I), null);
        }

        public void actionPerformed(ActionEvent e) {
            compRef.getInterfaceEditor().editInterface();
        }
    }

    static class EditRelationAction extends BaseAction {
        public EditRelationAction() {
            super("Edit Selected Relation...", UIUtil.createImageIcon("images/EditRelation.gif"), "edit selected relation", new Integer(KeyEvent.VK_E), KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0));
        }

        public void actionPerformed(ActionEvent e) {
            if (compRef.getInterfaceBar().isSelected()) {
                /* edit interface bar */
                compRef.getInterfaceEditor().editInterface();
                return;
            }

            RelationBar[] selectedBars = compRef.getSelectedRelationBars();

            if (selectedBars.length == 0) {
                Object[] options = { "OK" };
                JOptionPane.showOptionDialog(SwingUtilities.getWindowAncestor(compRef.getInterfaceBar()), "Please select a relation to be modified by clicking on its