-
Notifications
You must be signed in to change notification settings - Fork 1
DevFaqActionAddProjectOwnTypePopUp
-
To add the Copy/Delete/Move/Rename action to your project’s node, you should:
-
Implement the corresponding interface such as
org.netbeans.spi.project.CopyOperationImplementation
. -
Implement
org.netbeans.spi.project.ActionProvider
:
-
public final class AddActionActions implements ActionProvider { private final AddActionProject project; //suppose this is your project public AddActionActions(AddActionProject project) { this.project = project; } public String[] getSupportedActions() { return new String[] { ActionProvider.COMMAND_COPY }; } public boolean isActionEnabled(String command, Lookup context) { if (command.equals(ActionProvider.COMMAND_COPY)) { return true; } else { throw new IllegalArgumentException(command); } } public void invokeAction(String command, Lookup context) { if (command.equalsIgnoreCase(ActionProvider.COMMAND_COPY)){ DefaultProjectOperations.performDefaultCopyOperation(project); } } }
-
1. Add these implementations to your project’s lookup:
lookup = Lookups.fixed( // ... as before new AddActionOperation(this), new AddActionActions(this), );
-
1. Register the actions into the project node’s context menu:
public @Override Action[] getActions(boolean context) { Action[[ | ]] nodeActions = new Action[2]; nodeActions[0] = CommonProjectActions.copyProjectAction(); nodeActions[1] = CommonProjectActions.closeProjectAction(); return nodeActions; }
-
To add the other actions specified in the Project API such as
closeProjectAction
, just add it to the list of actions of your node. -
To add an action you created yourself, just add it to the list of actions of your node.
See also: Common Project Actions
The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.
This page was exported from http://wiki.netbeans.org/DevFaqActionAddProjectOwnTypePopUp , that was last modified by NetBeans user Jtulach on 2010-07-24T20:31:30Z.
NOTE: This document was automatically converted to the AsciiDoc format on 2018-01-26, and needs to be reviewed.
Apache NetBeans is an effort undergoing incubation at The Apache Software Foundation (ASF).
Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects.
While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
This wiki is an experiment pending Apache NetBeans Community approval.