org.openide.actions.ToolsAction Java Examples

The following examples show how to use org.openide.actions.ToolsAction. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PropertiesLocaleNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Lazily initialize set of node's actions.
 * Overrides superclass method.
 *
 * @return array of actions for this node
 */
@Override
protected SystemAction[] createActions () {
    return new SystemAction[] {
        SystemAction.get(EditAction.class),
        SystemAction.get(OpenAction.class),
        null,
        SystemAction.get(CutAction.class),
        SystemAction.get(CopyAction.class),
        SystemAction.get(PasteAction.class),
        null,
        SystemAction.get(DeleteAction.class),
        SystemAction.get(LangRenameAction.class),
        null,
        SystemAction.get(NewAction.class),
        SystemAction.get(SaveAsTemplateAction.class),
        null,
        SystemAction.get(FileSystemAction.class),
        null,
        SystemAction.get(ToolsAction.class),
        SystemAction.get(PropertiesAction.class)
    };
}
 
Example #2
Source File: MultiModuleNodeFactory.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NonNull
@Override
public Action[] getActions(final boolean context) {
    if (context) {
        return super.getActions(context);
    } else {
        if (actions == null) {
            actions = new Action[] {
                CommonProjectActions.newFileAction(),
                null,
                SystemAction.get(FindAction.class),
                null,
                SystemAction.get(PasteAction.class ),
                null,
                SystemAction.get(FileSystemAction.class ),
                null,
                SystemAction.get(ToolsAction.class )
            };
        }
        return actions;
    }
}
 
Example #3
Source File: ClientSideProjectLogicalView.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    List<Action> actions = new ArrayList<Action>();
    actions.add(CommonProjectActions.newFileAction());
    actions.add(null);
    actions.add(SystemAction.get(FindAction.class));
    actions.add(null);
    actions.add(SystemAction.get(FileSystemAction.class));
    actions.add(null);
    actions.add(SystemAction.get(PasteAction.class));
    actions.add(null);
    actions.add(SystemAction.get(ToolsAction.class));
    actions.add(null);
    actions.add(CommonProjectActions.customizeProjectAction());
    return actions.toArray(new Action[actions.size()]);
}
 
Example #4
Source File: AnnotationProviderTest.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Gets default system actions. Overrides superclass method. */
protected SystemAction[] defaultActions() {
    return new SystemAction[] {
        SystemAction.get(OpenAction.class),
        SystemAction.get (FileSystemAction.class),
        null,
        SystemAction.get(CutAction.class),
        SystemAction.get(CopyAction.class),
        SystemAction.get(PasteAction.class),
        null,
        SystemAction.get(DeleteAction.class),
        SystemAction.get(RenameAction.class),
        null,
        SystemAction.get(SaveAsTemplateAction.class),
        null,
        SystemAction.get(ToolsAction.class),
        SystemAction.get(PropertiesAction.class),
    };
}
 
Example #5
Source File: LookupNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public final Action[] getActions(boolean context) {
    if (isUISettingCategoryNode()) {
        return new Action[0];
    } else {
        return new Action[] {
            SystemAction.get(FileSystemAction.class),
            null,
            SystemAction.get(PasteAction.class),
            null,
            SystemAction.get(MoveUpAction.class),
            SystemAction.get(MoveDownAction.class),
            SystemAction.get(ReorderAction.class),
            null,
            SystemAction.get(NewTemplateAction.class),
            null,
            SystemAction.get(ToolsAction.class),
            SystemAction.get(PropertiesAction.class),
        };
    }
}
 
Example #6
Source File: AllPropsNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Action[] getActions(boolean context) {
    Action[] result = new Action[] {
        SystemAction.get(RefreshPropsAction.class),
                null,
                SystemAction.get(OpenLocalExplorerAction.class),
                null,
                SystemAction.get(NewAction.class),
                null,
                SystemAction.get(ToolsAction.class),
                SystemAction.get(PropertiesAction.class),
    };
    return result;
}
 
Example #7
Source File: MVCNode.java    From cakephp3-netbeans with Apache License 2.0 5 votes vote down vote up
@Override
@NbBundle.Messages({
    "LBL_DownloadCommand=Download...",
    "LBL_UploadCommand=Upload...",
    "LBL_SyncCommand=Synchronize..."
})
public Action[] getActions(boolean context) {
    List<Action> actions = new ArrayList<>();
    actions.add(CommonProjectActions.newFileAction());
    actions.add(null);
    actions.add(FileSensitiveActions.fileCommandAction("dowonload", Bundle.LBL_DownloadCommand(), null));
    actions.add(FileSensitiveActions.fileCommandAction("upload", Bundle.LBL_UploadCommand(), null));
    actions.add(FileSensitiveActions.fileCommandAction("synchronize", Bundle.LBL_SyncCommand(), null));
    actions.add(null);
    actions.add(SystemAction.get(FileSystemAction.class));
    actions.add(null);
    actions.add(SystemAction.get(FindAction.class));
    actions.add(null);
    actions.add(SystemAction.get(PasteAction.class));
    actions.add(null);
    actions.add(SystemAction.get(ToolsAction.class));
    actions.add(null);
    // customizer - open sources for source node, phpunit for test node
    Action customizeAction;
    customizeAction = CommonProjectActions.customizeProjectAction();
    actions.add(customizeAction);
    return actions.toArray(new Action[actions.size()]);
}
 
Example #8
Source File: SrcNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    List<Action> actions = new ArrayList<>();
    actions.add(CommonProjectActions.newFileAction());
    actions.add(null);
    if (!isTest) {
        actions.add(FileSensitiveActions.fileCommandAction(DownloadCommand.ID, DownloadCommand.DISPLAY_NAME, null));
        actions.add(FileSensitiveActions.fileCommandAction(UploadCommand.ID, UploadCommand.DISPLAY_NAME, null));
        actions.add(FileSensitiveActions.fileCommandAction(SyncCommand.ID, SyncCommand.DISPLAY_NAME, null));
        actions.add(null);
    } else {
        // #252010
        if (project.getTestRoots().getRoots().length > 1) {
            actions.add(ProjectSensitiveActions.projectCommandAction(RunTestsCommand.ID, RunTestsCommand.DISPLAY_NAME, null));
            actions.add(null);
        }
    }
    actions.add(SystemAction.get(FileSystemAction.class));
    actions.add(null);
    actions.add(SystemAction.get(FindAction.class));
    actions.add(null);
    actions.add(SystemAction.get(PasteAction.class));
    actions.add(null);
    actions.add(SystemAction.get(ToolsAction.class));
    actions.add(null);
    // customizer - open sources for source node, testing for test node
    Action customizeAction = null;
    if (isTest) {
        customizeAction = new PhpLogicalViewProvider.CustomizeProjectAction(project, CompositePanelProviderImpl.TESTING);
    } else {
        customizeAction = CommonProjectActions.customizeProjectAction();
    }
    if (customizeAction != null) {
        actions.add(customizeAction);
    }
    return actions.toArray(new Action[actions.size()]);
}
 
Example #9
Source File: ContextMenuWarmUpTask.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Warms up tools action popup menu item. */
private static void warmUpToolsPopupMenuItem() {
    SystemAction toolsAction = SystemAction.get(ToolsAction.class);
    if(toolsAction instanceof ContextAwareAction) {
        // Here is important to create proper lookup
        // to warm up Tools sub actions.
        Lookup lookup = new org.openide.util.lookup.ProxyLookup(
            new Lookup[] {
                // This part of lookup causes warm up of Node (cookie) actions.
                new AbstractNode(Children.LEAF).getLookup(),
                // This part of lookup causes warm up of Callback actions.
                new TopComponent().getLookup()
            }
        );
        
        Action action = ((ContextAwareAction)toolsAction)
                            .createContextAwareInstance(lookup);
        if(action instanceof Presenter.Popup) {
            JMenuItem toolsMenuItem = ((Presenter.Popup)action)
                                            .getPopupPresenter();
            if(toolsMenuItem instanceof Runnable) {
                // This actually makes the warm up.
                // See ToolsAction.Popup impl.
                ((Runnable)toolsMenuItem).run();
            }
        }
    }
}
 
Example #10
Source File: BrokenDataShadow.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Action[] getActions(boolean context) {
    return new Action[] {
                SystemAction.get (CutAction.class),
                SystemAction.get (CopyAction.class),
                SystemAction.get (PasteAction.class),
                null,
                SystemAction.get (DeleteAction.class),
                null,
                SystemAction.get (ToolsAction.class),
                SystemAction.get (PropertiesAction.class)
            };
}
 
Example #11
Source File: PhadhailNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Action[] getActions(boolean context) {
    return new Action[] {
        SystemAction.get(OpenAction.class),
        SystemAction.get(SaveAction.class),
        null,
        SystemAction.get(NewAction.class),
        null,
        SystemAction.get(DeleteAction.class),
        SystemAction.get(RenameAction.class),
        SystemAction.get(ToolsAction.class),
    };
}
 
Example #12
Source File: OnePropNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Action[] getActions(boolean context) {
    Action[] result = new Action[] {
        SystemAction.get(DeleteAction.class),
                SystemAction.get(RenameAction.class),
                null,
                SystemAction.get(ToolsAction.class),
                SystemAction.get(PropertiesAction.class),
    };
    return result;
}
 
Example #13
Source File: PackageView.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Creates actions for package root.
 * @return the array of {@link Action}s
 */
@NonNull
static Action[] createRootNodeActions() {
    return new Action[] {
        CommonProjectActions.newFileAction(),
        null,
        SystemAction.get( FindAction.class ),
        null,
        SystemAction.get( PasteAction.class ),
        null,
        SystemAction.get( FileSystemAction.class ),
        null,
        SystemAction.get( ToolsAction.class ),
    };
}
 
Example #14
Source File: SettingChildren.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Action[] getActions(boolean context) {            
    return removeActions(super.getActions(context), new Action[] {SystemAction.get(ToolsAction.class)});
}
 
Example #15
Source File: SettingChildren.java    From netbeans with Apache License 2.0 4 votes vote down vote up
/** Overrides superclass method, excludes the ToolsAction from the node. */
public Action[] getActions(boolean context) {
    return removeActions(super.getActions(context), new Action[] {SystemAction.get(ToolsAction.class)});
}
 
Example #16
Source File: SerialDataNode.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Action[] getActions(boolean context) {
    return removeActions(super.getActions(context), new Action[] {SystemAction.get(ToolsAction.class)});
}
 
Example #17
Source File: DefaultOpenFileImpl.java    From netbeans with Apache License 2.0 4 votes vote down vote up
private void openInEDT(FileObject fileObject, DataObject dataObject, int line) {
    Class<? extends Node.Cookie> cookieClass;        
    Node.Cookie cookie;
    
    if ((line != -1)
        && (   ((cookie = dataObject.getCookie(cookieClass = EditorCookie.Observable.class)) != null)
            || ((cookie = dataObject.getCookie(cookieClass = EditorCookie.class)) != null) )) {
        boolean ret = openByCookie(cookie, cookieClass, line);
        if (!ret) {
            showNotPlainFileWarning(fileObject);
        }
        return;
    } 
                        
    /* try to open the object using the default action */
    Node dataNode = dataObject.getNodeDelegate();        
    Action action = dataNode.getPreferredAction();
    if ((action != null)
            && !(action instanceof FileSystemAction)
            && !(action instanceof ToolsAction)) {
        if (log.isLoggable(FINEST)) {
            log.log(FINEST, " - using preferred action "            //NOI18N
                    + "(\"{0}\" - {1}) for opening the file",       //NOI18N
                    new Object[]{action.getValue(Action.NAME),
                        action.getClass().getName()});
        }

        if (action instanceof ContextAwareAction) {
            action = ((ContextAwareAction) action)
              .createContextAwareInstance(dataNode.getLookup());
            if (log.isLoggable(FINEST)) {
                log.finest("    - it is a ContextAwareAction");     //NOI18N
                log.log(FINEST, "    - using a context-aware "      //NOI18N
                        + "instance instead (\"{0}\" - {1})",       //NOI18N
                        new Object[]{action.getValue(Action.NAME),
                            action.getClass().getName()});
            }
        }

        log.finest("   - will call action.actionPerformed(...)");   //NOI18N
        final Action a = action;
        final Node n = dataNode;
        WindowManager.getDefault().invokeWhenUIReady(new Runnable() {

            @Override
            public void run() {
                a.actionPerformed(new ActionEvent(n, 0, ""));
            }
        });
        return;
    }             
    String fileName = fileObject.getNameExt();
    /* Try to grab an editor/open/edit/view cookie and open the object: */
    StatusDisplayer.getDefault().setStatusText(
            NbBundle.getMessage(DefaultOpenFileImpl.class,
                                "MSG_opening",                      //NOI18N
                                fileName));
    boolean success = openDataObjectByCookie(dataObject, line);
    if (success) {
        return;
    }        
    if (fileObject.isFolder() || FileUtil.isArchiveFile(fileObject)) {
        // select it in explorer:
        final Node node = dataObject.getNodeDelegate();
        if (node != null) {
            WindowManager.getDefault().invokeWhenUIReady(new Runnable() {

                @Override
                public void run() {
                    NodeOperation.getDefault().explore(node);
                }
            });
            return;
        }
    }
    showNotPlainFileWarning(fileObject);
}
 
Example #18
Source File: EnvironmentNode.java    From netbeans with Apache License 2.0 3 votes vote down vote up
/** Getter for set of actions that should be present in the
* popup menu of this node. This set is used in construction of
* menu returned from getContextMenu and specially when a menu for
* more nodes is constructed.
*
* @return array of system actions that should be in popup menu
*/
public SystemAction[] createActions () {
    return new SystemAction[] {
               SystemAction.get(ToolsAction.class),
               SystemAction.get(PropertiesAction.class)
           };
}