MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / actionPerformed

Method actionPerformed

ij/src/main/java/ij/ImageJ.java:444–477  ·  view source on GitHub ↗

Handle menu events.

(ActionEvent e)

Source from the content-addressed store, hash-verified

442
443 /** Handle menu events. */
444 public void actionPerformed(ActionEvent e) {
445 if ((e.getSource() instanceof MenuItem)) {
446 MenuItem item = (MenuItem)e.getSource();
447 String cmd = e.getActionCommand();
448 Frame frame = WindowManager.getFrontWindow();
449 if (frame!=null && (frame instanceof Fitter)) {
450 ((Fitter)frame).actionPerformed(e);
451 return;
452 }
453 commandName = cmd;
454 ImagePlus imp = null;
455 if (item.getParent()==Menus.getOpenRecentMenu()) {
456 new RecentOpener(cmd); // open image in separate thread
457 return;
458 } else if (item.getParent()==Menus.getPopupMenu()) {
459 Object parent = Menus.getPopupMenu().getParent();
460 if (parent instanceof ImageCanvas)
461 imp = ((ImageCanvas)parent).getImage();
462 }
463 int flags = e.getModifiers();
464 hotkey = false;
465 actionPerformedTime = System.currentTimeMillis();
466 long ellapsedTime = actionPerformedTime-keyPressedTime;
467 if (cmd!=null && (ellapsedTime>=200L||!cmd.equals(lastKeyCommand))) {
468 if ((flags & Event.ALT_MASK)!=0)
469 IJ.setKeyDown(KeyEvent.VK_ALT);
470 if ((flags & Event.SHIFT_MASK)!=0)
471 IJ.setKeyDown(KeyEvent.VK_SHIFT);
472 new Executer(cmd, imp);
473 }
474 lastKeyCommand = null;
475 if (IJ.debugMode) IJ.log("actionPerformed: time="+ellapsedTime+", "+e);
476 }
477 }
478
479 /** Handles CheckboxMenuItem state changes. */
480 public void itemStateChanged(ItemEvent e) {

Callers

nothing calls this directly

Calls 9

getFrontWindowMethod · 0.95
getOpenRecentMenuMethod · 0.95
getPopupMenuMethod · 0.95
setKeyDownMethod · 0.95
logMethod · 0.95
getParentMethod · 0.80
getModifiersMethod · 0.80
getImageMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected