[jbosstools-commits] JBoss Tools SVN: r44039 - in branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh: databinding and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Sep 26 09:46:32 EDT 2012


Author: adietish
Date: 2012-09-26 09:46:32 -0400 (Wed, 26 Sep 2012)
New Revision: 44039

Modified:
   branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java
   branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/databinding/SSHPublicKeyValidator.java
Log:
[JBIDE-12715] forcing revalidation when getting back from ssh2 preferences

Modified: branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java
===================================================================
--- branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java	2012-09-26 13:46:21 UTC (rev 44038)
+++ branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java	2012-09-26 13:46:32 UTC (rev 44039)
@@ -12,7 +12,6 @@
 
 import org.eclipse.core.databinding.Binding;
 import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.ValidationStatusProvider;
 import org.eclipse.core.databinding.beans.BeanProperties;
 import org.eclipse.core.databinding.observable.value.IObservableValue;
 import org.eclipse.core.runtime.IStatus;
@@ -110,7 +109,7 @@
 		GridDataFactory.fillDefaults()
 				.align(SWT.FILL, SWT.CENTER).applyTo(browseButton);
 
-		ValidationStatusProvider sshPublicKeyValidator = new SSHPublicKeyValidator(publicKeyObservable, pageModel);
+		SSHPublicKeyValidator sshPublicKeyValidator = new SSHPublicKeyValidator(publicKeyObservable, pageModel);
 		dbc.addValidationStatusProvider(sshPublicKeyValidator);
 		ControlDecorationSupport.create(
 				sshPublicKeyValidator, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
@@ -120,7 +119,7 @@
 				.setText("Please make sure that your private key for this public key is listed in the\n<a>SSH2 Preferences</a>");
 		GridDataFactory.fillDefaults()
 				.align(SWT.FILL, SWT.CENTER).applyTo(sshPrefsLink);
-		sshPrefsLink.addSelectionListener(onSshPrefs(dbc));
+		sshPrefsLink.addSelectionListener(onSshPrefs(sshPublicKeyValidator));
 
 	}
 
@@ -141,14 +140,17 @@
 		};
 	}
 
-	private SelectionAdapter onSshPrefs(final DataBindingContext dbc) {
+	private SelectionAdapter onSshPrefs(final SSHPublicKeyValidator sshPublicKeyValidator) {
 		return new SelectionAdapter() {
 
 			@Override
 			public void widgetSelected(SelectionEvent e) {
 				SSHUtils.openPreferencesPage(getShell());
 				// trigger revalidation after prefs were changed
-				dbc.updateTargets();
+				// we should be able to listen to prefs changes in jsch, but
+				// obviously they dont fire change event when changing private
+				// keys
+				sshPublicKeyValidator.forceRevalidate();
 			}
 		};
 	}

Modified: branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/databinding/SSHPublicKeyValidator.java
===================================================================
--- branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/databinding/SSHPublicKeyValidator.java	2012-09-26 13:46:21 UTC (rev 44038)
+++ branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/databinding/SSHPublicKeyValidator.java	2012-09-26 13:46:32 UTC (rev 44039)
@@ -81,5 +81,13 @@
 			return false;
 		}
 	}
+	
+	/**
+	 * Workaround since JSchUIPlugin seems not to fire property change events if
+	 * you change the private keys. Need to force revalidation manually.
+	 */
+	public void forceRevalidate() {
+		revalidate();
+	}
 
 }



More information about the jbosstools-commits mailing list