Author: rob.stryker(a)jboss.com
Date: 2010-05-31 02:57:10 -0400 (Mon, 31 May 2010)
New Revision: 22437
Modified:
branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
Log:
JBIDE-6222 - delete old deployments during a rename
Modified:
branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
---
branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2010-05-31
00:44:14 UTC (rev 22436)
+++
branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2010-05-31
06:57:10 UTC (rev 22437)
@@ -24,7 +24,6 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.model.IModuleResource;
@@ -38,10 +37,10 @@
import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil;
import org.jboss.ide.eclipse.as.core.server.xpl.PublishCopyUtil.LocalCopyCallback;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
-import org.jboss.ide.eclipse.as.core.util.IConstants;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.core.util.FileUtil.FileUtilListener;
import org.jboss.ide.eclipse.as.core.util.FileUtil.IFileUtilListener;
+import org.jboss.ide.eclipse.as.core.util.IConstants;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
/**
* This class provides a default implementation for packaging different types of
@@ -63,8 +62,8 @@
public boolean accepts(String type, IServer server, IModule[] module) {
IDeployableServer ds = ServerConverter.getDeployableServer(server);
boolean shouldAccept = ds != null &&
LocalPublishMethod.LOCAL_PUBLISH_METHOD.equals(type)
- && ModuleCoreNature.isFlexibleProject(module[0].getProject())
- && !ds.zipsWTPDeployments();
+ && !ds.zipsWTPDeployments()
+ && PublishUtil.isModuleCoreProject(module);
return shouldAccept;
}
Modified:
branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java
===================================================================
---
branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-05-31
00:44:14 UTC (rev 22436)
+++
branches/3.2.helios/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/PublishUtil.java 2010-05-31
06:57:10 UTC (rev 22437)
@@ -12,6 +12,7 @@
import java.io.File;
import java.io.IOException;
+import java.util.ArrayList;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
@@ -21,7 +22,9 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jst.server.core.IEnterpriseApplication;
+import org.eclipse.wst.common.componentcore.ModuleCoreNature;
import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.internal.DeletedModule;
import org.eclipse.wst.server.core.model.IModuleFile;
import org.eclipse.wst.server.core.model.IModuleFolder;
import org.eclipse.wst.server.core.model.IModuleResource;
@@ -149,6 +152,26 @@
}
+ public static ArrayList<String> moduleCoreFactories = new
ArrayList<String>();
+ static {
+ moduleCoreFactories.add("org.eclipse.jst.j2ee.server"); //$NON-NLS-1$
+ moduleCoreFactories.add("org.eclipse.jst.jee.server"); //$NON-NLS-1$
+ }
+ public static void addModuleCoreFactory(String s) {
+ if( !moduleCoreFactories.contains(s))
+ moduleCoreFactories.add(s);
+ }
+ public static boolean isModuleCoreProject(IModule[] module) {
+ IModule lastmod = module[module.length-1];
+ if( lastmod.getProject() == null && lastmod instanceof DeletedModule) {
+ int colon = lastmod.getId().indexOf(':');
+ String factory = lastmod.getId().substring(0,colon == -1 ? lastmod.getId().length() :
colon);
+ return moduleCoreFactories.contains(factory);
+ }
+ return ModuleCoreNature.isFlexibleProject(lastmod.getProject());
+ }
+
+
private static String getSuffix(String type) {
String suffix = null;
if( IJBossServerConstants.FACET_EAR.equals(type))
Show replies by date