org.openide.actions.PasteAction Java Examples

The following examples show how to use org.openide.actions.PasteAction. 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: FormRootNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    if (actions == null) { // from AbstractNode
        List<Action> l = new ArrayList<Action>();
        if (isModifiableContainer()) {
            l.add(SystemAction.get(AddAction.class));
            l.add(null);
            l.add(SystemAction.get(PasteAction.class));
            l.add(null);
            l.add(SystemAction.get(ReorderAction.class));
            l.add(null);
        }
        l.add(SystemAction.get(ReloadAction.class));
        l.add(null);
        for (Action a : super.getActions(context)) {
            l.add(a);
        }
        actions = l.toArray(new Action[l.size()]);
    }
    return actions;
}
 
Example #2
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 #3
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 #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: DocBaseNodeFactory.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    if (actions == null) {
        actions = new Action[9];
        actions[0] = CommonProjectActions.newFileAction();
        actions[1] = null;
        actions[2] = SystemAction.get(FindAction.class);
        actions[3] = null;
        actions[4] = SystemAction.get(PasteAction.class);
        actions[5] = null;
        actions[6] = SystemAction.get(FileSystemAction.class);
        actions[7] = null;
        actions[8] = ProjectUISupport.createPreselectPropertiesAction(project, "Sources", null); //NOI18N
    }
    return actions;
}
 
Example #6
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 #7
Source File: MVCNode.java    From cakephp3-netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    List<Action> actions = new ArrayList<>();
    actions.addAll(Arrays.asList(getOriginal().getActions(context)));
    Action[] commonActions = getCommonActions();
    int idx = actions.indexOf(SystemAction.get(PasteAction.class));
    for (int i = 0; i < commonActions.length; i++) {
        if (idx >= 0 && idx + commonActions.length < actions.size()) {
            //put on the proper place after paste
            actions.add(idx + i + 1, commonActions[i]);
        } else {
            //else put at the tail
            actions.add(commonActions[i]);
        }
    }
    return actions.toArray(new Action[actions.size()]);
}
 
Example #8
Source File: JmeSpatial.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
    public Action[] getActions(boolean context) {
//        return super.getActions(context);
        if (((JmeSpatialChildren) jmeChildren).readOnly) {
            return new Action[]{
                        SystemAction.get(CopyAction.class),};
        } else {
            return new Action[]{
                        new NewControlPopup(this),
                        new NewLightPopup(this),
                        Actions.alwaysEnabled(new AddUserDataAction(this), "Add User Data", "", false),
                        new ToolPopup(this),
                        SystemAction.get(RenameAction.class),
                        SystemAction.get(CopyAction.class),
                        SystemAction.get(CutAction.class),
                        SystemAction.get(PasteAction.class),
                        SystemAction.get(DeleteAction.class)
                    };
        }
    }
 
Example #9
Source File: JmeNode.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
    public Action[] getActions(boolean context) {
//        return super.getActions(context);
        if (((JmeSpatialChildren) jmeChildren).readOnly) {
            return new Action[]{
                        SystemAction.get(CopyAction.class),};
        } else {
            return new Action[]{
                        new NewSpatialPopup(this),
                        new NewControlPopup(this),
                        new NewLightPopup(this),
                        Actions.alwaysEnabled(new AddUserDataAction(this), "Add User Data", "", false),
                        new ToolPopup(this),
                        SystemAction.get(RenameAction.class),
                        SystemAction.get(CopyAction.class),
                        SystemAction.get(CutAction.class),
                        SystemAction.get(PasteAction.class),
                        SystemAction.get(DeleteAction.class)
                    };
        }
    }
 
Example #10
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 #11
Source File: MVCNode.java    From cakephp3-netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    List<Action> actions = new ArrayList<>();
    actions.addAll(Arrays.asList(getOriginal().getActions(context)));
    int idx = actions.indexOf(SystemAction.get(PasteAction.class));
    Action[] toAdd = getCommonActions();
    for (int i = 0; i < toAdd.length; i++) {
        if (idx >= 0 && idx + toAdd.length < actions.size()) {
            //put on the proper place after rename
            actions.add(idx + i + 1, toAdd[i]);
        } else {
            //else put at the tail
            actions.add(toAdd[i]);
        }
    }
    //#143782 find usages on php file has no sense
    for (Iterator<Action> it = actions.iterator(); it.hasNext();) {
        Action action = it.next();
        //hard code string WhereUsedAction chosen not need to depend on refactoring
        //just for this minority issue
        if (action != null
                && action.getClass().getName().contains("WhereUsedAction")) { // NOI18N
            it.remove();
            break;
        }
    }
    return actions.toArray(new Action[actions.size()]);
}
 
Example #12
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 #13
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 #14
Source File: ServerResourceNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Action[] getActions( boolean context ) {
    return new Action[] {
        CommonProjectActions.newFileAction(),
        null,
        SystemAction.get(FileSystemAction.class),
        null,
        SystemAction.get(FindAction.class),
        null,
        SystemAction.get(PasteAction.class),
    };
}
 
Example #15
Source File: JaxWsRootNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    return new Action[]{
        CommonProjectActions.newFileAction(),
        null,
        SystemAction.get(FindAction.class),
        null,
        SystemAction.get(PasteAction.class),
        null,
        SystemAction.get(PropertiesAction.class)
    };
}
 
Example #16
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 #17
Source File: SceneExplorerTopComponent.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void initActions() {
    CutAction cut = SystemAction.get(CutAction.class);
    getActionMap().put(cut.getActionMapKey(), ExplorerUtils.actionCut(explorerManager));
    CopyAction copy = SystemAction.get(CopyAction.class);
    getActionMap().put(copy.getActionMapKey(), ExplorerUtils.actionCopy(explorerManager));
    PasteAction paste = SystemAction.get(PasteAction.class);
    getActionMap().put(paste.getActionMapKey(), ExplorerUtils.actionPaste(explorerManager));
    DeleteAction delete = SystemAction.get(DeleteAction.class);
    getActionMap().put(delete.getActionMapKey(), ExplorerUtils.actionDelete(explorerManager, true));
}
 
Example #18
Source File: JaxWsClientRootNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    return new Action[]{
        CommonProjectActions.newFileAction(),
        null,
        SystemAction.get(FindAction.class),
        null,
        SystemAction.get(PasteAction.class),
        null,
        SystemAction.get(PropertiesAction.class)
    };
}
 
Example #19
Source File: RestServicesNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    return new Action[] {
                CommonProjectActions.newFileAction(),
                SystemAction.get(TestRestServicesAction.class),
                null,
                SystemAction.get(FindAction.class),
                null,
                SystemAction.get(PasteAction.class),
                null,
                SystemAction.get(PropertiesAction.class)
            };
}
 
Example #20
Source File: ProjectWebServiceNodeFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    return new Action[]{
                CommonProjectActions.newFileAction(),
                null,
                SystemAction.get(FindAction.class),
                null,
                SystemAction.get(PasteAction.class),
                null,
                SystemAction.get(PropertiesAction.class)
            };
}
 
Example #21
Source File: JaxWsRootNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    return new Action[]{
        CommonProjectActions.newFileAction(),
        null,
        SystemAction.get(FindAction.class),
        null,
        SystemAction.get(PasteAction.class),
        null,
        SystemAction.get(PropertiesAction.class)
    };
}
 
Example #22
Source File: JaxWsClientRootNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Action[] getActions(boolean context) {
    return new Action[]{
        CommonProjectActions.newFileAction(),
        null,
        SystemAction.get(FindAction.class),
        null,
        SystemAction.get(PasteAction.class),
        null,
        SystemAction.get(PropertiesAction.class)
    };
}
 
Example #23
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 #24
Source File: MimeLookupInheritanceTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testAntXmlPopup(){
    MimeLookup lookup = MimeLookup.getMimeLookup("text/xml"); //NOI18N
    Class layerObjects[] = {CutAction.class, CopyAction.class, PasteAction.class, ReplaceAction.class};
    testPopupItems(lookup, layerObjects);
    lookup = MimeLookup.getMimeLookup("text/x-ant+xml"); //NOI18N
    Class layerObjects2[] = {CutAction.class, CopyAction.class, PasteAction.class, ReplaceAction.class, FindAction.class};
    testPopupItems(lookup, layerObjects2);
}
 
Example #25
Source File: MimeLookupInheritanceTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Issue #61216: MimeLookup should support layer hidding
 */
public void testHidding(){
    Lookup lookup = MimeLookup.getLookup(MimePath.get("text/xml"));
    checkLookupObject(lookup, CopyAction.class, true);
    checkLookupObject(lookup, ReplaceAction.class, true);
    checkLookupObject(lookup, PasteAction.class, false);
    lookup = MimeLookup.getLookup(MimePath.get("text/x-ant+xml"));
    checkLookupObject(lookup, CutAction.class, true);
    checkLookupObject(lookup, CopyAction.class, false);
    checkLookupObject(lookup, PasteAction.class, true);
    checkLookupObject(lookup, ReplaceAction.class, false);
}
 
Example #26
Source File: MimeLookupInheritanceTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Testing MIME level popup items lookup, inheritance and sorting */
public void testMimeLevelPopupsWithStringAndSeparator(){
    MimePath mp = MimePath.parse("text/x-java/text/html/text/xml"); //NOI18N
    Lookup lookup = MimeLookup.getLookup(mp);
    Class layerObjects[] = {CutAction.class, CopyAction.class, PasteAction.class, ReplaceAction.class, JSeparator.class, String.class};
    testPopupItems(lookup, layerObjects);
}
 
Example #27
Source File: MimeLookupInheritanceTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Testing MIME level popup items lookup, inheritance and sorting */
public void testMimeLevelPopups(){
    MimePath mp = MimePath.parse("text/x-java/text/html"); //NOI18N
    Lookup lookup = MimeLookup.getLookup(mp);
    Class layerObjects[] = {CutAction.class, CopyAction.class, NewAction.class, PasteAction.class};
    testPopupItems(lookup, layerObjects);
}
 
Example #28
Source File: Depr_MimeLookupInheritanceTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void testAntXmlPopup(){
    MimeLookup lookup = MimeLookup.getMimeLookup("text/xml"); //NOI18N
    Class layerObjects[] = {CutAction.class, CopyAction.class, PasteAction.class, ReplaceAction.class};
    testPopupItems(lookup, layerObjects);
    lookup = MimeLookup.getMimeLookup("text/x-ant+xml"); //NOI18N
    Class layerObjects2[] = {CutAction.class, CopyAction.class, PasteAction.class, ReplaceAction.class, FindAction.class};
    testPopupItems(lookup, layerObjects2);
}
 
Example #29
Source File: Depr_MimeLookupInheritanceTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/**
 * Issue #61216: MimeLookup should support layer hidding
 */
public void testHidding(){
    MimeLookup lookup = MimeLookup.getMimeLookup("text/xml");
    checkLookupObject(lookup, CopyAction.class, true);
    checkLookupObject(lookup, ReplaceAction.class, true);
    checkLookupObject(lookup, PasteAction.class, false);
    lookup = MimeLookup.getMimeLookup("text/x-ant+xml");
    checkLookupObject(lookup, CutAction.class, true);
    checkLookupObject(lookup, CopyAction.class, false);
    checkLookupObject(lookup, PasteAction.class, true);
    checkLookupObject(lookup, ReplaceAction.class, false);
}
 
Example #30
Source File: MMDGraphEditor.java    From netbeans-mmd-plugin with Apache License 2.0 4 votes vote down vote up
private void restoreSystemCCPActions(@Nonnull final JComponent component) {
  final ActionMap actionMap = component.getActionMap();
  actionMap.put(DefaultEditorKit.copyAction, SystemAction.get(CopyAction.class));
  actionMap.put(DefaultEditorKit.cutAction, SystemAction.get(CutAction.class));
  actionMap.put(DefaultEditorKit.pasteAction, SystemAction.get(PasteAction.class));
}