JBoss Tools SVN: r35702 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-17 04:52:30 -0400 (Mon, 17 Oct 2011)
New Revision: 35702
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
Log:
[JBIDE-9793] updating "ssh key warning" after new key was added/removed from SSH2 prefs
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-17 08:51:20 UTC (rev 35701)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2011-10-17 08:52:30 UTC (rev 35702)
@@ -175,6 +175,7 @@
@Override
public void widgetSelected(SelectionEvent e) {
SshPrivateKeysPreferences.openPreferencesPage(getShell());
+ getDatabindingContext().updateTargets();
}
};
}
@@ -197,8 +198,8 @@
}
if (!isKeyKnownToSsh((String) value)) {
return ValidationStatus.warning(
- NLS.bind("Could not find the private portion for the public key \"{0}\". "
- + "Make sure your private key is listed in the ssh2 preferences.", value));
+ NLS.bind("Could not find the private portion for your public key. "
+ + "Make sure it is listed in the ssh2 preferences.", value));
}
return ValidationStatus.ok();
}
13 years, 2 months
JBoss Tools SVN: r35701 - trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-17 04:51:20 -0400 (Mon, 17 Oct 2011)
New Revision: 35701
Modified:
trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeDialog.java
Log:
JBIDE-9368 Dashboard(s) for easy news aggregation, twitter and easy additional/3rd party plugin installation and project template/creation
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeDialog.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeDialog.java 2011-10-17 07:57:36 UTC (rev 35700)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.ui/src/org/jboss/tools/runtime/ui/dialogs/DownloadRuntimeDialog.java 2011-10-17 08:51:20 UTC (rev 35701)
@@ -100,7 +100,7 @@
Label pathLabel = new Label(pathComposite, SWT.NONE);
- pathLabel.setText("Installation directory:");
+ pathLabel.setText("Install folder:");
pathText = new Text(pathComposite, SWT.BORDER);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
@@ -125,7 +125,7 @@
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
- dialog.setMessage("Select installation directory");
+ dialog.setMessage("Select install folder");
dialog.setFilterPath(pathText.getText());
final String path = dialog.open();
if (path == null) {
@@ -137,7 +137,7 @@
});
Label destinationLabel = new Label(pathComposite, SWT.NONE);
- destinationLabel.setText("Destination directory:");
+ destinationLabel.setText("Download folder:");
destinationPathText = new Text(pathComposite, SWT.BORDER);
gd = new GridData(SWT.FILL, SWT.FILL, true, false);
@@ -155,7 +155,7 @@
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(getShell());
- dialog.setMessage("Select destination directory");
+ dialog.setMessage("Select download folder");
dialog.setFilterPath(destinationPathText.getText());
final String path = dialog.open();
if (path == null) {
13 years, 2 months
JBoss Tools SVN: r35700 - trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2011-10-17 03:57:36 -0400 (Mon, 17 Oct 2011)
New Revision: 35700
Modified:
trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
Log:
JBIDE-9368 Dashboard(s) for easy news aggregation, twitter and easy additional/3rd party plugin installation and project template/creation
Modified: trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java
===================================================================
--- trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-10-17 07:53:25 UTC (rev 35699)
+++ trunk/central/plugins/org.jboss.tools.central/src/org/jboss/tools/central/editors/GettingStartedPage.java 2011-10-17 07:57:36 UTC (rev 35700)
@@ -501,7 +501,7 @@
IExtension[] extensions = extensionPoint.getExtensions();
List<String> wizardIDs = new ArrayList<String>();
- wizardIDs.add("org.jboss.ide.eclipse.as.openshift.express.ui.wizard.NewServerAdapter");
+ //wizardIDs.add("org.jboss.ide.eclipse.as.openshift.express.ui.wizard.NewServerAdapter");
wizardIDs.add("org.eclipse.jst.servlet.ui.project.facet.WebProjectWizard");
wizardIDs.add("org.jboss.tools.seam.ui.wizards.SeamProjectWizard");
wizardIDs.add("org.eclipse.m2e.core.wizards.Maven2ProjectWizard");
13 years, 2 months
JBoss Tools SVN: r35699 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-17 03:53:25 -0400 (Mon, 17 Oct 2011)
New Revision: 35699
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
Log:
[JBIDE-9920] corrected initial value to be blank
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java 2011-10-17 07:42:47 UTC (rev 35698)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java 2011-10-17 07:53:25 UTC (rev 35699)
@@ -21,7 +21,8 @@
public PassphraseDialog(Shell shell) {
super(shell
, "New ssh key"
- , "Please pick a passphrase for your new ssh key pair", "openshift"
+ , "Please pick a passphrase for your new ssh key pair"
+ , null
, new PassphraseValidator());
}
13 years, 2 months
JBoss Tools SVN: r35698 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-17 03:42:47 -0400 (Mon, 17 Oct 2011)
New Revision: 35698
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
Log:
[JBIDE-9793] corrected warning (unneeded import)
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-10-17 07:38:58 UTC (rev 35697)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/AdapterWizardPageModel.java 2011-10-17 07:42:47 UTC (rev 35698)
@@ -10,12 +10,9 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
-import java.io.File;
-
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.UIPreferences;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.openshift.express.internal.ui.common.StringUtils;
/**
* @author André Dietisheim
13 years, 2 months
JBoss Tools SVN: r35697 - in trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-17 03:38:58 -0400 (Mon, 17 Oct 2011)
New Revision: 35697
Added:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/FileUtils.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
Removed:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardModel.java
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
Log:
[JBIDE-9793] cleaning up implementation (moved methods to model)
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/FileUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/FileUtils.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/FileUtils.java 2011-10-17 07:38:58 UTC (rev 35697)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.common;
+
+import java.io.File;
+
+/**
+ * @author André Dietisheim
+ */
+public class FileUtils {
+
+ public static boolean canRead(String path) {
+ if (path == null) {
+ return false;
+ }
+ return canRead(new File(path));
+ }
+
+ public static boolean canRead(File file) {
+ if (file == null) {
+ return false;
+ }
+ return file.canRead();
+ }
+
+
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/FileUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java 2011-10-17 07:16:45 UTC (rev 35696)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainDialog.java 2011-10-17 07:38:58 UTC (rev 35697)
@@ -27,11 +27,11 @@
public class NewDomainDialog extends Wizard {
private String namespace;
- private NewDomainWizardModel model;
+ private NewDomainWizardPageModel model;
public NewDomainDialog(String namespace, ImportProjectWizardModel wizardModel) {
this.namespace = namespace;
- this.model = new NewDomainWizardModel(namespace, wizardModel.getUser());
+ this.model = new NewDomainWizardPageModel(namespace, wizardModel.getUser());
setNeedsProgressMonitor(true);
}
Deleted: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardModel.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardModel.java 2011-10-17 07:16:45 UTC (rev 35696)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardModel.java 2011-10-17 07:38:58 UTC (rev 35697)
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.openshift.express.internal.ui.wizard;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.openshift.express.client.IDomain;
-import org.jboss.tools.openshift.express.client.ISSHPublicKey;
-import org.jboss.tools.openshift.express.client.IUser;
-import org.jboss.tools.openshift.express.client.OpenshiftException;
-import org.jboss.tools.openshift.express.client.SSHPublicKey;
-
-/**
- * @author André Dietisheim
- */
-public class NewDomainWizardModel extends ObservableUIPojo {
-
- public static final String PROPERTY_NAMESPACE = "namespace";
- public static final String PROPERTY_SSHKEY = "sshKey";
- public static final String PROPERTY_DOMAIN = "domain";
-
- private String namespace;
- private IDomain domain;
- private String sshKey;
- private IUser user;
-
- public NewDomainWizardModel(String namespace, IUser user) {
- this.namespace = namespace;
- this.user = user;
- }
-
- public String getNamespace() {
- return this.namespace;
- }
-
- public void createDomain() throws OpenshiftException, IOException {
- IDomain domain = user.createDomain(namespace, loadSshKey());
- setDomain(domain);
- }
-
- public String getSshKey() {
- return sshKey;
- }
-
- public void setSshKey(String sshKey) {
- firePropertyChange(PROPERTY_SSHKEY, this.sshKey, this.sshKey = sshKey);
- }
-
- private ISSHPublicKey loadSshKey() throws IOException, OpenshiftException {
- return new SSHPublicKey(new File(sshKey));
- }
-
- public void setNamespace(String namespace) {
- firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
- }
-
- public boolean hasDomain() {
- return domain != null;
- }
-
- public IDomain getDomain() {
- return domain;
- }
-
- public void setDomain(IDomain domain) {
- firePropertyChange(PROPERTY_DOMAIN, this.domain, this.domain = domain);
- if (domain != null) {
- setNamespace(domain.getNamespace());
- }
- }
-}
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-17 07:16:45 UTC (rev 35696)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2011-10-17 07:38:58 UTC (rev 35697)
@@ -47,8 +47,8 @@
import org.jboss.tools.common.ui.databinding.ParametrizableWizardPageSupport;
import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
import org.jboss.tools.openshift.express.client.OpenshiftException;
-import org.jboss.tools.openshift.express.client.SSHKeyPair;
import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.common.FileUtils;
import org.jboss.tools.openshift.express.internal.ui.common.StringUtils;
/**
@@ -56,14 +56,12 @@
*/
public class NewDomainWizardPage extends AbstractOpenshiftWizardPage {
- private static final String OPENSHIFT_KEY_PREFIX = "openshift_id_rsa_";
- private static final String PUBLIC_KEY_SUFFIX = ".pub";
private static final String FILTEREXPRESSION_PUBLIC_SSH_KEY = "*.pub";
private static final String FILTERNAME_PUBLIC_SSH_KEY = "Public ssh key file (*.pub)";
- private NewDomainWizardModel model;
+ private NewDomainWizardPageModel model;
- public NewDomainWizardPage(String namespace, NewDomainWizardModel model, IWizard wizard) {
+ public NewDomainWizardPage(String namespace, NewDomainWizardPageModel model, IWizard wizard) {
super("Domain", "Create a new domain", "New Domain", wizard);
this.model = model;
}
@@ -79,7 +77,7 @@
GridDataFactory.fillDefaults()
.span(3, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(namespaceText);
DataBindingUtils.bindMandatoryTextField(
- namespaceText, "Domain name", NewDomainWizardModel.PROPERTY_NAMESPACE, model, dbc);
+ namespaceText, "Domain name", NewDomainWizardPageModel.PROPERTY_NAMESPACE, model, dbc);
Label sshKeyLabel = new Label(container, SWT.NONE);
sshKeyLabel.setText("SSH Public Key");
@@ -90,7 +88,7 @@
.align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(sshKeyText);
Binding sshKeyTextBinding = dbc.bindValue(
WidgetProperties.text(SWT.Modify).observe(sshKeyText),
- BeanProperties.value(NewDomainWizardModel.PROPERTY_SSHKEY).observe(model),
+ BeanProperties.value(NewDomainWizardPageModel.PROPERTY_SSHKEY).observe(model),
new UpdateValueStrategy().setAfterGetValidator(new MandatoryStringValidator(
"You have to select a ssh public key")),
new UpdateValueStrategy().setAfterGetValidator(new SSHKeyValidator()));
@@ -128,10 +126,7 @@
if (Dialog.OK == dialog.open()) {
try {
String passPhrase = dialog.getValue();
- String sshKeysDirectory = SshPrivateKeysPreferences.getSshKeyDirectory();
- SSHKeyPair keyPair = createSshKeyPair(passPhrase, sshKeysDirectory);
- SshPrivateKeysPreferences.add(keyPair.getPrivateKeyPath());
- model.setSshKey(keyPair.getPublicKeyPath());
+ model.createSShKeyPair(passPhrase);
} catch (FileNotFoundException ex) {
IStatus status = new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
"Could not read the ssh key folder", ex);
@@ -152,26 +147,6 @@
};
}
- private SSHKeyPair createSshKeyPair(String passPhrase, String sshKeysDirectory) throws OpenshiftException {
- String privateKeyPath = getKeyPairFileName(sshKeysDirectory);
- String publicKeyPath = getPublicKeyPath(privateKeyPath);
- return SSHKeyPair.create(passPhrase, privateKeyPath, publicKeyPath);
- }
-
- private String getKeyPairFileName(String sshKeysDirectory) {
- int i = 0;
- File privateKey = null;
- while (isReadable(privateKey = new File(sshKeysDirectory, OPENSHIFT_KEY_PREFIX + i))
- || isReadable(new File(sshKeysDirectory, getPublicKeyPath(privateKey.getName())))) {
- i++;
- }
- return privateKey.getAbsolutePath();
- }
-
- private String getPublicKeyPath(String privateKeyPath) {
- return privateKeyPath + PUBLIC_KEY_SUFFIX;
- }
-
private SelectionListener onBrowse() {
return new SelectionAdapter() {
@@ -217,7 +192,7 @@
public IStatus validate(Object value) {
if (!(value instanceof String)
|| StringUtils.isEmpty((String) value)
- || !isReadable((String) value)) {
+ || !FileUtils.canRead((String) value)) {
return ValidationStatus.error("You have to provide a valid ssh public key");
}
if (!isKeyKnownToSsh((String) value)) {
@@ -236,7 +211,7 @@
try {
File privateKey = SshPrivateKeysPreferences.getKeyFile(preferencesKey);
if (privateKey == null
- || !isReadable(privateKey)) {
+ || !FileUtils.canRead(privateKey)) {
continue;
}
if (publicKeyPath.startsWith(privateKey.getAbsolutePath() + ".")) {
@@ -250,18 +225,4 @@
}
}
- private boolean isReadable(String path) {
- if (path == null) {
- return false;
- }
- return isReadable(new File(path));
- }
-
- private boolean isReadable(File file) {
- if (file == null) {
- return false;
- }
- return file.exists()
- && file.canRead();
- }
}
Copied: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java (from rev 35692, trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardModel.java)
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java 2011-10-17 07:38:58 UTC (rev 35697)
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.wizard;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
+import org.jboss.tools.openshift.express.client.IDomain;
+import org.jboss.tools.openshift.express.client.ISSHPublicKey;
+import org.jboss.tools.openshift.express.client.IUser;
+import org.jboss.tools.openshift.express.client.OpenshiftException;
+import org.jboss.tools.openshift.express.client.SSHKeyPair;
+import org.jboss.tools.openshift.express.client.SSHPublicKey;
+import org.jboss.tools.openshift.express.internal.ui.common.FileUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewDomainWizardPageModel extends ObservableUIPojo {
+
+ private static final String OPENSHIFT_KEY_PREFIX = "openshift_id_rsa_";
+ private static final String PUBLIC_KEY_SUFFIX = ".pub";
+
+ public static final String PROPERTY_NAMESPACE = "namespace";
+ public static final String PROPERTY_SSHKEY = "sshKey";
+ public static final String PROPERTY_DOMAIN = "domain";
+
+ private String namespace;
+ private IDomain domain;
+ private String sshKey;
+ private IUser user;
+
+ public NewDomainWizardPageModel(String namespace, IUser user) {
+ this.namespace = namespace;
+ this.user = user;
+ }
+
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void createDomain() throws OpenshiftException, IOException {
+ IDomain domain = user.createDomain(namespace, loadSshKey());
+ setDomain(domain);
+ }
+
+ public String getSshKey() {
+ return sshKey;
+ }
+
+ public void createSShKeyPair(String passPhrase) throws FileNotFoundException, OpenshiftException {
+ String sshKeysDirectory = SshPrivateKeysPreferences.getSshKeyDirectory();
+ SSHKeyPair keyPair = createSshKeyPair(passPhrase, sshKeysDirectory);
+ SshPrivateKeysPreferences.add(keyPair.getPrivateKeyPath());
+ setSshKey(keyPair.getPublicKeyPath());
+ }
+
+ private SSHKeyPair createSshKeyPair(String passPhrase, String sshKeysDirectory) throws OpenshiftException {
+ String privateKeyPath = getKeyPairFileName(sshKeysDirectory);
+ String publicKeyPath = getPublicKeyPath(privateKeyPath);
+ return SSHKeyPair.create(passPhrase, privateKeyPath, publicKeyPath);
+ }
+
+ private String getKeyPairFileName(String sshKeysDirectory) {
+ int i = 0;
+ File privateKey = null;
+ while (FileUtils.canRead(privateKey = new File(sshKeysDirectory, OPENSHIFT_KEY_PREFIX + i))
+ || FileUtils.canRead(new File(sshKeysDirectory, getPublicKeyPath(privateKey.getName())))) {
+ i++;
+ }
+ return privateKey.getAbsolutePath();
+ }
+
+ private String getPublicKeyPath(String privateKeyPath) {
+ return privateKeyPath + PUBLIC_KEY_SUFFIX;
+ }
+
+ public void setSshKey(String sshKey) {
+ firePropertyChange(PROPERTY_SSHKEY, this.sshKey, this.sshKey = sshKey);
+ }
+
+ private ISSHPublicKey loadSshKey() throws IOException, OpenshiftException {
+ return new SSHPublicKey(new File(sshKey));
+ }
+
+ public void setNamespace(String namespace) {
+ firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
+ }
+
+ public boolean hasDomain() {
+ return domain != null;
+ }
+
+ public IDomain getDomain() {
+ return domain;
+ }
+
+ public void setDomain(IDomain domain) {
+ firePropertyChange(PROPERTY_DOMAIN, this.domain, this.domain = domain);
+ if (domain != null) {
+ setNamespace(domain.getNamespace());
+ }
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 2 months
JBoss Tools SVN: r35696 - in trunk: common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/ssh and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-17 03:16:45 -0400 (Mon, 17 Oct 2011)
New Revision: 35696
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/ssh/SshPrivateKeysPreferences.java
Log:
[JBIDE-9793] corrected method name and javadoc
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-17 07:11:33 UTC (rev 35695)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2011-10-17 07:16:45 UTC (rev 35696)
@@ -234,7 +234,7 @@
}
for (String preferencesKey : SshPrivateKeysPreferences.getKeys()) {
try {
- File privateKey = SshPrivateKeysPreferences.getPrivateKey(preferencesKey);
+ File privateKey = SshPrivateKeysPreferences.getKeyFile(preferencesKey);
if (privateKey == null
|| !isReadable(privateKey)) {
continue;
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/ssh/SshPrivateKeysPreferences.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/ssh/SshPrivateKeysPreferences.java 2011-10-17 07:11:33 UTC (rev 35695)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/ssh/SshPrivateKeysPreferences.java 2011-10-17 07:16:45 UTC (rev 35696)
@@ -102,23 +102,23 @@
}
/**
- * Returns the private key for the given entry from the ssh preferences.
- * This methods prepends the ssh directory to the path if it's a relative
- * one. There's no guarantee that the file returned really exists.
+ * Returns the key file for the given (absolute or relative) key path.
+ * This methods prepends the ssh directory to the path if the given it's a
+ * relative one. There's no guarantee that the file returned really exists.
*
- * @param privateKeysPreferencesEntry
+ * @param keyName
* @return
* @throws FileNotFoundException
*/
- public static File getPrivateKey(String privateKeysPreferencesEntry) throws FileNotFoundException {
- if (isEmpty(privateKeysPreferencesEntry)) {
+ public static File getKeyFile(String keyName) throws FileNotFoundException {
+ if (isEmpty(keyName)) {
return null;
}
- if (privateKeysPreferencesEntry.startsWith(File.separator)) {
- return new File(privateKeysPreferencesEntry);
+ if (keyName.startsWith(File.separator)) {
+ return new File(keyName);
} else {
- return new File(getSshKeyDirectory(), privateKeysPreferencesEntry);
+ return new File(getSshKeyDirectory(), keyName);
}
}
13 years, 2 months
JBoss Tools SVN: r35695 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-17 03:11:33 -0400 (Mon, 17 Oct 2011)
New Revision: 35695
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
Log:
[JBIDE-9920] changed passphrase text field to be a password text field
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-17 07:08:01 UTC (rev 35694)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2011-10-17 07:11:33 UTC (rev 35695)
@@ -49,6 +49,7 @@
import org.jboss.tools.openshift.express.client.OpenshiftException;
import org.jboss.tools.openshift.express.client.SSHKeyPair;
import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.common.StringUtils;
/**
* @author André Dietisheim
@@ -215,7 +216,7 @@
@Override
public IStatus validate(Object value) {
if (!(value instanceof String)
- || isEmpty((String) value)
+ || StringUtils.isEmpty((String) value)
|| !isReadable((String) value)) {
return ValidationStatus.error("You have to provide a valid ssh public key");
}
@@ -228,7 +229,7 @@
}
private boolean isKeyKnownToSsh(String publicKeyPath) {
- if (isEmpty(publicKeyPath)) {
+ if (StringUtils.isEmpty(publicKeyPath)) {
return false;
}
for (String preferencesKey : SshPrivateKeysPreferences.getKeys()) {
@@ -263,9 +264,4 @@
return file.exists()
&& file.canRead();
}
-
- private boolean isEmpty(String value) {
- return value == null
- || ((String) value).length() == 0;
- }
}
13 years, 2 months
JBoss Tools SVN: r35694 - trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-17 03:08:01 -0400 (Mon, 17 Oct 2011)
New Revision: 35694
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java
Log:
[JBIDE-9920] changed passphrase text field to be a password text field
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java 2011-10-17 07:00:13 UTC (rev 35693)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java 2011-10-17 07:08:01 UTC (rev 35694)
@@ -23,8 +23,8 @@
}
public static boolean isEmpty(String value) {
- return value != null
- && value.length() > 0;
+ return value == null
+ || value.length() == 0;
}
}
13 years, 2 months
JBoss Tools SVN: r35693 - in trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-10-17 03:00:13 -0400 (Mon, 17 Oct 2011)
New Revision: 35693
Added:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
Modified:
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java
trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java
Log:
[JBIDE-9920] changed passphrase text field to be a password text field
Modified: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java 2011-10-16 21:10:06 UTC (rev 35692)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/common/StringUtils.java 2011-10-17 07:00:13 UTC (rev 35693)
@@ -22,4 +22,9 @@
return "";
}
+ public static boolean isEmpty(String value) {
+ return value != null
+ && value.length() > 0;
+ }
+
}
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-16 21:10:06 UTC (rev 35692)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewDomainWizardPage.java 2011-10-17 07:00:13 UTC (rev 35693)
@@ -25,7 +25,6 @@
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IInputValidator;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
@@ -124,20 +123,8 @@
@Override
public void widgetSelected(SelectionEvent e) {
- InputDialog dialog = new InputDialog(getShell(),
- "New ssh key"
- , "Please pick a passphrase for your new ssh key pair", "openshift"
- , new IInputValidator() {
-
- @Override
- public String isValid(String input) {
- if (isEmpty(input)) {
- return "You have to provide a pass phrase";
- }
- return null;
- }
- });
- if (Dialog.OK == dialog.open()) {
+ InputDialog dialog = new PassphraseDialog(getShell());
+ if (Dialog.OK == dialog.open()) {
try {
String passPhrase = dialog.getValue();
String sshKeysDirectory = SshPrivateKeysPreferences.getSshKeyDirectory();
Added: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
===================================================================
--- trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java (rev 0)
+++ trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java 2011-10-17 07:00:13 UTC (rev 35693)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.wizard;
+
+import org.eclipse.jface.dialogs.IInputValidator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.openshift.express.internal.ui.common.StringUtils;
+
+public class PassphraseDialog extends InputDialog {
+
+ public PassphraseDialog(Shell shell) {
+ super(shell
+ , "New ssh key"
+ , "Please pick a passphrase for your new ssh key pair", "openshift"
+ , new PassphraseValidator());
+ }
+
+ protected int getInputTextStyle() {
+ return SWT.SINGLE | SWT.BORDER | SWT.PASSWORD;
+ }
+
+ private static class PassphraseValidator implements IInputValidator {
+
+ @Override
+ public String isValid(String input) {
+ if (StringUtils.isEmpty(input)) {
+ return "You have to provide a pass phrase";
+ }
+ return null;
+ }
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/PassphraseDialog.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 2 months