diff -r f526b2a560a6 server/apichanges.xml
--- a/server/apichanges.xml Fri Mar 27 10:17:46 2009 +0100
+++ b/server/apichanges.xml Mon Mar 30 11:52:41 2009 +0200
@@ -107,6 +107,19 @@
+
+
+ Extensible actions on root server node
+
+
+
+
+
+ By registering actions to Servers/Actions
you
+ can extend the list of popup actions on Servers node in
+ Services tab.
+
+
Support API for server instance persistence
diff -r f526b2a560a6 server/arch.xml
--- a/server/arch.xml Fri Mar 27 10:17:46 2009 +0100
+++ b/server/arch.xml Mon Mar 30 11:52:41 2009 +0200
@@ -69,6 +69,13 @@
module provides support API
to do that. This support API is not mandatory for clients to use in any way.
+
+
+
+ By registering actions to Servers/Actions
you
+ can extend the list of popup actions on Servers node in
+ Services tab.
+
diff -r f526b2a560a6 server/manifest.mf
--- a/server/manifest.mf Fri Mar 27 10:17:46 2009 +0100
+++ b/server/manifest.mf Mon Mar 30 11:52:41 2009 +0200
@@ -2,6 +2,7 @@
OpenIDE-Module: org.netbeans.modules.server/0
OpenIDE-Module-Layer: org/netbeans/modules/server/resources/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/server/resources/Bundle.properties
-OpenIDE-Module-Specification-Version: 1.3
+OpenIDE-Module-Specification-Version: 1.4
+OpenIDE-Module-Provides: org.netbeans.modules.server
AutoUpdate-Show-In-Client: false
diff -r f526b2a560a6 server/src/org/netbeans/modules/server/resources/layer.xml
--- a/server/src/org/netbeans/modules/server/resources/layer.xml Fri Mar 27 10:17:46 2009 +0100
+++ b/server/src/org/netbeans/modules/server/resources/layer.xml Mon Mar 30 11:52:41 2009 +0200
@@ -62,5 +62,11 @@
-
+
+
+
+
+
+
+
diff -r f526b2a560a6 server/src/org/netbeans/modules/server/ui/node/RootNode.java
--- a/server/src/org/netbeans/modules/server/ui/node/RootNode.java Fri Mar 27 10:17:46 2009 +0100
+++ b/server/src/org/netbeans/modules/server/ui/node/RootNode.java Mon Mar 30 11:52:41 2009 +0200
@@ -57,8 +57,10 @@
import org.openide.nodes.Node;
import org.openide.util.NbBundle;
import org.openide.util.RequestProcessor;
+import org.openide.util.Utilities;
import org.openide.util.WeakListeners;
import org.openide.util.actions.SystemAction;
+import org.openide.util.lookup.Lookups;
public final class RootNode extends AbstractNode {
@@ -87,7 +89,7 @@
@Override
public Action[] getActions(boolean context) {
- return new SystemAction[] {SystemAction.get(AddServerInstanceAction.class)};
+ return Utilities.actionsForPath("Servers/Actions").toArray(new Action[0]); // NOI18N
}
private static class ChildFactory extends org.openide.nodes.ChildFactory implements ChangeListener {
diff -r f526b2a560a6 server/test/unit/src/org/netbeans/modules/server/ui/node/RootNodeTest.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/test/unit/src/org/netbeans/modules/server/ui/node/RootNodeTest.java Mon Mar 30 11:52:41 2009 +0200
@@ -0,0 +1,89 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common
+ * Development and Distribution License("CDDL") (collectively, the
+ * "License"). You may not use this file except in compliance with the
+ * License. You can obtain a copy of the License at
+ * http://www.netbeans.org/cddl-gplv2.html
+ * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
+ * specific language governing permissions and limitations under the
+ * License. When distributing the software, include this License Header
+ * Notice in each file and include the License file at
+ * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the
+ * License Header, with the fields enclosed by brackets [] replaced by
+ * your own identifying information:
+ * "Portions Copyrighted [year] [name of copyright owner]"
+ *
+ * If you wish your version of this file to be governed by only the CDDL
+ * or only the GPL Version 2, indicate your decision by adding
+ * "[Contributor] elects to include this software in this distribution
+ * under the [CDDL or GPL Version 2] license." If you do not indicate a
+ * single choice of license, a recipient has the option to distribute
+ * your version of this file under either the CDDL, the GPL Version 2 or
+ * to extend the choice of license to its licensees as provided above.
+ * However, if you add GPL Version 2 code and therefore, elected the GPL
+ * Version 2 license, then the option applies only if the new code is
+ * made subject to such option by the copyright holder.
+ *
+ * Contributor(s):
+ *
+ * Portions Copyrighted 2009 Sun Microsystems, Inc.
+ */
+
+package org.netbeans.modules.server.ui.node;
+
+import javax.swing.Action;
+import org.netbeans.junit.NbTestCase;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.HelpCtx;
+import org.openide.util.actions.CallableSystemAction;
+
+/**
+ *
+ * @author Jaroslav Tulach
+ */
+public class RootNodeTest extends NbTestCase {
+
+ public RootNodeTest(String s) {
+ super(s);
+ }
+
+ public void testGetActions() throws Exception {
+ RootNode rn = RootNode.getInstance();
+ FileObject fo = FileUtil.getConfigFile("Servers/Actions");
+ assertNotNull("Folder for actions precreated", fo);
+ fo.createData(MyAction.class.getName().replace('.', '-') + ".instance");
+ Action[] arr = rn.getActions(true);
+ assertEquals("Two actions found", 2, arr.length);
+ MyAction a = MyAction.get(MyAction.class);
+
+ if (a != arr[0] && a != arr[1]) {
+ fail("My action shall be present in the node context actions: " + arr[0] + " 2nd: " + arr[1]);
+ }
+ }
+
+ public static final class MyAction extends CallableSystemAction {
+ @Override
+ public void performAction() {
+ }
+
+ @Override
+ public String getName() {
+ return "My";
+ }
+
+ @Override
+ public HelpCtx getHelpCtx() {
+ return HelpCtx.DEFAULT_HELP;
+ }
+
+ }
+}
\ No newline at end of file