Example usage for java.awt.event ActionEvent getActionCommand

List of usage examples for java.awt.event ActionEvent getActionCommand

Introduction

In this page you can find the example usage for java.awt.event ActionEvent getActionCommand.

Prototype

public String getActionCommand() 

Source Link

Document

Returns the command string associated with this action.

Usage

From source file:edu.ucla.stat.SOCR.applications.demo.BlackScholesApplication.java

public void actionPerformed(ActionEvent evt) {
    //   System.out.println("action start");
    for (int i = 0; i < numInput; i++)
        if (evt.getActionCommand().equals("Input" + (i + 1))) {
            input[i] = Double.parseDouble(in[i].getText());
            // System.out.println("getting input["+i+"]="+input[i]);
            updateGraph();//from ww w .j  ava 2 s.c  om
            chartPanel.validate();
        }
    /*   if (evt.getActionCommand().equals("Mu")) {
          Mu = Double.parseDouble(inMu.getText());
      }else if (evt.getActionCommand().equals("Delta")) {
          Delta = Double.parseDouble(inDelta.getText());
      }else if (evt.getActionCommand().equals("Dt")) {
          Dt = Double.parseDouble(inDt.getText());
      }else if (evt.getActionCommand().equals("S0")) {
          S0 = Double.parseDouble(inS0.getText());
      }else if (evt.getActionCommand().equals("N")) {
          N = Double.parseDouble(inN.getText());
      }
            
            
       updateGraph();
       chartPanel.validate();       */

    this.getMainPanel().validate();
}

From source file:edu.wpi.cs.wpisuitetng.modules.requirementsmanager.view.charts.StatView.java

/**
 * method to update this object upon receiving word of an action updates
 * user preference for data type and chart type and creates a new chart
 * based on those new preferences/*from ww  w  . ja  v  a 2 s  .co  m*/
 */
@Override
public void actionPerformed(final ActionEvent e) {

    final String source = e.getActionCommand();

    // TODO: the above is what is causing the exception

    if (source.equals("Pie Chart")) {
        if (chartDataType == DataType.VELOCITY) {
            updateChartDataType(DataType.STATUS);
            comboBoxStatisticType.setSelectedItem("Status");
        }
        updateChartType(ChartType.PIE);

    } else if (source.equals("Bar Chart")) {
        if (chartDataType == DataType.VELOCITY) {
            updateChartDataType(DataType.STATUS);
            comboBoxStatisticType.setSelectedItem("Status");
        }
        updateChartType(ChartType.BAR);
    } else if (source.equals("Line Chart")) {
        updateChartType(ChartType.LINE);
        updateChartDataType(DataType.VELOCITY);
        comboBoxStatisticType.setSelectedItem("Velocity");
    } else if (comboBoxStatisticType.getSelectedItem().equals("Status")) {
        if (chartType == ChartType.LINE) {
            updateChartType(ChartType.PIE);
            makePieRadio.setSelected(true);
            makePieRadio.setEnabled(true);
            makeBarRadio.setEnabled(true);
            makeLineRadio.setEnabled(false);
        }
        updateChartDataType(DataType.STATUS);

    } else if (comboBoxStatisticType.getSelectedItem().equals("Iterations")) {
        if (chartType == ChartType.LINE) {
            updateChartType(ChartType.PIE);
            makePieRadio.setSelected(true);
            makePieRadio.setEnabled(true);
            makeBarRadio.setEnabled(true);
            makeLineRadio.setEnabled(false);
        }
        updateChartDataType(DataType.ITERATION);
    } else if (comboBoxStatisticType.getSelectedItem().equals("Assignees")) {
        if (chartType == ChartType.LINE) {
            updateChartType(ChartType.PIE);
            makePieRadio.setSelected(true);
            makePieRadio.setEnabled(true);
            makeBarRadio.setEnabled(true);
            makeLineRadio.setEnabled(false);
        }
        updateChartDataType(DataType.ASSIGNEE);
    } else if (comboBoxStatisticType.getSelectedItem().equals("Estimates")) {
        updateChartDataType(DataType.ESTIMATES);
    } else if (comboBoxStatisticType.getSelectedItem().equals("Effort")) {
        updateChartDataType(DataType.EFFORT);
    } else if (comboBoxStatisticType.getSelectedItem().equals("Velocity")) {
        updateChartDataType(DataType.VELOCITY);
        updateChartType(ChartType.LINE);
        makeLineRadio.setSelected(true);
        makePieRadio.setEnabled(false);
        makeBarRadio.setEnabled(false);
        makeLineRadio.setEnabled(true);

    } else if (comboBoxStatisticType.getSelectedItem().equals("Tasks")) {
        updateChartDataType(DataType.TASK);
    }
    updateChart();

}

From source file:ucar.unidata.idv.control.McVHistogramWrapper.java

/**
 * @return {@link ActionListener} that listens for
 * {@link ChartPanel#PROPERTIES_COMMAND} events and shows the histogram
 * properties.//from www  .ja v  a2 s  .c o m
 */
private ActionListener buildHistoPropsListener() {
    return new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            String command = event.getActionCommand();
            if (ChartPanel.PROPERTIES_COMMAND.equals(command)) {
                McVHistogramWrapper.this.showProperties();
                return;
            }
        }
    };
}

From source file:de.tor.tribes.ui.views.DSWorkbenchChurchFrame.java

/**
 * Creates new form DSWorkbenchChurchFrame
 *//* ww  w  .j av  a 2s  .c  om*/
DSWorkbenchChurchFrame() {
    initComponents();
    centerPanel = new GenericTestPanel();
    jChurchPanel.add(centerPanel, BorderLayout.CENTER);
    centerPanel.setChildComponent(jXPanel1);
    buildMenu();

    KeyStroke delete = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0, false);
    KeyStroke bbCopy = KeyStroke.getKeyStroke(KeyEvent.VK_B, ActionEvent.CTRL_MASK, false);

    ActionListener listener = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if ("Delete".equals(e.getActionCommand())) {
                deleteSelection();
            } else if ("BBCopy".equals(e.getActionCommand())) {
                bbCopySelection();
            }
        }
    };
    capabilityInfoPanel1.addActionListener(listener);
    jChurchTable.registerKeyboardAction(listener, "Delete", delete,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
    jChurchTable.registerKeyboardAction(listener, "BBCopy", bbCopy,
            JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);

    jChurchFrameAlwaysOnTop.setSelected(GlobalOptions.getProperties().getBoolean("church.frame.alwaysOnTop"));
    setAlwaysOnTop(jChurchFrameAlwaysOnTop.isSelected());

    jChurchTable.setModel(new ChurchTableModel());
    // <editor-fold defaultstate="collapsed" desc=" Init HelpSystem ">
    if (!Constants.DEBUG) {
        GlobalOptions.getHelpBroker().enableHelpKey(getRootPane(), "pages.church_view",
                GlobalOptions.getHelpBroker().getHelpSet());
    }
    // </editor-fold>
    jChurchTable.getSelectionModel().addListSelectionListener(DSWorkbenchChurchFrame.this);
    pack();
}

From source file:net.chaosserver.timelord.swingui.TimelordMenu.java

/**
 * Listens for action events from the menu commands and executes them.
 *
 * @param evt the event to trigger things.
 *///from w  w  w.  j  ava  2  s. c  om
public void actionPerformed(ActionEvent evt) {
    if (ACTION_EXIT.equals(evt.getActionCommand())) {
        this.timelord.stop();
    } else if (ACTION_EXPORT_JORDAN.equals(evt.getActionCommand())) {
        timelord.writeTimeTrackData("net.chaosserver.timelord.swingui." + "data.ExcelDataReaderWriterUI", true);
    } else if (ACTION_EXPORT_DOUG.equals(evt.getActionCommand())) {
        timelord.writeTimeTrackData("net.chaosserver.timelord.data." + "ExcelUglyDataReaderWriter", true);
    } else if (ACTION_EXPORT_XML.equals(evt.getActionCommand())) {
        timelord.writeTimeTrackData("net.chaosserver.timelord.data.XmlDataReaderWriter", true);
    } else if (ACTION_ADDTASK.equals(evt.getActionCommand())) {
        timelord.getCommonTaskPanel().showAddTaskDialog();
    } else if (ACTION_FINDTASK.equals(evt.getActionCommand())) {
        // TODO: Find task on historical panel if that frame is
        // forward
        timelord.showFindTask();
    } else if (ACTION_HIDETASK.equals(evt.getActionCommand())) {
        timelord.getCommonTaskPanel().showHideTaskDialog();
    } else if (ACTION_UNHIDETASK.equals(evt.getActionCommand())) {
        timelord.getCommonTaskPanel().showUnhideTaskDialog();
    } else if (ACTION_ADDTIME.equals(evt.getActionCommand())) {
        timelord.getCommonTaskPanel().showAddTimeDialog();
    } else if (ACTION_SORT.equals(evt.getActionCommand())) {
        getTimelordData().sortTaskCollection();
    } else if (ACTION_ABOUT.equals(evt.getActionCommand())) {
        timelord.showAboutDialog();
    } else if (ACTION_LOG.equals(evt.getActionCommand())) {
        try {
            DefaultLF5Configurator.configure();
        } catch (IOException e) {
            if (log.isErrorEnabled()) {
                log.error("Failed to open help", e);
            }
        }
    } else if (ACTION_REFRESH_VIEW.equals(evt.getActionCommand())) {
        // timelord.getCommonTaskPanel().doLayout();
        // CommonTaskPanel commonTaskPanel = timelord.getCommonTaskPanel();
        timelord.buildCommonTaskPanel();

    } else if (ACTION_CHANGE_START.equals(evt.getActionCommand())) {
        timelord.changeStartTime(false);
    } else if (ACTION_CHANGE_ANNOY.equals(evt.getActionCommand())) {
        timelord.changeAnnoyTime();
    } else if (ACTION_NEXT_TAB.equals(evt.getActionCommand())) {
        timelord.showNextTab();
    } else if (ACTION_PREVIOUS_TAB.equals(evt.getActionCommand())) {
        timelord.showPreviousTab();
    } else if (evt.getSource().equals(annoyanceJordanCheckbox)) {
        timelord.setAnnoyanceMode(Timelord.ANNOYANCE_JORDAN);
        updateAnnoyanceButtons();
    } else if (evt.getSource().equals(annoyanceDougCheckbox)) {
        timelord.setAnnoyanceMode(Timelord.ANNOYANCE_DOUG);
        updateAnnoyanceButtons();
    } else if (evt.getSource().equals(annoyanceNoneCheckbox)) {
        timelord.setAnnoyanceMode(Timelord.ANNOYANCE_NONE);
        updateAnnoyanceButtons();
    }
}

From source file:DragPictureDemo2.java

public void actionPerformed(ActionEvent e) {
    if (focusOwner == null)
        return;//from   ww  w  .j a v a2 s.c o m
    String action = (String) e.getActionCommand();
    Action a = focusOwner.getActionMap().get(action);
    if (a != null) {
        a.actionPerformed(new ActionEvent(focusOwner, ActionEvent.ACTION_PERFORMED, null));
    }
}

From source file:edu.harvard.mcz.imagecapture.ui.ButtonEditor.java

@Override
public void actionPerformed(ActionEvent e) {

    // Action might not be event_button_pressed on all systems.
    log.debug("Button event actionCommand: " + e.getActionCommand());
    if (e.getActionCommand().equals(EVENT_PRESSED)) {
        // Event is a click on the cell
        // Identify the row that was clicked on.
        JTable table = (JTable) ((JButton) e.getSource()).getParent();
        log.debug(e.getSource());//w w w  .  j  av a 2s. com
        log.debug(table);
        int row = table.getEditingRow();
        // Stop editing - note, we need to have gotten e.getSource.getParent and getEditingRow first.
        fireEditingStopped(); //Make the renderer reappear.
        Singleton.getSingletonInstance().getMainFrame()
                .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        switch (formToOpen) {
        case OPEN_SPECIMEN_DETAILS:
            // Load the selected specimen record from its ID (the data value behind the button).
            //SpecimenLifeCycle sls = new SpecimenLifeCycle();
            //Specimen specimen = sls.findById((Long)targetId);
            //if (specimen!=null) {
            if (targetId != null) {
                // a specimen with this ID exists, bring up the details editor.
                try {
                    //SpecimenControler sc = new SpecimenControler(specimen);
                    if (((Specimen) targetId).getSpecimenId() != null) {
                        if (((Specimen) targetId).isStateDone()) {
                            // Specimens in state_done are no longer editable
                            JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(),
                                    "This Specimen record has been migrated and can no longer be edited here ["
                                            + ((Specimen) targetId).getLoadFlags()
                                            + "].\nSee: http://mczbase.mcz.harvard.edu/guid/MCZ:Ent:"
                                            + ((Specimen) targetId).getCatNum(),
                                    "Migrated Specimen", JOptionPane.WARNING_MESSAGE);
                        } else {
                            // Specimen is still editable
                            if (table != null) {
                                // Pass the specimen object for the row, the table model, and the row number on to the specimen controler.
                                try {
                                    SpecimenControler sc = new SpecimenControler((Specimen) targetId,
                                            (SpecimenListTableModel) table.getModel(), table, row);
                                    if (table.getParent().getParent().getParent().getParent()
                                            .getClass() == SpecimenBrowser.class) {
                                        sc.addListener((DataChangeListener) table.getParent());
                                    } else {
                                        Component x = table;
                                        boolean done = false;
                                        while (!done) {
                                            log.debug(x.getParent());
                                            x = x.getParent();
                                            if (x.getClass() == SpecimenBrowser.class) {
                                                sc.addListener((DataChangeListener) x);
                                                done = true;
                                            }
                                        }
                                    }
                                    sc.displayInEditor();
                                } catch (java.lang.ClassCastException eNotSp) {
                                    // Request isn't coming from a SpecimenListTableModel
                                    // View just the specimen record.
                                    SpecimenControler sc = new SpecimenControler((Specimen) targetId);
                                    sc.displayInEditor();
                                }
                            } else {
                                log.debug(e.getSource());
                                //SpecimenControler sc = new SpecimenControler((Specimen)targetId);
                                //sc.displayInEditor();
                            }
                        }
                    } else {
                        log.debug("User clicked on table row containing a new Specimen()");
                        JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(),
                                "No Specimen for this image", "Load Specimen Failed",
                                JOptionPane.WARNING_MESSAGE);
                    }
                } catch (NoSuchRecordException e1) {
                    log.error("Tested for specimen!=null, but SpecimenControler threw null specimen exception");
                    log.error(e1);
                }
            } else {
                log.debug("No matches found to specimen id=" + targetId);
                // TODO: Create new specimen record and bring up dialog
                JOptionPane.showMessageDialog(Singleton.getSingletonInstance().getMainFrame(),
                        "No specimen record.");
            }
            break;
        case OPEN_TEMPLATE:
            // Load the selected specimen record from its ID (the data value behind the button).
            try {
                // a template with this targetID exists, display it.
                ((PositionTemplateEditor) parentComponent).setTemplate((String) targetId);
            } catch (NoSuchTemplateException e1) {
                log.error("No such template on button press on a template in list.");
                log.error(e1);
                log.trace(e1);
            }

            break;
        case OPEN_USER:
            //TODO: tie to user
            log.debug("Open user");
            ((UserListBrowser) parentComponent).getEditUserPanel().setUser((Users) targetId);
            break;
        case OPEN_SPECIMEN_VERBATIM:
            log.debug("Open Verbatim Transcription");
            SpecimenLifeCycle sls = new SpecimenLifeCycle();
            List<Specimen> toTranscribe = sls.findForVerbatim(((GenusSpeciesCount) targetId).getGenus(),
                    ((GenusSpeciesCount) targetId).getSpecificEpithet(), WorkFlowStatus.STAGE_1);
            log.debug(toTranscribe.size());
            SpecimenListTableModel stm = new SpecimenListTableModel(toTranscribe);
            JTable stable = new JTable();
            stable.setModel(stm);
            SpecimenControler verbCont;
            try {
                verbCont = new SpecimenControler(toTranscribe.get(0), stm, stable, 0);
                VerbatimCaptureDialog dialog = new VerbatimCaptureDialog(toTranscribe.get(0), verbCont);
                dialog.setVisible(true);
            } catch (NoSuchRecordException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }
            break;
        case OPEN_VERBATIM_CLASSIFY:
            log.debug("Open Verbatim Classify dialog");
            try {
                VerbatimClassifyDialog dialog = new VerbatimClassifyDialog(
                        (VerbatimCount) table.getModel().getValueAt(row, 0));
                dialog.setVisible(true);
            } catch (ClassCastException e1) {
                log.error(e1.getMessage(), e1);
            }
            break;
        case ACTION_CANCEL_JOB:
            log.debug("Action Cancel requested on job " + targetId);
            Singleton.getSingletonInstance().getJobList().getJobAt((Integer) targetId).cancel();
            break;
        case OPEN_SPECIMENPARTATTRIBUTES:
            SpecimenPartAttributeDialog attrDialog = new SpecimenPartAttributeDialog((SpecimenPart) targetId);
            attrDialog.setVisible(true);
            break;
        }
        Singleton.getSingletonInstance().getMainFrame()
                .setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        System.gc();
    }
}

From source file:edu.unc.LCCC.caBIG.DWD.javaCode.visualization.SetUpPlotWindow.java

public void actionPerformed(ActionEvent ae) {
    myAction = ae.getActionCommand();

    if (myAction.equalsIgnoreCase("SAVEJPAG")) {
        //Container content = getContentPane();
        content = getContentPane();/*from   w w  w .  j  av  a  2s . c om*/
        JFrame jframe = new OpenFileDir("Open File Directory", "SAVEJPAG");
        jframe.show();

        /* Modified here on 5/31/2005*/

        //Container content = getContentPane();   
        /*             Component c = V4.getBottomComponent(); 
                     content.remove(c);
                
                   
                     String fileName = OpenFileDir.JPEGFileName;
                             
                     //System.out.println ("JPG filename in SetPlot= " +fileName);
                             
                     File fFile = new File (fileName);
                     if (fFile.exists ()) {
        int response = JOptionPane.showConfirmDialog (null,
              "Overwrite existing file "+ fileName +" ??" ,"Confirm Overwrite",
          JOptionPane.OK_CANCEL_OPTION,
          JOptionPane.QUESTION_MESSAGE);
        if (response == JOptionPane.CANCEL_OPTION) {
            go back to reload the file
           return;                   
        }
                     }
                     saveComponentAsJPEG(content, fileName);*/

    } /*else if (myAction.equalsIgnoreCase("SAVEJPAG") ) {
      Container content = getContentPane();
                         
      Component c = V4.getBottomComponent(); 
      content.remove(c);
              
              
      String fileName = OpenFileDir.JPEGFileName;
               
      File fFile = new File (fileName);
      if (fFile.exists ()) {
         int response = JOptionPane.showConfirmDialog (null,
           "Overwrite existing file "+ fileName +" ??" ,"Confirm Overwrite",
            JOptionPane.OK_CANCEL_OPTION,
            JOptionPane.QUESTION_MESSAGE);
         if (response == JOptionPane.CANCEL_OPTION) {
             go back to reload the file
             return;                   
         }
      }
      saveComponentAsJPEG(content, fileName);
      } */

}

From source file:net.sf.mzmine.desktop.impl.projecttree.ProjectTreeMouseHandler.java

public void actionPerformed(ActionEvent e) {

    String command = e.getActionCommand();

    // Actions for raw data files

    if (command.equals("SHOW_TIC")) {
        RawDataFile[] selectedFiles = tree.getSelectedObjects(RawDataFile.class);
        TICVisualizerModule.setupNewTICVisualizer(selectedFiles);
    }/*from  w w  w. jav a  2 s.c om*/

    if (command.equals("SHOW_SPECTRUM")) {
        RawDataFile[] selectedFiles = tree.getSelectedObjects(RawDataFile.class);
        SpectraVisualizerModule module = MZmineCore.getModuleInstance(SpectraVisualizerModule.class);
        ParameterSet parameters = MZmineCore.getConfiguration()
                .getModuleParameters(SpectraVisualizerModule.class);
        parameters.getParameter(SpectraVisualizerParameters.dataFiles)
                .setValue(RawDataFilesSelectionType.SPECIFIC_FILES, selectedFiles);
        ExitCode exitCode = parameters.showSetupDialog(MZmineCore.getDesktop().getMainWindow(), true);
        MZmineProject project = MZmineCore.getProjectManager().getCurrentProject();
        if (exitCode == ExitCode.OK)
            module.runModule(project, parameters, new ArrayList<Task>());
    }

    if (command.equals("SHOW_IDA")) {
        RawDataFile[] selectedFiles = tree.getSelectedObjects(RawDataFile.class);
        if (selectedFiles.length == 0)
            return;
        IDAVisualizerModule.showIDAVisualizerSetupDialog(selectedFiles[0]);

    }

    if (command.equals("SHOW_2D")) {
        RawDataFile[] selectedFiles = tree.getSelectedObjects(RawDataFile.class);
        if (selectedFiles.length == 0)
            return;
        TwoDVisualizerModule.show2DVisualizerSetupDialog(selectedFiles[0]);
    }

    if (command.equals("SHOW_3D")) {
        RawDataFile[] selectedFiles = tree.getSelectedObjects(RawDataFile.class);
        if (selectedFiles.length == 0)
            return;
        ThreeDVisualizerModule.setupNew3DVisualizer(selectedFiles[0]);
    }

    if (command.equals("SORT_FILES")) {
        // save current selection
        TreePath savedSelection[] = tree.getSelectionPaths();
        RawDataFile selectedFiles[] = tree.getSelectedObjects(RawDataFile.class);
        OrderDataFilesModule module = MZmineCore.getModuleInstance(OrderDataFilesModule.class);
        ParameterSet params = MZmineCore.getConfiguration().getModuleParameters(OrderDataFilesModule.class);
        params.getParameter(OrderDataFilesParameters.dataFiles)
                .setValue(RawDataFilesSelectionType.SPECIFIC_FILES, selectedFiles);
        module.runModule(MZmineCore.getProjectManager().getCurrentProject(), params, new ArrayList<Task>());
        // restore selection
        tree.setSelectionPaths(savedSelection);
    }

    if (command.equals("REMOVE_EXTENSION")) {
        RawDataFile[] selectedFiles = tree.getSelectedObjects(RawDataFile.class);
        for (RawDataFile file : selectedFiles) {
            file.setName(FilenameUtils.removeExtension(file.toString()));
        }
        tree.updateUI();
    }

    if (command.equals("REMOVE_FILE")) {
        RawDataFile[] selectedFiles = tree.getSelectedObjects(RawDataFile.class);
        PeakList allPeakLists[] = MZmineCore.getProjectManager().getCurrentProject().getPeakLists();
        for (RawDataFile file : selectedFiles) {
            for (PeakList peakList : allPeakLists) {
                if (peakList.hasRawDataFile(file)) {
                    String msg = "Cannot remove file " + file.getName()
                            + ", because it is present in the peak list " + peakList.getName();
                    MZmineCore.getDesktop().displayErrorMessage(MZmineCore.getDesktop().getMainWindow(), msg);
                    return;
                }
            }
            MZmineCore.getProjectManager().getCurrentProject().removeFile(file);
        }
    }

    // Actions for scans

    if (command.equals("SHOW_SCAN")) {
        Scan selectedScans[] = tree.getSelectedObjects(Scan.class);
        for (Scan scan : selectedScans) {
            SpectraVisualizerModule.showNewSpectrumWindow(scan.getDataFile(), scan.getScanNumber());
        }
    }

    if (command.equals("SHOW_MASSLIST")) {
        MassList selectedMassLists[] = tree.getSelectedObjects(MassList.class);
        for (MassList massList : selectedMassLists) {
            Scan scan = massList.getScan();
            SpectraVisualizerWindow window = SpectraVisualizerModule.showNewSpectrumWindow(scan.getDataFile(),
                    scan.getScanNumber());
            MassListDataSet dataset = new MassListDataSet(massList);
            window.addDataSet(dataset, Color.green);
        }
    }

    if (command.equals("REMOVE_MASSLIST")) {
        MassList selectedMassLists[] = tree.getSelectedObjects(MassList.class);
        for (MassList massList : selectedMassLists) {
            Scan scan = massList.getScan();
            scan.removeMassList(massList);
        }
    }

    if (command.equals("REMOVE_ALL_MASSLISTS")) {
        MassList selectedMassLists[] = tree.getSelectedObjects(MassList.class);
        for (MassList massList : selectedMassLists) {
            String massListName = massList.getName();
            RawDataFile dataFiles[] = MZmineCore.getProjectManager().getCurrentProject().getDataFiles();
            for (RawDataFile dataFile : dataFiles) {
                int scanNumbers[] = dataFile.getScanNumbers();
                for (int scanNum : scanNumbers) {
                    Scan scan = dataFile.getScan(scanNum);
                    MassList ml = scan.getMassList(massListName);
                    if (ml != null)
                        scan.removeMassList(ml);
                }
            }
        }
    }

    // Actions for peak lists

    if (command.equals("SHOW_PEAKLIST_TABLES")) {
        PeakList[] selectedPeakLists = tree.getSelectedObjects(PeakList.class);
        for (PeakList peakList : selectedPeakLists) {
            PeakListTableModule.showNewPeakListVisualizerWindow(peakList);
        }
    }

    if (command.equals("SHOW_PEAKLIST_INFO")) {
        PeakList[] selectedPeakLists = tree.getSelectedObjects(PeakList.class);
        for (PeakList peakList : selectedPeakLists) {
            InfoVisualizerModule.showNewPeakListInfo(peakList);
        }
    }

    if (command.equals("SHOW_SCATTER_PLOT")) {
        PeakList[] selectedPeakLists = tree.getSelectedObjects(PeakList.class);
        for (PeakList peakList : selectedPeakLists) {
            ScatterPlotVisualizerModule.showNewScatterPlotWindow(peakList);
        }
    }

    if (command.equals("SORT_PEAKLISTS")) {
        // save current selection
        TreePath savedSelection[] = tree.getSelectionPaths();
        PeakList selectedPeakLists[] = tree.getSelectedObjects(PeakList.class);
        OrderPeakListsModule module = MZmineCore.getModuleInstance(OrderPeakListsModule.class);
        ParameterSet params = MZmineCore.getConfiguration().getModuleParameters(OrderPeakListsModule.class);
        params.getParameter(OrderPeakListsParameters.peakLists)
                .setValue(PeakListsSelectionType.SPECIFIC_PEAKLISTS, selectedPeakLists);
        module.runModule(MZmineCore.getProjectManager().getCurrentProject(), params, new ArrayList<Task>());
        // restore selection
        tree.setSelectionPaths(savedSelection);
    }

    if (command.equals("REMOVE_PEAKLIST")) {
        PeakList[] selectedPeakLists = tree.getSelectedObjects(PeakList.class);
        for (PeakList peakList : selectedPeakLists)
            MZmineCore.getProjectManager().getCurrentProject().removePeakList(peakList);
    }

    // Actions for peak list rows

    if (command.equals("SHOW_PEAK_SUMMARY")) {
        PeakListRow[] selectedRows = tree.getSelectedObjects(PeakListRow.class);
        for (PeakListRow row : selectedRows) {
            PeakSummaryVisualizerModule.showNewPeakSummaryWindow(row);
        }
    }

}

From source file:net.sf.xmm.moviemanager.gui.DialogIMDbMultiAdd.java

JButton createPlayButton() {

    JButton playMediaFiles = new JButton("Play");
    playMediaFiles.setActionCommand("DialogIMDbMultiAdd - Play"); //$NON-NLS-1$

    playMediaFiles.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            log.debug("ActionPerformed: " + event.getActionCommand()); //$NON-NLS-1$

            if (multiAddFile != null) {

                String[] files = multiAddFile.toStringArray();

                try {
                    MovieManagerCommandPlay.executePlay(files);
                } catch (IOException e) {
                    log.warn("Exception:" + e.getMessage(), e);
                } catch (InterruptedException e) {
                    log.warn("Exception:" + e.getMessage(), e);
                }//w w  w.j  a va2s  .  c o m
            }
        }
    });

    return playMediaFiles;
}