Search in sources :

Example 1 with HpcAccountSettingAction

use of edu.cmu.tetradapp.app.hpc.action.HpcAccountSettingAction in project tetrad by cmu-phil.

the class TetradMenuBar method buildFileMenu.

// ================================ Private Method ===============================//
private void buildFileMenu(final JMenu fileMenu) {
    // =======================FILE MENU=========================//
    // These have to be wrapped in JMenuItems to get the keyboard
    // accelerators to work correctly.
    JMenuItem newSession = new JMenuItem(new NewSessionAction());
    JMenuItem loadSession = new JMenuItem(new LoadSessionAction());
    JMenuItem closeSession = new JMenuItem(new CloseSessionAction());
    JMenuItem saveSession = new JMenuItem(new SaveSessionAction());
    fileMenu.add(newSession);
    fileMenu.add(loadSession);
    fileMenu.add(closeSession);
    // fileMenu.addSeparator();
    // fileMenu.add(templateMenu);
    // 
    // //=======================EXAMPLES MENU=========================//
    // // Build a LoadTemplateAction for each file name in
    // // this.exampleFiles.
    // String[] templateNames = ConstructTemplateAction.getTemplateNames();
    // for (String templateName : templateNames) {
    // if ("--separator--".equals(templateName)) {
    // fileMenu.addSeparator();
    // } else {
    // ConstructTemplateAction action =
    // new ConstructTemplateAction(templateName);
    // fileMenu.add(action);
    // }
    // }
    fileMenu.addSeparator();
    fileMenu.add(saveSession);
    fileMenu.add(new SaveSessionAsAction());
    fileMenu.addSeparator();
    fileMenu.add(new SessionVersionAction());
    fileMenu.addSeparator();
    // fileMenu.add(new SaveScreenshot(desktop, true, "Save Screenshot..."));
    final JMenuItem menuItem = new JMenuItem("Save Session Workspace Image...");
    menuItem.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            SessionEditorIndirectRef editorRef = DesktopController.getInstance().getFrontmostSessionEditor();
            SessionEditor editor = (SessionEditor) editorRef;
            editor.saveSessionImage();
        }
    });
    fileMenu.add(menuItem);
    fileMenu.addSeparator();
    JMenu settingsMenu = new JMenu("Settings");
    JMenuItem loggingSettingMenuItem = new JMenuItem(new SetupLoggingAction());
    JMenuItem hpcAccountSettingMenuItem = new JMenuItem(new HpcAccountSettingAction());
    settingsMenu.add(loggingSettingMenuItem);
    settingsMenu.add(hpcAccountSettingMenuItem);
    fileMenu.add(settingsMenu);
    fileMenu.addSeparator();
    JMenuItem exit = new JMenuItem(new ExitAction());
    fileMenu.add(exit);
    exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
    newSession.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK));
    loadSession.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, ActionEvent.CTRL_MASK));
    saveSession.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK));
    closeSession.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, ActionEvent.CTRL_MASK));
}
Also used : ActionEvent(java.awt.event.ActionEvent) HpcAccountSettingAction(edu.cmu.tetradapp.app.hpc.action.HpcAccountSettingAction) ActionListener(java.awt.event.ActionListener) SessionEditorIndirectRef(edu.cmu.tetradapp.util.SessionEditorIndirectRef)

Aggregations

HpcAccountSettingAction (edu.cmu.tetradapp.app.hpc.action.HpcAccountSettingAction)1 SessionEditorIndirectRef (edu.cmu.tetradapp.util.SessionEditorIndirectRef)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1