Author: rob.stryker(a)jboss.com
Date: 2007-09-27 03:30:50 -0400 (Thu, 27 Sep 2007)
New Revision: 3851
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
Log:
Deleted modules mucking everything up. Will need a more elegant solution eventually
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-27
07:29:20 UTC (rev 3850)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-27
07:30:50 UTC (rev 3851)
@@ -33,6 +33,7 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.DeletedModule;
import org.eclipse.wst.server.core.model.IModuleFolder;
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
@@ -80,6 +81,11 @@
throws CoreException {
IStatus status = null;
+ for( int i = 0; i < module.length; i++ ) {
+ if( module[i] instanceof DeletedModule )
+ return null;
+ }
+
if (ServerBehaviourDelegate.REMOVED == deltaKind) {
status = unpublish(server, module, monitor);
} else if (kind == IServer.PUBLISH_FULL || kind == IServer.PUBLISH_CLEAN) {
@@ -117,7 +123,7 @@
protected IStatus unpublish(IDeployableServer jbServer, IModule[] module,
IProgressMonitor monitor) throws CoreException {
IPath path = getDeployPath(module);
- FileUtil.completeDelete(path.toFile());
+ FileUtil.safeDelete(path.toFile());
return new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
IStatus.OK, "", null);
}
@@ -179,25 +185,25 @@
/* Add one file or folder to a jar */
private void doPackModule(IModuleResource resource, ModulePackager packager) throws
CoreException, IOException{
- if (resource instanceof IModuleFolder) {
- IModuleFolder mFolder = (IModuleFolder)resource;
- IModuleResource[] resources = mFolder.members();
+ if (resource instanceof IModuleFolder) {
+ IModuleFolder mFolder = (IModuleFolder)resource;
+ IModuleResource[] resources = mFolder.members();
- packager.writeFolder(resource.getModuleRelativePath().append(resource.getName()).toPortableString());
+ packager.writeFolder(resource.getModuleRelativePath().append(resource.getName()).toPortableString());
- for (int i = 0; resources!= null && i < resources.length; i++) {
- doPackModule(resources[i], packager);
- }
- } else {
- String destination =
resource.getModuleRelativePath().append(resource.getName()).toPortableString();
- IFile file = (IFile) resource.getAdapter(IFile.class);
- if (file != null)
- packager.write(file, destination);
- else {
- File file2 = (File) resource.getAdapter(File.class);
- packager.write(file2, destination);
- }
+ for (int i = 0; resources!= null && i < resources.length; i++) {
+ doPackModule(resources[i], packager);
}
+ } else {
+ String destination =
resource.getModuleRelativePath().append(resource.getName()).toPortableString();
+ IFile file = (IFile) resource.getAdapter(IFile.class);
+ if (file != null)
+ packager.write(file, destination);
+ else {
+ File file2 = (File) resource.getAdapter(File.class);
+ packager.write(file2, destination);
+ }
+ }
}