Author: adietish
Date: 2011-11-07 11:04:17 -0500 (Mon, 07 Nov 2011)
New Revision: 36195
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
Log:
[JBIDE-10084] testing credentials only if credentials page will get activated as next page
(corrected page chaning events to inform the correct page with the correct progress
direction information so that the credentials page can avoid to check credentials on
deactivation)
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftWizardPage.java 2011-11-07
15:40:28 UTC (rev 36194)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AbstractOpenShiftWizardPage.java 2011-11-07
16:04:17 UTC (rev 36195)
@@ -32,6 +32,10 @@
*/
public abstract class AbstractOpenShiftWizardPage extends WizardPage {
+ protected enum Direction {
+ FORWARDS, BACKWARDS
+ }
+
private DataBindingContext dbc;
protected AbstractOpenShiftWizardPage(String title, String description, String pageName,
IWizard wizard) {
@@ -80,9 +84,19 @@
@Override
public void handlePageChanging(PageChangingEvent event) {
if (event.getTargetPage() == AbstractOpenShiftWizardPage.this) {
- onPageWillGetActivated(event, dbc);
- } else {
- onPageWillGetDeactivated(event, dbc);
+ if (event.getCurrentPage() == null
+ || event.getCurrentPage().equals(getPreviousPage())) {
+ onPageWillGetActivated(Direction.FORWARDS, event, dbc);
+ } else {
+ onPageWillGetActivated(Direction.BACKWARDS, event, dbc);
+ }
+ } else if (event.getCurrentPage() == AbstractOpenShiftWizardPage.this){
+ if (event.getTargetPage() == null
+ || event.getTargetPage().equals(getNextPage())) {
+ onPageWillGetDeactivated(Direction.FORWARDS, event, dbc);
+ } else {
+ onPageWillGetDeactivated(Direction.BACKWARDS, event, dbc);
+ }
}
}
});
@@ -99,10 +113,17 @@
protected void onPageDeactivated(DataBindingContext dbc) {
}
- protected void onPageWillGetActivated(PageChangingEvent event, DataBindingContext dbc)
{
+ protected void onPageWillGetActivated(Direction direction, PageChangingEvent event,
DataBindingContext dbc) {
}
- protected void onPageWillGetDeactivated(PageChangingEvent event, DataBindingContext dbc)
{
+ /**
+ * Callback that gets called when this page is going to be deactivated.
+ *
+ * @param progress the direction that the wizard is moving: backwards/forwards
+ * @param event the page changing event that may be use to veto the change
+ * @param dbc the current data binding context
+ */
+ protected void onPageWillGetDeactivated(Direction progress, PageChangingEvent event,
DataBindingContext dbc) {
}
protected abstract void doCreateControls(Composite parent, DataBindingContext dbc);
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-11-07
15:40:28 UTC (rev 36194)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2011-11-07
16:04:17 UTC (rev 36195)
@@ -146,7 +146,11 @@
}
@Override
- protected void onPageWillGetDeactivated(PageChangingEvent event, DataBindingContext dbc)
{
+ protected void onPageWillGetDeactivated(Direction direction, PageChangingEvent event,
DataBindingContext dbc) {
+ if (direction == Direction.BACKWARDS) {
+ return;
+ }
+
if (!model.areCredentialsValidated()) {
try {
final ArrayBlockingQueue<IStatus> queue = new
ArrayBlockingQueue<IStatus>(1);
Show replies by date