Java 类javax.swing.Action 实例源码

项目:incubator-netbeans    文件:RepositoryRevision.java   
@NbBundle.Messages({
    "CTL_Action.ViewCurrent.name=View Current"
})
Action[] getActions () {
    List<Action> actions = new ArrayList<Action>();
    boolean viewEnabled = getFile() != null && getChangedPath().getAction() != HgLogMessage.HgDelStatus;
    if (getFile() != null) {
        actions.add(new AbstractAction(NbBundle.getMessage(RepositoryRevision.class, "CTL_SummaryView_RollbackTo", getLogInfoHeader().getLog().getRevisionNumber())) { // NOI18N
            @Override
            public void actionPerformed(ActionEvent e) {
                revertModifications();
            }                
        });
    }
    if (viewEnabled) {
        actions.add(new AbstractAction(NbBundle.getMessage(RepositoryRevision.class, "CTL_SummaryView_View")) { //NOI18N
项目:incubator-netbeans    文件:AbstractEditorAction.java   
@Override
public final Object getValue(String key) {
    Action dAction = delegateAction;
    // Delegate whole getValue() if delegateAction already exists
    if (dAction != null && dAction != UNITIALIZED_ACTION) {
        Object value = dAction.getValue(key);
        if (value == null) {
            value = getValueLocal(key);
            if (value != null) {
                if (LOG.isLoggable(Level.FINE)) {
                    LOG.fine("Transfer wrapper action property: key=" + key + ", value=" + value + '\n'); // NOI18N
                }
                dAction.putValue(key, value);
            }
        }
        return value;
    }

    return getValueLocal(key);
}
项目:incubator-netbeans    文件:VCSHistoryTest.java   
public void testHistoryEntryEditable() throws IOException {
    MessageEditProviderImpl provider = new MessageEditProviderImpl();
    provider.message = null;
    VCSHistoryProvider.HistoryEntry h = 
            new VCSHistoryProvider.HistoryEntry(
                new File[] {new File("")}, 
                new Date(System.currentTimeMillis()), 
                "msg", 
                "user", 
                "username", 
                "12345", 
                "1234567890", 
                new Action[0], 
                null,
                provider);
    assertTrue(h.canEdit());
    h.setMessage("msg2");
    assertEquals("msg2", provider.message);
}
项目:incubator-netbeans    文件:ProfilerTableActions.java   
private Action selectNextColumnAction() {
    return new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            ProfilerColumnModel cModel = table._getColumnModel();
            if (table.getRowCount() == 0 || cModel.getVisibleColumnCount() == 0) return;

            int column = table.getSelectedColumn();
            if (column == -1) {
                table.selectColumn(cModel.getFirstVisibleColumn(), false);
                table.selectRow(0, true);
            } else {
                int nextColumn = cModel.getNextVisibleColumn(column);
                if (nextColumn > column) table.selectColumn(nextColumn, true);
            }
        }
    };
}
项目:incubator-netbeans    文件:ShelveChangesAction.java   
public static ShelveChangesActionProvider getProvider () {
    if (ACTION_PROVIDER == null) {
        ACTION_PROVIDER = new ShelveChangesActionProvider() {
            @Override
            public Action getAction () {
                Action a = SystemAction.get(SaveStashAction.class);
                Utils.setAcceleratorBindings("Actions/Git", a); //NOI18N
                return a;
            }

            @Override
            public JComponent[] getUnshelveActions (VCSContext ctx, boolean popup) {
                JComponent[] cont = UnshelveMenu.getInstance().getMenu(ctx, popup);
                if (cont == null) {
                    cont = super.getUnshelveActions(ctx, popup);
                }
                return cont;
            }

        };
    }
    return ACTION_PROVIDER;
}
项目:incubator-netbeans    文件:AbstractMultiViewTopComponentTestCase.java   
public void testGetLookup() throws Exception {
    final MVElem elem1 = new MVElem(new Action[] {new Act1("act1")} );
    final MVElem elem2 = new MVElem(new Action[] {new Act1("act2")} );
    MultiViewDescription desc1 = new MVDesc("desc1", null, 0, elem1);
    MultiViewDescription desc2 = new MVDesc("desc2", null, 0, elem2);
    MultiViewDescription[] descs = new MultiViewDescription[] { desc1, desc2 };
    TopComponent tc = callFactory(descs, desc2);

    tc.open();
    Object result = tc.getLookup().lookup(MVElem.class);
    assertNotNull(result);
    assertEquals(result, elem2);
    MultiViewHandler hand = MultiViews.findMultiViewHandler(tc);

    hand.requestActive(Accessor.DEFAULT.createPerspective(desc1));
    result = tc.getLookup().lookup(MVElem.class);
    assertNotNull(result);
    assertEquals(result, elem1);

}
项目:incubator-netbeans    文件:LabelVarsFilter.java   
public Action[] getActions(NodeActionsProvider original, Object node) throws UnknownTypeException {
    Action [] actions = original.getActions (node);
    if (node instanceof ObjectVariable) {
        int index;
        for (index = 0; index < actions.length; index++) {
            if (actions[index] == null)
                break;
        }
        Action[] newActions = new Action[actions.length + 1];
        System.arraycopy(actions, 0, newActions, 0, index);
        newActions[index] = MARK_OBJECT_ACTION;
        if (index < actions.length) {
            System.arraycopy(actions, index, newActions, index + 1, actions.length - index);
        }
        actions = newActions;
    }
    return actions;
}
项目:incubator-netbeans    文件:EditablePropertyDisplayer.java   
Action getCustomEditorAction() {
    if (customEditorAction == null) {
        PropertyModel mdl = null;

        if (modelRef != null) {
            mdl = modelRef.get();
        }

        customEditorAction = new CustomEditorAction(new Invoker(), mdl);

        getInputMap(WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(
            KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, KeyEvent.CTRL_DOWN_MASK, false), "invokeCustomEditor"
        ); //NOI18N

        //XXX this could be done lazily
        getActionMap().put("invokeCustomEditor", customEditorAction); //NOI18N

        //            System.err.println("Installed custom editor action");
    }

    return customEditorAction;
}
项目:incubator-netbeans    文件:ContextManagerTest.java   
@RandomlyFails
public void testListenerGCedAfterActionGCed () throws Exception {
    InstanceContent ic = new InstanceContent();
    lkp = new AbstractLookup(ic);
    Lookup.Result<Integer> lookupResult = lkp.lookupResult(Integer.class);

    Action action = ((ContextAwareAction) Actions.forID("cat", "survive")).createContextAwareInstance(lkp);
    Action fallbackAction = ((GeneralAction.DelegateAction) action).fallback;
    WeakReference<Action> fallbackActionRef = new WeakReference<Action>(fallbackAction);
    WeakReference<Action> clone = new WeakReference<Action>(action);
    cm = ContextManager.findManager(lkp, true);
    WeakReference lsetRef = new WeakReference<Object>(cm.findLSet(Integer.class));

    // both delegate and delegating actions are GCed before WeakListenerSupport is triggered in ActiveRefQueue:
    // fallbackAction.removePropertyChangeListener(delegating.weakL);
    fallbackAction = null;
    action = null;
    assertGC("Action should be GCed", clone);

    assertGC("Fallback action should be GCed", fallbackActionRef);
    assertGC("Action LSet Should be GCed", lsetRef);
    lookupResult.allInstances();
}
项目:incubator-netbeans    文件:CslTestBase.java   
protected void initializeRegistry() {
    DefaultLanguageConfig defaultLanguage = getPreferredLanguage();
    if (defaultLanguage == null) {
        fail("If you don't implement getPreferredLanguage(), you must override initializeRegistry!");
        return;
    }
    if (!LanguageRegistry.getInstance().isSupported(getPreferredMimeType())) {
        List<Action> actions = Collections.emptyList();
        org.netbeans.modules.csl.core.Language dl = new org.netbeans.modules.csl.core.Language(
                "unknown", getPreferredMimeType(), actions,
                defaultLanguage, getCodeCompleter(),
                getRenameHandler(), defaultLanguage.getDeclarationFinder(),
                defaultLanguage.getFormatter(), getKeystrokeHandler(),
                getIndexerFactory(), getStructureScanner(), null,
                defaultLanguage.isUsingCustomEditorKit());
        List<org.netbeans.modules.csl.core.Language> languages = new ArrayList<org.netbeans.modules.csl.core.Language>();
        languages.add(dl);
        CslCorePackageAccessor.get().languageRegistryAddLanguages(languages);
    }
}
项目:incubator-netbeans    文件:MergeAction.java   
Action getDelegateAction() {
    Action result = null;
    synchronized (this) {
        result = delegateAction;
        if (result == null || !result.isEnabled()) {
            if (attached()) {
                result = updateDelegateAction();
            } else {
                result = findEnabledAction();
            }
        }
    }
    if (result == null) {
        result = actions[0];
    }
    return result;
}
项目:VASSAL-src    文件:ModuleManagerWindow.java   
@Override
public JPopupMenu buildPopup(int row) {
  final JPopupMenu m = new JPopupMenu();
  final Action playAction = new Player.LaunchAction(ModuleManagerWindow.this, file);
  playAction.setEnabled(!Info.isModuleTooNew(metadata.getVassalVersion()));
  m.add(playAction);
  final Action editAction = new Editor.ListLaunchAction(ModuleManagerWindow.this, file);
  editAction.setEnabled(!Info.isModuleTooNew(metadata.getVassalVersion()));
  m.add(editAction);
  m.add(new AbstractAction(Resources.getString("General.remove")) {
    private static final long serialVersionUID = 1L;

    public void actionPerformed(ActionEvent e) {
      removeModule(file);
      cleanupTileCache();
    }
  });

  m.addSeparator();
  m.add(addFolderAction);
  m.addSeparator();
  m.add(newExtensionAction);
  m.add(addExtensionAction);
  return m;
}
项目:incubator-netbeans    文件:RuntimeComboBox.java   
@Override
public void setSelectedItem(final Object anItem) {
    if (anItem != null) {
        if (anItem.equals(SEPARATOR)) return;
        if (anItem instanceof Action) {
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    ((Action)anItem).actionPerformed(new ActionEvent(this, 0, "grow")); //NOI18N
                }
            });

        } else {
            selected = (T)anItem;
        }
    }
}
项目:incubator-netbeans    文件:TextRegionManager.java   
public void actionPerformed(ActionEvent evt) {
    TextRegionManager manager = textRegionManager(evt);
    if (manager != null) {
        switch (actionType) {
            case TAB:
                manager.tabAction();
                break;
            case SHIFT_TAB:
                manager.shiftTabAction();
                break;
            case ENTER:
                if (!manager.enterAction()) {
                    Action original = (Action)getValue(ORIGINAL_ACTION_PROPERTY);
                    if (original != null)
                        original.actionPerformed(evt);
                }
                break;
        }
    }
}
项目:incubator-netbeans    文件:DefaultAWTBridgeTest.java   
public void testHideWhenDisabled() throws Exception {
    class NoOpAction extends AbstractAction {
        NoOpAction(String n) {
            super(n);
        }
        public @Override void actionPerformed(ActionEvent e) {}
    }
    Action a = new NoOpAction("a1");
    assertEquals(Collections.singletonList("a1"), popupMenu(a));
    a = new NoOpAction("a2");
    a.setEnabled(false);
    assertEquals(Collections.singletonList("a2[disabled]"), popupMenu(a));
    a = new NoOpAction("a3");
    a.putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, true);
    assertEquals(Collections.singletonList("a3"), popupMenu(a));
    a = new NoOpAction("a4");
    a.putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, true);
    a.setEnabled(false);
    assertEquals(Collections.emptyList(), popupMenu(a));
}
项目:incubator-netbeans    文件:ExecJSAction.java   
protected ExecJSAction(String name) {
    putValue(Action.NAME, name);
    js = null;
    NashornPlatform.getDefault().addChangeListener(WeakListeners.change(this, NashornPlatform.getDefault()));
    JavaPlatform platform = NashornPlatform.getDefault().getPlatform();
    setEnabled(platform != null);
}
项目:incubator-netbeans    文件:DockerNode.java   
@Override
public Action[] getActions(boolean context) {
    List<Action> ret = new ArrayList<>();
    ret.addAll(Utilities.actionsForPath("Docker/Wizard")); // NOI18N
    ret.add(null);
    ret.addAll(Utilities.actionsForPath("Docker/Credentials")); // NOI18N
    return ret.toArray(new Action[ret.size()]);
}
项目:SER316-Dresden    文件:HTMLEditor.java   
public RedoAction() {
    super(Local.getString("Redo"));
    setEnabled(false);
    putValue(
        Action.SMALL_ICON,
        new ImageIcon(cl.getResource("/htmleditor/icons/redo16.png")));
    putValue(
        Action.ACCELERATOR_KEY,
        KeyStroke.getKeyStroke(
            KeyEvent.VK_Z,
            KeyEvent.CTRL_MASK + KeyEvent.SHIFT_MASK));
}
项目:incubator-netbeans    文件:DerbyDatabaseNode.java   
@Override
public Action[] getActions(boolean context) {
    if ( context ) {
        return super.getActions(context);
    } else {
        return new SystemAction[] {
            SystemAction.get(ConnectDatabaseAction.class),
            SystemAction.get(DeleteAction.class)
        };
    }
}
项目:incubator-netbeans    文件:RootNode.java   
@Override
public Action[] getActions(boolean context) {
    Action[] arr = Utilities.actionsForPath(registry.getPath()+"/Actions").toArray(new Action[0]); // NOI18N
    for (int i = 0; i < arr.length; i++) {
        if (arr[i] == null) {
            continue;
        }
        if (Boolean.TRUE.equals(arr[i].getValue("serverNodeHidden"))) { // NOI18N
            arr[i] = null;
        }
    }
    return arr;
}
项目:incubator-netbeans    文件:BIEditorSupport.java   
final CloseOperationState canCloseElement(TopComponent tc) {
    // if this is not the last cloned java editor component, closing is OK
    if (!isLastView(tc)) {
        return CloseOperationState.STATE_OK;
    }

    if (!isModified()) {
        return CloseOperationState.STATE_OK;
    }

    AbstractAction save = new AbstractAction() {

        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                saveDocument();
            } catch (IOException ex) {
                Exceptions.printStackTrace(ex);
            }
        }
    };
    save.putValue(Action.LONG_DESCRIPTION, NbBundle.getMessage(BIEditorSupport.class, "MSG_MODIFIED", getDataObject().getPrimaryFile().getNameExt()));

    // return a placeholder state - to be sure our CloseHandler is called
    return MultiViewFactory.createUnsafeCloseState(
            "ID_BEANINFO_CLOSING", // NOI18N
            save,
            MultiViewFactory.NOOP_CLOSE_ACTION);
}
项目:incubator-netbeans    文件:LocalHistoryProvider.java   
private synchronized Action[] getActions() {
    if(actions == null) {
        actions = new Action[] {
            new RevertFileAction(),
            new DeleteAction()
        };
    }
    return actions;
}
项目:MaxSim    文件:ActionManager.java   
public StateChangeAction getStateChangeAction(String name)
{
    Action a = getAction(name);
    if(a instanceof StateChangeAction)
        return (StateChangeAction)a;
    else
        return null;
}
项目:smile_1.5.0_java7    文件:FontChooser.java   
private JDialog createDialog(Component parent) {
    Frame frame = parent instanceof Frame ? (Frame) parent
            : (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent);
    JDialog dialog = new JDialog(frame, getMessage("SelectFont"), true);

    Action okAction = new DialogOKAction(dialog);
    Action cancelAction = new DialogCancelAction(dialog);

    JButton okButton = new JButton(okAction);
    okButton.setFont(DEFAULT_FONT);
    JButton cancelButton = new JButton(cancelAction);
    cancelButton.setFont(DEFAULT_FONT);

    JPanel buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new GridLayout(2, 1));
    buttonsPanel.add(okButton);
    buttonsPanel.add(cancelButton);
    buttonsPanel.setBorder(BorderFactory.createEmptyBorder(25, 0, 10, 10));

    ActionMap actionMap = buttonsPanel.getActionMap();
    actionMap.put(cancelAction.getValue(Action.DEFAULT), cancelAction);
    actionMap.put(okAction.getValue(Action.DEFAULT), okAction);
    InputMap inputMap = buttonsPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), cancelAction.getValue(Action.DEFAULT));
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), okAction.getValue(Action.DEFAULT));

    JPanel dialogEastPanel = new JPanel();
    dialogEastPanel.setLayout(new BorderLayout());
    dialogEastPanel.add(buttonsPanel, BorderLayout.NORTH);

    dialog.getContentPane().add(this, BorderLayout.CENTER);
    dialog.getContentPane().add(dialogEastPanel, BorderLayout.EAST);
    dialog.pack();
    dialog.setLocationRelativeTo(frame);
    return dialog;
}
项目:incubator-netbeans    文件:NbEditorKit.java   
@Override
protected Action[] getDeclaredActions() {
    List<Action> declaredActionList = EditorActionsProvider.getEditorActions(getContentType());
    Action[] declaredActions = new Action[declaredActionList.size()];
    declaredActionList.toArray(declaredActions);
    if (LOG.isLoggable(Level.FINE)) {
        LOG.log(Level.FINE, "Declared Actions (found ({0})): ", new Object[]{Integer.valueOf(declaredActions.length)}); // NOI18N
        for (Action a : declaredActions) {
            LOG.log(Level.FINE, "Action: {0}", new Object[]{a}); // NOI18N
        }
    }
    return declaredActions;
}
项目:ramus    文件:MainFrame.java   
private JToolBar createToolBar(final Object[] os) {
    final JToolBar res = new JToolBar();
    for (final Object o : os) {
        if (o == null)
            res.addSeparator();
        else
            res.add((Action) o);
    }
    desableFocus(res);
    return res;
}
项目:Reinickendorf_SER316    文件:HTMLEditor.java   
public RedoAction() {
    super(Local.getString("Redo"));
    setEnabled(false);
    putValue(
        Action.SMALL_ICON,
        new ImageIcon(cl.getResource("resources/icons/redo16.png")));
    putValue(
        Action.ACCELERATOR_KEY,
        KeyStroke.getKeyStroke(
            KeyEvent.VK_Z,
            KeyEvent.CTRL_MASK + KeyEvent.SHIFT_MASK));
}
项目:incubator-netbeans    文件:JavaKit.java   
@Override
protected Action[] createActions() {
    Action[] superActions = super.createActions();

    Action[] actions = new BaseAction[] {
        new PrefixMakerAction(makeGetterAction, "get", getSetIsPrefixes), // NOI18N
        new PrefixMakerAction(makeSetterAction, "set", getSetIsPrefixes), // NOI18N
        new PrefixMakerAction(makeIsAction, "is", getSetIsPrefixes), // NOI18N
        new ToggleCommentAction("//"), // NOI18N
        new JavaGenerateFoldPopupAction(), // NO_KEYBINDING in super
        new InstantRenameAction(),
        new InsertSemicolonAction(true),
        new InsertSemicolonAction(false),
        new SelectCodeElementAction(selectNextElementAction, true),
        new SelectCodeElementAction(selectPreviousElementAction, false),
        new JavaMoveCodeElementAction(EditorActionNames.moveCodeElementUp, false),
        new JavaMoveCodeElementAction(EditorActionNames.moveCodeElementDown, true),

        new FastImportAction(),
        new GoToSuperTypeAction(),

        new GoToMarkOccurrencesAction(false),
        new GoToMarkOccurrencesAction(true),
        new ClipboardHandler.JavaCutAction(),
    };
    final Action[] value = TextAction.augmentList(superActions, actions);

    return !INSTANT ? value : removeInstant(value);
}
项目:incubator-netbeans    文件:RepositoryBrowserPanel.java   
@Override
public Action[] getPopupActions (boolean context) {
    return new Action[] {
        new AbstractAction(NbBundle.getMessage(BranchesTopNode.class, "LBL_RepositoryPanel.RefreshTagsAction.name")) { //NOI18N
            @Override
            public void actionPerformed (ActionEvent e) {
                ((TagChildren) getChildren()).refreshTags();
            }
        }
    };
}
项目:incubator-netbeans    文件:GuiUtil.java   
private static void callAction(Action a, Node node, ActionEvent actionEvent) {
    if (a instanceof ContextAwareAction) {
        a = ((ContextAwareAction)a).createContextAwareInstance(node.getLookup());
    }
    if (a == null) {
        return;
    }
    a.actionPerformed(actionEvent);
}
项目:incubator-netbeans    文件:RepositoryBrowserPanel.java   
@Override
public void actionPerformed (ActionEvent e) {
    List<Action> delegetaActions = getDeleteDelegates();
    for (Action a : delegetaActions) {
        a.actionPerformed(e);
    }
}
项目:SER316-Dresden    文件:HTMLEditor.java   
protected void update() {
    if (undo.canUndo()) {
        setEnabled(true);
        putValue(
            Action.SHORT_DESCRIPTION,
            undo.getUndoPresentationName());
    } else {
        setEnabled(false);
        putValue(Action.SHORT_DESCRIPTION, Local.getString("Undo"));
    }
}
项目:incubator-netbeans    文件:NbEditorToolBar.java   
/** Attempt to find the editor keystroke for the given action. */
private KeyStroke[] findEditorKeys(String editorActionName, KeyStroke defaultKey) {
    KeyStroke[] ret = new KeyStroke[] { defaultKey };
    JTextComponent comp = getComponent();
    if (editorActionName != null && comp != null) {
        TextUI textUI = comp.getUI();
        Keymap km = comp.getKeymap();
        if (textUI != null && km != null) {
            EditorKit kit = textUI.getEditorKit(comp);
            if (kit instanceof BaseKit) {
                Action a = ((BaseKit)kit).getActionByName(editorActionName);
                if (a != null) {
                    KeyStroke[] keys = km.getKeyStrokesForAction(a);
                    if (keys != null && keys.length > 0) {
                        ret = keys;
                    } else {
                        // try kit's keymap
                        Keymap km2 = ((BaseKit)kit).getKeymap();
                        KeyStroke[] keys2 = km2.getKeyStrokesForAction(a);
                        if (keys2 != null && keys2.length > 0) {
                            ret = keys2;
                        }                            
                    }
                }
            }
        }
    }
    return ret;
}
项目:incubator-netbeans    文件:PhysicalView.java   
public @Override Action[] getActions(boolean context) {

            if ( context ) {
                return super.getActions( true );
            }
            else { 
                Action[] folderActions = super.getActions( false );
                Action[] projectActions;

                if ( isProjectDir ) {
                    if( projectDelegateNode != null ) {
                        projectActions = projectDelegateNode.getActions( false );
                    }
                    else {
                        // If this is project dir then the properties action 
                        // has to be replaced to invoke project customizer
                        projectActions = new Action[ folderActions.length ]; 
                        for ( int i = 0; i < folderActions.length; i++ ) {
                            if ( folderActions[i] instanceof org.openide.actions.PropertiesAction ) {
                                projectActions[i] = CommonProjectActions.customizeProjectAction();
                            }
                            else {
                                projectActions[i] = folderActions[i];
                            }
                        }
                    }
                }
                else {
                    projectActions = folderActions;
                }

                return projectActions;
            }                                            
        }
项目:incubator-netbeans    文件:LinkButton.java   
/**
 * C'tor
 *
 * @param text
 * @param icon
 * @param al Action to invoke when the button is pressed, can be null but
 * the button is disabled then.
 */
public LinkButton(String text, Icon icon, Action a, boolean underlined) {
    super(text);
    this.underlined = underlined;
    setIcon(icon);
    setPressedIcon(icon);
    Object tooltip = a.getValue(Action.SHORT_DESCRIPTION);
    if (null != tooltip) {
        setToolTipText(tooltip.toString());
    }
    this.handlePopupEvents = true;
    init(a);
}
项目:incubator-netbeans    文件:BreakpointCustomizeAction.java   
public Action createContextAwareInstance(Lookup actionContext) {
    Collection<? extends BreakpointAnnotation> ann = actionContext.lookupAll(BreakpointAnnotation.class);
    if (ann.size() == 1) {
        return new BreakpointAwareAction(ann.iterator().next());
    } else {
        //Exceptions.printStackTrace(new IllegalStateException("expecting BreakpointAnnotation object in lookup "+actionContext));
        return this;
    }
}
项目:incubator-netbeans    文件:ViewActions.java   
/**
 * Creates an action that opens Sessions TopComponent.
 */
public static Action createSessionsViewAction () {
    ViewActions action = new ViewActions("sessionsView");
    // When changed, update also mf-layer.xml, where are the properties duplicated because of Actions.alwaysEnabled()
    action.putValue (Action.NAME, "CTL_SessionsAction");
    action.putValue ("iconbase",
            "org/netbeans/modules/debugger/resources/sessionsView/session_16.png" // NOI18N
    );
    return action;
}
项目:jaer    文件:SliderToolTips.java   
public static void postToolTip(JComponent comp){ 
    Action action = comp.getActionMap().get("postTip"); 
    if(action==null) // no tooltip 
        return; 
    ActionEvent ae = new ActionEvent(comp, ActionEvent.ACTION_PERFORMED, 
                            "postTip", EventQueue.getMostRecentEventTime(), 0); 
    action.actionPerformed(ae); 
}
项目:incubator-netbeans    文件:BaseNode.java   
/**
 * Gets the actions associated with this node.
 * 
 * @param context true if this is for a context menu, false otherwise
 * @return an array of Actions
 */
@Override
public Action[] getActions(boolean context) {
    if (context) {
        return super.getActions(true);
    }

    return Utilities
            .actionsForPath("Databases/Explorer/" + layerEntry + "/Actions")
            .toArray(new Action[0]);
}
项目:VASSAL-src    文件:ConfigureTree.java   
protected Action buildImportAction(final Configurable target) {
  Action a = new AbstractAction("Add Imported Class") {
    private static final long serialVersionUID = 1L;

    public void actionPerformed(ActionEvent evt) {
      final Configurable child = importConfigurable();
      if (child != null) {
        try {
          child.build(null);
          final Configurable c = target;
          if (child.getConfigurer() != null) {
            PropertiesWindow w = new PropertiesWindow((Frame) SwingUtilities.getAncestorOfClass(Frame.class, ConfigureTree.this), false, child, helpWindow) {
              private static final long serialVersionUID = 1L;

              public void save() {
                super.save();
                insert(c, child, getTreeNode(c).getChildCount());
              }

              public void cancel() {
                dispose();
              }
            };
            w.setVisible(true);
          }
          else {
            insert(c, child, getTreeNode(c).getChildCount());
          }
        }
        // FIXME: review error message
        catch (Exception ex) {
          JOptionPane.showMessageDialog(getTopLevelAncestor(), "Error adding " + getConfigureName(child) + " to " + getConfigureName(target) + "\n"
              + ex.getMessage(), "Illegal configuration", JOptionPane.ERROR_MESSAGE);
        }
      }
    }
  };
  return a;
}