Author: adietish
Date: 2011-05-19 05:23:45 -0400 (Thu, 19 May 2011)
New Revision: 31367
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/NewConnectionHandler.java
Log:
[JBIDE-8090] initialized wizards when editing a connection / creating a new connection so
that they show a dialog title
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2011-05-19
09:23:28 UTC (rev 31366)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2011-05-19
09:23:45 UTC (rev 31367)
@@ -17,8 +17,8 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWizard;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.internal.deltacloud.ui.utils.WorkbenchUtils;
@@ -33,9 +33,11 @@
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
- DeltaCloud cloud = WorkbenchUtils.getFirstAdaptedElement(selection,
DeltaCloud.class);
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ DeltaCloud cloud = WorkbenchUtils.getFirstAdaptedElement(structuredSelection,
DeltaCloud.class);
if (cloud != null) {
- IWizard wizard = new EditCloudConnectionWizard(cloud);
+ IWorkbenchWizard wizard = new EditCloudConnectionWizard(cloud);
+ wizard.init(WorkbenchUtils.getWorkbench(), structuredSelection);
WizardDialog dialog = new
WizardDialog(WorkbenchUtils.getActiveWorkbenchWindow().getShell(), wizard);
dialog.create();
dialog.open();
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/NewConnectionHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/NewConnectionHandler.java 2011-05-19
09:23:28 UTC (rev 31366)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/NewConnectionHandler.java 2011-05-19
09:23:45 UTC (rev 31367)
@@ -14,9 +14,13 @@
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWizard;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.internal.deltacloud.ui.utils.WizardUtils;
+import org.jboss.tools.internal.deltacloud.ui.utils.WorkbenchUtils;
import org.jboss.tools.internal.deltacloud.ui.wizards.NewCloudConnectionWizard;
/**
@@ -27,7 +31,10 @@
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- WizardUtils.openWizardDialog(new NewCloudConnectionWizard(), shell);
+ IWorkbenchWizard wizard = new NewCloudConnectionWizard();
+ IStructuredSelection selection = (IStructuredSelection)
HandlerUtil.getCurrentSelectionChecked(event);
+ wizard.init(WorkbenchUtils.getWorkbench(), selection);
+ WizardUtils.openWizardDialog(wizard, shell);
return Status.OK_STATUS;
}
}
Show replies by date