微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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",elem1);
    MultiViewDescription desc2 = new MVDesc("desc2",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,newActions,index);
        newActions[index] = MARK_OBJECT_ACTION;
        if (index < actions.length) {
            System.arraycopy(actions,index,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(),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,"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,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,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",// NOI18N
        new PrefixMakerAction(makeIsAction,"is",// 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,new JavaMoveCodeElementAction(EditorActionNames.moveCodeElementUp,new JavaMoveCodeElementAction(EditorActionNames.moveCodeElementDown,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,getTreeNode(c).getChildCount());
              }

              public void cancel() {
                dispose();
              }
            };
            w.setVisible(true);
          }
          else {
            insert(c,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;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。