Author: adietish
Date: 2011-01-27 08:49:12 -0500 (Thu, 27 Jan 2011)
New Revision: 28653
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
Log:
[JBIDE-8254] replaced the warning dialog by a similar decoration to the key text field.
Warning is displayed in the title area and in the tooltip of the decoration
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-01-27 12:30:29
UTC (rev 28652)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-01-27 13:49:12
UTC (rev 28653)
@@ -1,3 +1,11 @@
+2011-01-27 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
+ (KeyValidator.validate):
+ (KeyValidator.isKeyKnowToSsh):
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
(performFinish):
+ [JBIDE-8254] replaced the warning dialog by a similar decoration to the key text field.
Warning is displayed in the title area and in the tooltip of the decoration
+
2011-01-26 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionWizard.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2011-01-27
12:30:29 UTC (rev 28652)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2011-01-27
13:49:12 UTC (rev 28653)
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.jboss.tools.internal.deltacloud.ui.wizards;
+import java.io.File;
+import java.io.FileNotFoundException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
@@ -403,7 +405,7 @@
WidgetProperties.text(SWT.Modify).observeDelayed(KEY_CHECK_DELAY, text),
BeanProperties.value(NewInstancePageModel.class,
NewInstancePageModel.PROPERTY_KEYID).observe(model),
new UpdateValueStrategy()
- .setBeforeSetValidator(
+ .setAfterGetValidator(
new MandatoryStringValidator(WizardMessages.getString(MUST_ENTER_A_KEYNAME)))
.setBeforeSetValidator(
new KeyValidator()),
@@ -420,6 +422,11 @@
if (value instanceof String
&& ((String) value).length() > 0) {
if (doesKeyExist((String) value)) {
+ if (!isKeyKnowToSsh((String) value)) {
+ return ValidationStatus
+ .warning(
+ "Key is not known to the ssh subsystem (SSH2 preferenes, private keys).
");
+ }
return ValidationStatus.ok();
}
}
@@ -427,6 +434,15 @@
"The key is not known to cloud \"{0}\"", cloud.getName()));
}
+ private boolean isKeyKnowToSsh(String keyId) {
+ try {
+ File file = PemFileManager.getFile(keyId,
SshPrivateKeysPreferences.getSshKeyDirectory());
+ return SshPrivateKeysPreferences.contains(file.getAbsolutePath());
+ } catch (FileNotFoundException e) {
+ return false;
+ }
+ }
+
private boolean doesKeyExist(String keyId) {
try {
return cloud.getKey(keyId) != null;
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2011-01-27
12:30:29 UTC (rev 28652)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2011-01-27
13:49:12 UTC (rev 28653)
@@ -10,13 +10,9 @@
*******************************************************************************/
package org.jboss.tools.internal.deltacloud.ui.wizards;
-import java.io.File;
-import java.io.FileNotFoundException;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.jboss.tools.common.jobs.ChainedJob;
import org.jboss.tools.deltacloud.core.DeltaCloud;
@@ -106,7 +102,6 @@
Exception e = null;
try {
if (isProceed()) {
- warnSshPrivateKey(keyId);
instance = cloud.createInstance(name, imageId, realmId, profileId, keyId, memory,
storage);
if (instance != null) {
result = true;
@@ -129,23 +124,6 @@
return result;
}
- private void warnSshPrivateKey(String keyId) {
- try {
- File file = PemFileManager.getFile(keyId,
SshPrivateKeysPreferences.getSshKeyDirectory());
- boolean isKnowPrivateKey =
SshPrivateKeysPreferences.contains(file.getAbsolutePath());
-
- if (!isKnowPrivateKey) {
- MessageDialog
- .openWarning(
- getShell(),
- "Instance key is not private key",
- "The instance key you have chosen is not known as private key to the ssh
subsystem. If you need this key to connect to your instance, you'll have to download
it and add it to the private keys in the SSH preferences.");
- }
- } catch (FileNotFoundException e) {
-
- }
- }
-
private void scheduleJobs() {
ChainedJob first =
new InstanceStateJob(
Show replies by date