Java Code Examples for org.openide.util.Utilities#actionsForPath()

The following examples show how to use org.openide.util.Utilities#actionsForPath() . 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: Nodes.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    if (context) {
        return globalActions;
    } else {
        final List<? extends Action> additionalActions = Utilities.actionsForPath(ACTION_FOLDER);
        final int additionalActionSize = additionalActions.isEmpty() ? 0 : additionalActions.size() + 1;
        final List<Action> actions  = new ArrayList<Action>(4 + globalActions.length + additionalActionSize);
        actions.add(getOpenAction());
        actions.add(FileUtil.getConfigObject(INSPECT_HIERARCHY_ACTION, Action.class));
        actions.add(RefactoringActionsFactory.whereUsedAction());
        actions.add(null);
        if (additionalActionSize > 0) {
            actions.addAll(additionalActions);
            actions.add(null);
        }
        actions.addAll(Arrays.asList(globalActions));
        return actions.toArray(new Action[actions.size()]);
    }
}
 
Example 2
Source File: AddServerInstanceWizard.java    From netbeans with Apache License 2.0 6 votes vote down vote up
static JRadioButton[] listAvailableProviders(String path) {
    List<JRadioButton> res = new ArrayList<JRadioButton>();

    for (Action a : Utilities.actionsForPath(path+"/Actions")) { // NOI18N
        if (a == null) {
            continue;
        }
        Object msg = a.getValue("wizardMessage"); // NOI18N
        if (msg instanceof String) {
            JRadioButton button = new JRadioButton((String)msg);
            button.putClientProperty("action", a); // NOI18N
            res.add(button);
        }
    }

    return res.toArray(new JRadioButton[0]);
}
 
Example 3
Source File: NbAndroidProjectImpl.java    From NBANDROID-V2 with Apache License 2.0 6 votes vote down vote up
@Override
public Action[] getActions(boolean arg0) {
    List<Action> projectActions = new ArrayList<>(32);
    projectActions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_REBUILD, "Clean and Build", null));
    projectActions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_CLEAN, "Clean", null));
    projectActions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_BUILD, "Buld", null));
    projectActions.add(null);
    projectActions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_RUN, "Run", null));
    projectActions.add(ProjectSensitiveActions.projectCommandAction(ActionProvider.COMMAND_DEBUG, "Debug", null));
    projectActions.add(selectDeviceProjectAction);
    projectActions.add(configurationsProjectAction);
    projectActions.add(null);
    List<? extends Action> actionsForPath = Utilities.actionsForPath("Android/Projects/Project");
    projectActions.addAll(actionsForPath);
    projectActions.add(CommonProjectActions.closeProjectAction());
    projectActions.add(CommonProjectActions.setAsMainProjectAction());
    projectActions.add(null);
    projectActions.addAll(Utilities.actionsForPath("Projects/Actions"));
    projectActions.add(null);
    projectActions.add(CommonProjectActions.customizeProjectAction());
    return projectActions.toArray(new Action[projectActions.size()]);

}
 
Example 4
Source File: ElementNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Action[] getActions( boolean context ) {
    if ( context || description.name == null ) {
        return description.ui.getActions();
    } else {
        final Action panelActions[] = description.ui.getActions();
        final List<? extends Action> standardActions;
        final List<? extends Action> additionalActions;
        if (description.kind == ElementKind.OTHER) {
            standardActions = Collections.singletonList(getOpenAction());
            additionalActions = Collections.<Action>emptyList();
        } else {
            standardActions = Arrays.asList(new Action[] {
                getOpenAction(),
                RefactoringActionsFactory.whereUsedAction(),
                RefactoringActionsFactory.popupSubmenuAction()
            });
            additionalActions = Utilities.actionsForPath(ACTION_FOLDER);
        }
        final int standardActionsSize = standardActions.isEmpty() ? 0 : standardActions.size() + 1;
        final int additionalActionSize = additionalActions.isEmpty() ? 0 : additionalActions.size() + 1;
        final List<Action> actions = new ArrayList<>(standardActionsSize + additionalActionSize + panelActions.length);
        if (standardActionsSize > 0) {
            actions.addAll(standardActions);
            actions.add(null);
        }
        if (additionalActionSize > 0) {
            actions.addAll(additionalActions);
            actions.add(null);
        }
        actions.addAll(Arrays.asList(panelActions));
        return actions.toArray(new Action[actions.size()]);
    }
}
 
Example 5
Source File: TerminalContainerTopComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private synchronized static Action[] getToolbarActions() {
    if (actions == null) {
        List<? extends Action> termActions = Utilities.actionsForPath(TerminalAction.TERMINAL_ACTIONS_PATH);// NOI18N
        actions = termActions.toArray(new Action[termActions.size()]);
    }
    return actions;
}
 
Example 6
Source File: ProjectsRootNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Action[] getActions( boolean context ) {
    if (context) { // XXX why?
        return new Action[0];
    } else {
        List<? extends Action> actions = Utilities.actionsForPath(type == PHYSICAL_VIEW ? ACTIONS_FOLDER_PHYSICAL : ACTIONS_FOLDER);
        return actions.toArray(new Action[actions.size()]);
    }
}
 
Example 7
Source File: DelegatingVCS.java    From netbeans with Apache License 2.0 5 votes vote down vote up
Action[] getInitActions(org.netbeans.modules.versioning.core.spi.VCSContext ctx) {
    String category = (String) map.get("actionsCategory");              // NOI18N
    List<? extends Action> l = Utilities.actionsForPath("Versioning/" + category + "/Actions/Unversioned"); // NOI18N
    List<Action> ret = new ArrayList<Action>(l.size());
    for (Action action : l) {
        if(action instanceof ContextAwareAction) {
            ret.add(((ContextAwareAction)action).createContextAwareInstance(Lookups.singleton(ctx)));
        } else {
            ret.add(action);
        }
    }
    return ret.toArray(new Action[ret.size()]);
}
 
Example 8
Source File: DelegatingVCS.java    From netbeans with Apache License 2.0 5 votes vote down vote up
Action[] getInitActions(VCSContext ctx) {
    String category = (String) map.get("actionsCategory");              // NOI18N
    List<? extends Action> l = Utilities.actionsForPath("Versioning/" + category + "/Actions/Unversioned"); // NOI18N
    List<Action> ret = new ArrayList<Action>(l.size());
    for (Action action : l) {
        if(action instanceof ContextAwareAction) {
            ret.add(((ContextAwareAction)action).createContextAwareInstance(Lookups.singleton(ctx)));
        } else {
            ret.add(action);
        }
    }
    return ret.toArray(new Action[ret.size()]);
}
 
Example 9
Source File: ProductPlacemarkView.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
public JPopupMenu createPopupMenu(Component component) {
    JPopupMenu popupMenu = new JPopupMenu();
    List<? extends Action> viewActions = Utilities.actionsForPath("Context/ProductPlacemarkView");
    for (Action action : viewActions) {
        popupMenu.add(action);
    }
    popupMenu.add(new CopyToClipboardAction());
    return popupMenu;
}
 
Example 10
Source File: ProductSceneView.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
@Override
public JPopupMenu createPopupMenu(MouseEvent event) {
    JPopupMenu popupMenu = new JPopupMenu();
    List<? extends Action> viewActions = Utilities.actionsForPath("Context/ProductSceneView");
    for (Action action : viewActions) {
        JMenuItem menuItem = popupMenu.add(action);
        String popupText = (String) action.getValue("popupText");
        if (StringUtils.isNotNullAndNotEmpty(popupText)) {
            menuItem.setText(popupText);
        }
    }
    return popupMenu;
}
 
Example 11
Source File: PNNodeSupport.java    From snap-desktop with GNU General Public License v3.0 5 votes vote down vote up
static Action[] getContextActions(ProductNode productNode) {
    ArrayList<Action> actionList = new ArrayList<>();
    Class<?> type = productNode.getClass();
    do {
        List<? extends Action> actions = Utilities.actionsForPath("Context/Product/" + type.getSimpleName());
        actionList.addAll(actions);
        type = type.getSuperclass();
    } while (type != null && ProductNode.class.isAssignableFrom(type));

    return actionList.toArray(new Action[actionList.size()]);
}
 
Example 12
Source File: ClientNode.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    List<? extends Action> actions = Utilities.actionsForPath("UI/AndroidDevices/AndroidDeviceClients/Actions");
    return actions.toArray(new Action[actions.size()]);
}
 
Example 13
Source File: MobileDeviceNode.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    List<? extends Action> actionsForPath = Utilities.actionsForPath("Android/ADB/MobileDevice");
    return actionsForPath.toArray(new Action[actionsForPath.size()]);
}
 
Example 14
Source File: EmulatorDeviceNode.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    List<? extends Action> actionsForPath = Utilities.actionsForPath("Android/ADB/EmulatorDevice");
    return actionsForPath.toArray(new Action[actionsForPath.size()]);
}
 
Example 15
Source File: DependencyNode.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    List<? extends Action> actionsForPath = Utilities.actionsForPath("Actions/NbAndroid/Dependency");
    return actionsForPath.toArray(new Action[actionsForPath.size()]);
}
 
Example 16
Source File: DependenciesNode.java    From NBANDROID-V2 with Apache License 2.0 4 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    List<? extends Action> actionsForPath = Utilities.actionsForPath("Actions/NbAndroid/Dependencies");
    return actionsForPath.toArray(new Action[actionsForPath.size()]);
}