diff -r f526b2a560a6 ide.ergonomics/identity.properties
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ide.ergonomics/identity.properties Mon Mar 30 17:52:18 2009 +0200
@@ -0,0 +1,38 @@
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 2008 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 2008 Sun Microsystems, Inc.
+
+mainModule=org.netbeans.modules.identity.kit
diff -r f526b2a560a6 ide.ergonomics/manifest.mf
--- a/ide.ergonomics/manifest.mf Fri Mar 27 10:17:46 2009 +0100
+++ b/ide.ergonomics/manifest.mf Mon Mar 30 17:52:18 2009 +0200
@@ -3,6 +3,7 @@
OpenIDE-Module-Layer: org/netbeans/modules/ide/ergonomics/layer.xml
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/ide/ergonomics/Bundle.properties
OpenIDE-Module-Specification-Version: 1.2
+OpenIDE-Module-Recommends: org.netbeans.modules.server
AutoUpdate-Show-In-Client: false
AutoUpdate-Essential-Module: true
diff -r f526b2a560a6 ide.ergonomics/project-wizard.xsl
--- a/ide.ergonomics/project-wizard.xsl Fri Mar 27 10:17:46 2009 +0100
+++ b/ide.ergonomics/project-wizard.xsl Mon Mar 30 17:52:18 2009 +0200
@@ -25,6 +25,24 @@
Debugger
+
+
+
+
+ Servers
+
+ Actions
+
+
+
+
+
+
@@ -130,6 +148,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ delegate
+ org.netbeans.modules.ide.ergonomics.fod.FeatureAction.create
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r f526b2a560a6 ide.ergonomics/src-ant/org/netbeans/modules/ide/ergonomics/ant/relative-refs.xsl
--- a/ide.ergonomics/src-ant/org/netbeans/modules/ide/ergonomics/ant/relative-refs.xsl Fri Mar 27 10:17:46 2009 +0100
+++ b/ide.ergonomics/src-ant/org/netbeans/modules/ide/ergonomics/ant/relative-refs.xsl Mon Mar 30 17:52:18 2009 +0200
@@ -47,6 +47,27 @@
Debugger
+
+
+
+
+ Servers
+
+ Actions
+
+
+
+
+
+
+ Actions
+
diff -r f526b2a560a6 ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/Bundle.properties
--- a/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/Bundle.properties Fri Mar 27 10:17:46 2009 +0100
+++ b/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/Bundle.properties Mon Mar 30 17:52:18 2009 +0200
@@ -86,3 +86,7 @@
MSG_Opening_File=Opening File {0}
CAP_Opening_File=Opening File
FodDataObjectFactoryPanel.fileName.text=
+
+
+MSG_Action=Preparing Action "{0}"
+CAP_Action=Executing Action
\ No newline at end of file
diff -r f526b2a560a6 ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FeatureAction.java
--- a/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FeatureAction.java Fri Mar 27 10:17:46 2009 +0100
+++ b/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FeatureAction.java Mon Mar 30 17:52:18 2009 +0200
@@ -38,12 +38,20 @@
*/
package org.netbeans.modules.ide.ergonomics.fod;
+import java.awt.EventQueue;
+import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import javax.swing.SwingUtilities;
+import java.util.logging.Level;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import org.netbeans.api.progress.ProgressHandle;
+import org.netbeans.api.progress.ProgressHandleFactory;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
+import org.openide.util.NbBundle;
import org.openide.util.RequestProcessor;
+import org.openide.util.Utilities;
/**
*
@@ -53,21 +61,41 @@
private boolean success;
private FileObject fo;
- private boolean isDelegateAction = false;
+ private ProgressHandle handle;
+ private JDialog dialog;
- public FeatureAction(FileObject fo, boolean delegate) {
+ private FeatureAction(FileObject fo) {
this.fo = fo;
- this.isDelegateAction = delegate;
+ }
+
+ public static ActionListener create(FileObject fo) {
+ return new FeatureAction(fo);
}
public void actionPerformed(ActionEvent e) {
success = false;
+ if (EventQueue.isDispatchThread()) {
+ handle = ProgressHandleFactory.createHandle(
+ NbBundle.getMessage(FeatureAction.class, "MSG_Action", fo.getAttribute("displayName"))
+ ); // NOI18N
+ Frame[] arr = JFrame.getFrames();
+ final Frame mainWindow = arr.length > 0 ? arr[0] : null;
+ dialog = new JDialog(
+ mainWindow,
+ NbBundle.getMessage(FodDataObjectFactory.class, "CAP_Action"),
+ true
+ );
+ dialog.getContentPane().add(new FodDataObjectFactoryPanel(handle, null, (String)fo.getAttribute("displayName")));
+ dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
+ dialog.pack();
+ dialog.setBounds(Utilities.findCenterBounds(dialog.getPreferredSize()));
+ FoDFileSystem.LOG.log(Level.FINE, "Bounds {0}", dialog.getBounds());
+ }
RequestProcessor.Task t = RequestProcessor.getDefault().post(this, 0, Thread.NORM_PRIORITY);
- if (isDelegateAction) {
- t.waitFinished ();
- } else {
- return ;
+ if (dialog != null) {
+ dialog.setVisible(true);
}
+ t.waitFinished ();
if (! success) {
return ;
@@ -85,8 +113,19 @@
}
public void run() {
- assert ! SwingUtilities.isEventDispatchThread () : "Cannot run in EQ!";
+ assert ! EventQueue.isDispatchThread () : "Cannot run in EQ!";
FeatureInfo info = FoDFileSystem.getInstance().whichProvides(fo);
+ if (handle != null) {
+ handle.start();
+ }
success = ModulesInstaller.installModules(info);
+ if (dialog != null) {
+ dialog.setVisible(false);
+ }
+ if (handle != null) {
+ handle.finish();
+ }
+ handle = null;
+ dialog = null;
}
}
diff -r f526b2a560a6 ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FodDataObjectFactory.java
--- a/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FodDataObjectFactory.java Fri Mar 27 10:17:46 2009 +0100
+++ b/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FodDataObjectFactory.java Mon Mar 30 17:52:18 2009 +0200
@@ -164,7 +164,7 @@
Frame[] arr = JFrame.getFrames();
final Frame mainWindow = arr.length > 0 ? arr[0] : null;
dialog = new JDialog(mainWindow, NbBundle.getMessage(FodDataObjectFactory.class, "CAP_Opening_File"), true);
- dialog.getContentPane().add(new FodDataObjectFactoryPanel(handle, fo));
+ dialog.getContentPane().add(new FodDataObjectFactoryPanel(handle, fo, null));
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.pack();
dialog.setBounds(Utilities.findCenterBounds(dialog.getPreferredSize()));
diff -r f526b2a560a6 ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FodDataObjectFactoryPanel.java
--- a/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FodDataObjectFactoryPanel.java Fri Mar 27 10:17:46 2009 +0100
+++ b/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FodDataObjectFactoryPanel.java Mon Mar 30 17:52:18 2009 +0200
@@ -52,10 +52,15 @@
*/
final class FodDataObjectFactoryPanel extends javax.swing.JPanel {
/** Creates new form OpeningProjectPanel */
- public FodDataObjectFactoryPanel(ProgressHandle handle, FileObject fo) {
+ public FodDataObjectFactoryPanel(ProgressHandle handle, FileObject fo, String msg) {
initComponents();
progressPanel.add(BorderLayout.CENTER, ProgressHandleFactory.createProgressComponent(handle));
- fileName.setText(fo.getPath());
+ if (fo != null) {
+ fileName.setText(fo.getPath());
+ }
+ if (msg != null) {
+ actionName.setText(msg);
+ }
}
/** This method is called from within the constructor to
diff -r f526b2a560a6 ide.ergonomics/test/unit/src/org/netbeans/modules/ide/ergonomics/DynamicVerifyTest.java
--- a/ide.ergonomics/test/unit/src/org/netbeans/modules/ide/ergonomics/DynamicVerifyTest.java Fri Mar 27 10:17:46 2009 +0100
+++ b/ide.ergonomics/test/unit/src/org/netbeans/modules/ide/ergonomics/DynamicVerifyTest.java Mon Mar 30 17:52:18 2009 +0200
@@ -66,6 +66,7 @@
addTest(ProjectTemplatesCheck.class).
addTest(FilesAndAttributesCheck.class, "testGetAllTemplates", "testCheckAllTemplatesPretest").
addTest(DebuggerAttachTypesCheck.class, "testGetAllDebuggers").
+ addTest(ServersNodeActionsCheck.class, "testGetAll", "testCheckAllPretest").
gui(false).
clusters("ergonomics.*").
clusters(".*").
@@ -77,6 +78,7 @@
addTest(AllClustersProcessedCheck.class).
addTest(FilesAndAttributesCheck.class, "testCheckAllTemplatesReal").
addTest(DebuggerAttachTypesCheck.class, "testGetAllDebuggersReal").
+ addTest(ServersNodeActionsCheck.class, "testCheckAllReal").
gui(false).
clusters("ergonomics.*").
clusters(".*").
diff -r f526b2a560a6 ide.ergonomics/test/unit/src/org/netbeans/modules/ide/ergonomics/ServersNodeActionsCheck.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ide.ergonomics/test/unit/src/org/netbeans/modules/ide/ergonomics/ServersNodeActionsCheck.java Mon Mar 30 17:52:18 2009 +0200
@@ -0,0 +1,219 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 2008 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 2008 Sun Microsystems, Inc.
+ */
+package org.netbeans.modules.ide.ergonomics;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import org.netbeans.junit.NbTestCase;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileStateInvalidException;
+import org.openide.filesystems.FileUtil;
+import org.openide.util.Enumerations;
+
+/**
+ *
+ * @author Jaroslav Tulach
+ */
+public class ServersNodeActionsCheck extends NbTestCase {
+
+ public ServersNodeActionsCheck(String name) {
+ super(name);
+ }
+
+ public void testGetAll() throws Exception {
+ clearWorkDir();
+
+ FileObject orig = FileUtil.getConfigFile("Servers/Actions");
+ assertNotNull("actions folder is there", orig);
+
+ Enumeration extends FileObject> nodes = orig.getChildren(true);
+ class VisitOriginalFile implements Enumerations.Processor {
+ public FileObject process(FileObject fo, Collection toAdd) {
+ Object attr = fo.getAttribute("originalFile");
+ if (attr instanceof String) {
+ FileObject originalFile = FileUtil.getConfigFile((String)attr);
+ assertNotNull("Original file for " + attr + " found", originalFile);
+ toAdd.add(originalFile);
+ }
+ return fo;
+ }
+ }
+
+
+ StringBuilder errors = new StringBuilder();
+ Enumeration extends FileObject> en = Enumerations.queue(nodes, new VisitOriginalFile());
+ while (en.hasMoreElements()) {
+ FileObject fo = en.nextElement();
+
+ int cnt = 0;
+ Enumeration allAttributes = fo.getAttributes();
+ while (allAttributes.hasMoreElements()) {
+ String name = allAttributes.nextElement();
+ Object attr = fo.getAttribute(name);
+ if (attr == null) {
+ fail("fo: " + fo + " has null " + name + " attribute");
+ }
+ System.setProperty(dynAttr + fo.getPath() + "@" + name, attr.toString());
+ cnt++;
+
+ if (attr instanceof URL) {
+ URL u = (URL) attr;
+ int read = -1;
+ try {
+ read = u.openStream().read(new byte[4096]);
+ } catch (IOException ex) {
+ errors.append(ex.getMessage()).append('\n');
+ }
+ if (read <= 0) {
+ errors.append("Resource shall exist: " + fo + " attr: " + name + " value: " + attr + "\n");
+ }
+ }
+ }
+ System.setProperty(dynVery + fo.getPath(), String.valueOf(cnt));
+ String locName = getDisplayName(fo);
+ System.setProperty(dynName + fo.getPath(), locName);
+ }
+
+ if (errors.length() > 0) {
+ fail(errors.toString());
+ }
+ }
+ private static final String dynName = "serversnodedynamic/name/";
+ private static final String dynVery = "serversnodedynamic/verify/";
+ private static final String dynAttr = "serversnodedynamic/attr/";
+
+ public void testCheckAllPretest() throws Exception {
+ testCheckAllReal();
+ }
+ public void testCheckAllReal() throws Exception {
+ Map> filesAndAttribs = new TreeMap>();
+ for (Object o : System.getProperties().keySet()) {
+ String f = (String)o;
+ if (f.startsWith(dynVery)) {
+ int cnt = Integer.parseInt(System.getProperties().getProperty(f));
+ f = f.substring(dynVery.length());
+ ArrayList arr = new ArrayList();
+ String pref = dynAttr + f + "@";
+ for (Map.Entry
+
+
+ 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 17:52:18 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 17:52:18 2009 +0200
@@ -62,5 +62,15 @@
-
+
+
+
+
+
+
+
+
+
+
+
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 17:52:18 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 17:52:18 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