Author: rob.stryker(a)jboss.com
Date: 2010-12-14 04:43:28 -0500 (Tue, 14 Dec 2010)
New Revision: 27434
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ShowInRemoteSystemExplorerHandler.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/build.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
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/NewInstanceWizard.java
Log:
JBIDE-7889 deltacloud integration stuff
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF 2010-12-14
09:29:18 UTC (rev 27433)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/META-INF/MANIFEST.MF 2010-12-14
09:43:28 UTC (rev 27434)
@@ -1,8 +1,16 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: DeltaCloud Core (Experimental)
-Bundle-SymbolicName: org.jboss.tools.deltacloud.as
+Bundle-Name: DeltaCloud Integration (Experimental)
+Bundle-SymbolicName: org.jboss.tools.deltacloud.integration;singleton:=true
Bundle-Version: 0.0.1.qualifier
Bundle-Vendor: Red Hat Inc.
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-
+Bundle-Activator: org.jboss.tools.deltacloud.integration.DeltaCloudIntegrationPlugin
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Require-Bundle: org.jboss.tools.common,
+ org.eclipse.rse.core,
+ org.eclipse.core.runtime,
+ org.eclipse.jface,
+ org.eclipse.ui,
+ org.jboss.tools.deltacloud.core,
+ org.jboss.tools.deltacloud.ui,
+ org.jboss.ide.eclipse.as.core
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/build.properties
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/build.properties 2010-12-14
09:29:18 UTC (rev 27433)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/build.properties 2010-12-14
09:43:28 UTC (rev 27434)
@@ -2,19 +2,11 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
- lib/apache-mime4j-0.6.jar,\
- lib/commons-codec-1.3.jar,\
- lib/commons-logging-1.1.1.jar,\
- lib/httpclient-4.0.1.jar,\
- lib/httpcore-4.0.1.jar,\
- lib/httpcore-nio-4.0.1.jar,\
- lib/httpmime-4.0.1.jar,\
- lib/log4j-1.2.14.jar,\
about.html,\
+ plugin.properties,\
pom.xml,\
src/,\
- .settings/,\
- .project
+ .project,\
+ plugin.xml
src.includes = bin/,\
- lib/,\
pom.xml
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 2010-12-14
09:29:18 UTC (rev 27433)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2010-12-14
09:43:28 UTC (rev 27434)
@@ -6,19 +6,21 @@
Bundle-Activator: org.jboss.tools.deltacloud.ui.Activator
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
-Require-Bundle: org.jboss.tools.common;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.ui;bundle-version="[3.6.0,4.0.0)",
- org.eclipse.equinox.security;bundle-version="[1.0.100,2.0.0)",
- org.eclipse.core.runtime;bundle-version="[3.6.0,4.0.0)",
- org.eclipse.ui.views;bundle-version="[3.4.1,4.0.0)",
- org.eclipse.ui.views.properties.tabbed;bundle-version="[3.5.0,4.0.0)",
- org.jboss.tools.deltacloud.core;bundle-version="[0.0.1,1.0.0]",
- org.eclipse.rse.core;bundle-version="[3.1.1,4.0.0)",
- org.eclipse.jface.databinding;bundle-version="[1.4.0,2.0.0)",
- org.eclipse.core.databinding;bundle-version="[1.3.100,2.0.0)",
- org.eclipse.core.databinding.observable;bundle-version="[1.3.0,2.0.0)",
- org.eclipse.core.databinding.property;bundle-version="[1.3.0,2.0.0)",
- org.eclipse.core.databinding.beans;bundle-version="[1.2.100,2.0.0)",
- org.eclipse.core.expressions;bundle-version="[3.4.200,4.0.0)"
+Require-Bundle: org.jboss.tools.common,
+ org.eclipse.ui,
+ org.eclipse.equinox.security,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.views,
+ org.eclipse.ui.views.properties.tabbed,
+ org.jboss.tools.deltacloud.core,
+ org.eclipse.rse.core,
+ org.eclipse.jface.databinding,
+ org.eclipse.core.databinding,
+ org.eclipse.core.databinding.observable,
+ org.eclipse.core.databinding.property,
+ org.eclipse.core.databinding.beans,
+ org.eclipse.core.expressions
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
+Export-Package: org.jboss.tools.deltacloud.ui,
+ org.jboss.tools.internal.deltacloud.ui.utils
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties 2010-12-14
09:29:18 UTC (rev 27433)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties 2010-12-14
09:43:28 UTC (rev 27434)
@@ -57,6 +57,3 @@
command.filterimages.name = Filter Images...
command.filterinstances.description = Filters instances
command.filterinstancesname = Filter Instances...
-command.showInRemoteSysExplorer=Show in Remote System Explorer...
-command.showInRemoteSysExplorer.tooltip=Show in Remote System Explorer...
-command.showInRemoteSysExplorer.description=Show in Remote System Explorer
\ No newline at end of file
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-14 09:29:18
UTC (rev 27433)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-14 09:43:28
UTC (rev 27434)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
+ <extension-point id="newInstanceWizardPage"
name="org.jboss.tools.deltacloud.ui.newInstanceWizardPage"
schema="schema/newInstanceWizardPage.exsd"/>
<extension
point="org.eclipse.ui.views">
<category
@@ -382,34 +383,6 @@
</enabledWhen>
</handler>
</extension>
- <!-- Show in remote system explorer handler -->
- <extension
- point="org.eclipse.ui.handlers">
- <handler
-
class="org.jboss.tools.deltacloud.ui.commands.ShowInRemoteSystemExplorerHandler"
-
commandId="org.jboss.tools.deltacloud.ui.showremotesysexplorer">
- <activeWhen>
- <with
- variable="selection">
- <iterate operator="and">
- <and>
- <adapt
-
type="org.jboss.tools.deltacloud.core.DeltaCloudInstance">
- <test property="org.jboss.tools.deltacloud.ui.commands.isRunning"
- value="true"/>
- </adapt>
- </and>
- </iterate>
- </with>
- </activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <count value="+" />
- </with>
- </enabledWhen>
- </handler>
- </extension>
<!-- InstanceView context menu ================================== -->
<extension point="org.eclipse.ui.menus">
<menuContribution
@@ -424,9 +397,6 @@
<separator
name="additions"
visible="true" />
- <separator
- name="remoteSysExplorer"
- visible="true" />
</menuContribution>
<!-- instance commands -->
<menuContribution
@@ -487,19 +457,6 @@
tooltip="%command.refreshinstances.tooltip">
</command>
</menuContribution>
- <!-- remote system explorer -->
- <menuContribution
- allPopups="true"
-
locationURI="popup:org.jboss.tools.deltacloud.ui.views.InstanceView?after=remoteSysExplorer">
- <command
- commandId="org.jboss.tools.deltacloud.ui.showremotesysexplorer"
- disabledIcon="icons/system_viewd.gif"
- icon="icons/system_view.gif"
- label="%command.showInRemoteSysExplorer"
- style="push"
- tooltip="%command.showInRemoteSysExplorer.tooltip">
- </command>
- </menuContribution>
</extension>
<extension point="org.eclipse.ui.menus">
<!-- InstanceView toolbar ================================== -->
@@ -546,14 +503,6 @@
style="push"
tooltip="%command.destroyinstance.tooltip">
</command>
- <command
- commandId="org.jboss.tools.deltacloud.ui.showremotesysexplorer"
- disabledIcon="icons/system_viewd.gif"
- icon="icons/system_view.gif"
- label="%command.showInRemoteSysExplorer"
- style="push"
- tooltip="%command.showInRemoteSysExplorer.tooltip">
- </command>
</menuContribution>
<!-- DeltaCloudView toolbar ================================== -->
<menuContribution
@@ -591,9 +540,6 @@
<separator
name="filters"
visible="true" />
- <separator
- name="remoteSysExplorer"
- visible="true" />
</menuContribution>
<!-- instance commands -->
<menuContribution
@@ -731,19 +677,6 @@
tooltip="%command.filterinstances.tooltip">
</command>
</menuContribution>
- <!-- remote system explorer -->
- <menuContribution
- allPopups="true"
-
locationURI="popup:org.jboss.tools.deltacloud.ui.views.DeltaCloudView?after=remoteSysExplorer">
- <command
- commandId="org.jboss.tools.deltacloud.ui.showremotesysexplorer"
- disabledIcon="icons/system_viewd.gif"
- icon="icons/system_view.gif"
- label="%command.showInRemoteSysExplorer"
- style="push"
- tooltip="%command.showInRemoteSysExplorer.tooltip">
- </command>
- </menuContribution>
</extension>
<extension point="org.eclipse.ui.menus">
@@ -854,12 +787,6 @@
id="org.jboss.tools.deltacloud.ui.filterinstances"
name="%command.filterinstances.name">
</command>
- <!-- launch remote system explorer command -->
- <command
- description="%command.showInRemoteSysExplorer.description"
- id="org.jboss.tools.deltacloud.ui.showremotesysexplorer"
- name="%command.showInRemoteSysExplorer">
- </command>
</extension>
<extension point="org.eclipse.core.expressions.propertyTesters">
<propertyTester
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java 2010-12-14
09:29:18 UTC (rev 27433)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/RSEUtils.java 2010-12-14
09:43:28 UTC (rev 27434)
@@ -1,158 +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.deltacloud.ui;
-
-import java.text.MessageFormat;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.rse.core.IRSECoreRegistry;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.core.model.SystemStartHere;
-import org.eclipse.rse.core.subsystems.IConnectorService;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
-import org.jboss.tools.common.log.StatusFactory;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.views.CVMessages;
-import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
-
-/**
- * @author André Dietisheim
- */
-public class RSEUtils {
-
- private static final String VIEW_REMOTESYSEXPLORER_ID =
"org.eclipse.rse.ui.view.systemView";
- private final static String RSE_CONNECTING_MSG = "ConnectingRSE.msg";
//$NON-NLS-1$
-
- public static IRSESystemType getSSHOnlySystemType() {
- IRSESystemType sshType = null;
- RSECorePlugin rsep = RSECorePlugin.getDefault();
- IRSECoreRegistry coreRegistry = rsep.getCoreRegistry();
- IRSESystemType[] sysTypes = coreRegistry.getSystemTypes();
- for (IRSESystemType sysType : sysTypes) {
- if (sysType.getId().equals(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID))
- sshType = sysType;
- }
- Assert.isTrue(sshType != null,
- "Remote System Explorer could not initialize SSH subsystem: ssh type not
found");
- return sshType;
- }
-
- public static ISystemRegistry getSystemRegistry() {
- return SystemStartHere.getSystemRegistry();
- }
-
- public static String createConnectionName(DeltaCloudInstance instance) {
- Assert.isLegal(instance != null, "Cannot create connection name: instance is not
defined");
- return instance.getName() + " [" + instance.getId() + "]";
//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public static String createHostName(DeltaCloudInstance instance) {
- Assert.isLegal(instance != null, "Cannot get hostname: instance is not
defined");
-
- String hostName = instance.getHostName();
- Assert.isTrue(hostName != null && hostName.length() > 0,
- MessageFormat.format("Cannot get host name: not defined for instance {0}",
instance.getName()));
- return hostName;
- }
-
- public static IHost createHost(String connectionName, String hostname, IRSESystemType
systemType,
- ISystemRegistry systemRegistry) throws Exception {
- // TODO: Internationalize strings
- Assert.isLegal(connectionName != null && connectionName.length() > 0,
- "Cannot create Host: connectionName is not defined");
- Assert.isLegal(hostname != null && hostname.length() > 0, "Cannot
create Host: hostname is not defined");
- Assert.isLegal(systemType != null, "Cannot create Host: system type is not
defined");
- Assert.isLegal(systemRegistry != null, "Cannot create Host: system registry is not
defined");
-
- IHost host = systemRegistry.createHost(systemType, connectionName, hostname, null);
- host.setDefaultUserId("root"); //$NON-NLS-1$
- return host;
- }
-
- public static IConnectorService getConnectorService(IHost host) {
- IConnectorService[] services = host.getConnectorServices();
- if (services == null || services.length <= 0) {
- return null;
- }
- return services[0];
- }
-
- public static Job connect(String connectionName, final IConnectorService service)
- throws Exception {
- // TODO: internationalize strings
- Assert.isLegal(connectionName != null,
- "Remote System Explorer could not connect: connection name is not
defined");
- Assert.isLegal(service != null, "Remote System Explorer could not connect:
connector service not found.");
-
- Job job = new Job(CVMessages.getFormattedString(RSE_CONNECTING_MSG, connectionName)) {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- monitor.worked(1);
- service.connect(monitor);
- monitor.done();
- return Status.OK_STATUS;
- } catch (Exception e) {
- // odd behavior: service reports connection failure even if things seem to work
(view opens up with connection in it)
- // ignore errors since things work
- //
- // return StatusFactory.getInstance(IStatus.ERROR,
- // Activator.PLUGIN_ID, e.getMessage(), e);
- return Status.OK_STATUS;
- }
- }
- };
- job.setUser(true);
- job.schedule();
- return job;
- }
-
- public static void showRemoteSystemExplorer(Job job) {
- job.addJobChangeListener(new JobChangeAdapter() {
-
- @Override
- public void done(IJobChangeEvent event) {
- super.done(event);
- showRemoteSystemExplorer();
- }
- });
- }
-
- public static void showRemoteSystemExplorer() {
- Display.getDefault().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- try {
- UIUtils.showView(VIEW_REMOTESYSEXPLORER_ID);
- } catch (PartInitException e) {
- IStatus status = StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
e.getMessage(), e);
- // TODO: internationalize strings
- ErrorDialog.openError(UIUtils.getActiveShell(),
- "Error",
- "Could not launch remote system explorer",
- status);
- }
- }
- });
- }
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ShowInRemoteSystemExplorerHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ShowInRemoteSystemExplorerHandler.java 2010-12-14
09:29:18 UTC (rev 27433)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/ShowInRemoteSystemExplorerHandler.java 2010-12-14
09:43:28 UTC (rev 27434)
@@ -1,57 +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.deltacloud.ui.commands;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.jboss.tools.common.log.StatusFactory;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.Activator;
-import org.jboss.tools.deltacloud.ui.RSEUtils;
-import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
-
-/**
- * @author Andre Dietisheim
- */
-public class ShowInRemoteSystemExplorerHandler extends AbstractHandler implements
IHandler {
-
- @Override
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- if (selection instanceof IStructuredSelection) {
- DeltaCloudInstance instance = UIUtils.getFirstAdaptedElement(selection,
DeltaCloudInstance.class);
- try {
- String connectionName = RSEUtils.createConnectionName(instance);
- IHost host = RSEUtils.createHost(connectionName,
- RSEUtils.createHostName(instance),
- RSEUtils.getSSHOnlySystemType(),
- RSEUtils.getSystemRegistry());
- Job connectJob = RSEUtils.connect(connectionName,
RSEUtils.getConnectorService(host));
- RSEUtils.showRemoteSystemExplorer(connectJob);
- } catch (Exception e) {
- return StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
- "Could not launch remote system explorer for instance \"" +
instance.getName() + "\"",
- e);
- }
- }
-
- return Status.OK_STATUS;
- }
-}
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 2010-12-14
09:29:18 UTC (rev 27433)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-12-14
09:43:28 UTC (rev 27434)
@@ -530,8 +530,6 @@
private void asyncGetRealms() {
// TODO: internationalize strings
new AbstractCloudElementJob("Get realms", cloud, CLOUDELEMENT.REALMS) {
-
- @Override
protected IStatus doRun(IProgressMonitor monitor) throws Exception {
realms = getRealms();
Display.getDefault().asyncExec(new Runnable() {
@@ -547,8 +545,6 @@
private void asyncGetProfiles() {
// TODO: internationalize strings
new AbstractCloudElementJob("Get Profiles", cloud, CLOUDELEMENT.PROFILES) {
-
- @Override
protected IStatus doRun(IProgressMonitor monitor) throws Exception {
allProfiles = getProfiles();
profilePages = new HashMap<String, ProfileComposite>();
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2010-12-14
09:29:18 UTC (rev 27433)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2010-12-14
09:43:28 UTC (rev 27434)
@@ -20,17 +20,17 @@
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.rse.core.model.IHost;
+import org.jboss.tools.common.jobs.ChainedJob;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
-import org.jboss.tools.deltacloud.core.job.InstanceStateJob;
import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.DeltacloudUIExtensionManager;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
-import org.jboss.tools.deltacloud.ui.RSEUtils;
+import org.jboss.tools.deltacloud.ui.INewInstanceWizardPage;
import org.osgi.service.prefs.Preferences;
public class NewInstanceWizard extends Wizard {
@@ -40,9 +40,11 @@
private final static String CONFIRM_CREATE_TITLE = "ConfirmCreate.title";
//$NON-NLS-1$
private final static String CONFIRM_CREATE_MSG = "ConfirmCreate.msg";
//$NON-NLS-1$
private final static String DONT_SHOW_THIS_AGAIN_MSG =
"DontShowThisAgain.msg"; //$NON-NLS-1$
+ private final static String STARTING_INSTANCE_MSG = "StartingInstance.msg";
//$NON-NLS-1$
private final static String STARTING_INSTANCE_TITLE =
"StartingInstance.title"; //$NON-NLS-1$
protected NewInstancePage mainPage;
+ protected INewInstanceWizardPage[] additionalPages;
protected DeltaCloud cloud;
protected DeltaCloudInstance instance;
/**
@@ -62,9 +64,13 @@
@Override
public void addPages() {
mainPage = new NewInstancePage(cloud);
- if (image != null)
+ if( image != null )
mainPage.setImage(image);
addPage(mainPage);
+ additionalPages =
DeltacloudUIExtensionManager.getDefault().loadNewInstanceWizardPages();
+ for( int i = 0; i < additionalPages.length; i++ ) {
+ addPage(additionalPages[i]);
+ }
}
@Override
@@ -72,46 +78,45 @@
return mainPage.isPageComplete();
}
- private class WatchCreateJob extends InstanceStateJob {
+ private class WatchCreateJob extends ChainedJob {
- public WatchCreateJob(DeltaCloudInstance instance) {
- super(WizardMessages.getString(STARTING_INSTANCE_TITLE), instance,
DeltaCloudInstance.State.RUNNING);
- setUser(true);
+ private DeltaCloud cloud;
+ private String instanceId;
+ private String instanceName;
+
+ public WatchCreateJob(String title, DeltaCloud cloud,
+ String instanceId, String instanceName) {
+ super(title, INewInstanceWizardPage.NEW_INSTANCE_FAMILY);
+ this.cloud = cloud;
+ this.instanceId = instanceId;
+ this.instanceName = instanceName;
}
- @Override
- public IStatus doRun(IProgressMonitor monitor) {
- // DeltaCloudInstance instance = null;
- try {
- super.doRun(monitor);
- } catch (Exception e) {
- // do nothing
- } finally {
- // cloud.replaceInstance(instance);
- String hostname = RSEUtils.createHostName(instance);
- if (hostname != null && hostname.length() > 0 && isAutoconnect())
{
- try {
- String connectionName = RSEUtils.createConnectionName(instance);
- IHost host = RSEUtils.createHost(connectionName,
- RSEUtils.createHostName(instance),
- RSEUtils.getSSHOnlySystemType(),
- RSEUtils.getSystemRegistry());
- RSEUtils.connect(connectionName, RSEUtils.getConnectorService(host));
- } catch (Exception e) {
- return ErrorUtils.handleError("Error",
- "Could not launch remote system explorer for instance \""
- + instance.getName() + "\"", e, getShell());
- }
+ public IStatus run(IProgressMonitor pm) {
+ if (!pm.isCanceled()) {
+ DeltaCloudInstance instance = null;
+ try {
+ pm.beginTask(
+ WizardMessages.getFormattedString(STARTING_INSTANCE_MSG, new String[] {
instanceName }),
+ IProgressMonitor.UNKNOWN);
+ pm.worked(1);
+ cloud.registerInstanceJob(instanceId, this);
+ instance = cloud.waitWhilePending(instanceId, pm);
+
+ } catch (Exception e) {
+ // do nothing
+ } finally {
+ cloud.replaceInstance(instance);
+ cloud.removeInstanceJob(instanceId, this);
+ System.out.println(instance.getHostName());
+ pm.done();
}
+ return Status.OK_STATUS;
+ } else {
+ pm.done();
+ return Status.CANCEL_STATUS;
}
- return Status.OK_STATUS;
}
-
- private boolean isAutoconnect() {
- Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
- boolean autoConnect =
prefs.getBoolean(IDeltaCloudPreferenceConstants.AUTO_CONNECT_INSTANCE, true);
- return autoConnect;
- }
};
@Override
@@ -158,7 +163,23 @@
result = true;
}
if (instance != null &&
instance.getState().equals(DeltaCloudInstance.State.PENDING)) {
- new WatchCreateJob(instance).schedule();
+ final String instanceId = instance.getId();
+ final String instanceName = name;
+
+ // TODO use chained job? Maybe. But chainedJob needs to be moved
+ ChainedJob first = new
WatchCreateJob(WizardMessages.getString(STARTING_INSTANCE_TITLE),
+ cloud, instanceId, instanceName);
+ first.setUser(true);
+ ChainedJob last = first;
+ ChainedJob temp;
+ for( int i = 0; i < additionalPages.length; i++ ) {
+ temp = additionalPages[i].getPerformFinishJob(instance);
+ if( temp != null ) {
+ last.setNextJob(temp);
+ last = temp;
+ }
+ }
+ first.schedule();
}
} catch (DeltaCloudException ex) {
e = ex;