[jbosstools-commits] JBoss Tools SVN: r43796 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: ui/utils and 1 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue Sep 18 11:13:09 EDT 2012
Author: adietish
Date: 2012-09-18 11:13:09 -0400 (Tue, 18 Sep 2012)
New Revision: 43796
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/JobChainBuilder.java
Removed:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/JobScheduler.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPageModel.java
Log:
[JBIDE-11912] finished implementing "Add existing SSH key"
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-09-18 13:01:10 UTC (rev 43795)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-09-18 15:13:09 UTC (rev 43796)
@@ -324,4 +324,13 @@
return delegate.putSSHKey(name, key);
}
+ public boolean hasSSHKeyName(String name) {
+ return delegate.hasSSHKeyName(name);
+ }
+
+ public boolean hasSSHPublicKey(String publicKey) {
+ return delegate.hasSSHPublicKey(publicKey);
+ }
+
+
}
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/JobChainBuilder.java (from rev 43795, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/JobScheduler.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/JobChainBuilder.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/JobChainBuilder.java 2012-09-18 15:13:09 UTC (rev 43796)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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 Incorporated - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.utils;
+
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class JobChainBuilder {
+
+ private Job job;
+
+ public JobChainBuilder(Job job) {
+ this.job = job;
+ }
+
+ public JobConstraint andRunWhenDone(Job constrainedJob) {
+ return new JobConstraint(job).runWhenDone(constrainedJob);
+ }
+
+ public class JobConstraint {
+ private Job job;
+
+ private JobConstraint(Job job) {
+ this.job = job;
+ }
+
+ public JobConstraint runWhenDone(final Job constrainedJob) {
+ job.addJobChangeListener(new JobChangeAdapter() {
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ constrainedJob.schedule();
+ }});
+ return new JobConstraint(constrainedJob);
+ }
+
+ public void schedule() {
+ JobChainBuilder.this.job.schedule();
+ }
+
+ public Job build() {
+ return JobChainBuilder.this.job;
+ }
+ }
+}
Property changes on: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/JobChainBuilder.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/JobScheduler.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/JobScheduler.java 2012-09-18 13:01:10 UTC (rev 43795)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/utils/JobScheduler.java 2012-09-18 15:13:09 UTC (rev 43796)
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 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 Incorporated - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.openshift.express.internal.ui.utils;
-
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-
-/**
- * @author Andre Dietisheim
- */
-public class JobScheduler {
-
- private Job job;
-
- public JobScheduler(Job job) {
- this.job = job;
- }
-
- public JobConstraint runWhenDone(Job constrainedJob) {
- return new JobConstraint(job).runWhenDone(constrainedJob);
- }
-
- public class JobConstraint {
- private Job job;
-
- private JobConstraint(Job job) {
- this.job = job;
- }
-
- public JobConstraint runWhenDone(final Job constrainedJob) {
- job.addJobChangeListener(new JobChangeAdapter() {
-
- @Override
- public void done(IJobChangeEvent event) {
- constrainedJob.schedule();
- }});
- return new JobConstraint(constrainedJob);
- }
-
- public void schedule() {
- JobScheduler.this.job.schedule();
- }
- }
-}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizard.java 2012-09-18 13:01:10 UTC (rev 43795)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizard.java 2012-09-18 15:13:09 UTC (rev 43796)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.wizard.Wizard;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
@@ -28,8 +29,8 @@
@Override
public boolean performFinish() {
- addSSHKeyWizardPage.addConfiguredSSHKey();
- return true;
+ IStatus status = addSSHKeyWizardPage.addConfiguredSSHKey();
+ return status.isOK();
}
@Override
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java 2012-09-18 13:01:10 UTC (rev 43795)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPage.java 2012-09-18 15:13:09 UTC (rev 43796)
@@ -10,14 +10,26 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
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.databinding.validation.MultiValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.databinding.fieldassist.ControlDecorationSupport;
import org.eclipse.jface.databinding.swt.WidgetProperties;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -28,13 +40,19 @@
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.jboss.tools.common.ui.WizardUtils;
import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
+import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.databinding.AlphanumericStringValidator;
import org.jboss.tools.openshift.express.internal.ui.databinding.RequiredControlDecorationUpdater;
import org.jboss.tools.openshift.express.internal.ui.utils.SSHUtils;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import org.jboss.tools.openshift.express.internal.ui.wizard.AbstractOpenShiftWizardPage;
+import com.openshift.client.OpenShiftException;
+import com.openshift.client.SSHPublicKey;
+
/**
* @author André Dietisheim
*/
@@ -70,7 +88,22 @@
.align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(nameText);
Binding nameBinding = ValueBindingBuilder
.bind(WidgetProperties.text(SWT.Modify).observe(nameText))
- .validatingAfterConvert(new AlphanumericStringValidator("key name"))
+ .validatingAfterConvert(new AlphanumericStringValidator("key name") {
+
+ @Override
+ public IStatus validate(Object value) {
+ IStatus validationStatus = super.validate(value);
+ if (!validationStatus.isOK()) {
+ return validationStatus;
+ }
+ String keyName = (String) value;
+ if (pageModel.hasKeyName(keyName)) {
+ return ValidationStatus.error("There's already a key with the name " + keyName);
+ }
+ return ValidationStatus.ok();
+ }
+
+ })
.to(BeanProperties.value(AddSSHKeyWizardPageModel.PROPERTY_NAME).observe(pageModel))
.notUpdatingParticipant()
.in(dbc);
@@ -86,13 +119,12 @@
fileText.setEditable(false);
GridDataFactory.fillDefaults()
.align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(fileText);
- Binding filePathBinding = ValueBindingBuilder
- .bind(WidgetProperties.text(SWT.Modify).observe(fileText))
- .validatingAfterConvert(new AlphanumericStringValidator("key file"))
+ IObservableValue filePathObservable =
+ WidgetProperties.text(SWT.Modify).observe(fileText);
+ ValueBindingBuilder
+ .bind(filePathObservable)
.to(BeanProperties.value(AddSSHKeyWizardPageModel.PROPERTY_FILEPATH).observe(pageModel))
.in(dbc);
- ControlDecorationSupport.create(
- filePathBinding, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
Button browseButton = new Button(addSSHKeyGroup, SWT.PUSH);
browseButton.setText("Browse...");
@@ -100,6 +132,10 @@
GridDataFactory.fillDefaults()
.align(SWT.FILL, SWT.CENTER).applyTo(browseButton);
+ ValidationStatusProvider sshPublicKeyValidator = new SSHPublicKeyValidator(filePathObservable);
+ dbc.addValidationStatusProvider(sshPublicKeyValidator);
+ ControlDecorationSupport.create(
+ sshPublicKeyValidator, SWT.LEFT | SWT.TOP, null, new RequiredControlDecorationUpdater());
}
private SelectionListener onBrowse() {
@@ -117,7 +153,62 @@
};
}
- public void addConfiguredSSHKey() {
- pageModel.addConfiguredSSHKey();
+ public IStatus addConfiguredSSHKey() {
+ try {
+ return WizardUtils.runInWizard(new AddSSHKeyJob(), getContainer());
+ } catch (Exception e) {
+ return OpenShiftUIActivator.createErrorStatus("Could not add ssh key " + pageModel.getName() + ".");
+ }
}
+
+ private class AddSSHKeyJob extends Job {
+
+ public AddSSHKeyJob() {
+ super("Adding SSH key " + pageModel.getName() + "...");
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ pageModel.addConfiguredSSHKey();
+ return Status.OK_STATUS;
+ } catch (Exception e) {
+ return OpenShiftUIActivator.createErrorStatus(
+ NLS.bind("Could not add SSH key {0} to OpenShift", pageModel.getName()), e);
+ }
+ }
+ }
+
+ public class SSHPublicKeyValidator extends MultiValidator {
+
+ private IObservableValue filePathObservable;
+
+ public SSHPublicKeyValidator(IObservableValue filePathObservable) {
+ this.filePathObservable = filePathObservable;
+ }
+
+ @Override
+ protected IStatus validate() {
+ String filePath = (String) filePathObservable.getValue();
+ if (StringUtils.isEmpty(filePath)) {
+ return ValidationStatus.cancel("You have to supply a public SSH key.");
+ }
+ try {
+ SSHPublicKey sshPublicKey = new SSHPublicKey(filePath);
+ if (pageModel.hasPublicKey(sshPublicKey.getPublicKey())) {
+ return ValidationStatus.error("The public key in " + filePath + " is already in use on OpenShift. Choose another key.");
+ }
+ } catch (FileNotFoundException e) {
+ return ValidationStatus.error("Could not load file: " + e.getMessage());
+ } catch (OpenShiftException e) {
+ return ValidationStatus.error(filePath + "is not a valid public SSH key: " + e.getMessage());
+ } catch (IOException e) {
+ return ValidationStatus.error("Could not load file: " + e.getMessage());
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ }
+
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java 2012-09-18 13:01:10 UTC (rev 43795)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/AddSSHKeyWizardPageModel.java 2012-09-18 15:13:09 UTC (rev 43796)
@@ -10,9 +10,16 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
+import com.openshift.client.OpenShiftException;
+import com.openshift.client.SSHPublicKey;
+
/**
* @author Andre Dietisheim
*/
@@ -44,8 +51,19 @@
public void setFilePath(String filePath) {
firePropertyChange(PROPERTY_FILEPATH, this.filePath, this.filePath = filePath);
}
-
- public void addConfiguredSSHKey() {
+
+ public boolean hasKeyName(String name) {
+ return user.hasSSHKeyName(name);
}
+
+ public boolean hasPublicKey(String publicKeyContent) {
+ return user.hasSSHPublicKey(publicKeyContent);
+ }
+
+ public void addConfiguredSSHKey() throws FileNotFoundException, OpenShiftException, IOException {
+ SSHPublicKey sshPublicKey = new SSHPublicKey(new File(filePath));
+ user.putSSHKey(name, sshPublicKey);
+ }
+
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPage.java 2012-09-18 13:01:10 UTC (rev 43795)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPage.java 2012-09-18 15:13:09 UTC (rev 43796)
@@ -11,8 +11,6 @@
package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Collection;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.beans.BeanProperties;
@@ -41,7 +39,7 @@
import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
-import org.jboss.tools.openshift.express.internal.ui.utils.JobScheduler;
+import org.jboss.tools.openshift.express.internal.ui.utils.JobChainBuilder;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.TableViewerBuilder;
import org.jboss.tools.openshift.express.internal.ui.utils.TableViewerBuilder.IColumnLabelProvider;
@@ -79,8 +77,8 @@
GridDataFactory.fillDefaults()
.span(1, 5).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tableContainer);
ValueBindingBuilder.bind(ViewerProperties.singleSelection().observe(viewer))
- .to(BeanProperties.value(ManageSSHKeysWizardPageModel.PROPERTY_SELECTED_KEY).observe(pageModel))
- .in(dbc);
+ .to(BeanProperties.value(ManageSSHKeysWizardPageModel.PROPERTY_SELECTED_KEY).observe(pageModel))
+ .in(dbc);
Button addButton = new Button(sshKeysGroup, SWT.PUSH);
GridDataFactory.fillDefaults()
@@ -122,13 +120,15 @@
"Are you sure that you want to remove public SSH key {0} from OpenShift?",
keyName)))
try {
- RemoveKeyJob removeSSHKeyJob = new RemoveKeyJob();
- new JobScheduler(removeSSHKeyJob).runWhenDone(new RefreshViewerJob());
- setViewerInput(pageModel.getSSHKeys());
- WizardUtils.runInWizard(removeSSHKeyJob, getContainer()) ;
+ WizardUtils.runInWizard(
+ new JobChainBuilder(
+ new RemoveKeyJob()).andRunWhenDone(new RefreshViewerJob())
+ .build()
+ , getContainer());
} catch (Exception ex) {
StatusManager.getManager().handle(
- OpenShiftUIActivator.createErrorStatus("Could not remove key " + keyName + ".", ex), StatusManager.LOG);
+ OpenShiftUIActivator.createErrorStatus("Could not remove key " + keyName + ".", ex),
+ StatusManager.LOG);
}
}
};
@@ -140,6 +140,14 @@
@Override
public void widgetSelected(SelectionEvent e) {
WizardUtils.openWizardDialog(new AddSSHKeyWizard(pageModel.getUser()), getShell());
+ try {
+ WizardUtils.runInWizard(
+ new RefreshViewerJob(),
+ getContainer());
+ } catch (Exception ex) {
+ StatusManager.getManager().handle(
+ OpenShiftUIActivator.createErrorStatus("Could not refresh keys.", ex), StatusManager.LOG);
+ }
}
};
}
@@ -184,7 +192,7 @@
protected void onPageActivated(DataBindingContext dbc) {
try {
Job loadKeysJob = new LoadKeysJob();
- new JobScheduler(loadKeysJob).runWhenDone(new RefreshViewerJob());
+ new JobChainBuilder(loadKeysJob).andRunWhenDone(new RefreshViewerJob());
WizardUtils.runInWizard(loadKeysJob, getContainer());
} catch (Exception e) {
StatusManager.getManager().handle(
@@ -199,7 +207,7 @@
public void widgetSelected(SelectionEvent e) {
try {
Job refreshKeysJob = new RefreshKeysJob();
- new JobScheduler(refreshKeysJob).runWhenDone(new RefreshViewerJob());
+ new JobChainBuilder(refreshKeysJob).andRunWhenDone(new RefreshViewerJob());
WizardUtils.runInWizard(refreshKeysJob, getContainer());
} catch (Exception ex) {
StatusManager.getManager().handle(
@@ -210,22 +218,8 @@
};
}
- private void clearViewer() {
- setViewerInput(new ArrayList<IOpenShiftSSHKey>());
- }
-
- private void setViewerInput(final Collection<IOpenShiftSSHKey> keys) {
- getShell().getDisplay().syncExec(new Runnable() {
-
- @Override
- public void run() {
- viewer.setInput(keys);
- }
- });
- }
-
private class RemoveKeyJob extends Job {
-
+
private RemoveKeyJob() {
super("Removing SSH key " + pageModel.getSelectedSSHKey().getName() + "...");
}
@@ -236,9 +230,9 @@
return Status.OK_STATUS;
}
}
-
+
private class RefreshKeysJob extends Job {
-
+
private RefreshKeysJob() {
super("Refreshing SSH keys... ");
}
@@ -251,7 +245,7 @@
}
private class LoadKeysJob extends Job {
-
+
private LoadKeysJob() {
super("Loading SSH keys... ");
}
@@ -277,4 +271,3 @@
}
}
-
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPageModel.java 2012-09-18 13:01:10 UTC (rev 43795)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ssh/ManageSSHKeysWizardPageModel.java 2012-09-18 15:13:09 UTC (rev 43796)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard.ssh;
-import java.util.ArrayList;
import java.util.List;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
@@ -23,11 +22,9 @@
*/
public class ManageSSHKeysWizardPageModel extends ObservableUIPojo {
- public static final String PROPERTY_SSH_KEYS = "SSHKeys";
public static final String PROPERTY_SELECTED_KEY = "selectedSSHKey";
private UserDelegate user;
- private List<IOpenShiftSSHKey> keys = new ArrayList<IOpenShiftSSHKey>();
private IOpenShiftSSHKey selectedKey;
public ManageSSHKeysWizardPageModel(UserDelegate user) {
@@ -35,18 +32,13 @@
}
public List<IOpenShiftSSHKey> loadSSHKeys() {
- return setSSHKeys(user.getSSHKeys());
+ return user.getSSHKeys();
}
public List<IOpenShiftSSHKey> getSSHKeys() {
- return keys;
+ return user.getSSHKeys();
}
-
- public List<IOpenShiftSSHKey> setSSHKeys(List<IOpenShiftSSHKey> keys) {
- firePropertyChange(PROPERTY_SSH_KEYS, this.keys, this.keys = keys);
- return this.keys;
- }
-
+
public IOpenShiftSSHKey getSelectedSSHKey() {
return selectedKey;
}
@@ -60,12 +52,10 @@
return;
}
selectedKey.destroy();
- setSSHKeys(user.getSSHKeys());
}
public void refresh() {
user.refresh();
- setSSHKeys(user.getSSHKeys());
}
public UserDelegate getUser() {
More information about the jbosstools-commits
mailing list