org.openide.actions.RenameAction Java Examples
The following examples show how to use
org.openide.actions.RenameAction.
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: RenameGroupAction.java From netbeans with Apache License 2.0 | 6 votes |
@Override protected void performAction(Node[] nodes) { if (nodes != null && nodes.length == 1) { SaasGroup group = nodes[0].getLookup().lookup(SaasGroup.class); if (group == null) { return; } Node n = nodes[0]; NotifyDescriptor.InputLine dlg = new NotifyDescriptor.InputLine( NbBundle.getMessage(RenameAction.class, "CTL_RenameLabel"), // NOI18N NbBundle.getMessage(RenameAction.class, "CTL_RenameTitle")); // NOI18N dlg.setInputText(n.getName()); if (NotifyDescriptor.OK_OPTION.equals(DialogDisplayer.getDefault().notify(dlg))) { String name = dlg.getInputText().trim(); if (group.getParent().getChildGroup(name) != null) { String msg = NbBundle.getMessage(RenameGroupAction.class, "MSG_DuplicateGroupName"); // NOI18N DialogDisplayer.getDefault().notify( new NotifyDescriptor.Message(msg, NotifyDescriptor.ERROR_MESSAGE)); return; } SaasServicesModel.getInstance().renameGroup(group, name); n.setName(name); } } }
Example #2
Source File: MimeLookupPerformanceTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testClassLookuping() throws IOException{ MimePath mp = MimePath.parse("text/x-java/text/html/text/xml"); Lookup lookup = MimeLookup.getLookup(mp); PopupActions popup = (PopupActions) lookup.lookup(PopupActions.class); List list = popup.getPopupActions(); checkPopupItemPresence(lookup, RenameAction.class, true); gc(); int size = assertSize("", Arrays.asList( new Object[] {lookup} ), 10000000, getFilter()); for (int i=0; i<30; i++){ popup = (PopupActions) lookup.lookup(PopupActions.class); list = popup.getPopupActions(); checkPopupItemPresence(lookup, RenameAction.class, true); } gc(); assertSize("", size + 20, lookup); }
Example #3
Source File: MimeLookupPerformanceTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testTemplateLookuping() throws IOException{ MimePath mp = MimePath.parse("text/x-java/text/html/text/xml"); Lookup lookup = MimeLookup.getLookup(mp); Result result = lookup.lookup(new Template(PopupActions.class)); Collection col = result.allInstances(); checkPopupItemPresence(lookup, RenameAction.class, true); gc(); int size = assertSize("", Arrays.asList( new Object[] {lookup} ), 10000000, getFilter()); for (int i=0; i<30; i++){ result = lookup.lookup(new Template(PopupActions.class)); col = result.allInstances(); checkPopupItemPresence(lookup, RenameAction.class, true); } gc(); assertSize("", size, lookup); }
Example #4
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 #5
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 #6
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 #7
Source File: OnePropNode.java From netbeans with Apache License 2.0 | 5 votes |
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 #8
Source File: PhadhailLook.java From netbeans with Apache License 2.0 | 5 votes |
public Action[] getActions(Phadhail ph, Lookup e) { 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 #9
Source File: PhadhailNode.java From netbeans with Apache License 2.0 | 5 votes |
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 #10
Source File: BookmarkNode.java From netbeans with Apache License 2.0 | 5 votes |
@Override public Action[] getActions(boolean context) { return new Action[] { SystemAction.get(OpenAction.class), SystemAction.get(RenameAction.class), SystemAction.get(DeleteAction.class) }; }
Example #11
Source File: StatisticNode.java From BART with MIT License | 5 votes |
@Override public Action[] getActions(boolean context) { Action[] a = { Actions.forID("StatisticNode", "it.unibas.bartgui.controlegt.actions.node.Statistics.Open"), Actions.forID("StatisticNode", "it.unibas.bartgui.controlegt.actions.node.Statistics.Export"), null, SystemAction.get(RenameAction.class), SystemAction.get(DeleteAction.class), null, SystemAction.get(PropertiesAction.class), }; return a; }
Example #12
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); }
Example #13
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); }