예제 #1
0
 /**
  * The constructor.
  *
  * @param hasIcon true if an icon has to be shown
  * @param key the (to be localized) name of the action
  * @param global the action is global, i.e. implements shouldBeEnabled(), and listens to Target
  *     changes
  */
 public UMLAction(String key, boolean global, boolean hasIcon) {
   super(Translator.localize(key));
   if (hasIcon) {
     iconName = key;
   }
   putValue(Action.SHORT_DESCRIPTION, Translator.localize(key));
   if (global) {
     Actions.addAction(this);
   }
   // Jaap B. 17-6-2003 added next line to make sure every action
   // is in the right enable condition on creation.
   setEnabled(shouldBeEnabled());
 }
예제 #2
0
 /** @see javax.swing.Action#isEnabled() */
 public boolean isEnabled() {
   if (!Actions.isGlobalAction(this)) {
     return shouldBeEnabled();
   }
   return super.isEnabled();
 }
예제 #3
0
 /**
  * Perform the work the action is supposed to do. This method needs to be overridden by all
  * actions, since it only shows a fake progressbar... TODO: I suspect the above comment may well
  * not be true. We need to some how get rid of this anyway. If we find everything works then
  * delete it otherwise we find a way to fix.
  *
  * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
  */
 public void oldActionPerformed(ActionEvent e) {
   LOG.debug("pushed " + getValue(Action.NAME));
   Actions.updateAllEnabled();
 }