fileMenu.add(newFolderMenuItem); fileMenu.addSeparator(); configureMenuItem = new JMenuItem(ActionUtil.CONFIGURE_ACTION); configureMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { organizer.startBuilder(); } }); fileMenu.add(configureMenuItem); buildMenuItem = new JMenuItem(ActionUtil.BUILD_ACTION); buildMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { organizer.startExperimentBuilder(); } }); fileMenu.add(buildMenuItem); runMenuItem = new JMenuItem(ActionUtil.RUN_ACTION); runMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { organizer.startConsole(); } }); fileMenu.add(runMenuItem); duplicateMenuItem = new JMenuItem(ActionUtil.DUPLICATE_ACTION); duplicateMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { organizer.duplicate(); } }); fileMenu.add(duplicateMenuItem); deleteMenuItem = new JMenuItem(ActionUtil.DELETE_ACTION); deleteMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { organizer.delete(); } }); fileMenu.add(deleteMenuItem); deleteExperimentFromDatabaseMenuItem = new JMenuItem(ActionUtil.DELETE_EXPERIMENT_FROM_DATABASE_ACTION); deleteExperimentFromDatabaseMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { organizer.deleteExperimentFromDatabase(); } }); fileMenu.add(deleteExperimentFromDatabaseMenuItem); deleteRecipeFromDatabaseMenuItem = new JMenuItem(ActionUtil.DELETE_RECIPE_FROM_DATABASE_ACTION); deleteRecipeFromDatabaseMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { organizer.deleteRecipeFromDatabase(); } }); fileMenu.add(deleteRecipeFromDatabaseMenuItem); renameMenuItem = new JMenuItem(ActionUtil.RENAME_ACTION); renameMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { organizer.rename(); } }); fileMenu.add(renameMenuItem); fileMenu.addSeparator(); JMenuItem exitMenuItem = new JMenuItem(EXIT_MENU_ITEM); exitMenuItem.addActionListener(this);
  public CSMART() {    setTitle("CSMART");    createLog();    // Write initial CSMART info to the log file    if (log.isShoutEnabled()) {      log.shout(writeDebug());    }    resultDir = initResultDir();    JMenuBar menuBar = new JMenuBar();    getRootPane().setJMenuBar(menuBar);    // set-up file menu which includes entries based on workspace selection    fileMenu = new JMenu(FILE_MENU);    fileMenu.setToolTipText("Create new workspace or quit.");    fileMenu.addMenuListener(myMenuListener);    JMenuItem newMenuItem = new JMenuItem(NEW_MENU_ITEM);    newMenuItem.addActionListener(this);    newMenuItem.setToolTipText("Create a new workspace.");    fileMenu.add(newMenuItem);    JMenuItem newResultsMenuItem = new JMenuItem(NEW_RESULTS_MENU_ITEM);    newResultsMenuItem.addActionListener(this);    newResultsMenuItem.setToolTipText("Select a directory for saving results");    fileMenu.add(newResultsMenuItem);    newExperimentMenu = new JMenu(ActionUtil.NEW_EXPERIMENT_ACTION);    for (int i = 0; i < newExperimentActions.length; i++)      newExperimentMenu.add(newExperimentActions[i]);    fileMenu.add(newExperimentMenu);    newRecipeMenu = new JMenu(ActionUtil.NEW_RECIPE_ACTION);    for (int i = 0; i < newRecipeActions.length; i++)      newRecipeMenu.add(newRecipeActions[i]);    fileMenu.add(newRecipeMenu);    newFolderMenuItem = new JMenuItem(ActionUtil.NEW_FOLDER_ACTION);    newFolderMenuItem.addActionListener(new ActionListener() {        public void actionPerformed(ActionEvent e) {          organizer.newFolder();        }      });    fileMenu.add(newFolderMenuItem);    fileMenu.addSeparator();    configureMenuItem = new JMenuItem(ActionUtil.CONFIGURE_ACTION);    configureMenuItem.addActionListener(new ActionListener() {        public void actionPerformed(ActionEvent e) {          organizer.startBuilder();        }      });    fileMenu.add(configureMenuItem);    buildMenuItem = new JMenuItem(ActionUtil.BUILD_ACTION);    buildMenuItem.addActionListener(new ActionListener() {        public void actionPerformed(ActionEvent e) {          organizer.startExperimentBuilder();        }      });    fileMenu.add(buildMenuItem);    runMenuItem = new JMenuItem(ActionUtil.RUN_ACTION);    runMenuItem.addActionListener(new ActionListener() {        public void actionPerformed(ActionEvent e) {          organizer.startConsole();        }      });    fileMenu.add(runMenuItem);    duplicateMenuItem = new JMenuItem(ActionUtil.DUPLICATE_ACTION);    duplicateMenuItem.addActionListener(new ActionListener() {        public void actionPerformed(ActionEvent e) {          organizer.duplicate();        }      });    fileMenu.add(duplicateMenuItem);    deleteMenuItem = new JMenuItem(ActionUtil.DELETE_ACTION);    deleteMenuItem.addActionListener(new ActionListener() {        public void actionPerformed(ActionEvent e) {          organizer.delete();        }      });    fileMenu.add(deleteMenuItem);    deleteExperimentFromDatabaseMenuItem =       new JMenuItem(ActionUtil.DELETE_EXPERIMENT_FROM_DATABASE_ACTION);    deleteExperimentFromDatabaseMenuItem.addActionListener(new ActionListener() {        public void actionPerformed(ActionEvent e) {          organizer.deleteExperimentFromDatabase();        }      });    fileMenu.add(deleteExperimentFromDatabaseMenuItem);    deleteRecipeFromDatabaseMenuItem =       new JMenuItem(ActionUtil.DELETE_RECIPE_FROM_DATABASE_ACTION);    deleteRecipeFromDatabaseMenuItem.addActionListener(new ActionListener() {        public void actionPerformed(ActionEvent e) {          organizer.deleteRecipeFromDatabase();        }      });    fileMenu.add(deleteRecipeFromDatabaseMenuItem);    renameMenuItem = new JMenuItem(ActionUtil.RENAME_ACTION);    renameMenuItem.addActionListener(new ActionListener() {        public void actionPerformed(ActionEvent e) {          organizer.rename();        }      });    fileMenu.add(renameMenuItem);    fileMenu.addSeparator();    JMenuItem exitMenuItem = new JMenuItem(EXIT_MENU_ITEM);    exitMenuItem.addActionListener(this);    exitMenuItem.setToolTipText("Exit");    fileMenu.add(exitMenuItem);    windowMenu = new JMenu(WINDOW_MENU);    windowMenu.setToolTipText("Display selected window.");    JMenu helpMenu = new JMenu(HELP_MENU);    for (int i = 0; i < helpMenuItems.length; i++) {      JMenuItem mItem = new JMenuItem(helpMenuItems[i]);      mItem.addActionListener(this);      helpMenu.add(mItem);    }    menuBar.add(fileMenu);    menuBar.add(windowMenu);    menuBar.add(helpMenu);    toolBar = new JToolBar();    toolBar.setLayout(new GridLayout(1, 5, 2, 2));    getContentPane().add("North", toolBar);    organizer = new Organizer(this);    organizer.addTreeSelectionListener(this);    organizer.addTreeModelListener(this);    getContentPane().add("Center", organizer);    for (int i = 0; i < views.length; i++) {      JButton button = makeButton(views[i], iconFilenames[i]);      button.setHorizontalTextPosition(JButton.CENTER);      button.setVerticalTextPosition(JButton.BOTTOM);      button.setActionCommand(views[i]);      button.addActionListener(this);      button.setToolTipText(tooltips[i]);      toolBar.add(button);    }    enableCSMARTTools();    // if user closes this window, quit    addWindowListener(new WindowAdapter() {      public void windowClosing(WindowEvent e) {	exit();      }    });    NamedFrame.getNamedFrame().addObserver(this);    pack();    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();    int w = getWidth();    int h = getHeight();    setSize(w, h);    setLocation((screenSize.width - w)/2, (screenSize.height - h)/2);    setVisible(true);  }