JBoss Tools SVN: r27438 - in workspace/snjeza/runtime-update: features and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2010-12-14 05:37:54 -0500 (Tue, 14 Dec 2010)
New Revision: 27438
Added:
workspace/snjeza/runtime-update/features/org.jboss.tools.runtime.core.feature_1.0.0.201012141134.jar
workspace/snjeza/runtime-update/features/org.jboss.tools.runtime.feature_1.2.0.201012141134.jar
workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime.core_1.0.0.201012141134.jar
workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime.ui_1.0.0.201012141134.jar
workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime_1.2.0.201012141134.jar
Removed:
workspace/snjeza/runtime-update/features/org.jboss.tools.runtime.core.feature_1.0.0.201012092004.jar
workspace/snjeza/runtime-update/features/org.jboss.tools.runtime.feature_1.2.0.201012092004.jar
workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime.core_1.0.0.201012092004.jar
workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime.ui_1.0.0.201012092004.jar
workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime_1.2.0.201012092004.jar
Modified:
workspace/snjeza/runtime-update/artifacts.jar
workspace/snjeza/runtime-update/content.jar
workspace/snjeza/runtime-update/site.xml
Log:
JBIDE-7527 JBoss Runtime Detection update site
Modified: workspace/snjeza/runtime-update/artifacts.jar
===================================================================
(Binary files differ)
Modified: workspace/snjeza/runtime-update/content.jar
===================================================================
(Binary files differ)
Deleted: workspace/snjeza/runtime-update/features/org.jboss.tools.runtime.core.feature_1.0.0.201012092004.jar
===================================================================
(Binary files differ)
Added: workspace/snjeza/runtime-update/features/org.jboss.tools.runtime.core.feature_1.0.0.201012141134.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/runtime-update/features/org.jboss.tools.runtime.core.feature_1.0.0.201012141134.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: workspace/snjeza/runtime-update/features/org.jboss.tools.runtime.feature_1.2.0.201012092004.jar
===================================================================
(Binary files differ)
Added: workspace/snjeza/runtime-update/features/org.jboss.tools.runtime.feature_1.2.0.201012141134.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/runtime-update/features/org.jboss.tools.runtime.feature_1.2.0.201012141134.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime.core_1.0.0.201012092004.jar
===================================================================
(Binary files differ)
Added: workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime.core_1.0.0.201012141134.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime.core_1.0.0.201012141134.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime.ui_1.0.0.201012092004.jar
===================================================================
(Binary files differ)
Added: workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime.ui_1.0.0.201012141134.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime.ui_1.0.0.201012141134.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime_1.2.0.201012092004.jar
===================================================================
(Binary files differ)
Added: workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime_1.2.0.201012141134.jar
===================================================================
(Binary files differ)
Property changes on: workspace/snjeza/runtime-update/plugins/org.jboss.tools.runtime_1.2.0.201012141134.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: workspace/snjeza/runtime-update/site.xml
===================================================================
--- workspace/snjeza/runtime-update/site.xml 2010-12-14 10:21:22 UTC (rev 27437)
+++ workspace/snjeza/runtime-update/site.xml 2010-12-14 10:37:54 UTC (rev 27438)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
- <feature url="features/org.jboss.tools.runtime.core.feature_1.0.0.201012092004.jar" id="org.jboss.tools.runtime.core.feature" version="1.0.0.201012092004">
+ <feature url="features/org.jboss.tools.runtime.core.feature_1.0.0.201012141134.jar" id="org.jboss.tools.runtime.core.feature" version="1.0.0.201012141134">
<category name="org.jboss.tools.runtime.category"/>
</feature>
- <feature url="features/org.jboss.tools.runtime.feature_1.2.0.201012092004.jar" id="org.jboss.tools.runtime.feature" version="1.2.0.201012092004">
+ <feature url="features/org.jboss.tools.runtime.feature_1.2.0.201012141134.jar" id="org.jboss.tools.runtime.feature" version="1.2.0.201012141134">
<category name="org.jboss.tools.runtime.category"/>
</feature>
<category-def name="org.jboss.tools.runtime.category" label="JBoss Runtime Detection"/>
14 years, 1 month
JBoss Tools SVN: r27437 - trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2010-12-14 05:21:22 -0500 (Tue, 14 Dec 2010)
New Revision: 27437
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-7884
Set Validation mode to none for all console configuration types.
Modified: trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2010-12-14 10:00:27 UTC (rev 27436)
+++ trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2010-12-14 10:21:22 UTC (rev 27437)
@@ -156,10 +156,15 @@
// TODO: delegate to some extension point
private Configuration buildConfiguration(Properties properties, boolean includeMappings) {
Configuration localCfg = null;
+ Properties overrides = new Properties();
+ overrides.put("javax.persistence.validation.mode", "none"); //$NON-NLS-1$//$NON-NLS-2$
+ if (properties != null) {
+ overrides.putAll(properties);
+ }
if (prefs.getConfigurationMode().equals(ConfigurationMode.ANNOTATIONS)) {
try {
localCfg = buildAnnotationConfiguration();
- localCfg = configureStandardConfiguration(includeMappings, localCfg, properties);
+ localCfg = configureStandardConfiguration(includeMappings, localCfg, overrides);
} catch (HibernateConsoleRuntimeException he) {
throw he;
} catch (Exception e) {
@@ -170,7 +175,7 @@
} else if (prefs.getConfigurationMode().equals(ConfigurationMode.JPA)) {
try {
localCfg = buildJPAConfiguration(getPreferences().getPersistenceUnitName(),
- properties, prefs.getEntityResolverName(), includeMappings);
+ overrides, prefs.getEntityResolverName(), includeMappings);
} catch (HibernateConsoleRuntimeException he) {
throw he;
} catch (Exception e) {
@@ -179,7 +184,7 @@
}
} else {
localCfg = new Configuration();
- localCfg = configureStandardConfiguration(includeMappings, localCfg, properties);
+ localCfg = configureStandardConfiguration(includeMappings, localCfg, overrides);
}
return localCfg;
}
@@ -200,9 +205,8 @@
}
try {
Map<Object, Object> overrides = new HashMap<Object, Object>();
- if (properties != null) {
- overrides.putAll(properties);
- }
+ overrides.putAll(properties);
+
if (StringHelper.isNotEmpty(prefs.getNamingStrategy())) {
overrides.put("hibernate.ejb.naming_strategy", prefs.getNamingStrategy()); //$NON-NLS-1$
}
@@ -212,9 +216,6 @@
if (!includeMappings) {
overrides.put("hibernate.archive.autodetection", "none"); //$NON-NLS-1$//$NON-NLS-2$
}
- if (StringHelper.isEmpty((String) overrides.get("javax.persistence.validation.mode"))) {//$NON-NLS-1$
- overrides.put("javax.persistence.validation.mode", "none"); //$NON-NLS-1$//$NON-NLS-2$
- }
Class<?> clazz = ReflectHelper.classForName(
"org.hibernate.ejb.Ejb3Configuration", ConsoleConfiguration.class); //$NON-NLS-1$
Object ejb3cfg = clazz.newInstance();
@@ -247,9 +248,8 @@
private Configuration configureStandardConfiguration(final boolean includeMappings,
Configuration localCfg, Properties properties) {
- if (properties != null) {
- localCfg = localCfg.setProperties(properties);
- }
+ localCfg = localCfg.setProperties(properties);
+
EntityResolver entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;
if (StringHelper.isNotEmpty(prefs.getEntityResolverName())) {
try {
14 years, 1 month
JBoss Tools SVN: r27436 - trunk/deltacloud/features/org.jboss.tools.deltacloud.feature.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-14 05:00:27 -0500 (Tue, 14 Dec 2010)
New Revision: 27436
Modified:
trunk/deltacloud/features/org.jboss.tools.deltacloud.feature/
trunk/deltacloud/features/org.jboss.tools.deltacloud.feature/feature.xml
Log:
remove as-plugin, added ui-plugin
Property changes on: trunk/deltacloud/features/org.jboss.tools.deltacloud.feature
___________________________________________________________________
Name: svn:ignore
- target
+ target
.settings
Modified: trunk/deltacloud/features/org.jboss.tools.deltacloud.feature/feature.xml
===================================================================
--- trunk/deltacloud/features/org.jboss.tools.deltacloud.feature/feature.xml 2010-12-14 09:47:38 UTC (rev 27435)
+++ trunk/deltacloud/features/org.jboss.tools.deltacloud.feature/feature.xml 2010-12-14 10:00:27 UTC (rev 27436)
@@ -23,14 +23,14 @@
</requires>
<plugin
- id="org.jboss.tools.deltacloud.core"
+ id="org.jboss.tools.deltacloud.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
- id="org.jboss.tools.deltacloud.as"
+ id="org.jboss.tools.deltacloud.core"
download-size="0"
install-size="0"
version="0.0.0"
14 years, 1 month
JBoss Tools SVN: r27435 - in trunk/deltacloud/plugins: org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2010-12-14 04:47:38 -0500 (Tue, 14 Dec 2010)
New Revision: 27435
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/plugin.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/schema/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/DeltaCloudIntegrationPlugin.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/Messages.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/messages.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/ShowInRemoteSystemExplorerHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/RSEandASWizardPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/schema/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/schema/newInstanceWizardPage.exsd
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltacloudUIExtensionManager.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/INewInstanceWizardPage.java
Log:
"JBIDE-7889 deltacloud integration stuff"
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/plugin.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/plugin.properties (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/plugin.properties 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,3 @@
+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
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/plugin.xml (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/plugin.xml 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <!-- Show in remote system explorer handler -->
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.jboss.tools.deltacloud.integration.rse.util.ShowInRemoteSystemExplorerHandler"
+ commandId="org.jboss.tools.deltacloud.integration.rse.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>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ description="%command.showInRemoteSysExplorer.description"
+ id="org.jboss.tools.deltacloud.integration.rse.showremotesysexplorer"
+ name="%command.showInRemoteSysExplorer">
+ </command>
+ </extension>
+ <extension point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="true"
+ locationURI="popup:org.jboss.tools.deltacloud.ui.views.InstanceView?after=additions">
+ <command
+ commandId="org.jboss.tools.deltacloud.integration.rse.showremotesysexplorer"
+ disabledIcon="icons/system_viewd.gif"
+ icon="icons/system_view.gif"
+ label="%command.showInRemoteSysExplorer"
+ style="push"
+ tooltip="%command.showInRemoteSysExplorer.tooltip">
+ </command>
+ </menuContribution>
+ </extension>
+ <menuContribution
+ allPopups="true"
+ locationURI="toolbar:org.jboss.tools.deltacloud.ui.views.InstanceView?after=instances">
+ <command
+ commandId="org.jboss.tools.deltacloud.integration.rse.showremotesysexplorer"
+ disabledIcon="icons/system_viewd.gif"
+ icon="icons/system_view.gif"
+ label="%command.showInRemoteSysExplorer"
+ style="push"
+ tooltip="%command.showInRemoteSysExplorer.tooltip">
+ </command>
+ </menuContribution>
+ <extension
+ point="org.jboss.tools.deltacloud.ui.newInstanceWizardPage">
+ <page
+ class="org.jboss.tools.deltacloud.integration.wizard.RSEandASWizardPage"
+ id="org.jboss.tools.deltacloud.integration.RSEandASPage">
+ </page>
+ </extension>
+</plugin>
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/DeltaCloudIntegrationPlugin.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/DeltaCloudIntegrationPlugin.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/DeltaCloudIntegrationPlugin.java 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,47 @@
+package org.jboss.tools.deltacloud.integration;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+public class DeltaCloudIntegrationPlugin extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.deltacloud.integration";
+
+ // The shared instance
+ private static DeltaCloudIntegrationPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public DeltaCloudIntegrationPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static DeltaCloudIntegrationPlugin getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/Messages.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/Messages.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/Messages.java 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,18 @@
+package org.jboss.tools.deltacloud.integration;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages {
+ private static final String BUNDLE_NAME = DeltaCloudIntegrationPlugin.PLUGIN_ID + ".Messages"; //$NON-NLS-1$
+
+ public static String ERROR;
+ public static String COULD_NOT_LAUNCH_RSE_EXPLORER;
+ public static String COULD_NOT_LAUNCH_RSE_EXPLORER2;
+ public static String RSE_CONNECTING_MESSAGE;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+ private Messages() {
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/messages.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/messages.properties (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/messages.properties 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,4 @@
+RSE_CONNECTING_MESSAGE=Connecting instance as: {0}
+COULD_NOT_LAUNCH_RSE_EXPLORER=Could not open remote system explorer
+COULD_NOT_LAUNCH_RSE_EXPLORER2=Could not launch remote system explorer for instance "{0}"
+ERROR=Error
\ No newline at end of file
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/RSEUtils.java 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * 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.integration.rse.util;
+
+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.osgi.util.NLS;
+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.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.integration.DeltaCloudIntegrationPlugin;
+import org.jboss.tools.deltacloud.integration.Messages;
+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";
+
+ 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();
+ System.out.println(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(NLS.bind(Messages.RSE_CONNECTING_MESSAGE, 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) {
+ // I have no idea wtf is wrong here
+ // but my dev environment will not let me use common classes
+// IStatus status = StatusFactory.getInstance(IStatus.ERROR,
+// DeltaCloudIntegrationPlugin.PLUGIN_ID, e.getMessage(), e);
+ Status status = new Status(IStatus.ERROR, DeltaCloudIntegrationPlugin.PLUGIN_ID, e.getMessage(), e);
+ ErrorDialog.openError(UIUtils.getActiveShell(),
+ Messages.ERROR,
+ Messages.COULD_NOT_LAUNCH_RSE_EXPLORER,
+ status);
+ }
+ }
+ });
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/ShowInRemoteSystemExplorerHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/ShowInRemoteSystemExplorerHandler.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/rse/util/ShowInRemoteSystemExplorerHandler.java 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.integration.rse.util;
+
+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.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.integration.DeltaCloudIntegrationPlugin;
+import org.jboss.tools.deltacloud.integration.Messages;
+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 new Status(IStatus.ERROR, DeltaCloudIntegrationPlugin.PLUGIN_ID,
+ Messages.COULD_NOT_LAUNCH_RSE_EXPLORER2, e);
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/RSEandASWizardPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/RSEandASWizardPage.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.integration/src/org/jboss/tools/deltacloud/integration/wizard/RSEandASWizardPage.java 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,130 @@
+package org.jboss.tools.deltacloud.integration.wizard;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Widget;
+import org.jboss.tools.common.jobs.ChainedJob;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.integration.DeltaCloudIntegrationPlugin;
+import org.jboss.tools.deltacloud.integration.Messages;
+import org.jboss.tools.deltacloud.integration.rse.util.RSEUtils;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
+import org.jboss.tools.deltacloud.ui.INewInstanceWizardPage;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+
+public class RSEandASWizardPage extends WizardPage implements INewInstanceWizardPage {
+
+ private Button createRSE;
+ private Button createServer;
+ private final static String CREATE_RSE_PREF_KEY = "org.jboss.tools.deltacloud.integration.wizard.RSEandASWizard.CREATE_RSE_PREF_KEY";
+ private final static String CREATE_SERVER_PREF_KEY = "org.jboss.tools.deltacloud.integration.wizard.RSEandASWizard.CREATE_SERVER_PREF_KEY";
+
+ public RSEandASWizardPage() {
+ super("Blah Wizard Page");
+ setTitle("Blah Title");
+ setDescription("Blah Desc");
+ }
+
+ public void createControl(Composite parent) {
+ Composite c2 = new Composite(parent, SWT.NONE);
+ c2.setLayout(new FormLayout());
+ createRSE = new Button(c2, SWT.CHECK);
+ createRSE.setText("Create RSE Connection");
+ createRSE.setLayoutData(UIUtils.createFormData(0, 5, null, 0, 0, 5, 100, -5));
+ createServer = new Button(c2, SWT.CHECK);
+ createServer.setText("Create Server Adapter");
+ createServer.setLayoutData(UIUtils.createFormData(createRSE, 5, null, 0, 0, 5, 100, -5));
+
+ IEclipsePreferences prefs = new InstanceScope().getNode(DeltaCloudIntegrationPlugin.PLUGIN_ID);
+ boolean initRSE, initServer;
+ initRSE = prefs.getBoolean(CREATE_RSE_PREF_KEY, true);
+ initServer = prefs.getBoolean(CREATE_SERVER_PREF_KEY, true);
+ createRSE.setSelection(initRSE);
+ createServer.setSelection(initServer);
+
+ SelectionListener listener = new SelectionListener(){
+ public void widgetSelected(SelectionEvent e) {
+ handleSelection(e.widget);
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ handleSelection(e.widget);
+ }
+ };
+
+ createRSE.addSelectionListener(listener);
+ createServer.addSelectionListener(listener);
+ setControl(c2);
+ }
+
+ private void handleSelection(Widget w) {
+ if( w == createRSE ) {
+ if( !createRSE.getSelection()) {
+ createServer.setEnabled(false);
+ createServer.setSelection(false);
+ } else {
+ createServer.setEnabled(true);
+ }
+ }
+ }
+
+ public ChainedJob getPerformFinishJob(final DeltaCloudInstance instance) {
+ IEclipsePreferences prefs = new InstanceScope().getNode(DeltaCloudIntegrationPlugin.PLUGIN_ID);
+ prefs.putBoolean(CREATE_RSE_PREF_KEY, createRSE.getSelection());
+ prefs.putBoolean(CREATE_SERVER_PREF_KEY, createServer.getSelection());
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e1) {
+ // ignore
+ }
+
+ ChainedJob j = new ChainedJob("Register RSE Connection", INewInstanceWizardPage.NEW_INSTANCE_FAMILY) {
+ public IStatus run(IProgressMonitor monitor) {
+ return runJob(instance, monitor);
+ }
+ };
+ return j;
+ }
+
+
+ private IStatus runJob(DeltaCloudInstance instance, IProgressMonitor monitor) {
+ 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(Messages.ERROR,
+ NLS.bind(Messages.COULD_NOT_LAUNCH_RSE_EXPLORER2, instance.getName()),
+ e, getShell());
+ }
+ }
+ 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;
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/schema/newInstanceWizardPage.exsd
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/schema/newInstanceWizardPage.exsd (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/schema/newInstanceWizardPage.exsd 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,111 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.deltacloud.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.jboss.tools.deltacloud.ui"
+ id="newInstanceWizardPage"
+ name="org.jboss.tools.deltacloud.ui.newInstanceWizardPage"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="page" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="page">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.jboss.tools.deltacloud.ui.INewInstanceWizardPage"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltacloudUIExtensionManager.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltacloudUIExtensionManager.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltacloudUIExtensionManager.java 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are 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.deltacloud.ui;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.wizard.WizardPage;
+
+
+public class DeltacloudUIExtensionManager {
+ /** Singleton instance of the manager */
+ private static DeltacloudUIExtensionManager instance;
+
+ /** Singleton getter */
+ public static DeltacloudUIExtensionManager getDefault() {
+ if( instance == null )
+ instance = new DeltacloudUIExtensionManager();
+ return instance;
+ }
+
+ public INewInstanceWizardPage[] loadNewInstanceWizardPages() {
+ ArrayList<WizardPage> pages = new ArrayList<WizardPage>();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] cf = registry.getConfigurationElementsFor(Activator.PLUGIN_ID, "newInstanceWizardPage"); //$NON-NLS-1$
+ Object o = null;
+ for( int i = 0; i < cf.length; i++ ) {
+ o = null;
+ try {
+ o = cf[i].createExecutableExtension("class");
+ } catch(CoreException ce) {
+ ce.printStackTrace();
+ }
+ if( o != null ) {
+ pages.add((WizardPage)o);
+ }
+ }
+ return (INewInstanceWizardPage[]) pages.toArray(new INewInstanceWizardPage[pages.size()]);
+ }
+
+}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/INewInstanceWizardPage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/INewInstanceWizardPage.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/INewInstanceWizardPage.java 2010-12-14 09:47:38 UTC (rev 27435)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are 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.deltacloud.ui;
+
+import org.eclipse.jface.wizard.IWizardPage;
+import org.jboss.tools.common.jobs.ChainedJob;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+
+public interface INewInstanceWizardPage extends IWizardPage {
+ public static final String NEW_INSTANCE_FAMILY = "newInstanceFamily";
+ public ChainedJob getPerformFinishJob(DeltaCloudInstance addedInstance);
+}
14 years, 1 month
JBoss Tools SVN: r27434 - in trunk/deltacloud/plugins: org.jboss.tools.deltacloud.integration/META-INF and 5 other directories.
by jbosstools-commits@lists.jboss.org
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;
14 years, 1 month
JBoss Tools SVN: r27433 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-14 04:29:18 -0500 (Tue, 14 Dec 2010)
New Revision: 27433
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java
Log:
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java 2010-12-14 09:28:17 UTC (rev 27432)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java 2010-12-14 09:29:18 UTC (rev 27433)
@@ -43,7 +43,7 @@
* @see Job#belongsTo(java.lang.Object)
*/
public boolean belongsTo(Object family) {
- if (family == null) {
+ if (this.family == null) {
return false;
}
return this.family.equals(family);
14 years, 1 month
JBoss Tools SVN: r27432 - trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-14 04:28:17 -0500 (Tue, 14 Dec 2010)
New Revision: 27432
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudJob.java
Log:
moved to ChainedJob superclass
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudJob.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudJob.java 2010-12-14 09:27:39 UTC (rev 27431)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudJob.java 2010-12-14 09:28:17 UTC (rev 27432)
@@ -16,6 +16,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
+import org.jboss.tools.common.jobs.ChainedJob;
import org.jboss.tools.common.log.StatusFactory;
import org.jboss.tools.deltacloud.core.Activator;
import org.jboss.tools.deltacloud.core.DeltaCloud;
@@ -23,7 +24,7 @@
/**
* @author André Dietisheim
*/
-public abstract class AbstractCloudJob extends Job {
+public abstract class AbstractCloudJob extends ChainedJob {
private DeltaCloud cloud;
14 years, 1 month
JBoss Tools SVN: r27431 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-14 04:27:39 -0500 (Tue, 14 Dec 2010)
New Revision: 27431
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java
Log:
added constructor without family-parameter
Modified: trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java 2010-12-14 09:18:53 UTC (rev 27430)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/jobs/ChainedJob.java 2010-12-14 09:27:39 UTC (rev 27431)
@@ -24,6 +24,10 @@
private IJobChangeListener listener;
private String family;
+ public ChainedJob(String name) {
+ this(name, null);
+ }
+
/**
* Create a new dependent job.
*
@@ -39,6 +43,9 @@
* @see Job#belongsTo(java.lang.Object)
*/
public boolean belongsTo(Object family) {
+ if (family == null) {
+ return false;
+ }
return this.family.equals(family);
}
14 years, 1 month
JBoss Tools SVN: r27430 - in trunk/ws/tests/org.jboss.tools.ws.creation.core.test: projects/ClientTest/jars and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2010-12-14 04:18:53 -0500 (Tue, 14 Dec 2010)
New Revision: 27430
Added:
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-client.jar
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-native-jaxrpc.jar
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-native-jaxws-ext.jar
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-native-saaj.jar
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/xercesImpl.jar
Modified:
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/.classpath
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/AbstractJBossWSGenerationTest.java
Log:
JBIDE-6581: using custom jre to run a server with ws unit test
Modified: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/.classpath
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/.classpath 2010-12-14 09:11:36 UTC (rev 27429)
+++ trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/.classpath 2010-12-14 09:18:53 UTC (rev 27430)
@@ -8,7 +8,12 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
+ <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.jboss.ide.eclipse.as.core.server.runtime.runtimeTarget/org.jboss.ide.eclipse.as.runtime.42"/>
<classpathentry kind="lib" path="jars/jbossws-native-jaxws.jar"/>
<classpathentry kind="lib" path="jars/jaxb-api.jar"/>
+ <classpathentry kind="lib" path="jars/jbossws-native-jaxrpc.jar"/>
+ <classpathentry kind="lib" path="jars/jbossws-native-jaxws-ext.jar"/>
+ <classpathentry kind="lib" path="jars/jbossws-native-saaj.jar"/>
+ <classpathentry kind="lib" path="jars/xercesImpl.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Added: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-client.jar
===================================================================
(Binary files differ)
Property changes on: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-client.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-native-jaxrpc.jar
===================================================================
(Binary files differ)
Property changes on: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-native-jaxrpc.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-native-jaxws-ext.jar
===================================================================
(Binary files differ)
Property changes on: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-native-jaxws-ext.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-native-saaj.jar
===================================================================
(Binary files differ)
Property changes on: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/jbossws-native-saaj.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/xercesImpl.jar
===================================================================
(Binary files differ)
Property changes on: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/projects/ClientTest/jars/xercesImpl.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/AbstractJBossWSGenerationTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/AbstractJBossWSGenerationTest.java 2010-12-14 09:11:36 UTC (rev 27429)
+++ trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/AbstractJBossWSGenerationTest.java 2010-12-14 09:18:53 UTC (rev 27430)
@@ -18,8 +18,10 @@
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.test.ASTest;
import org.jboss.ide.eclipse.as.test.util.ServerRuntimeUtils;
+import org.jboss.ide.eclipse.as.test.util.jdt.JREUtils;
import org.jboss.tools.test.util.JobUtils;
import org.jboss.tools.test.util.ResourcesUtils;
import org.jboss.tools.test.util.TestProjectProvider;
@@ -36,8 +38,8 @@
private String RuntimeName = "testjbosswsruntime";
public String wsdlFileName = "hello_world.wsdl";
public ServiceModel model;
- private String JBOSS_AS_423_HOME = ASTest.JBOSS_AS_42_HOME;
- private String JBOSS_WS_HOME = JBOSS_AS_423_HOME;
+ private String JBOSS_AS_42_HOME = ASTest.JBOSS_AS_42_HOME;
+ private String JBOSS_WS_HOME = JBOSS_AS_42_HOME;
public String wsHomePath;
IFacetedProject fproject;
public IFile wsdlFile;
@@ -50,7 +52,7 @@
}
public void createWSServer() throws Exception {
- currentServer = create42Server();
+ currentServer = createServer(IJBossToolingConstants.AS_42, IJBossToolingConstants.SERVER_AS_42, ASTest.JBOSS_AS_42_HOME, DEFAULT_CONFIG,JREUtils.createJRE());
}
public IProject createProject(String prjName) throws CoreException {
14 years, 1 month
JBoss Tools SVN: r27429 - in trunk/deltacloud/plugins: org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job and 6 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2010-12-14 04:11:36 -0500 (Tue, 14 Dec 2010)
New Revision: 27429
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/DestroyCloudInstanceJob.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceActionJob.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceSchedulingRule.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceStateJob.java
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/PerformDestroyInstanceActionThread.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/PerformInstanceActionJob.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudElementJob.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudJob.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/CloudElementSchedulingRule.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/CloudSchedulingRule.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractInstanceHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DestroyInstanceHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshInstancesHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImagesCategoryItem.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstancesCategoryItem.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
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-7594]
* added instance related job & scheduling rule (blocks instance jobs on same instance and superclass jobs on same cloud & element)
* corrected scheduling rule to block superclass scheduling rule on the same cloud
* added scheduling element that reflects cloud properties being processed (instances, images, realms, profiles)
* switched RefreshImagesHandler and RefreshInstancesHandler to AbstractCloudElementJob to have consistent blocking with all other jobs
* switched DestroyInstanceHandler to DestroyInstanceJob to have consistent blocking with all other jobs
* switched AbstractInstanceHandler to InstanceActionJob to have consistent blocking with all other jobs
* switched InstancesCategoryItem to AbstractCloudElementJob to have consistent blocking with all other jobs
* switched ImagesCategoryItem to AbstractCloudElementJob to have consistent blocking with all other jobs
* switched ImageViewLabelAndContentProvider to AbstractCloudElementJob to have consistent blocking with all other jobs
* switched InstanceViewLabelAndContentProvider to AbstractCloudElementJob to have consistent blocking with all other jobs
* switched FindImagePage to AbstractCloudElementJob to have consistent blocking with all other jobs
* switched NewInstancePage to AbstractCloudElementJob to have consistent blocking with all other jobs
* switched NewInstanceWizard#WatchInstanceJob to InstanceStateJob to have consistent blocking with all other jobs
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-12-14 09:11:36 UTC (rev 27429)
@@ -1,3 +1,15 @@
+2010-12-14 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/job/InstanceSchedulingRule.java:
+ * src/org/jboss/tools/deltacloud/core/job/InstanceStateJob.java:
+ * src/org/jboss/tools/deltacloud/core/job/InstanceActionJob.java:
+ [JBIDE-7594] added instance related job & scheduling rule
+ (blocks instance jobs on same instance and superclass jobs on same cloud & element)
+ * src/org/jboss/tools/deltacloud/core/job/CloudElementSchedulingRule.java (isOnSameElement):
+ [JBIDE-7594] corrected scheduling rule to block superclass scheduling rule on the same cloud
+ * src/org/jboss/tools/deltacloud/core/job/AbstractCloudElementJob.java (CLOUDELEMENT):
+ [JBIDE-7594] added scheduling element that reflects cloud properties being processed (instances, images, realms, profiles)
+
2010-12-13 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/DeltaCloud.java
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudElementJob.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudElementJob.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudElementJob.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -10,8 +10,6 @@
******************************************************************************/
package org.jboss.tools.deltacloud.core.job;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.jboss.tools.deltacloud.core.DeltaCloud;
@@ -21,7 +19,7 @@
public abstract class AbstractCloudElementJob extends AbstractCloudJob {
public static enum CLOUDELEMENT {
- IMAGES, INSTANCES
+ IMAGES, INSTANCES, PROFILES, REALMS
}
private CLOUDELEMENT cloudElement;
@@ -32,10 +30,13 @@
// setUser(true);
}
- protected abstract IStatus doRun(IProgressMonitor monitor) throws Exception;
-
@Override
protected ISchedulingRule getSchedulingRule() {
return new CloudElementSchedulingRule(getCloud(), cloudElement);
}
+
+ protected CLOUDELEMENT getCloudElement() {
+ return cloudElement;
+ }
+
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudJob.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudJob.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/AbstractCloudJob.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -30,7 +30,6 @@
public AbstractCloudJob(String name, DeltaCloud cloud) {
super(name);
this.cloud = cloud;
- // setUser(true);
}
@Override
@@ -38,7 +37,6 @@
ISchedulingRule rule = getSchedulingRule();
Job.getJobManager().beginRule(rule, monitor);
monitor.beginTask(getName(), IProgressMonitor.UNKNOWN);
- monitor.worked(1);
try {
return doRun(monitor);
} catch (Exception e) {
@@ -46,6 +44,7 @@
return StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID,
MessageFormat.format("Could not {0}", getName()));
} finally {
+ monitor.done();
Job.getJobManager().endRule(rule);
}
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/CloudElementSchedulingRule.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/CloudElementSchedulingRule.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/CloudElementSchedulingRule.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -30,19 +30,19 @@
}
@Override
- public boolean contains(ISchedulingRule rule) {
- return rule == this;
- }
-
- @Override
public boolean isConflicting(ISchedulingRule rule) {
return super.isConflicting(rule)
&& isOnSameElement(rule);
}
private boolean isOnSameElement(ISchedulingRule rule) {
- return rule.getClass().isAssignableFrom(CloudElementSchedulingRule.class)
- && ((CloudElementSchedulingRule) rule).getCloudElement().equals(element);
+ if (CloudElementSchedulingRule.class.isAssignableFrom(rule.getClass())) {
+ return ((CloudElementSchedulingRule) rule).getCloudElement().equals(element);
+ } else {
+ // this rules conflicts with a cloud rule which is not an element
+ // rule
+ return true;
+ }
}
private CLOUDELEMENT getCloudElement() {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/CloudSchedulingRule.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/CloudSchedulingRule.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/CloudSchedulingRule.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -47,10 +47,20 @@
}
private boolean isCloudRule(ISchedulingRule rule) {
- return rule.getClass().isAssignableFrom(CloudSchedulingRule.class);
+ return CloudSchedulingRule.class.isAssignableFrom(rule.getClass());
}
- private DeltaCloud getCloud() {
+ protected DeltaCloud getCloud() {
return cloud;
}
+
+ public String toString() {
+ return new StringBuilder()
+ .append("[InstanceSchedulingRule ")
+ .append("cloud :\"")
+ .append(getCloud().getName())
+ .append("\"")
+ .append("]")
+ .toString();
+ }
}
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/DestroyCloudInstanceJob.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/DestroyCloudInstanceJob.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/DestroyCloudInstanceJob.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.core.job;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+
+/**
+ * @author André Dietisheim
+ */
+public class DestroyCloudInstanceJob extends InstanceActionJob {
+
+ public DestroyCloudInstanceJob(String name, DeltaCloudInstance instance) {
+ super(name, instance, DeltaCloudInstance.Action.DESTROY, DeltaCloudInstance.State.TERMINATED);
+ }
+
+ @Override
+ protected IStatus doRun(IProgressMonitor monitor) throws Exception {
+ String id = getInstance().getId();
+ getCloud().performInstanceAction(id, getAction());
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ protected ISchedulingRule getSchedulingRule() {
+ return new InstanceSchedulingRule(getCloud(), getCloudElement(), getInstance());
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/DestroyCloudInstanceJob.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceActionJob.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceActionJob.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceActionJob.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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.core.job;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance.Action;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance.State;
+
+/**
+ * @author André Dietisheim
+ */
+public class InstanceActionJob extends InstanceStateJob {
+
+ private Action action;
+
+ public InstanceActionJob(String name, DeltaCloudInstance instance,
+ Action action, State expectedState) {
+ super(name, instance, expectedState);
+ this.action = action;
+ }
+
+ @Override
+ protected IStatus doRun(IProgressMonitor monitor) throws Exception {
+ String id = getInstance().getId();
+ getCloud().performInstanceAction(id, action);
+ getCloud().waitForState(id, getExpectedState(), monitor);
+ return Status.OK_STATUS;
+ }
+
+ protected Action getAction() {
+ return action;
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceActionJob.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceSchedulingRule.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceSchedulingRule.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceSchedulingRule.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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.core.job;
+
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
+
+/**
+ * A scheduling rule for jobs that prevents 2 jobs from running on the same
+ * cloud instance.
+ *
+ * @author André Dietisheim
+ */
+public class InstanceSchedulingRule extends CloudElementSchedulingRule {
+
+ private DeltaCloudInstance instance;
+
+ public InstanceSchedulingRule(DeltaCloud cloud, CLOUDELEMENT element, DeltaCloudInstance instance) {
+ super(cloud, element);
+ this.instance = instance;
+ }
+
+ @Override
+ public boolean isConflicting(ISchedulingRule rule) {
+ return super.isConflicting(rule)
+ && isOnSameInstance(rule);
+ }
+
+ private boolean isOnSameInstance(ISchedulingRule rule) {
+ if (InstanceSchedulingRule.class.isAssignableFrom(rule.getClass())) {
+ return instance.equals(((InstanceSchedulingRule) rule).getInstance());
+ } else {
+ // this rules conflicts with a cloud element rule which is not an instance rule
+ return true;
+ }
+ }
+
+ protected DeltaCloudInstance getInstance() {
+ return instance;
+ }
+
+ public String toString() {
+ return new StringBuilder()
+ .append("[InstanceSchedulingRule ")
+ .append("cloud :\"")
+ .append(getCloud().getName())
+ .append("\"")
+ .append("instance :\"")
+ .append(getInstance().getName())
+ .append("\"")
+ .append("]")
+ .toString();
+ }
+
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceSchedulingRule.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceStateJob.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceStateJob.java (rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceStateJob.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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.core.job;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance.State;
+
+/**
+ * @author André Dietisheim
+ */
+public class InstanceStateJob extends AbstractCloudElementJob {
+
+ private DeltaCloudInstance instance;
+ private State expectedState;
+
+ public InstanceStateJob(String name, DeltaCloudInstance instance, State expectedState) {
+ super(name, instance.getDeltaCloud(), CLOUDELEMENT.INSTANCES);
+ this.instance = instance;
+ this.expectedState = expectedState;
+ }
+
+ @Override
+ protected IStatus doRun(IProgressMonitor monitor) throws Exception {
+ String id = instance.getId();
+ getCloud().waitForState(id, expectedState, monitor);
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ protected ISchedulingRule getSchedulingRule() {
+ return new InstanceSchedulingRule(getCloud(), getCloudElement(), instance);
+ }
+
+ protected DeltaCloudInstance getInstance() {
+ return instance;
+ }
+
+ protected State getExpectedState() {
+ return expectedState;
+ }
+}
Property changes on: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/job/InstanceStateJob.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-14 09:11:36 UTC (rev 27429)
@@ -1,5 +1,37 @@
+2010-12-14 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java (WatchCreateJob):
+ [JBIDE-7594] switched WatchCreateJob to InstanceStateJob to have consistent blocking with all other jobs
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java (asyncGetProfiles):
+ [JBIDE-7594] switched to AbstractCloudElementJob to have consistent blocking with all other jobs
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java (asyncSetImagesToViewer):
+ [JBIDE-7594] switched to AbstractCloudElementJob to have consistent blocking with all other jobs
+ * src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java (asyncAddCloudElements):
+ * src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java (asyncAddCloudElements):
+ [JBIDE-7594] switched to AbstractCloudElementJob to have consistent blocking with all other jobs
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/InstancesCategoryItem.java (asyncAddCloudElements):
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/ImagesCategoryItem.java (asyncAddCloudElements):
+ [JBIDE-7594] switched to AbstractCloudElementJob to have consistent blocking with all other jobs
+ * src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java (refresh):
+ * src/org/jboss/tools/deltacloud/ui/commands/RefreshInstancesHandler.java (refresh):
+ [JBIDE-7594] switched to AbstractCloudElementJob to have consistent blocking with all other jobs
+ * src/org/jboss/tools/deltacloud/ui/commands/DestroyInstanceHandler.java (destroyInstance):
+ [JBIDE-7594] switched to DestroyInstanceJob to have consistent blocking with all other jobs
+ * src/org/jboss/tools/deltacloud/ui/commands/AbstractInstanceHandler.java (executeInstanceAction):
+ [JBIDE-7594] switched to InstanceActionJob to have consistent blocking with all other jobs
+
+
2010-12-13 André Dietisheim <adietish(a)redhat.com>
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java (asyncGetRealms):
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java (asyncSetImagesToViewer):
+ * src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java (asyncAddCloudElements):
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/InstancesCategoryItem.java (asyncAddCloudElements):
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/ImagesCategoryItem.java (asyncAddCloudElements):
+ * src/org/jboss/tools/deltacloud/ui/commands/RefreshInstancesHandler.java:
+ * src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java:
+ * src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java (asyncAddCloudElements):
+ [JBIDE-7594] switched all cloud element jobs to cloud element related jobs, so that scheduling rules may be applied
* src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java (performFinish):
* src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java (getStatusIcon):
* src/org/jboss/tools/deltacloud/ui/views/PerformDestroyInstanceActionThread.java (run):
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractInstanceHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractInstanceHandler.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/AbstractInstanceHandler.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -15,7 +15,7 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.views.PerformInstanceActionJob;
+import org.jboss.tools.deltacloud.core.job.InstanceActionJob;
import org.jboss.tools.internal.deltacloud.ui.utils.StringUtils;
import org.jboss.tools.internal.deltacloud.ui.utils.StringUtils.IElementFormatter;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
@@ -27,25 +27,19 @@
*/
public abstract class AbstractInstanceHandler extends AbstractHandler implements IHandler {
- protected void executeInstanceAction(DeltaCloudInstance instance, DeltaCloudInstance.Action action, DeltaCloudInstance.State expectedState,
- String title, String message) {
+ protected void executeInstanceAction(DeltaCloudInstance instance, DeltaCloudInstance.Action action,
+ DeltaCloudInstance.State expectedState, String title, String message) {
if (instance != null) {
- PerformInstanceActionJob t = new PerformInstanceActionJob(
- instance.getDeltaCloud(),
- instance,
- action,
- title,
- message,
- expectedState);
- t.setUser(true);
- t.schedule();
+ // TODO internationalize strings
+ new InstanceActionJob(message, instance, action, expectedState)
+ .schedule();
}
}
-
+
protected boolean isSingleInstanceSelected(ISelection selection) {
return UIUtils.isSingleSelection(selection, DeltaCloudInstance.class);
}
-
+
@SuppressWarnings("unchecked")
protected String getInstanceNames(ISelection selection) {
return StringUtils.getFormattedString(((IStructuredSelection) selection).toList(),
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DestroyInstanceHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DestroyInstanceHandler.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DestroyInstanceHandler.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -22,19 +22,15 @@
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.core.job.DestroyCloudInstanceJob;
import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
-import org.jboss.tools.deltacloud.ui.views.PerformDestroyInstanceActionThread;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
/**
* @author Andre Dietisheim
*/
public class DestroyInstanceHandler extends AbstractInstanceHandler {
-
- private final static String DESTROYING_INSTANCE_TITLE = "DestroyingInstance.title"; //$NON-NLS-1$
- private final static String DESTROYING_INSTANCE_MSG = "DestroyingInstance.msg"; //$NON-NLS-1$
-
private final static String DESTROY_INSTANCE_TITLE = "DestroyInstancesDialog.title"; //$NON-NLS-1$
private final static String DESTROY_INSTANCE_MSG = "DestroyInstancesDialog.msg"; //$NON-NLS-1$
@@ -61,10 +57,11 @@
@SuppressWarnings("unchecked")
private void destroyWithDialog(IStructuredSelection selection) {
- List<DeltaCloudInstance> deltaCloudInstances = UIUtils.adapt((List<DeltaCloudInstance>) selection.toList(), DeltaCloudInstance.class);
+ List<DeltaCloudInstance> deltaCloudInstances =
+ UIUtils.adapt((List<DeltaCloudInstance>) selection.toList(),DeltaCloudInstance.class);
DeltaCloudInstanceDialog dialog = new DeltaCloudInstanceDialog(
UIUtils.getActiveShell()
- , deltaCloudInstances
+ , deltaCloudInstances
, CVMessages.getString(DESTROY_INSTANCE_TITLE)
, CVMessages.getString(DESTROY_INSTANCE_MSG));
dialog.setInitialElementSelections(deltaCloudInstances);
@@ -81,13 +78,8 @@
private void destroyInstance(DeltaCloudInstance instance) {
if (instance != null) {
- PerformDestroyInstanceActionThread t = new PerformDestroyInstanceActionThread(
- instance.getDeltaCloud(),
- instance,
- CVMessages.getString(DESTROYING_INSTANCE_TITLE),
- CVMessages.getFormattedString(DESTROYING_INSTANCE_MSG, new String[] { instance.getName() }));
- t.setUser(true);
- t.schedule();
+ new DestroyCloudInstanceJob("Destroy" + instance.getName(), instance)
+ .schedule();
}
}
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -58,9 +58,7 @@
@Override
protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
try {
- monitor.worked(1);
cloud.loadChildren();
- monitor.done();
} catch (DeltaCloudMultiException e) {
return ErrorUtils.createMultiStatus(e);
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshImagesHandler.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -15,7 +15,8 @@
import org.eclipse.core.runtime.Status;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.job.AbstractCloudJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
/**
* @author Andre Dietisheim
@@ -24,7 +25,7 @@
protected void refresh(final DeltaCloud cloud) {
// TODO: internationalize strings
- new AbstractCloudJob("Refreshing images on cloud " + cloud.getName(), cloud) {
+ new AbstractCloudElementJob("Refreshing images on cloud " + cloud.getName(), cloud, CLOUDELEMENT.IMAGES) {
@Override
protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshInstancesHandler.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshInstancesHandler.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshInstancesHandler.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -15,7 +15,8 @@
import org.eclipse.core.runtime.Status;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.job.AbstractCloudJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
/**
* @author Andre Dietisheim
@@ -25,17 +26,16 @@
protected void refresh(final DeltaCloud cloud) {
if (cloud != null) {
// TODO: internationalize strings
- new AbstractCloudJob("Refreshing instances on cloud " + cloud.getName(), cloud) {
+ new AbstractCloudElementJob("Refreshing instances on cloud " + cloud.getName(), cloud,
+ CLOUDELEMENT.INSTANCES) {
@Override
protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
- monitor.worked(1);
cloud.loadInstances();
- monitor.done();
return Status.OK_STATUS;
}
- }.setUser(true);
+ }.schedule();
}
}
}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/PerformDestroyInstanceActionThread.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/PerformDestroyInstanceActionThread.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/PerformDestroyInstanceActionThread.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -1,66 +0,0 @@
-package org.jboss.tools.deltacloud.ui.views;
-
-import java.text.MessageFormat;
-
-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.swt.widgets.Display;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-
-public class PerformDestroyInstanceActionThread extends Job {
- private DeltaCloud cloud;
- private DeltaCloudInstance instance;
- private String taskName;
-
- public PerformDestroyInstanceActionThread(DeltaCloud cloud, DeltaCloudInstance instance,
- String title, String taskName) {
- super(title);
- this.cloud = cloud;
- this.instance = instance;
- this.taskName = taskName;
- }
-
- @Override
- public IStatus run(IProgressMonitor pm) {
- String id = instance.getId();
- try {
- pm.beginTask(taskName, IProgressMonitor.UNKNOWN);
- pm.worked(1);
- // To handle the user starting a new action when we haven't
- // confirmed the last one yet,
- // cancel the previous job and then go on performing this action
- Job job = cloud.getInstanceJob(id);
- if (job != null) {
- job.cancel();
- try {
- job.join();
- } catch (InterruptedException e) {
- // do nothing, this is ok
- }
- }
- cloud.registerInstanceJob(id, this);
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- try {
- cloud.performInstanceAction(instance.getId(), DeltaCloudInstance.Action.DESTROY);
- } catch (DeltaCloudException e) {
- // TODO internationalize strings
- ErrorUtils.handleError("Error",
- MessageFormat.format("Could not destroy instance {0}", instance.getName()), e,
- Display.getDefault().getActiveShell());
- }
- }
- });
- } finally {
- cloud.removeInstanceJob(id, this);
- pm.done();
- }
- return Status.OK_STATUS;
- }
-}
Deleted: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/PerformInstanceActionJob.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/PerformInstanceActionJob.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/PerformInstanceActionJob.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -1,89 +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.views;
-
-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.dialogs.ErrorDialog;
-import org.eclipse.swt.widgets.Display;
-import org.jboss.tools.common.log.StatusFactory;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.Activator;
-import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
-
-public class PerformInstanceActionJob extends Job {
-
- private static final String INSTANCEACTION_ERROR_TITLE = "InstanceActionError.title"; //$NON-NLS-1$
- private static final String INSTANCEACTION_ERROR_MESSAGE = "InstanceActionError.msg"; //$NON-NLS-1$
-
- private DeltaCloud cloud;
- private DeltaCloudInstance instance;
- private DeltaCloudInstance.Action action;
- private String taskName;
- private DeltaCloudInstance.State expectedState;
-
- public PerformInstanceActionJob(DeltaCloud cloud, DeltaCloudInstance instance,
- DeltaCloudInstance.Action action, String title, String taskName, DeltaCloudInstance.State expectedState) {
- super(title);
- this.cloud = cloud;
- this.instance = instance;
- this.action = action;
- this.taskName = taskName;
- this.expectedState = expectedState;
- }
-
- @Override
- public IStatus run(IProgressMonitor pm) {
- String id = instance.getId();
- try {
- pm.beginTask(taskName, IProgressMonitor.UNKNOWN);
- pm.worked(1);
- // To handle the user starting a new action when we haven't
- // confirmed the last one yet,
- // cancel the previous job and then go on performing this action
- cancelPreviousJob(id);
- cloud.performInstanceAction(id, action);
- cloud.waitForState(id, expectedState, pm);
- } catch (Exception e) {
- final IStatus status = StatusFactory.getInstance(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e);
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- ErrorDialog.openError(
- UIUtils.getActiveShell(),
- CVMessages.getString(INSTANCEACTION_ERROR_TITLE),
- CVMessages.getFormattedString(INSTANCEACTION_ERROR_MESSAGE, action.getName(), instance.getName()),
- status);
- }
- });
-
- } finally {
- cloud.removeInstanceJob(id, this);
- pm.done();
- }
- return Status.OK_STATUS;
- }
-
- private void cancelPreviousJob(String id) {
- Job job = cloud.getInstanceJob(id);
- if (job != null) {
- job.cancel();
- try {
- job.join();
- } catch (InterruptedException e) {
- // do nothing, this is ok
- }
- }
- }
-}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImagesCategoryItem.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImagesCategoryItem.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/ImagesCategoryItem.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -21,7 +21,8 @@
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.IImageFilter;
-import org.jboss.tools.deltacloud.core.job.AbstractCloudJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
@@ -44,8 +45,8 @@
@Override
protected void asyncAddCloudElements() {
setLoadingIndicator();
- new AbstractCloudJob(
- MessageFormat.format("Get images from cloud {0}", getModel().getName()), getModel()) {
+ new AbstractCloudElementJob(
+ MessageFormat.format("Get images from cloud {0}", getModel().getName()), getModel(), CLOUDELEMENT.IMAGES) {
@Override
protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstancesCategoryItem.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstancesCategoryItem.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/InstancesCategoryItem.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -21,7 +21,8 @@
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
import org.jboss.tools.deltacloud.core.IInstanceFilter;
-import org.jboss.tools.deltacloud.core.job.AbstractCloudJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
@@ -44,8 +45,9 @@
@Override
protected void asyncAddCloudElements() {
setLoadingIndicator();
- new AbstractCloudJob(
- MessageFormat.format("Get instances from cloud {0}", getModel().getName()), getModel()) {
+ new AbstractCloudElementJob(
+ MessageFormat.format("Get instances from cloud {0}", getModel().getName()), getModel(),
+ CLOUDELEMENT.INSTANCES) {
@Override
protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
@@ -55,7 +57,7 @@
addChildren(instances);
expand();
return Status.OK_STATUS;
- } catch(DeltaCloudException e) {
+ } catch (DeltaCloudException e) {
clearChildren();
throw e;
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -24,7 +24,8 @@
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.ICloudElementFilter;
-import org.jboss.tools.deltacloud.core.job.AbstractCloudJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
/**
* @author Jeff Johnston
@@ -99,8 +100,8 @@
@Override
protected void asyncAddCloudElements(final DeltaCloud cloud) {
- new AbstractCloudJob(
- MessageFormat.format("Get images from cloud {0}", cloud.getName()), cloud) {
+ new AbstractCloudElementJob(
+ MessageFormat.format("Get images from cloud {0}", cloud.getName()), cloud, CLOUDELEMENT.IMAGES) {
@Override
protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -26,7 +26,8 @@
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
import org.jboss.tools.deltacloud.core.ICloudElementFilter;
-import org.jboss.tools.deltacloud.core.job.AbstractCloudJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
/**
@@ -124,8 +125,8 @@
@Override
protected void asyncAddCloudElements(final DeltaCloud cloud) {
- new AbstractCloudJob(
- MessageFormat.format("Get instances from cloud {0}", cloud.getName()), cloud) {
+ new AbstractCloudElementJob(
+ MessageFormat.format("Get instances from cloud {0}", cloud.getName()), cloud, CLOUDELEMENT.INSTANCES) {
@Override
protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java 2010-12-14 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -32,7 +32,8 @@
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.IImageFilter;
import org.jboss.tools.deltacloud.core.ImageFilter;
-import org.jboss.tools.deltacloud.core.job.AbstractCloudJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
import org.jboss.tools.deltacloud.ui.views.cloudelements.ImageViewLabelAndContentProvider;
@@ -301,8 +302,8 @@
}
private void asyncSetImagesToViewer() {
- new AbstractCloudJob(
- MessageFormat.format("Get images from cloud {0}", cloud.getName()), cloud) {
+ new AbstractCloudElementJob(
+ MessageFormat.format("Get images from cloud {0}", cloud.getName()), cloud, CLOUDELEMENT.IMAGES) {
@Override
protected IStatus doRun(IProgressMonitor monitor) throws DeltaCloudException {
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 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -63,7 +63,8 @@
import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProfile;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudRealm;
-import org.jboss.tools.deltacloud.core.job.AbstractCloudJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob;
+import org.jboss.tools.deltacloud.core.job.AbstractCloudElementJob.CLOUDELEMENT;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
import org.jboss.tools.internal.deltacloud.ui.common.databinding.validator.MandatoryStringValidator;
@@ -528,7 +529,7 @@
private void asyncGetRealms() {
// TODO: internationalize strings
- new AbstractCloudJob("Get realms", cloud) {
+ new AbstractCloudElementJob("Get realms", cloud, CLOUDELEMENT.REALMS) {
@Override
protected IStatus doRun(IProgressMonitor monitor) throws Exception {
@@ -545,7 +546,7 @@
private void asyncGetProfiles() {
// TODO: internationalize strings
- new AbstractCloudJob("Get Profiles", cloud) {
+ new AbstractCloudElementJob("Get Profiles", cloud, CLOUDELEMENT.PROFILES) {
@Override
protected IStatus doRun(IProgressMonitor monitor) throws Exception {
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 08:46:56 UTC (rev 27428)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstanceWizard.java 2010-12-14 09:11:36 UTC (rev 27429)
@@ -16,7 +16,6 @@
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.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
@@ -27,6 +26,7 @@
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.ErrorUtils;
import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
@@ -40,7 +40,6 @@
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;
@@ -63,7 +62,7 @@
@Override
public void addPages() {
mainPage = new NewInstancePage(cloud);
- if( image != null )
+ if (image != null)
mainPage.setImage(image);
addPage(mainPage);
}
@@ -73,56 +72,39 @@
return mainPage.isPageComplete();
}
- private class WatchCreateJob extends Job {
+ private class WatchCreateJob extends InstanceStateJob {
- private DeltaCloud cloud;
- private String instanceId;
- private String instanceName;
-
- public WatchCreateJob(String title, DeltaCloud cloud,
- String instanceId, String instanceName) {
- super(title);
- this.cloud = cloud;
- this.instanceId = instanceId;
- this.instanceName = instanceName;
+ public WatchCreateJob(DeltaCloudInstance instance) {
+ super(WizardMessages.getString(STARTING_INSTANCE_TITLE), instance, DeltaCloudInstance.State.RUNNING);
+ setUser(true);
}
- 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);
- String hostname = RSEUtils.createHostName(instance);
- if (hostname != null && hostname.length() > 0 && isAutoconnect()) {
- try {
- String connectionName = RSEUtils.createConnectionName(instance);
- IHost host = RSEUtils.createHost(connectionName,
+ @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());
- }
+ 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());
}
- pm.done();
}
- return Status.OK_STATUS;
- } else {
- pm.done();
- return Status.CANCEL_STATUS;
}
+ return Status.OK_STATUS;
}
private boolean isAutoconnect() {
@@ -176,12 +158,7 @@
result = true;
}
if (instance != null && instance.getState().equals(DeltaCloudInstance.State.PENDING)) {
- final String instanceId = instance.getId();
- final String instanceName = name;
- Job job = new WatchCreateJob(WizardMessages.getString(STARTING_INSTANCE_TITLE),
- cloud, instanceId, instanceName);
- job.setUser(true);
- job.schedule();
+ new WatchCreateJob(instance).schedule();
}
} catch (DeltaCloudException ex) {
e = ex;
14 years, 1 month