Author: rob.stryker(a)jboss.com
Date: 2007-09-20 19:26:50 -0400 (Thu, 20 Sep 2007)
New Revision: 3739
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
Log:
Ensuring modules are added appropriately to the list of modules
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-20
22:29:14 UTC (rev 3738)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-20
23:26:50 UTC (rev 3739)
@@ -7,10 +7,13 @@
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerWorkingCopy;
+import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.internal.IModuleVisitor;
import org.eclipse.wst.server.core.internal.ProgressUtil;
import org.eclipse.wst.server.core.internal.Server;
@@ -133,6 +136,9 @@
// Basically stolen from RunOnServerActionDelegate
public IStatus publishOneModule(int kind, IModule[] module, int deltaKind,
IProgressMonitor monitor) {
+ // add it to the server first
+ addAndRemoveModules(module, deltaKind);
+
ArrayList moduleList = new ArrayList();
ArrayList deltaKindList = new ArrayList();
moduleList.add(module);
@@ -174,19 +180,19 @@
return Status.CANCEL_STATUS;
}
-// protected void addAndRemoveModules(IModule[] module, int deltaKind) {
-// if( getServer() == null ) return;
-// boolean contains = ServerUtil.containsModule(getServer(), module[0], new
NullProgressMonitor());
-// try {
-// if( !contains && (deltaKind == ServerBehaviourDelegate.ADDED) || (deltaKind
== ServerBehaviourDelegate.CHANGED)) {
-// IServerWorkingCopy wc = getServer().createWorkingCopy();
-// ServerUtil.modifyModules(wc, module, new IModule[0], new
NullProgressMonitor());
-// wc.save(false, new NullProgressMonitor());
-// } else if( contains && deltaKind == ServerBehaviourDelegate.REMOVED) {
-// IServerWorkingCopy wc = getServer().createWorkingCopy();
-// ServerUtil.modifyModules(wc, new IModule[0], module, new NullProgressMonitor());
-// wc.save(false, new NullProgressMonitor());
-// }
-// } catch( Exception e ) {} // swallowed
-// }
+ protected void addAndRemoveModules(IModule[] module, int deltaKind) {
+ if( getServer() == null ) return;
+ boolean contains = ServerUtil.containsModule(getServer(), module[0], new
NullProgressMonitor());
+ try {
+ if( !contains && (deltaKind == ServerBehaviourDelegate.ADDED) || (deltaKind ==
ServerBehaviourDelegate.CHANGED)) {
+ IServerWorkingCopy wc = getServer().createWorkingCopy();
+ ServerUtil.modifyModules(wc, module, new IModule[0], new NullProgressMonitor());
+ wc.save(false, new NullProgressMonitor());
+ } else if( contains && deltaKind == ServerBehaviourDelegate.REMOVED) {
+ IServerWorkingCopy wc = getServer().createWorkingCopy();
+ ServerUtil.modifyModules(wc, new IModule[0], module, new NullProgressMonitor());
+ wc.save(false, new NullProgressMonitor());
+ }
+ } catch( Exception e ) {} // swallowed
+ }
}