Author: rob.stryker(a)jboss.com
Date: 2009-04-17 02:33:38 -0400 (Fri, 17 Apr 2009)
New Revision: 14783
Added:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/TestPublisher.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
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/server/IDeployableServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/schema/publishers.exsd
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4193
Modified: trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2009-04-16
16:53:34 UTC (rev 14782)
+++ trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/plugin.xml 2009-04-17
06:33:38 UTC (rev 14783)
@@ -90,6 +90,11 @@
class="org.jboss.ide.eclipse.archives.webtools.modules.PackagesPublisher"
priority="5">
</publisher>
+ <publisher
+
class="org.jboss.ide.eclipse.archives.webtools.modules.WTPZippedPublisher"
+ priority="0"
+ zipDelegate="true">
+ </publisher>
</extension>
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/TestPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/TestPublisher.java 2009-04-16
16:53:34 UTC (rev 14782)
+++
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/TestPublisher.java 2009-04-17
06:33:38 UTC (rev 14783)
@@ -1,290 +0,0 @@
-package org.jboss.ide.eclipse.archives.webtools.modules;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-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.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.server.core.IModule;
-import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.model.IModuleFile;
-import org.eclipse.wst.server.core.model.IModuleFolder;
-import org.eclipse.wst.server.core.model.IModuleResource;
-import org.eclipse.wst.server.core.model.IModuleResourceDelta;
-import org.jboss.ide.eclipse.archives.core.util.internal.TrueZipUtil;
-import org.jboss.ide.eclipse.archives.webtools.IntegrationPlugin;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
-import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
-import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
-import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
-import org.jboss.ide.eclipse.as.core.util.FileUtil;
-import org.jboss.ide.eclipse.as.core.util.FileUtil.IFileUtilListener;
-
-import de.schlichtherle.io.ArchiveDetector;
-
-public class TestPublisher extends PublishUtil implements IJBossServerPublisher {
- private int moduleState = IServer.PUBLISH_STATE_NONE;
- public boolean accepts(IServer server, IModule[] module) {
- // TODO check for zip preference
- return ModuleCoreNature.isFlexibleProject(module[0].getProject());
- }
-
- public int getPublishState() {
- return moduleState;
- }
-
- protected IDeployableServer getDeployableServer(IServer server) {
- return (IDeployableServer)server.loadAdapter(IDeployableServer.class, new
NullProgressMonitor());
- }
- protected DeployableServerBehavior getBehaviour(IServer server) {
- return (DeployableServerBehavior)server.loadAdapter(DeployableServerBehavior.class, new
NullProgressMonitor());
- }
-
- protected List<IModule[]> getRemovedModules(IServer s) {
- return getBehaviour(s).getRemovedModules();
- }
-
- public boolean isNew(IModule[] module, IServer s) {
- return !getBehaviour(s).hasBeenPublished(module);
- }
-
-
- public IStatus publishModule(IServer server, IModule[] module,
- int publishType, IModuleResourceDelta[] delta,
- IProgressMonitor monitor) throws CoreException {
- if( module.length > 1 ) {
- return Status.OK_STATUS;
- }
-
- IStatus[] returnStatus;
- // Am I a removal? If yes, remove me, and return
- if( publishType == IJBossServerPublisher.REMOVE_PUBLISH)
- returnStatus = removeModule(server, module);
-
- // Am I a full publish? If yes, full publish me, and return
- else if( publishType == IJBossServerPublisher.FULL_PUBLISH)
- returnStatus = fullPublish(server, module);
-
- else {
- // Am I changed? If yes, handle my changes
- ArrayList<IStatus> results = new ArrayList<IStatus>();
- if( countChanges(delta) > 0) {
- results.addAll(Arrays.asList(publishChanges(server, module)));
- }
-
- IModule[] children = server.getChildModules(module, new NullProgressMonitor());
- results.addAll(Arrays.asList(handleChildrenDeltas(server, module, children)));
-
- // Handle the removed children that are not returned by getChildModules
- List<IModule[]> removed = getBehaviour(server).getRemovedModules();
- Iterator<IModule[]> i = removed.iterator();
- while(i.hasNext()) {
- IModule[] removedArray = i.next();
- if( removedArray[0].getId().equals(module[0].getId())) {
- results.addAll(Arrays.asList(removeModule(server, removedArray)));
- }
- }
- returnStatus = (IStatus[]) results.toArray(new IStatus[results.size()]);
- }
- TrueZipUtil.umount();
-
- IStatus finalStatus;
- if( returnStatus.length > 0 ) {
- MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.JST_PUB_INC_FAIL,
- "Publish Failed for module " + module[0].getName(), null); //$NON-NLS-1$
- for( int i = 0; i < returnStatus.length; i++ )
- ms.add(returnStatus[i]);
- finalStatus = ms;
- } else
- finalStatus = Status.OK_STATUS;
-
- return finalStatus;
- }
-
- protected IStatus[] handleChildrenDeltas(IServer server, IModule[] module, IModule[]
children) {
- // For each child:
- ArrayList<IStatus> results = new ArrayList<IStatus>();
- for( int i = 0; i < children.length; i++ ) {
- IModule[] combinedChild = combine(module, children[i]);
- // if it's new, full publish it
- if( !getBehaviour(server).hasBeenPublished(combinedChild)) {
- results.addAll(Arrays.asList(fullPublish(server, combinedChild)));
- }
- // else if it's removed, full remove it
- else if( isRemoved(server, combinedChild)) {
- results.addAll(Arrays.asList(removeModule(server, combinedChild)));
- }
- // else
- else {
- // handle changed resources
- results.addAll(Arrays.asList(publishChanges(server, combinedChild)));
-
- // recurse
- IModule[] children2 = server.getChildModules(combinedChild, new
NullProgressMonitor());
- results.addAll(Arrays.asList(handleChildrenDeltas(server, children, children2)));
- }
- }
- return (IStatus[]) results.toArray(new IStatus[results.size()]);
- }
-
- protected boolean isRemoved(IServer server, IModule[] child) {
- List<IModule[]> removed = getBehaviour(server).getRemovedModules();
- Iterator<IModule[]> i = removed.iterator();
- while(i.hasNext()) {
- IModule[] next = i.next();
- if( next.length == child.length) {
- for( int j = 0; j < next.length; j++ ) {
- if( !next[j].getId().equals(child[j].getId())) {
- continue;
- }
- }
- return true;
- }
- }
- return false;
- }
-
- protected IStatus[] removeModule(IServer server, IModule[] module) {
- String depFolder = getDeployableServer(server).getDeployFolder();
- IPath deployPath = getDeployPath(module, depFolder);
- final ArrayList<IStatus> status = new ArrayList<IStatus>();
- IFileUtilListener listener = new IFileUtilListener() {
- public void fileCopied(File source, File dest, boolean result,Exception e) {}
- public void fileDeleted(File file, boolean result, Exception e) {
- if( result == false || e != null ) {
- status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.JST_PUB_FILE_DELETE_FAIL,
- "Attempt to delete " + file.getAbsolutePath() + " failed",e));
//$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- public void folderDeleted(File file, boolean result, Exception e) {
- if( result == false || e != null ) {
- status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.JST_PUB_FILE_DELETE_FAIL,
- "Attempt to delete " + file.getAbsolutePath() + " failed",e));
//$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- };
- FileUtil.safeDelete(deployPath.toFile(), listener);
- return (IStatus[]) status.toArray(new IStatus[status.size()]);
- }
-
- protected IStatus[] fullPublish(IServer server, IModule[] module) {
- ArrayList<IStatus> results = new ArrayList<IStatus>();
- try {
- String depFolder = getDeployableServer(server).getDeployFolder();
- IPath path = getDeployPath(module, depFolder);
- // Get rid of the old
- path.toFile().delete();
-
- TrueZipUtil.createArchive(path);
- de.schlichtherle.io.File root = TrueZipUtil.getFile(path,
TrueZipUtil.getJarArchiveDetector());
- IModuleResource[] resources = getResources(module);
- results.addAll(Arrays.asList(copy(root, resources)));
-
- IModule[] children = server.getChildModules(module, new NullProgressMonitor());
- for( int i = 0; i < children.length; i++ )
- results.addAll(Arrays.asList(fullPublish(server, combine(module, children[i]))));
- return (IStatus[]) results.toArray(new IStatus[results.size()]);
- } catch( CoreException ce) {
- results.add(generateCoreExceptionStatus(ce));
- return (IStatus[]) results.toArray(new IStatus[results.size()]);
- }
- }
-
- protected IStatus[] publishChanges(IServer server, IModule[] module) {
- String depFolder = getDeployableServer(server).getDeployFolder();
- IPath path = getDeployPath(module, depFolder);
- de.schlichtherle.io.File root = TrueZipUtil.getFile(path,
TrueZipUtil.getJarArchiveDetector());
- IModuleResourceDelta[] deltas = ((Server)server).getPublishedResourceDelta(module);
- return publishChanges(server, deltas, root);
- }
-
- protected IStatus[] publishChanges(IServer server, IModuleResourceDelta[] deltas,
de.schlichtherle.io.File root) {
- ArrayList<IStatus> results = new ArrayList<IStatus>();
- if( deltas == null || deltas.length == 0 )
- return new IStatus[]{};
- int dKind;
- IModuleResource resource;
- for( int i = 0; i < deltas.length; i++ ) {
- dKind = deltas[i].getKind();
- resource = deltas[i].getModuleResource();
- if( dKind == IModuleResourceDelta.ADDED ) {
- results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
- } else if( dKind == IModuleResourceDelta.CHANGED ) {
- if( resource instanceof IModuleFile )
- results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
- results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(),
root)));
- } else if( dKind == IModuleResourceDelta.REMOVED) {
- de.schlichtherle.io.File f = getFileInArchive(root,
- resource.getModuleRelativePath().append(
- resource.getName()));
- boolean b = f.deleteAll();
- if( !b )
- results.add(generateDeleteFailedStatus(f));
- } else if( dKind == IModuleResourceDelta.NO_CHANGE ) {
- results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(),
root)));
- }
- }
-
- return (IStatus[]) results.toArray(new IStatus[results.size()]);
- }
-
-
- protected IStatus[] copy(de.schlichtherle.io.File root, IModuleResource[] children) {
- ArrayList<IStatus> results = new ArrayList<IStatus>();
- for( int i = 0; i < children.length; i++ ) {
- if( children[i] instanceof IModuleFile ) {
- IModuleFile mf = (IModuleFile)children[i];
- java.io.File source = getFile(mf);
- de.schlichtherle.io.File destination = getFileInArchive(root,
mf.getModuleRelativePath().append(mf.getName()));
- boolean b = new de.schlichtherle.io.File(source).copyAllTo(destination);
- if( !b )
- results.add(generateCopyFailStatus(source, destination));
- } else if( children[i] instanceof IModuleFolder ) {
- de.schlichtherle.io.File destination = getFileInArchive(root,
children[i].getModuleRelativePath().append(children[i].getName()));
- destination.mkdirs();
- IModuleFolder mf = (IModuleFolder)children[i];
- results.addAll(Arrays.asList(copy(root, mf.members())));
- }
- }
- return (IStatus[]) results.toArray(new IStatus[results.size()]);
- }
-
- protected IStatus generateDeleteFailedStatus(java.io.File file) {
- return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, "Could not delete
file " + file); //$NON-NLS-1$
- }
- protected IStatus generateCoreExceptionStatus(CoreException ce) {
- return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, ce.getMessage(), ce);
- }
- protected IStatus generateCopyFailStatus(java.io.File source, java.io.File destination)
{
- return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, "Copy of " +
source + " to " + destination + " has
failed");//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
- }
-
- protected de.schlichtherle.io.File getFileInArchive(de.schlichtherle.io.File root, IPath
relative) {
- while(relative.segmentCount() > 0 ) {
- root = new de.schlichtherle.io.File(root,
- relative.segment(0), ArchiveDetector.DEFAULT);
- relative = relative.removeFirstSegments(1);
- }
- return root;
- }
-
- private IModule[] combine(IModule[] module, IModule newMod) {
- IModule[] retval = new IModule[module.length + 1];
- for( int i = 0; i < module.length; i++ )
- retval[i]=module[i];
- retval[retval.length-1] = newMod;
- return retval;
- }
-}
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
(from rev 14768,
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/TestPublisher.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2009-04-17
06:33:38 UTC (rev 14783)
@@ -0,0 +1,290 @@
+package org.jboss.ide.eclipse.archives.webtools.modules;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+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.wst.common.componentcore.ModuleCoreNature;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.Server;
+import org.eclipse.wst.server.core.model.IModuleFile;
+import org.eclipse.wst.server.core.model.IModuleFolder;
+import org.eclipse.wst.server.core.model.IModuleResource;
+import org.eclipse.wst.server.core.model.IModuleResourceDelta;
+import org.jboss.ide.eclipse.archives.core.util.internal.TrueZipUtil;
+import org.jboss.ide.eclipse.archives.webtools.IntegrationPlugin;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
+import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
+import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher;
+import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
+import org.jboss.ide.eclipse.as.core.util.FileUtil;
+import org.jboss.ide.eclipse.as.core.util.FileUtil.IFileUtilListener;
+
+import de.schlichtherle.io.ArchiveDetector;
+
+public class WTPZippedPublisher extends PublishUtil implements IJBossServerPublisher {
+ private int moduleState = IServer.PUBLISH_STATE_NONE;
+ public boolean accepts(IServer server, IModule[] module) {
+ // TODO check for zip preference
+ return ModuleCoreNature.isFlexibleProject(module[0].getProject());
+ }
+
+ public int getPublishState() {
+ return moduleState;
+ }
+
+ protected IDeployableServer getDeployableServer(IServer server) {
+ return (IDeployableServer)server.loadAdapter(IDeployableServer.class, new
NullProgressMonitor());
+ }
+ protected DeployableServerBehavior getBehaviour(IServer server) {
+ return (DeployableServerBehavior)server.loadAdapter(DeployableServerBehavior.class, new
NullProgressMonitor());
+ }
+
+ protected List<IModule[]> getRemovedModules(IServer s) {
+ return getBehaviour(s).getRemovedModules();
+ }
+
+ public boolean isNew(IModule[] module, IServer s) {
+ return !getBehaviour(s).hasBeenPublished(module);
+ }
+
+
+ public IStatus publishModule(IServer server, IModule[] module,
+ int publishType, IModuleResourceDelta[] delta,
+ IProgressMonitor monitor) throws CoreException {
+ if( module.length > 1 ) {
+ return Status.OK_STATUS;
+ }
+
+ IStatus[] returnStatus;
+ // Am I a removal? If yes, remove me, and return
+ if( publishType == IJBossServerPublisher.REMOVE_PUBLISH)
+ returnStatus = removeModule(server, module);
+
+ // Am I a full publish? If yes, full publish me, and return
+ else if( publishType == IJBossServerPublisher.FULL_PUBLISH)
+ returnStatus = fullPublish(server, module);
+
+ else {
+ // Am I changed? If yes, handle my changes
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ if( countChanges(delta) > 0) {
+ results.addAll(Arrays.asList(publishChanges(server, module)));
+ }
+
+ IModule[] children = server.getChildModules(module, new NullProgressMonitor());
+ results.addAll(Arrays.asList(handleChildrenDeltas(server, module, children)));
+
+ // Handle the removed children that are not returned by getChildModules
+ List<IModule[]> removed = getBehaviour(server).getRemovedModules();
+ Iterator<IModule[]> i = removed.iterator();
+ while(i.hasNext()) {
+ IModule[] removedArray = i.next();
+ if( removedArray[0].getId().equals(module[0].getId())) {
+ results.addAll(Arrays.asList(removeModule(server, removedArray)));
+ }
+ }
+ returnStatus = (IStatus[]) results.toArray(new IStatus[results.size()]);
+ }
+ TrueZipUtil.umount();
+
+ IStatus finalStatus;
+ if( returnStatus.length > 0 ) {
+ MultiStatus ms = new MultiStatus(JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.JST_PUB_INC_FAIL,
+ "Publish Failed for module " + module[0].getName(), null); //$NON-NLS-1$
+ for( int i = 0; i < returnStatus.length; i++ )
+ ms.add(returnStatus[i]);
+ finalStatus = ms;
+ } else
+ finalStatus = Status.OK_STATUS;
+
+ return finalStatus;
+ }
+
+ protected IStatus[] handleChildrenDeltas(IServer server, IModule[] module, IModule[]
children) {
+ // For each child:
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ for( int i = 0; i < children.length; i++ ) {
+ IModule[] combinedChild = combine(module, children[i]);
+ // if it's new, full publish it
+ if( !getBehaviour(server).hasBeenPublished(combinedChild)) {
+ results.addAll(Arrays.asList(fullPublish(server, combinedChild)));
+ }
+ // else if it's removed, full remove it
+ else if( isRemoved(server, combinedChild)) {
+ results.addAll(Arrays.asList(removeModule(server, combinedChild)));
+ }
+ // else
+ else {
+ // handle changed resources
+ results.addAll(Arrays.asList(publishChanges(server, combinedChild)));
+
+ // recurse
+ IModule[] children2 = server.getChildModules(combinedChild, new
NullProgressMonitor());
+ results.addAll(Arrays.asList(handleChildrenDeltas(server, children, children2)));
+ }
+ }
+ return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ }
+
+ protected boolean isRemoved(IServer server, IModule[] child) {
+ List<IModule[]> removed = getBehaviour(server).getRemovedModules();
+ Iterator<IModule[]> i = removed.iterator();
+ while(i.hasNext()) {
+ IModule[] next = i.next();
+ if( next.length == child.length) {
+ for( int j = 0; j < next.length; j++ ) {
+ if( !next[j].getId().equals(child[j].getId())) {
+ continue;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected IStatus[] removeModule(IServer server, IModule[] module) {
+ String depFolder = getDeployableServer(server).getDeployFolder();
+ IPath deployPath = getDeployPath(module, depFolder);
+ final ArrayList<IStatus> status = new ArrayList<IStatus>();
+ IFileUtilListener listener = new IFileUtilListener() {
+ public void fileCopied(File source, File dest, boolean result,Exception e) {}
+ public void fileDeleted(File file, boolean result, Exception e) {
+ if( result == false || e != null ) {
+ status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.JST_PUB_FILE_DELETE_FAIL,
+ "Attempt to delete " + file.getAbsolutePath() + " failed",e));
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ public void folderDeleted(File file, boolean result, Exception e) {
+ if( result == false || e != null ) {
+ status.add(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
IEventCodes.JST_PUB_FILE_DELETE_FAIL,
+ "Attempt to delete " + file.getAbsolutePath() + " failed",e));
//$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ };
+ FileUtil.safeDelete(deployPath.toFile(), listener);
+ return (IStatus[]) status.toArray(new IStatus[status.size()]);
+ }
+
+ protected IStatus[] fullPublish(IServer server, IModule[] module) {
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ try {
+ String depFolder = getDeployableServer(server).getDeployFolder();
+ IPath path = getDeployPath(module, depFolder);
+ // Get rid of the old
+ FileUtil.safeDelete(path.toFile(), null);
+
+ TrueZipUtil.createArchive(path);
+ de.schlichtherle.io.File root = TrueZipUtil.getFile(path,
TrueZipUtil.getJarArchiveDetector());
+ IModuleResource[] resources = getResources(module);
+ results.addAll(Arrays.asList(copy(root, resources)));
+
+ IModule[] children = server.getChildModules(module, new NullProgressMonitor());
+ for( int i = 0; i < children.length; i++ )
+ results.addAll(Arrays.asList(fullPublish(server, combine(module, children[i]))));
+ return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ } catch( CoreException ce) {
+ results.add(generateCoreExceptionStatus(ce));
+ return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ }
+ }
+
+ protected IStatus[] publishChanges(IServer server, IModule[] module) {
+ String depFolder = getDeployableServer(server).getDeployFolder();
+ IPath path = getDeployPath(module, depFolder);
+ de.schlichtherle.io.File root = TrueZipUtil.getFile(path,
TrueZipUtil.getJarArchiveDetector());
+ IModuleResourceDelta[] deltas = ((Server)server).getPublishedResourceDelta(module);
+ return publishChanges(server, deltas, root);
+ }
+
+ protected IStatus[] publishChanges(IServer server, IModuleResourceDelta[] deltas,
de.schlichtherle.io.File root) {
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ if( deltas == null || deltas.length == 0 )
+ return new IStatus[]{};
+ int dKind;
+ IModuleResource resource;
+ for( int i = 0; i < deltas.length; i++ ) {
+ dKind = deltas[i].getKind();
+ resource = deltas[i].getModuleResource();
+ if( dKind == IModuleResourceDelta.ADDED ) {
+ results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
+ } else if( dKind == IModuleResourceDelta.CHANGED ) {
+ if( resource instanceof IModuleFile )
+ results.addAll(Arrays.asList(copy(root, new IModuleResource[]{resource})));
+ results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(),
root)));
+ } else if( dKind == IModuleResourceDelta.REMOVED) {
+ de.schlichtherle.io.File f = getFileInArchive(root,
+ resource.getModuleRelativePath().append(
+ resource.getName()));
+ boolean b = f.deleteAll();
+ if( !b )
+ results.add(generateDeleteFailedStatus(f));
+ } else if( dKind == IModuleResourceDelta.NO_CHANGE ) {
+ results.addAll(Arrays.asList(publishChanges(server, deltas[i].getAffectedChildren(),
root)));
+ }
+ }
+
+ return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ }
+
+
+ protected IStatus[] copy(de.schlichtherle.io.File root, IModuleResource[] children) {
+ ArrayList<IStatus> results = new ArrayList<IStatus>();
+ for( int i = 0; i < children.length; i++ ) {
+ if( children[i] instanceof IModuleFile ) {
+ IModuleFile mf = (IModuleFile)children[i];
+ java.io.File source = getFile(mf);
+ de.schlichtherle.io.File destination = getFileInArchive(root,
mf.getModuleRelativePath().append(mf.getName()));
+ boolean b = new de.schlichtherle.io.File(source).copyAllTo(destination);
+ if( !b )
+ results.add(generateCopyFailStatus(source, destination));
+ } else if( children[i] instanceof IModuleFolder ) {
+ de.schlichtherle.io.File destination = getFileInArchive(root,
children[i].getModuleRelativePath().append(children[i].getName()));
+ destination.mkdirs();
+ IModuleFolder mf = (IModuleFolder)children[i];
+ results.addAll(Arrays.asList(copy(root, mf.members())));
+ }
+ }
+ return (IStatus[]) results.toArray(new IStatus[results.size()]);
+ }
+
+ protected IStatus generateDeleteFailedStatus(java.io.File file) {
+ return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, "Could not delete
file " + file); //$NON-NLS-1$
+ }
+ protected IStatus generateCoreExceptionStatus(CoreException ce) {
+ return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, ce.getMessage(), ce);
+ }
+ protected IStatus generateCopyFailStatus(java.io.File source, java.io.File destination)
{
+ return new Status(IStatus.ERROR, IntegrationPlugin.PLUGIN_ID, "Copy of " +
source + " to " + destination + " has
failed");//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
+ }
+
+ protected de.schlichtherle.io.File getFileInArchive(de.schlichtherle.io.File root, IPath
relative) {
+ while(relative.segmentCount() > 0 ) {
+ root = new de.schlichtherle.io.File(root,
+ relative.segment(0), ArchiveDetector.DEFAULT);
+ relative = relative.removeFirstSegments(1);
+ }
+ return root;
+ }
+
+ private IModule[] combine(IModule[] module, IModule newMod) {
+ IModule[] retval = new IModule[module.length + 1];
+ for( int i = 0; i < module.length; i++ )
+ retval[i]=module[i];
+ retval[retval.length-1] = newMod;
+ return retval;
+ }
+}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2009-04-16
16:53:34 UTC (rev 14782)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2009-04-17
06:33:38 UTC (rev 14783)
@@ -164,6 +164,19 @@
return null;
}
+ public IJBossServerPublisher getZippedPublisher() {
+ if( publishers == null )
+ loadPublishers();
+ Iterator<PublisherWrapper> i = publishers.iterator();
+ PublisherWrapper wrapper;
+ while(i.hasNext()) {
+ wrapper = i.next();
+ if( wrapper.isZipDelegate )
+ return wrapper.publisher;
+ }
+ return null;
+ }
+
private void loadPublishers() {
ArrayList<PublisherWrapper> publishers = new
ArrayList<PublisherWrapper>();
IExtensionRegistry registry = Platform.getExtensionRegistry();
@@ -172,11 +185,12 @@
try {
Object clazz = cf[i].createExecutableExtension("class");
String priority = cf[i].getAttribute("priority");
+ String zipDelegate = cf[i].getAttribute("zipDelegate");
int p = -1;
try {
p = Integer.parseInt(priority);
} catch( NumberFormatException nfe) {}
- publishers.add(new PublisherWrapper(p, (IJBossServerPublisher)clazz));
+ publishers.add(new PublisherWrapper(p, zipDelegate, (IJBossServerPublisher)clazz));
} catch( CoreException e ) {
} catch( ClassCastException cce ) {
}
@@ -193,9 +207,11 @@
private class PublisherWrapper {
private int priority;
private IJBossServerPublisher publisher;
- private PublisherWrapper(int priority, IJBossServerPublisher publisher) {
+ private boolean isZipDelegate = false;
+ private PublisherWrapper(int priority, String zipDelegate, IJBossServerPublisher
publisher) {
this.priority = priority;
this.publisher = publisher;
+ isZipDelegate = Boolean.parseBoolean(zipDelegate);
}
}
}
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 2009-04-16
16:53:34 UTC (rev 14782)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2009-04-17
06:33:38 UTC (rev 14783)
@@ -44,6 +44,7 @@
import org.eclipse.wst.server.core.model.IModuleResource;
import org.eclipse.wst.server.core.model.IModuleResourceDelta;
import org.eclipse.wst.server.core.util.ProjectModule;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
@@ -72,15 +73,31 @@
public JstPublisher() {
}
+ private boolean serverRequiresZips() {
+ return server.zipsWTPDeployments();
+ }
+
public IStatus publishModule(IServer server, IModule[] module,
int publishType, IModuleResourceDelta[] delta, IProgressMonitor monitor) throws
CoreException {
IStatus status = null;
this.server = ServerConverter.getDeployableServer(server);
this.delta = delta;
+
+ if( serverRequiresZips() ) {
+ IJBossServerPublisher delegate =
+ ExtensionManager.getDefault().getZippedPublisher();
+ if( delegate != null ) {
+ return delegate.publishModule(server, module, publishType, delta, monitor);
+ } else {
+ // TODO log, return
+ }
+ }
+
+
boolean deleted = false;
for( int i = 0; i < module.length; i++ ) {
- if( module[i] instanceof DeletedModule )
+ if( module[i].isExternal() )
deleted = true;
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IDeployableServer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IDeployableServer.java 2009-04-16
16:53:34 UTC (rev 14782)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IDeployableServer.java 2009-04-17
06:33:38 UTC (rev 14783)
@@ -32,6 +32,7 @@
public static final String DEPLOY_DIRECTORY =
"org.jboss.ide.eclipse.as.core.server.deployDirectory";
public static final String TEMP_DEPLOY_DIRECTORY =
"org.jboss.ide.eclipse.as.core.server.tempDeployDirectory";
public static final String DEPLOY_DIRECTORY_TYPE =
"org.jboss.ide.eclipse.as.core.server.deployDirectoryType";
+ public static final String ZIP_DEPLOYMENTS_PREF =
"org.jboss.ide.eclipse.as.core.server.zipDeploymentsPreference";
public static final String DEPLOY_METADATA = "metadata";
public static final String DEPLOY_CUSTOM = "custom";
@@ -43,6 +44,8 @@
public void setTempDeployFolder(String folder);
public String getDeployLocationType();
public void setDeployLocationType(String type);
+ public boolean zipsWTPDeployments();
+ public void setZipWTPDeployments(boolean val);
public String getConfigDirectory();
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java 2009-04-16
16:53:34 UTC (rev 14782)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServer.java 2009-04-17
06:33:38 UTC (rev 14783)
@@ -157,6 +157,14 @@
return getAttribute(DEPLOY_DIRECTORY_TYPE, DEPLOY_CUSTOM);
}
+ public void setZipWTPDeployments(boolean val) {
+ setAttribute(ZIP_DEPLOYMENTS_PREF, val);
+ }
+ public boolean zipsWTPDeployments() {
+ return getAttribute(ZIP_DEPLOYMENTS_PREF, false);
+ }
+
+
/*
* (non-Javadoc)
* @see
org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer#getAttributeHelper()
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/schema/publishers.exsd
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/schema/publishers.exsd 2009-04-16
16:53:34 UTC (rev 14782)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/schema/publishers.exsd 2009-04-17
06:33:38 UTC (rev 14783)
@@ -2,9 +2,9 @@
<!-- Schema file written by PDE -->
<schema targetNamespace="org.jboss.ide.eclipse.as.core"
xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
- <appinfo>
+ <appInfo>
<meta.schema plugin="org.jboss.ide.eclipse.as.core"
id="publishers" name="org.jboss.ide.eclipse.as.core.publishers"/>
- </appinfo>
+ </appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
@@ -12,9 +12,9 @@
<element name="extension">
<annotation>
- <appinfo>
+ <appInfo>
<meta.element />
- </appinfo>
+ </appInfo>
</annotation>
<complexType>
<sequence>
@@ -39,9 +39,9 @@
<documentation>
</documentation>
- <appinfo>
+ <appInfo>
<meta.attribute translatable="true"/>
- </appinfo>
+ </appInfo>
</annotation>
</attribute>
</complexType>
@@ -61,45 +61,52 @@
<documentation>
</documentation>
- <appinfo>
+ <appInfo>
<meta.attribute kind="java"
basedOn=":org.jboss.ide.eclipse.as.core.server.IJBossServerPublisher"/>
- </appinfo>
+ </appInfo>
</annotation>
</attribute>
+ <attribute name="zipDelegate" type="boolean"
use="default" value="false">
+ <annotation>
+ <documentation>
+ This should be false unless you want to be the delegated zip handler
for webtools projects.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
<annotation>
- <appinfo>
+ <appInfo>
<meta.section type="since"/>
- </appinfo>
+ </appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
- <appinfo>
+ <appInfo>
<meta.section type="examples"/>
- </appinfo>
+ </appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
- <appinfo>
+ <appInfo>
<meta.section type="apiinfo"/>
- </appinfo>
+ </appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
- <appinfo>
+ <appInfo>
<meta.section type="implementation"/>
- </appinfo>
+ </appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2009-04-16
16:53:34 UTC (rev 14782)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2009-04-17
06:33:38 UTC (rev 14783)
@@ -130,6 +130,7 @@
public static String EditorUseCustomDeployFolder;
public static String EditorSetDeployLabel;
public static String EditorSetTempDeployLabel;
+ public static String EditorZipDeployments;
public static String EditorSetRadioClicked;
public static String EditorDeployDNE;
public static String EditorTempDeployDNE;
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2009-04-16
16:53:34 UTC (rev 14782)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2009-04-17
06:33:38 UTC (rev 14783)
@@ -108,6 +108,7 @@
EditorUseCustomDeployFolder=Use a custom deploy folder
EditorSetDeployLabel=Set Deploy Directory
EditorSetTempDeployLabel=Set Temporary Deploy Directory
+EditorZipDeployments=Zip webtools projects when deploying
EditorSetRadioClicked=Set Deploy Location
EditorDeployDNE=The deploy directory "{0}" does not exist.
EditorTempDeployDNE=The temporary deploy directory "{0}" does not exist.
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2009-04-16
16:53:34 UTC (rev 14782)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploySection.java 2009-04-17
06:33:38 UTC (rev 14783)
@@ -56,6 +56,7 @@
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.ui.editor.ServerEditorSection;
import org.eclipse.wst.server.ui.internal.command.ServerCommand;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
@@ -76,9 +77,9 @@
private Button metadataRadio, serverRadio, customRadio, currentSelection;
private Button deployButton, tempDeployButton;
private ModifyListener deployListener, tempDeployListener;
- private SelectionListener radioListener;
+ private SelectionListener radioListener, zipListener;
private ServerAttributeHelper helper;
-
+ private Button zipDeployWTPProjects;
private String lastCustomDeploy, lastCustomTemp;
public DeploySection() {
}
@@ -103,41 +104,41 @@
Label descriptionLabel = toolkit.createLabel(composite,
Messages.swf_DeploymentDescription);
Control top = descriptionLabel;
- Composite inner = toolkit.createComposite(composite);
- inner.setLayout(new GridLayout(1, false));
- metadataRadio = toolkit.createButton(inner, Messages.EditorUseWorkspaceMetadata,
SWT.RADIO);
- serverRadio = toolkit.createButton(inner, Messages.EditorUseServersDeployFolder,
SWT.RADIO);
- customRadio = toolkit.createButton(inner, Messages.EditorUseCustomDeployFolder,
SWT.RADIO);
-
- metadataRadio.setSelection(getDeployType().equals(IDeployableServer.DEPLOY_METADATA));
- serverRadio.setSelection(getDeployType().equals(IDeployableServer.DEPLOY_SERVER));
- customRadio.setSelection(getDeployType().equals(IDeployableServer.DEPLOY_CUSTOM));
- currentSelection = metadataRadio.getSelection() ? metadataRadio :
- serverRadio.getSelection() ? serverRadio :
- customRadio;
-
- radioListener = new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- public void widgetSelected(SelectionEvent e) {
- if( e.getSource() == currentSelection )
- return; // do nothing
- execute(new RadioClickedCommand((Button)e.getSource(), currentSelection));
- currentSelection = (Button)e.getSource();
- } };
- metadataRadio.addSelectionListener(radioListener);
- serverRadio.addSelectionListener(radioListener);
- customRadio.addSelectionListener(radioListener);
-
- FormData radios = new FormData();
- radios.top = new FormAttachment(descriptionLabel,5);
- radios.left = new FormAttachment(0,5);
- radios.right = new FormAttachment(100,-5);
- inner.setLayoutData(radios);
- top = inner;
+ Composite inner = toolkit.createComposite(composite);
+ inner.setLayout(new GridLayout(1, false));
+ metadataRadio = toolkit.createButton(inner, Messages.EditorUseWorkspaceMetadata,
SWT.RADIO);
+ serverRadio = toolkit.createButton(inner, Messages.EditorUseServersDeployFolder,
SWT.RADIO);
+ customRadio = toolkit.createButton(inner, Messages.EditorUseCustomDeployFolder,
SWT.RADIO);
+ metadataRadio.setSelection(getDeployType().equals(IDeployableServer.DEPLOY_METADATA));
+ serverRadio.setSelection(getDeployType().equals(IDeployableServer.DEPLOY_SERVER));
+ customRadio.setSelection(getDeployType().equals(IDeployableServer.DEPLOY_CUSTOM));
+ currentSelection = metadataRadio.getSelection() ? metadataRadio :
+ serverRadio.getSelection() ? serverRadio :
+ customRadio;
+ radioListener = new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ public void widgetSelected(SelectionEvent e) {
+ if( e.getSource() == currentSelection )
+ return; // do nothing
+ execute(new RadioClickedCommand((Button)e.getSource(), currentSelection));
+ currentSelection = (Button)e.getSource();
+ } };
+ metadataRadio.addSelectionListener(radioListener);
+ serverRadio.addSelectionListener(radioListener);
+ customRadio.addSelectionListener(radioListener);
+
+ FormData radios = new FormData();
+ radios.top = new FormAttachment(descriptionLabel,5);
+ radios.left = new FormAttachment(0,5);
+ radios.right = new FormAttachment(100,-5);
+ inner.setLayoutData(radios);
+ top = inner;
+
+
Label label = toolkit.createLabel(composite, Messages.swf_DeployDirectory);
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
deployText = toolkit.createText(composite, getDeployDir(), SWT.BORDER);
@@ -232,6 +233,28 @@
tempButtonData.top = new FormAttachment(deployText,5);
tempDeployButton.setLayoutData(tempButtonData);
+ zipDeployWTPProjects = toolkit.createButton(composite, Messages.EditorZipDeployments,
SWT.CHECK);
+ boolean publisherAvailable = ExtensionManager.getDefault().getZippedPublisher() !=
null;
+ boolean value = getServer().zipsWTPDeployments();
+ zipDeployWTPProjects.setEnabled(publisherAvailable);
+ zipDeployWTPProjects.setSelection(publisherAvailable && value);
+
+ FormData zipButtonData = new FormData();
+ zipButtonData.right = new FormAttachment(100,-5);
+ zipButtonData.left = new FormAttachment(0,5);
+ zipButtonData.top = new FormAttachment(tempDeployText,5);
+ zipDeployWTPProjects.setLayoutData(zipButtonData);
+
+ zipListener = new SelectionListener(){
+ public void widgetSelected(SelectionEvent e) {
+ execute(new SetZipCommand());
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ widgetSelected(e);
+ }
+ };
+ zipDeployWTPProjects.addSelectionListener(zipListener);
+
toolkit.paintBordersFor(composite);
section.setClient(composite);
getSaveStatus();
@@ -303,6 +326,27 @@
}
}
+ public class SetZipCommand extends ServerCommand {
+ boolean oldVal;
+ boolean newVal;
+ public SetZipCommand() {
+ super(DeploySection.this.server, Messages.EditorZipDeployments);
+ oldVal = helper.getAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, false);
+ newVal = zipDeployWTPProjects.getSelection();
+ }
+ public void execute() {
+ helper.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, newVal);
+ getSaveStatus();
+ }
+ public void undo() {
+ zipDeployWTPProjects.removeSelectionListener(zipListener);
+ zipDeployWTPProjects.setSelection(oldVal);
+ helper.setAttribute(IDeployableServer.ZIP_DEPLOYMENTS_PREF, oldVal);
+ zipDeployWTPProjects.addSelectionListener(zipListener);
+ getSaveStatus();
+ }
+ }
+
public class SetTempDeployDirCommand extends ServerCommand {
private String oldDir;
private String newDir;