[jbosstools-commits] JBoss Tools SVN: r39859 - 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
Wed Mar 28 03:06:01 EDT 2012


Author: rob.stryker at jboss.com
Date: 2012-03-28 03:05:52 -0400 (Wed, 28 Mar 2012)
New Revision: 39859

Modified:
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressMessages.java
   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/expressMessages.properties
Log:
JBIDE-11251 

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressMessages.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressMessages.java	2012-03-28 06:31:45 UTC (rev 39858)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressMessages.java	2012-03-28 07:05:52 UTC (rev 39859)
@@ -17,5 +17,6 @@
 	public static String shareProjectTitle;
 	public static String shareProjectMessage;	
 	public static String additionNotRequiredModule;
+	public static String publishFailMissingProject;
 	
 }

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-03-28 06:31:45 UTC (rev 39858)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java	2012-03-28 07:05:52 UTC (rev 39859)
@@ -21,10 +21,10 @@
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.egit.core.op.AddToIndexOperation;
 import org.eclipse.egit.core.op.PushOperationResult;
-import org.eclipse.egit.core.op.RemoveFromIndexOperation;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.osgi.util.NLS;
@@ -55,8 +55,13 @@
 	@Override
 	public void publishStart(DeployableServerBehavior behaviour,
 			IProgressMonitor monitor) throws CoreException {
-		// TODO Auto-generated method stub
-
+		String destProjName = ExpressServerUtils.getExpressDeployProject(behaviour.getServer());
+		IProject magicProject = destProjName == null ? null : ResourcesPlugin.getWorkspace().getRoot().getProject(destProjName);
+		if( magicProject == null || !magicProject.isAccessible()) {
+			throw new CoreException(new Status(IStatus.ERROR, 
+				OpenShiftUIActivator.PLUGIN_ID, 
+				NLS.bind(ExpressMessages.publishFailMissingProject, behaviour.getServer().getName(), destProjName)));
+		}
 	}
 
 	@Override
@@ -103,7 +108,6 @@
 		
 		// Magic Project
 		String destProjName = ExpressServerUtils.getExpressDeployProject(behaviour.getServer());
-		
 		if( isInDestProjectTree(destProjName, module))
 			return IServer.PUBLISH_STATE_NONE;
 		
@@ -163,9 +167,13 @@
 
 	protected PushOperationResult commitAndPushProject(IProject p,
 			DeployableServerBehavior behaviour, IProgressMonitor monitor) throws CoreException {
-		Repository repository = EGitUtils.getRepository(p);
-
-		int changed = EGitUtils.countCommitableChanges(p, behaviour.getServer(), new NullProgressMonitor() );
+		
+		int changed = 0;
+		try {
+			changed = EGitUtils.countCommitableChanges(p, behaviour.getServer(), new NullProgressMonitor() );
+		} catch( CoreException ce) {
+			// What to do in this situation?? 
+		}
 		String remoteName = behaviour.getServer().getAttribute(ExpressServerUtils.ATTRIBUTE_REMOTE_NAME, 
 				ExpressServerUtils.ATTRIBUTE_REMOTE_NAME_DEFAULT);
 		PushOperationResult result = null;
@@ -189,6 +197,7 @@
 				return null;
 			
 			try {
+				Repository repository = EGitUtils.getRepository(p);
 				result = EGitUtils.pushForce(remoteName, repository, new SubProgressMonitor(monitor, 100));
 				monitor.done();
 			} catch(CoreException ce2) {

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/expressMessages.properties
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/expressMessages.properties	2012-03-28 06:31:45 UTC (rev 39858)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/expressMessages.properties	2012-03-28 07:05:52 UTC (rev 39859)
@@ -5,4 +5,5 @@
 cannotModifyModules=Openshift Express servers cannot be modified.
 additionNotRequiredModule=This server requires the {0} application. 
 shareProjectTitle=Share projects?
-shareProjectMessage="There are {0}  projects that are not connected to any git repository. Would you like to share them now?
\ No newline at end of file
+shareProjectMessage="There are {0}  projects that are not connected to any git repository. Would you like to share them now?
+publishFailMissingProject=Server {0} cannot publish. Required project "{1}" is missing or inaccessible.
\ No newline at end of file



More information about the jbosstools-commits mailing list