[jbosstools-commits] JBoss Tools SVN: r35837 - in trunk/as/plugins: org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Oct 20 06:58:03 EDT 2011


Author: rob.stryker at jboss.com
Date: 2011-10-20 06:58:03 -0400 (Thu, 20 Oct 2011)
New Revision: 35837

Modified:
   trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
Log:
trunk - cleanup for astools including runtime validation in the new openshift proj wizard, synchronized state, second message box for forced push, etc

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java	2011-10-20 10:57:03 UTC (rev 35836)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/src/org/jboss/ide/eclipse/as/egit/core/EGitUtils.java	2011-10-20 10:58:03 UTC (rev 35837)
@@ -459,13 +459,13 @@
 					IteratorService.createInitialIterator(repo));
 			indexDiff.diff(jgitMonitor, 0, 0, NLS.bind(
 					UIText.CommitActionHandler_repository, repo.getDirectory().getPath()));
-			System.out.println(indexDiff.getAdded().size());
-			System.out.println(indexDiff.getChanged().size());
-			System.out.println(indexDiff.getConflicting().size());
-			System.out.println(indexDiff.getMissing().size());
-			System.out.println(indexDiff.getModified().size());
-			System.out.println(indexDiff.getRemoved().size());
-			System.out.println(indexDiff.getUntracked().size());
+//			System.out.println(indexDiff.getAdded().size());
+//			System.out.println(indexDiff.getChanged().size());
+//			System.out.println(indexDiff.getConflicting().size());
+//			System.out.println(indexDiff.getMissing().size());
+//			System.out.println(indexDiff.getModified().size());
+//			System.out.println(indexDiff.getRemoved().size());
+//			System.out.println(indexDiff.getUntracked().size());
 			
 			return indexDiff.getModified().size();
 		} catch( IOException ioe ) {

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java	2011-10-20 10:57:03 UTC (rev 35836)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java	2011-10-20 10:58:03 UTC (rev 35837)
@@ -44,26 +44,43 @@
 		int state = behaviour.getServer().getModulePublishState(module);
 		IProject p = module[module.length-1].getProject();
 		int changed = EGitUtils.countCommitableChanges(p, new NullProgressMonitor() );
-		if( changed != 0 && (kind == IServer.PUBLISH_FULL || state == IServer.PUBLISH_STATE_FULL)) {
-			if( requestApproval(module)) {
+		if( changed == 0 || (kind == IServer.PUBLISH_FULL || state == IServer.PUBLISH_STATE_FULL)) {
+			if( changed != 0 && requestCommitAndPushApproval(module)) {
 				monitor.beginTask("Publishing " + p.getName(), 200);
 				EGitUtils.commit(p, new SubProgressMonitor(monitor, 100));
 				EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
-				return IServer.PUBLISH_STATE_NONE;
+				monitor.done();
+			} else if( changed == 0 && requestPushApproval(module)) {
+				monitor.beginTask("Publishing " + p.getName(), 100);
+				EGitUtils.push(EGitUtils.getRepository(p), new SubProgressMonitor(monitor, 100));
+				monitor.done();
 			}
+			return IServer.PUBLISH_STATE_NONE;
 		}
 		return IServer.PUBLISH_STATE_INCREMENTAL;
 	}
 
-	private boolean requestApproval(final IModule[] module) {
+	private boolean requestCommitAndPushApproval(final IModule[] module) {
+		String projName = module[module.length-1].getProject().getName();
+		String msg = "Do you wish to publish \"" + projName + "\" to OpenShift by commiting and pushing its git repository?";
+		String title = "Publish " + projName + "?";
+		return requestApproval(module, msg, title);
+	}
+
+	private boolean requestPushApproval(final IModule[] module) {
+		String projName = module[module.length-1].getProject().getName();
+		String msg = "Do you wish to publish \"" + projName + "\" to OpenShift by pushing its git repository?";
+		String title = "Publish " + projName + "?";
+		return requestApproval(module, msg, title);
+	}
+
+	private boolean requestApproval(final IModule[] module, final String message, final String title) {
 		final boolean[] b = new boolean[1];
 		Display.getDefault().syncExec(new Runnable() { 
 			public void run() {
 				MessageBox messageBox = new MessageBox(new Shell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
-				String projName = module[module.length-1].getProject().getName();
-				String msg = "Do you wish to publish \"" + projName + "\" to OpenShift by commiting and pushing it's git repository?";
-		        messageBox.setMessage(msg);
-		        messageBox.setText("Publish " + projName + "?");
+		        messageBox.setMessage(message);
+		        messageBox.setText(title);
 		        int response = messageBox.open();
 		        if (response == SWT.YES)
 		        	b[0] = true;

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java	2011-10-20 10:57:03 UTC (rev 35836)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java	2011-10-20 10:58:03 UTC (rev 35837)
@@ -344,8 +344,14 @@
 		addRuntimeLink.addSelectionListener(new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent e) {
 				IRuntimeType type = getValidRuntimeType();
-				if (type != null)
-					showRuntimeWizard(type);
+				if (type != null) {
+					int result = showRuntimeWizard(type);
+					if( result == Window.OK ) {
+						suitableRuntimesCombo.select(0);
+						selectedRuntimeObservable.setValue(0);
+						updateSelectedRuntimeDelegate();
+					}
+				}
 			}
 		});
 
@@ -411,6 +417,7 @@
 		String[] names = new String[runtimes.length];
 		for (int i = 0; i < runtimes.length; i++) {
 			names[i] = runtimes[i].getName();
+			suitableRuntimesObservable.add(runtimes[i].getName());
 		}
 		combo.setItems(names);
 	}
@@ -423,6 +430,7 @@
 		refreshValidRuntimes();
 		if (suitableRuntimesCombo.getItemCount() > 0) {
 			suitableRuntimesCombo.select(0);
+			selectedRuntimeObservable.setValue(0);
 			updateSelectedRuntimeDelegate();
 		}
 		IRuntimeType type = getValidRuntimeType();



More information about the jbosstools-commits mailing list