diff -r 660a239324ea glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java --- a/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java Wed Jun 18 15:29:42 2008 +0200 +++ b/glassfish.common/src/org/netbeans/modules/glassfish/common/GlassfishInstanceProvider.java Thu Jun 19 10:58:48 2008 +0200 @@ -60,6 +60,7 @@ import org.openide.filesystems.FileUtil; import org.openide.filesystems.FileUtil; import org.openide.filesystems.Repository; import org.openide.util.ChangeSupport; +import org.openide.util.Lookup; import org.openide.util.NbBundle; import org.openide.util.NbPreferences; @@ -124,6 +125,17 @@ public final class GlassfishInstanceProv } return result; + } + + public Lookup getLookupFor(ServerInstance instance) { + synchronized (instanceMap) { + for (GlassfishInstance gfInstance : instanceMap.values()) { + if (gfInstance.getCommonInstance().equals(instance)) { + return gfInstance.getLookup(); + } + } + return null; + } } public ServerInstanceImplementation getInternalInstance(String uri) { diff -r 660a239324ea glassfish.common/src/org/netbeans/modules/glassfish/spi/ServerUtilities.java --- a/glassfish.common/src/org/netbeans/modules/glassfish/spi/ServerUtilities.java Wed Jun 18 15:29:42 2008 +0200 +++ b/glassfish.common/src/org/netbeans/modules/glassfish/spi/ServerUtilities.java Thu Jun 19 10:58:48 2008 +0200 @@ -52,6 +52,7 @@ import org.netbeans.spi.server.ServerIns import org.netbeans.spi.server.ServerInstanceProvider; import org.openide.WizardDescriptor.InstantiatingIterator; import org.openide.filesystems.FileUtil; +import org.openide.util.Lookup; /** @@ -80,6 +81,10 @@ public final class ServerUtilities { */ public static ServerInstance getServerInstance(String uri) { return GlassfishInstanceProvider.getDefault().getInstance(uri); + } + + public static Lookup getLookupFor(ServerInstance instance) { + return GlassfishInstanceProvider.getDefault().getLookupFor(instance); } /** @@ -128,13 +133,9 @@ public final class ServerUtilities { /** * Returns an instance of the AddServerWizard for this server plugin. - * (Formerly used by glassfish.javaee module.) * * @return instance of the AddServerWizard for this server. - * - * @deprecated */ - @Deprecated public static InstantiatingIterator getAddInstanceIterator() { return new ServerWizardIterator(); } diff -r 660a239324ea glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Bundle.properties --- a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Bundle.properties Wed Jun 18 15:29:42 2008 +0200 +++ b/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Bundle.properties Thu Jun 19 10:58:48 2008 +0200 @@ -43,7 +43,7 @@ OpenIDE-Module-Name=GlassFish V3 JavaEE OpenIDE-Module-Name=GlassFish V3 JavaEE Integration OpenIDE-Module-Short-Description=GlassFish V3 server support for JavaEE projects. -TXT_DisplayName=GlassFish V3 (JavaEE Wizard) +TXT_DisplayName=GlassFish V3 TP2 MSG_START_SERVER_FAILED_FNF={0} Server can't start. The start jar was not found. MSG_START_SERVER_FAILED_PD={0} Server start failed. Can't create start proccess. diff -r 660a239324ea glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2OptionalFactory.java --- a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2OptionalFactory.java Wed Jun 18 15:29:42 2008 +0200 +++ b/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/Hk2OptionalFactory.java Thu Jun 19 10:58:48 2008 +0200 @@ -39,18 +39,27 @@ package org.netbeans.modules.glassfish.javaee; +import java.io.IOException; +import java.util.Collections; +import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import javax.enterprise.deploy.spi.DeploymentManager; +import javax.swing.event.ChangeListener; +import org.netbeans.api.server.ServerInstance; import org.netbeans.modules.glassfish.javaee.db.Hk2DatasourceManager; import org.netbeans.modules.glassfish.javaee.ide.FastDeploy; +import org.netbeans.modules.glassfish.spi.ServerUtilities; import org.netbeans.modules.j2ee.deployment.plugins.spi.DatasourceManager; import org.netbeans.modules.j2ee.deployment.plugins.spi.FindJSPServlet; import org.netbeans.modules.j2ee.deployment.plugins.spi.IncrementalDeployment; import org.netbeans.modules.j2ee.deployment.plugins.spi.JDBCDriverDeployer; import org.netbeans.modules.j2ee.deployment.plugins.spi.OptionalDeploymentManagerFactory; import org.netbeans.modules.j2ee.deployment.plugins.spi.StartServer; +import org.openide.WizardDescriptor; import org.openide.WizardDescriptor.InstantiatingIterator; +import org.openide.WizardDescriptor.Panel; +import org.openide.util.Lookup; /** @@ -74,10 +83,15 @@ public class Hk2OptionalFactory extends "JavaEE_V3_OptionalFactory.getFindJSPServlet"); return null; } + + @Override + public boolean isCommonUIRequired() { + return false; + } @Override public InstantiatingIterator getAddInstanceIterator() { - return null; + return new J2eeInstantiatingIterator(ServerUtilities.getAddInstanceIterator()); } @Override @@ -91,4 +105,68 @@ public class Hk2OptionalFactory extends return null; } + private static class J2eeInstantiatingIterator implements InstantiatingIterator { + + private final InstantiatingIterator delegate; + + public J2eeInstantiatingIterator(InstantiatingIterator delegate) { + this.delegate = delegate; + } + + public void removeChangeListener(ChangeListener l) { + delegate.removeChangeListener(l); + } + + public void previousPanel() { + delegate.previousPanel(); + } + + public void nextPanel() { + delegate.nextPanel(); + } + + public String name() { + return delegate.name(); + } + + public boolean hasPrevious() { + return delegate.hasPrevious(); + } + + public boolean hasNext() { + return delegate.hasNext(); + } + + public Panel current() { + return delegate.current(); + } + + public void addChangeListener(ChangeListener l) { + delegate.addChangeListener(l); + } + + public void uninitialize(WizardDescriptor wizard) { + delegate.uninitialize(wizard); + } + + public Set instantiate() throws IOException { + Set set = delegate.instantiate(); + if (!set.isEmpty()) { + Object inst = set.iterator().next(); + if (inst instanceof ServerInstance) { + Lookup lookup = ServerUtilities.getLookupFor((ServerInstance) inst); + if (lookup != null) { + JavaEEServerModule module = lookup.lookup(JavaEEServerModule.class); + return Collections.singleton(module.getInstanceProperties()); + } + } + } + return Collections.EMPTY_SET; + } + + public void initialize(WizardDescriptor wizard) { + delegate.initialize(wizard); + } + + } } diff -r 660a239324ea glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/JavaEEServerModule.java --- a/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/JavaEEServerModule.java Wed Jun 18 15:29:42 2008 +0200 +++ b/glassfish.javaee/src/org/netbeans/modules/glassfish/javaee/JavaEEServerModule.java Thu Jun 19 10:58:48 2008 +0200 @@ -50,14 +50,17 @@ import org.openide.util.Lookup; */ public class JavaEEServerModule implements RemoveCookie { - private Lookup lookup; - private InstanceProperties instanceProperties; + private final Lookup lookup; + private final InstanceProperties instanceProperties; JavaEEServerModule(Lookup instanceLookup, InstanceProperties ip) { lookup = instanceLookup; instanceProperties = ip; } + public InstanceProperties getInstanceProperties() { + return instanceProperties; + } // ------------------------------------------------------------------------ // RemoveCookie support // ------------------------------------------------------------------------