org.openide.actions.CutAction Java Examples
The following examples show how to use
org.openide.actions.CutAction.
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: JmeNode.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@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 #2
Source File: JmeSpatial.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
@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 #3
Source File: PropertiesLocaleNode.java From netbeans with Apache License 2.0 | 6 votes |
/** 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 #4
Source File: FavoritesNode.java From netbeans with Apache License 2.0 | 6 votes |
/** Add action 'Add to Favorites'. */ private Action [] createActionsForFile (Action [] arr) { boolean added = false; List<Action> newArr = new ArrayList<Action>(); for (int i = 0; i < arr.length; i++) { //Add before CopyAction or CutAction if (!added && ((arr[i] instanceof CopyAction) || (arr[i] instanceof CutAction))) { added = true; newArr.add(Actions.add()); newArr.add(null); } newArr.add(arr[i]); } if (!added) { added = true; newArr.add(null); newArr.add(Actions.add()); } return newArr.toArray (new Action[newArr.size()]); }
Example #5
Source File: FavoritesNode.java From netbeans with Apache License 2.0 | 6 votes |
/** Add action 'Add to Favorites'. */ private Action [] createActionsForFolder (Action [] arr) { boolean added = false; List<Action> newArr = new ArrayList<Action>(); for (int i = 0; i < arr.length; i++) { //Add before CopyAction or CutAction if (!added && ((arr[i] instanceof CopyAction) || (arr[i] instanceof CutAction))) { added = true; newArr.add(Actions.add()); newArr.add(null); } newArr.add(arr[i]); } if (!added) { added = true; newArr.add(null); newArr.add(Actions.add()); } return newArr.toArray (new Action[newArr.size()]); }
Example #6
Source File: FavoritesNode.java From netbeans with Apache License 2.0 | 6 votes |
/** Add action 'Remove from Favorites'. */ private Action [] createActionsForFavoriteFile (Action [] arr) { boolean added = false; List<Action> newArr = new ArrayList<Action>(); for (int i = 0; i < arr.length; i++) { //Add before CopyAction or CutAction if (!added && ((arr[i] instanceof CopyAction) || (arr[i] instanceof CutAction))) { added = true; newArr.add(Actions.remove()); newArr.add(null); } //Do not add Delete action if (!(arr[i] instanceof DeleteAction)) { newArr.add(arr[i]); } } if (!added) { added = true; newArr.add(null); newArr.add(Actions.remove()); } return newArr.toArray (new Action[newArr.size()]); }
Example #7
Source File: FavoritesNode.java From netbeans with Apache License 2.0 | 6 votes |
/** Add action 'Remove from Favorites'. */ private Action [] createActionsForFavoriteFolder (Action [] arr) { boolean added = false; List<Action> newArr = new ArrayList<Action>(); for (int i = 0; i < arr.length; i++) { //Add before CopyAction or CutAction if (!added && ((arr[i] instanceof CopyAction) || (arr[i] instanceof CutAction))) { added = true; newArr.add(Actions.remove()); newArr.add(null); } //Do not add Delete action if (!(arr[i] instanceof DeleteAction)) { newArr.add(arr[i]); } } if (!added) { added = true; newArr.add(null); newArr.add(Actions.remove()); } return newArr.toArray (new Action[newArr.size()]); }
Example #8
Source File: AnnotationProviderTest.java From netbeans with Apache License 2.0 | 6 votes |
/** 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 #9
Source File: MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 5 votes |
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 #10
Source File: SceneExplorerTopComponent.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
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 #11
Source File: DataLoaderGetActionsTest.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected SystemAction[] defaultActions() { return new SystemAction[] { SystemAction.get(CutAction.class), null, SystemAction.get(CopyAction.class), null, SystemAction.get(DeleteAction.class), }; }
Example #12
Source File: BrokenDataShadow.java From netbeans with Apache License 2.0 | 5 votes |
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 #13
Source File: ExplorerPanelTest.java From netbeans with Apache License 2.0 | 5 votes |
/** Tests whether the cut, copy (callback) actions are enabled/disabled * in the right time, see # */ public void testCutCopyActionsEnabling() throws Exception { assertTrue ("Can run only in AWT thread", java.awt.EventQueue.isDispatchThread()); TestNode enabledNode = new TestNode(true, true, true); TestNode disabledNode = new TestNode(false, false, false); manager.setRootContext(new TestRoot( new Node[] {enabledNode, disabledNode})); Action copy = ((ContextAwareAction)SystemAction.get(CopyAction.class)).createContextAwareInstance(context); Action cut = ((ContextAwareAction)SystemAction.get(CutAction.class)).createContextAwareInstance(context); assertTrue("Copy action has to be disabled", !copy.isEnabled()); assertTrue("Cut action has to be disabled", !cut.isEnabled()); manager.setSelectedNodes(new Node[] {enabledNode}); manager.waitActionsFinished(); assertTrue("Copy action has to be enabled", copy.isEnabled()); assertTrue("Cut action has to be enabled", cut.isEnabled()); copy.actionPerformed (new java.awt.event.ActionEvent (this, 0, "waitFinished")); assertEquals ("clipboardCopy invoked", 1, enabledNode.countCopy); cut.actionPerformed (new java.awt.event.ActionEvent (this, 0, "waitFinished")); assertEquals ("clipboardCut invoked", 1, enabledNode.countCut); manager.setSelectedNodes(new Node[] {disabledNode}); manager.waitActionsFinished(); assertTrue("Copy action has to be disabled", !copy.isEnabled()); assertTrue("Cut action has to be disabled", !cut.isEnabled()); }
Example #14
Source File: MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 5 votes |
/** * Issue #61245: Delegate application/*+xml -> text/xml */ public void test61245(){ MimeLookup lookup = MimeLookup.getMimeLookup("application/xml"); checkLookupObject(lookup, FindAction.class, true); lookup = MimeLookup.getMimeLookup("application/xhtml+xml"); checkLookupObject(lookup, CutAction.class, true); checkLookupObject(lookup, FindAction.class, false); checkLookupObject(lookup, ReplaceAction.class, true); }
Example #15
Source File: MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 5 votes |
/** * 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 #16
Source File: MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 5 votes |
/** 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 #17
Source File: MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 5 votes |
/** 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 #18
Source File: Depr_MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 5 votes |
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 #19
Source File: Depr_MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 5 votes |
/** * Issue #61245: Delegate application/*+xml -> text/xml */ public void test61245(){ MimeLookup lookup = MimeLookup.getMimeLookup("application/xml"); checkLookupObject(lookup, FindAction.class, true); lookup = MimeLookup.getMimeLookup("application/xhtml+xml"); checkLookupObject(lookup, CutAction.class, true); checkLookupObject(lookup, FindAction.class, false); checkLookupObject(lookup, ReplaceAction.class, true); }
Example #20
Source File: Depr_MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 5 votes |
/** * 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 #21
Source File: Depr_MimeLookupPopupItemsChangeTest.java From netbeans with Apache License 2.0 | 4 votes |
/** Testing Base level popup items lookup and sorting */ @RandomlyFails // NB-Core-Build #3718 public void testDynamicChangeInPopupFolders() throws IOException{ final int resultChangedCount[] = new int[1]; resultChangedCount[0] = 0; MimeLookup lookup = MimeLookup.getMimeLookup("text/x-java").childLookup("text/xml"). //NOI18N childLookup("text/html"); //NOI18N Lookup.Result result = lookup.lookup(new Template(PopupActions.class)); result.allInstances(); // remove this line if issue #60010 is fixed LookupListener listener = new LookupListener(){ public void resultChanged(LookupEvent ev){ resultChangedCount[0]++; } }; result.addLookupListener(listener); PopupActions actions = (PopupActions) lookup.lookup(PopupActions.class); assertTrue("PopupActions should be found", actions != null); List popupActions = actions.getPopupActions(); int size = popupActions.size(); assertTrue("Number of PopupActions found:"+size+" and should be:"+fsstruct.length, size == fsstruct.length); //delete RenameAction TestUtilities.deleteFile(getWorkDir(), "Editors/text/html/Popup/org-openide-actions-RenameAction.instance"); checkPopupItemPresence(lookup, RenameAction.class, false); // check firing the change assertTrue(("resultChangedCount is:"+resultChangedCount[0]+" instead of 1"),resultChangedCount[0] == 1); resultChangedCount[0] = 0; //delete base CutAction TestUtilities.deleteFile(getWorkDir(), "Editors/Popup/org-openide-actions-CutAction.instance"); checkPopupItemPresence(lookup, CutAction.class, false); // check firing the change assertTrue(("resultChangedCount is:"+resultChangedCount[0]+" instead of 1"),resultChangedCount[0] == 1); resultChangedCount[0] = 0; //simulate module installation, new action will be added TestUtilities.createFile(getWorkDir(), "Editors/Popup/org-openide-actions-FindAction.instance"); //NOI18N checkPopupItemPresence(lookup, FindAction.class, true); // check firing the change assertTrue(("resultChangedCount is:"+resultChangedCount[0]+" instead of 1"),resultChangedCount[0] == 1); resultChangedCount[0] = 0; //simulate module installation, new action will be added TestUtilities.createFile(getWorkDir(), "Editors/text/x-java/text/xml/text/html/Popup/org-openide-actions-ReplaceAction.instance"); //NOI18N checkPopupItemPresence(lookup, ReplaceAction.class, true); //ReplaceAction was created in the uppermost folder // let's try it is missing in the lower lookup lookup = MimeLookup.getMimeLookup("text/x-java").childLookup("text/xml"); //NOI18N checkPopupItemPresence(lookup, ReplaceAction.class, false); checkPopupItemPresence(lookup, FindAction.class, true); // lookup for ReplaceAction in the folder that doesn't exist lookup = MimeLookup.getMimeLookup("text/html"); //NOI18N checkPopupItemPresence(lookup, ReplaceAction.class, false); // create folder with ReplaceAction TestUtilities.createFile(getWorkDir(), "Editors/text/html/Popup/org-openide-actions-ReplaceAction.instance"); //NOI18N checkPopupItemPresence(lookup, ReplaceAction.class, true); }
Example #22
Source File: MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 4 votes |
/** Testing Base level popup items lookup and sorting */ public void testBaseLevelPopups(){ MimeLookup lookup = MimeLookup.getMimeLookup(""); //NOI18N Class layerObjects[] = {CutAction.class, CopyAction.class, PasteAction.class}; testPopupItems(lookup, layerObjects); }
Example #23
Source File: Depr_MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 4 votes |
/** Testing MIME level popup items lookup, inheritance and sorting */ public void testMimeLevelPopupsWithStringAndSeparator(){ MimeLookup lookup = MimeLookup.getMimeLookup("text/x-java").childLookup("text/html").childLookup("text/xml"); //NOI18N Class layerObjects[] = {CutAction.class, CopyAction.class, PasteAction.class, ReplaceAction.class, JSeparator.class, String.class}; testPopupItems(lookup, layerObjects); }
Example #24
Source File: MMDGraphEditor.java From netbeans-mmd-plugin with Apache License 2.0 | 4 votes |
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)); }
Example #25
Source File: Depr_MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 4 votes |
/** Testing MIME level popup items lookup, inheritance and sorting */ public void testMimeLevelPopups(){ MimeLookup lookup = MimeLookup.getMimeLookup("text/x-java").childLookup("text/html"); //NOI18N Class layerObjects[] = {CutAction.class, CopyAction.class, NewAction.class, PasteAction.class}; testPopupItems(lookup, layerObjects); }
Example #26
Source File: Depr_MimeLookupInheritanceTest.java From netbeans with Apache License 2.0 | 4 votes |
/** Testing Base level popup items lookup and sorting */ public void testBaseLevelPopups(){ MimeLookup lookup = MimeLookup.getMimeLookup(""); //NOI18N Class layerObjects[] = {CutAction.class, CopyAction.class, PasteAction.class}; testPopupItems(lookup, layerObjects); }
Example #27
Source File: MimeLookupPopupItemsChangeTest.java From netbeans with Apache License 2.0 | 4 votes |
/** Testing Base level popup items lookup and sorting */ @RandomlyFails // NB-Core-Build #4599: resultChangedCount is:2 instead of 1 public void testDynamicChangeInPopupFolders() throws Exception { final int resultChangedCount[] = new int[1]; resultChangedCount[0] = 0; MimePath mp = MimePath.parse("text/x-java/text/xml/text/html"); Lookup lookup = getLookup(mp); Lookup.Result result = lookup.lookup(new Template(PopupActions.class)); result.allInstances(); // remove this line if issue #60010 is fixed LookupListener listener = new LookupListener(){ public void resultChanged(LookupEvent ev){ resultChangedCount[0]++; } }; result.addLookupListener(listener); PopupActions actions = (PopupActions) lookup.lookup(PopupActions.class); assertTrue("PopupActions should be found", actions != null); List popupActions = actions.getPopupActions(); int size = popupActions.size(); assertTrue("Number of PopupActions found:"+size+" and should be:"+fsstruct.length, size == fsstruct.length); //delete RenameAction TestUtilities.deleteFile(getWorkDir(), "Editors/text/html/Popup/org-openide-actions-RenameAction.instance"); checkPopupItemPresence(lookup, RenameAction.class, false); // check firing the change assertTrue(("resultChangedCount is:"+resultChangedCount[0]+" instead of 1"),resultChangedCount[0] == 1); resultChangedCount[0] = 0; //delete base CutAction TestUtilities.deleteFile(getWorkDir(), "Editors/Popup/org-openide-actions-CutAction.instance"); checkPopupItemPresence(lookup, CutAction.class, false); // check firing the change assertTrue(("resultChangedCount is:"+resultChangedCount[0]+" instead of 1"),resultChangedCount[0] == 1); resultChangedCount[0] = 0; //simulate module installation, new action will be added TestUtilities.createFile(getWorkDir(), "Editors/Popup/org-openide-actions-FindAction.instance"); //NOI18N checkPopupItemPresence(lookup, FindAction.class, true); // check firing the change assertTrue(("resultChangedCount is:"+resultChangedCount[0]+" instead of 1"),resultChangedCount[0] == 1); resultChangedCount[0] = 0; //simulate module installation, new action will be added TestUtilities.createFile(getWorkDir(), "Editors/text/x-java/text/xml/text/html/Popup/org-openide-actions-ReplaceAction.instance"); //NOI18N checkPopupItemPresence(lookup, ReplaceAction.class, true); //ReplaceAction was created in the uppermost folder // let's try it is missing in the lower lookup mp = MimePath.get(MimePath.get("text/x-java"), "text/xml"); lookup = getLookup(mp); checkPopupItemPresence(lookup, ReplaceAction.class, false); checkPopupItemPresence(lookup, FindAction.class, true); // lookup for ReplaceAction in the folder that doesn't exist lookup = MimeLookup.getLookup("text/html"); //NOI18N checkPopupItemPresence(lookup, ReplaceAction.class, false); // create folder with ReplaceAction TestUtilities.createFile(getWorkDir(), "Editors/text/html/Popup/org-openide-actions-ReplaceAction.instance"); //NOI18N checkPopupItemPresence(lookup, ReplaceAction.class, true); }