Author: adietish
Date: 2011-06-01 08:07:03 -0400 (Wed, 01 Jun 2011)
New Revision: 31729
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/AltMethodZippedJSTPublisher.java
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
Log:
[JBIDE-8920] simplified code so that it gets better readable (no functional change!)
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/AltMethodZippedJSTPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/AltMethodZippedJSTPublisher.java 2011-06-01
11:48:16 UTC (rev 31728)
+++
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/AltMethodZippedJSTPublisher.java 2011-06-01
12:07:03 UTC (rev 31729)
@@ -61,51 +61,51 @@
IServer server, IModule[] module,
int publishType, IModuleResourceDelta[] delta,
IProgressMonitor monitor) throws CoreException {
- this.module = module;
- this.server = server;
- this.method = method;
-
- String taskName = "Publishing " + module[0].getName(); //$NON-NLS-1$
- monitor.beginTask(taskName, 200);
- monitor.setTaskName(taskName);
- if( module.length > 1 ) {
- monitor.done();
- return null;
- }
-
- monitor.setTaskName("Publishing to remote server " + server.getName());
//$NON-NLS-1$
-
- // set up needed vars
- IDeployableServer server2 = ServerConverter.getDeployableServer(server);
- String remoteTempDeployRoot = getDeployRoot(module,
ServerConverter.getDeployableServer(server));
- IPath sourcePath = PublishUtil.getDeployPath(module, remoteTempDeployRoot, server2);
- IPath destFolder = PublishUtil.getDeployPath(method, module, server2);
- String name = sourcePath.lastSegment();
- IStatus result = null;
-
- removeDeployFailedMarker(monitor);
-
- // Am I a removal? If yes, remove me, and return
- if( publishType == IJBossServerPublisher.REMOVE_PUBLISH) {
- result = removeRemoteDeployment(sourcePath, destFolder, name, monitor);
- } else if( publishType != IJBossServerPublisher.NO_PUBLISH ){
- // Locally zip it up into the remote tmp folder
- result = super.publishModule(method, server, module, publishType, delta,
- AbstractServerToolsPublisher.getSubMon(monitor, 50));
- if( !result.isOK() ) {
- monitor.done();
- } else {
- result = remoteFullPublish(sourcePath, destFolder.removeLastSegments(1), name,
- AbstractServerToolsPublisher.getSubMon(monitor, 150));
+ try {
+ this.module = module;
+ this.server = server;
+ this.method = method;
+
+ String taskName = "Publishing " + module[0].getName(); //$NON-NLS-1$
+ monitor.beginTask(taskName, 200);
+ monitor.setTaskName(taskName);
+ if( module.length > 1 ) {
+ return null;
}
- }
-
- monitor.done();
- if( result != null ) {
+
+ monitor.setTaskName("Publishing to remote server " + server.getName());
//$NON-NLS-1$
+
+ // set up needed vars
+ IDeployableServer server2 = ServerConverter.getDeployableServer(server);
+ String remoteTempDeployRoot = getDeployRoot(module,
ServerConverter.getDeployableServer(server));
+ IPath sourcePath = PublishUtil.getDeployPath(module, remoteTempDeployRoot, server2);
+ IPath destFolder = PublishUtil.getDeployPath(method, module, server2);
+ String name = sourcePath.lastSegment();
+ IStatus result = null;
+
+ removeDeployFailedMarker(monitor);
+
+ // Am I a removal? If yes, remove me, and return
+ if( publishType == IJBossServerPublisher.REMOVE_PUBLISH) {
+ result = removeRemoteDeployment(sourcePath, destFolder, name, monitor);
+ } else if( publishType != IJBossServerPublisher.NO_PUBLISH ){
+ // Locally zip it up into the remote tmp folder
+ result = super.publishModule(method, server, module, publishType, delta,
+ AbstractServerToolsPublisher.getSubMon(monitor, 50));
+ if( result.isOK() ) {
+ result = remoteFullPublish(sourcePath, destFolder.removeLastSegments(1), name,
+ AbstractServerToolsPublisher.getSubMon(monitor, 150));
+ }
+ }
+
+ if( result == null ) {
+ result = Status.OK_STATUS;
+ }
+
return result;
+ } finally {
+ monitor.done();
}
-
- return Status.OK_STATUS;
}
private IStatus remoteFullPublish(IPath sourcePath,
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2011-06-01
11:48:16 UTC (rev 31728)
+++
trunk/as/plugins/org.jboss.ide.eclipse.archives.webtools/src/org/jboss/ide/eclipse/archives/webtools/modules/WTPZippedPublisher.java 2011-06-01
12:07:03 UTC (rev 31729)
@@ -58,18 +58,21 @@
IProgressMonitor monitor) throws CoreException {
// Build all parts together at once.
// When a call for [ear, childWar] comes in, ignore it.
+ IStatus status = Status.OK_STATUS;
+
if( module.length > 1 )
return null;
- if( DeploymentMarkerUtils.supportsJBoss7MarkerDeployment(server))
- return handleJBoss7Deployment(method, server, module, publishType, delta, monitor);
-
- IDeployableServer ds = ServerConverter.getDeployableServer(server);
- String deployRoot = getDeployRoot(module, ds);
- LocalZippedPublisherUtil util = new LocalZippedPublisherUtil();
- IStatus s = util.publishModule(server, deployRoot, module, publishType, delta,
monitor);
- monitor.done();
- return s;
+ if( DeploymentMarkerUtils.supportsJBoss7MarkerDeployment(server)) {
+ status = handleJBoss7Deployment(method, server, module, publishType, delta, monitor);
+ } else {
+ IDeployableServer ds = ServerConverter.getDeployableServer(server);
+ String deployRoot = getDeployRoot(module, ds);
+ LocalZippedPublisherUtil util = new LocalZippedPublisherUtil();
+ status = util.publishModule(server, deployRoot, module, publishType, delta, monitor);
+ monitor.done();
+ }
+ return status;
}
public IStatus handleJBoss7Deployment(