Author: adietish
Date: 2011-10-13 11:52:22 -0400 (Thu, 13 Oct 2011)
New Revision: 35626
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/SshPrivateKeysPreferences.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPageModel.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
Log:
[JBIDE-9805] moved SshPrivateKeysPreferences to org.jboss.tools.common.ui (was:
org.jboss.tools.deltacloud.ui)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2011-10-13
15:51:01 UTC (rev 35625)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2011-10-13
15:52:22 UTC (rev 35626)
@@ -31,4 +31,5 @@
org.jboss.tools.internal.deltacloud.ui.utils;x-friends:="org.jboss.tools.deltacloud.test,org.jboss.tools.deltacloud.integration"
Import-Package: org.jboss.tools.common.ui,
org.jboss.tools.common.ui.databinding,
- org.jboss.tools.common.ui.preferencevalue
+ org.jboss.tools.common.ui.preferencevalue,
+ org.jboss.tools.common.ui.ssh
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java 2011-10-13
15:51:01 UTC (rev 35625)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java 2011-10-13
15:52:22 UTC (rev 35626)
@@ -52,6 +52,7 @@
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.common.log.StatusFactory;
import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudKey;
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPageModel.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPageModel.java 2011-10-13
15:51:01 UTC (rev 35625)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPageModel.java 2011-10-13
15:52:22 UTC (rev 35626)
@@ -17,6 +17,7 @@
import java.util.List;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudKey;
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-10-13
15:51:01 UTC (rev 35625)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2011-10-13
15:52:22 UTC (rev 35626)
@@ -64,6 +64,7 @@
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.jboss.tools.common.log.StatusFactory;
import org.jboss.tools.common.ui.databinding.MandatoryStringValidator;
+import org.jboss.tools.common.ui.ssh.SshPrivateKeysPreferences;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProfile;
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/SshPrivateKeysPreferences.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/SshPrivateKeysPreferences.java 2011-10-13
15:51:01 UTC (rev 35625)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/SshPrivateKeysPreferences.java 2011-10-13
15:52:22 UTC (rev 35626)
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.internal.deltacloud.ui.wizards;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-
-import org.apache.deltacloud.client.utils.StringUtils;
-import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.common.ui.preferencevalue.StringPreferenceValue;
-import org.jboss.tools.common.ui.preferencevalue.StringsPreferenceValue;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-
-/**
- * @author André Dietisheim
- */
-public class SshPrivateKeysPreferences {
-
- private static final String PLUGIN_ID = "org.eclipse.jsch.core";
- /**
- * Preference keys defined by org.eclipse.jsch.
- *
- * these keys are replicates from org.eclipse.jsch.internal.core.IConstants
- */
- private static final String PRIVATEKEY = "PRIVATEKEY";
- private static final String SSH2HOME = "SSH2HOME";
-
- private static final String SSH_USERHOME = ".ssh";
- private static final String SSH_USERHOME_WIN32 = "ssh";
-
- private static StringsPreferenceValue sshPrivateKeyPreference =
- new StringsPreferenceValue(',', PRIVATEKEY, PLUGIN_ID);
- private static StringPreferenceValue sshHome = new StringPreferenceValue(SSH2HOME,
PLUGIN_ID);
-
- /**
- * Adds the given keyName to the ssh-preferences
- *
- * @param keyName
- * the name of the key to add
- */
- public static void add(String keyName) {
- sshPrivateKeyPreference.add(keyName);
- }
-
- public static String[] getKeys() {
- return sshPrivateKeyPreference.get();
- }
-
- /**
- * Removes the given keyName from the ssh-preferences
- *
- * @param keyName
- * the name of the key to remove
- */
- public static void remove(String keyName) {
- sshPrivateKeyPreference.remove(keyName);
- }
-
- /**
- * Returns the path to the folder that ssh keys get stored to. It either
- * gets the preferences value from org.eclipse.jsch or uses a ssh folder in
- * the user home. This code was built according to what
- * org.eclipse.jsch.internal.core.PreferenceInitializer is doing.
- *
- * @return the directory to store or load the ssh keys from
- * @throws DeltaCloudException
- * if the directory could not be determined
- */
- public static String getSshKeyDirectory() throws FileNotFoundException {
- String sshHomePath = sshHome.get();
- if (StringUtils.isEmpty(sshHomePath)) {
- sshHomePath = getSshSystemHome();
- }
-
- if (StringUtils.isEmpty(sshHomePath)) {
- throw new FileNotFoundException("Could not determine path to ssh keys
directory.");
- }
- return sshHomePath;
- }
-
- private static String getSshSystemHome() {
- String userHomePath = System.getProperty("user.home");
- StringBuilder builder = new StringBuilder(userHomePath);
- builder.append(File.separatorChar);
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
- builder.append(SSH_USERHOME_WIN32); //$NON-NLS-1$
- } else {
- builder.append(SSH_USERHOME);
- }
- return builder.toString();
- }
-}