[jbosstools-commits] JBoss Tools SVN: r35976 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Oct 25 06:00:50 EDT 2011


Author: adietish
Date: 2011-10-25 06:00:50 -0400 (Tue, 25 Oct 2011)
New Revision: 35976

Modified:
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftWizardPage.java
   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/ApplicationWizardPage.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
   trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
Log:
[JBIDE-10012] corrected page activation notifications

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftWizardPage.java	2011-10-25 09:36:06 UTC (rev 35975)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftWizardPage.java	2011-10-25 10:00:50 UTC (rev 35976)
@@ -20,6 +20,7 @@
 import org.eclipse.jface.layout.GridLayoutFactory;
 import org.eclipse.jface.wizard.IWizard;
 import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
@@ -32,6 +33,10 @@
  */
 public abstract class AbstractOpenShiftWizardPage extends WizardPage {
 
+	protected enum WizardProgressDirection {
+		BACKWARD, FORWARD
+	}
+	
 	private DataBindingContext dbc;
 
 	protected AbstractOpenShiftWizardPage(String title, String description, String pageName, IWizard wizard) {
@@ -80,29 +85,46 @@
 				@Override
 				public void handlePageChanging(PageChangingEvent event) {
 					if (event.getTargetPage() == AbstractOpenShiftWizardPage.this) {
-						onPageWillGetActivated(event, dbc);
-					} else {
-						onPageWillGetDeactivated(event, dbc);
+						onPageWillGetActivated(getActivationDirection(event), event, dbc);
+					} else if (event.getCurrentPage() == AbstractOpenShiftWizardPage.this){
+						onPageWillGetDeactivated(getDeactivationDirection(event), event, dbc);
 					}
 				}
+
 			});
 		}
 	}
 
-	protected DataBindingContext getDatabindingContext() {
-		return dbc;
+	private WizardProgressDirection getActivationDirection(PageChangingEvent event) {
+		IWizardPage previousPage = getPreviousPage();
+		if (previousPage == null
+				|| previousPage.equals(event.getCurrentPage())) {
+			return WizardProgressDirection.BACKWARD;
+		} else {
+			return WizardProgressDirection.FORWARD;
+		}
 	}
 
+	private WizardProgressDirection getDeactivationDirection(PageChangingEvent event) {
+		IWizardPage previousPage = getPreviousPage();
+		if (previousPage == null
+				|| previousPage.equals(event.getTargetPage())) {
+			return WizardProgressDirection.BACKWARD;
+		} else {
+			return WizardProgressDirection.FORWARD;
+		}
+	}
+
 	protected void onPageActivated(DataBindingContext dbc) {
 	}
 	
 	protected void onPageDeactivated(DataBindingContext dbc) {
 	}
 
-	protected void onPageWillGetActivated(PageChangingEvent event, DataBindingContext dbc) {
+	protected void onPageWillGetActivated(WizardProgressDirection direction, PageChangingEvent event, DataBindingContext dbc) {
 	}
 	
-	protected void onPageWillGetDeactivated(PageChangingEvent event, DataBindingContext dbc) {
+	protected void onPageWillGetDeactivated(WizardProgressDirection direction, PageChangingEvent event, DataBindingContext dbc) {
 	}
 
 	protected abstract void doCreateControls(Composite parent, DataBindingContext dbc);
@@ -110,5 +132,4 @@
 	protected DataBindingContext getDataBindingContext() {
 		return dbc;
 	}
-
 }

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-25 09:36:06 UTC (rev 35975)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPage.java	2011-10-25 10:00:50 UTC (rev 35976)
@@ -323,7 +323,7 @@
 		Label domainLabel = new Label(c, SWT.NONE);
 		domainLabel.setText("Host");
 		domainValueLabel = new Label(c, SWT.NONE);
-		DataBindingContext dbc = getDatabindingContext();
+		DataBindingContext dbc = getDataBindingContext();
 		ValueBindingBuilder
 				.bind(WidgetProperties.text().observe(domainValueLabel))
 				.notUpdating(BeanProperties.value(AdapterWizardPageModel.PROPERTY_APPLICATION_URL).observe(model))

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java	2011-10-25 09:36:06 UTC (rev 35975)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardPage.java	2011-10-25 10:00:50 UTC (rev 35976)
@@ -208,7 +208,7 @@
 										"Could not rename domain", e);
 							}
 						}
-					}, getContainer(), getDatabindingContext());
+					}, getContainer(), getDataBindingContext());
 		} catch (Exception ex) {
 			// ignore
 		}
@@ -363,7 +363,7 @@
 					}
 				}
 
-			}, getContainer(), getDatabindingContext());
+			}, getContainer(), getDataBindingContext());
 
 		} catch (Exception ex) {
 			// ignore

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java	2011-10-25 09:36:06 UTC (rev 35975)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java	2011-10-25 10:00:50 UTC (rev 35976)
@@ -146,8 +146,9 @@
 	}
 
 	@Override
-	protected void onPageWillGetDeactivated(PageChangingEvent event, DataBindingContext dbc) {
-		if (!model.areCredentialsValidated()) {
+	protected void onPageWillGetDeactivated(WizardProgressDirection direction, PageChangingEvent event, DataBindingContext dbc) {
+		if (!model.areCredentialsValidated()
+				&& direction == WizardProgressDirection.FORWARD) {
 			try {
 				final ArrayBlockingQueue<IStatus> queue = new ArrayBlockingQueue<IStatus>(1);
 				WizardUtils.runInWizard(
@@ -159,7 +160,7 @@
 								queue.offer(status);
 								return Status.OK_STATUS;
 							}
-						}, getContainer(), getDatabindingContext());
+						}, getContainer(), getDataBindingContext());
 				queue.poll(10, TimeUnit.SECONDS);
 				event.doit = model.areCredentialsValid();
 			} catch (Exception ex) {

Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java	2011-10-25 09:36:06 UTC (rev 35975)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java	2011-10-25 10:00:50 UTC (rev 35976)
@@ -177,7 +177,7 @@
 				SshPrivateKeysPreferences.openPreferencesPage(getShell());
 				// refresh warning about key 
 				// (since user may have changed SSH2 prefs)
-				getDatabindingContext().updateTargets();
+				getDataBindingContext().updateTargets();
 			}
 		};
 	}



More information about the jbosstools-commits mailing list