Search in sources :

Example 1 with FileSaveAsAction

use of easik.ui.menu.FileSaveAsAction in project fql by CategoricalData.

the class ApplicationFrame method buildMenu.

/**
 * Builds the menu
 */
private void buildMenu() {
    final JMenuBar mainMenu;
    final JMenu menuFile;
    final JMenu menuEdit;
    @SuppressWarnings("unused") JMenu menuAction;
    final JMenu menuHelp;
    mainMenu = new JMenuBar();
    // Make the File Menu
    menuFile = new JMenu("File");
    addMenuItem(menuFile, new FileNewOverviewAction(this), KeyEvent.VK_N);
    addMenuItem(menuFile, new FileOpenAction(this), KeyEvent.VK_O);
    menuFile.addSeparator();
    addMenuItem(menuFile, new FileSaveAction(this), KeyEvent.VK_S);
    addMenuItem(menuFile, new FileSaveAsAction(this), KeyEvent.VK_S, InputEvent.SHIFT_DOWN_MASK);
    menuFile.addSeparator();
    _recentFilesMenu = new JMenu("Open recent...");
    menuFile.add(_recentFilesMenu);
    updateRecentFilesMenu();
    menuFile.addSeparator();
    addMenuItem(menuFile, new OverviewDocumentInfoAction(this), KeyEvent.VK_I);
    menuFile.addSeparator();
    addMenuItem(menuFile, new FileQuitAction(this), KeyEvent.VK_Q);
    mainMenu.add(menuFile);
    menuFile.setMnemonic(KeyEvent.VK_F);
    menuEdit = new JMenu("Edit");
    menuEdit.add(new JMenuItem(new NewSketchAction(null, _overview)));
    menuEdit.add(new JMenuItem(new ImportSketchAction(null, _overview)));
    menuEdit.addSeparator();
    menuEdit.add(_NewViewMenuItem = new JMenuItem(new NewViewAction(_overview)));
    mainMenu.add(menuEdit);
    menuEdit.addMenuListener(new MenuListener() {

        @Override
        public void menuSelected(final MenuEvent e1) {
            final Object[] selection = _overview.getSelectionCells();
            _NewViewMenuItem.setEnabled((selection.length == 1) && (selection[0] instanceof SketchNode));
        }

        @Override
        public void menuDeselected(final MenuEvent e1) {
        }

        @Override
        public void menuCanceled(final MenuEvent e1) {
        }
    });
    menuEdit.addSeparator();
    // If
    addMenuItem(menuEdit, _ProgramSettingsItem = new JMenuItem("Preferences"), KeyEvent.VK_E);
    // you
    // change
    // this
    // title,
    // update
    // OSX.java
    _ProgramSettingsItem.setToolTipText("Set Global Easik Properties");
    _ProgramSettingsItem.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(final ActionEvent e1) {
            final ProgramSettingsUI myUI = new ProgramSettingsUI(ApplicationFrame.this);
            myUI.showDialog();
        }
    });
    menuEdit.setMnemonic(KeyEvent.VK_E);
    // Create help menu
    menuHelp = new JMenu("Help");
    mainMenu.add(menuHelp);
    menuHelp.setMnemonic(KeyEvent.VK_H);
    menuHelp.add(new HelpAction());
    menuHelp.add(new AboutAction());
    setJMenuBar(mainMenu);
}
Also used : FileNewOverviewAction(easik.ui.menu.FileNewOverviewAction) HelpAction(easik.ui.menu.HelpAction) OverviewDocumentInfoAction(easik.ui.menu.OverviewDocumentInfoAction) NewViewAction(easik.ui.menu.popup.NewViewAction) MenuListener(javax.swing.event.MenuListener) ActionEvent(java.awt.event.ActionEvent) AboutAction(easik.ui.menu.AboutAction) FileSaveAsAction(easik.ui.menu.FileSaveAsAction) SketchNode(easik.overview.vertex.SketchNode) FileSaveAction(easik.ui.menu.FileSaveAction) FileQuitAction(easik.ui.menu.FileQuitAction) ActionListener(java.awt.event.ActionListener) ImportSketchAction(easik.ui.menu.popup.ImportSketchAction) JMenuItem(javax.swing.JMenuItem) NewSketchAction(easik.ui.menu.popup.NewSketchAction) JMenuBar(javax.swing.JMenuBar) JMenu(javax.swing.JMenu) FileOpenAction(easik.ui.menu.FileOpenAction) MenuEvent(javax.swing.event.MenuEvent)

Aggregations

SketchNode (easik.overview.vertex.SketchNode)1 AboutAction (easik.ui.menu.AboutAction)1 FileNewOverviewAction (easik.ui.menu.FileNewOverviewAction)1 FileOpenAction (easik.ui.menu.FileOpenAction)1 FileQuitAction (easik.ui.menu.FileQuitAction)1 FileSaveAction (easik.ui.menu.FileSaveAction)1 FileSaveAsAction (easik.ui.menu.FileSaveAsAction)1 HelpAction (easik.ui.menu.HelpAction)1 OverviewDocumentInfoAction (easik.ui.menu.OverviewDocumentInfoAction)1 ImportSketchAction (easik.ui.menu.popup.ImportSketchAction)1 NewSketchAction (easik.ui.menu.popup.NewSketchAction)1 NewViewAction (easik.ui.menu.popup.NewViewAction)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 JMenu (javax.swing.JMenu)1 JMenuBar (javax.swing.JMenuBar)1 JMenuItem (javax.swing.JMenuItem)1 MenuEvent (javax.swing.event.MenuEvent)1 MenuListener (javax.swing.event.MenuListener)1