[jbosstools-commits] JBoss Tools SVN: r41716 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Jun 5 08:37:57 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-06-05 08:37:55 -0400 (Tue, 05 Jun 2012)
New Revision: 41716

Modified:
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
Log:
JBIDE-12079 to trunk

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java	2012-06-05 10:52:06 UTC (rev 41715)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java	2012-06-05 12:37:55 UTC (rev 41716)
@@ -70,14 +70,18 @@
 		
 		String destProjName = ExpressServerUtils.getExpressDeployProject(behaviour.getServer());
 		IProject destProj = ResourcesPlugin.getWorkspace().getRoot().getProject(destProjName);
-		if( destProj != null ) {
-			if( destProj.exists() ) {
+		boolean allSubModulesPublished = areAllPublished(behaviour);
+		if( destProj != null && destProj.exists()) {
+			String destinationFolder = ExpressServerUtils.getExpressDeployFolder(behaviour.getServer());
+			IContainer destFolder = "".equals(destinationFolder) ? destProj : (IContainer)destProj.findMember(new Path(destinationFolder));
+			if( allSubModulesPublished || (destFolder != null && destFolder.isAccessible())) {
 				refreshProject(destProj, submon(monitor, 100));
 				commitAndPushProject(destProj, behaviour, submon(monitor, 100));
-			}
+			} // else ignore. (one or more modules not published AND magic folder doesn't exist
+			  // The previous exception will be propagated. 
 		}
 
-        return areAllPublished(behaviour) ? IServer.PUBLISH_STATE_NONE : IServer.PUBLISH_STATE_INCREMENTAL;	
+        return allSubModulesPublished ? IServer.PUBLISH_STATE_NONE : IServer.PUBLISH_STATE_INCREMENTAL;	
     }
 	
 	protected boolean areAllPublished(DeployableServerBehavior behaviour) {
@@ -104,22 +108,20 @@
 			return -1;
 		
 		if( module.length > 1 )
-			return 0;
+			return IServer.PUBLISH_STATE_UNKNOWN;
 		
 		// Magic Project
 		String destProjName = ExpressServerUtils.getExpressDeployProject(behaviour.getServer());
 		if( isInDestProjectTree(destProjName, module))
 			return IServer.PUBLISH_STATE_NONE;
 		
+		// Cannot be null, checked for in publishStart
 		IProject destProj = ResourcesPlugin.getWorkspace().getRoot().getProject(destProjName);
-		
 		if( destProj.equals(module[module.length-1].getProject()))
-			return 0;
+			return IServer.PUBLISH_STATE_NONE;
 		
 		String destinationFolder = ExpressServerUtils.getExpressDeployFolder(behaviour.getServer());
-		
 		IContainer destFolder = "".equals(destinationFolder) ? destProj : (IContainer)destProj.findMember(new Path(destinationFolder));
-		
 		if( destFolder == null || !destFolder.isAccessible()) {
 			StringBuffer missingPath = new StringBuffer("");
 			if(destFolder==null) {
@@ -289,12 +291,13 @@
 		return ret[0];
 	}
 	
-	@Override
 	public IPublishCopyCallbackHandler getCallbackHandler(IPath path,
 			IServer server) {
-		// TODO Auto-generated method stub
 		return null;
 	}
+	public IPublishCopyCallbackHandler getCallbackHandler(IPath deployPath, IPath tmpFolder, IServer server) {
+		return null;
+	}
 
 	public String getPublishDefaultRootFolder(IServer server) {
 		IDeployableServer s = ServerConverter.getDeployableServer(server);
@@ -313,5 +316,4 @@
             final int ticks, final int style ) {
     	return ( parent == null ? new NullProgressMonitor() : new SubProgressMonitor( parent, ticks, style ) );
     }
-
 }



More information about the jbosstools-commits mailing list