Author: adietish
Date: 2011-01-17 09:50:08 -0500 (Mon, 17 Jan 2011)
New Revision: 28304
Modified:
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/WizardUtils.java
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java
Log:
[JBIDE-8126] close manage keys dialog on double click on a key
Modified:
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/WizardUtils.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/WizardUtils.java 2011-01-17
14:49:35 UTC (rev 28303)
+++
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/WizardUtils.java 2011-01-17
14:50:08 UTC (rev 28304)
@@ -18,7 +18,9 @@
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
/**
* @author André Dietisheim
@@ -39,7 +41,7 @@
* the invocation target exception
* @throws InterruptedException
* the interrupted exception
- *
+ *
* @author André Dietisheim
*/
public static void runInWizard(final Job job, IWizardContainer container) throws
InvocationTargetException,
@@ -62,4 +64,22 @@
}
});
}
+
+ /**
+ * Flips to the next wizard page or finishes the current wizard.
+ *
+ * @param wizardPage
+ * the wizard page this call is executed in
+ */
+ public static void nextPageOrFinish(IWizardPage wizardPage) {
+ IWizard wizard = wizardPage.getWizard();
+ if (wizardPage.canFlipToNextPage()) {
+ IWizardPage nextPage = wizard.getNextPage(wizardPage);
+ wizard.getContainer().showPage(nextPage);
+ } else if (wizard.canFinish()) {
+ if (wizard.performFinish()) {
+ wizard.getContainer().getShell().close();
+ }
+ }
+ }
}
Modified:
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java
===================================================================
---
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java 2011-01-17
14:49:35 UTC (rev 28303)
+++
branches/jbosstools-3.2.0.CR1/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java 2011-01-17
14:50:08 UTC (rev 28304)
@@ -42,9 +42,11 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
+import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.common.log.StatusFactory;
@@ -266,6 +268,9 @@
BeanProperties.value(ManageKeysPageModel.PROP_SELECTED_KEY).observe(model),
new UpdateValueStrategy().setConverter(new Id2KeyConverter()),
new UpdateValueStrategy().setConverter(new Key2IdConverter()));
+
+ keyList.addListener(SWT.MouseDoubleClick, onKeyDoubleclick());
+
return keyList;
}
@@ -293,6 +298,16 @@
};
}
+ private Listener onKeyDoubleclick() {
+ return new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ WizardUtils.nextPageOrFinish(ManageKeysPage.this);
+ }
+ };
+ }
+
private void refreshKeys() {
Job job = new AbstractCloudElementJob("Get keys", model.getCloud(),
CLOUDELEMENT.KEYS) {