Author: nickboldt
Date: 2010-09-03 12:47:53 -0400 (Fri, 03 Sep 2010)
New Revision: 24711
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/Activator.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudException.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageListListener.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceListListener.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/API.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AddressList.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Realm.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/Activator.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/CustomProgressMonitorDialog.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudPerspective.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageComparator.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
Log:
Merge changes in trunk to m2 branch for jjohnson per instruction
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,106 @@
+2010-09-03 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (addReplaceInstance): New method.
+
+2010-09-01 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (deleteKey): Change
+ arguments to just the key name is given. Don't delete any file.
+ (createKey): Change the directory argument to just be a String instead of an IPath.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (deleteKey): New method.
+ (createKey): Ditto.
+ (refreshInstance): Remove stack trace on error since a pending cloud start will
+ result in not found until the cloud actually is running.
+
+2010-08-30 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/Activator.java: Add Copyright and License info.
+ * src/org/jboss/tools/deltacloud/core/client/AddressList.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/client/API.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/client/Image.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/client/Instance.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/client/Property.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/client/Realm.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudException.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/IImageListListener.java: Ditto.
+ * src/org/jboss/tools/deltacloud/core/IInstanceListListener.java: Ditto.
+ * META-INF/MANIFEST.MF: Back-leveling to 0.0.1 as not in 1.0.0 state yet.
+
+2010-08-27 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (buildInstance): Add
+ call to getAuthentication method.
+ (getAuthentication): New method to get authentication items such as keyname.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getCurrInstances): Synchronize
on
+ new instanceLock object.
+ (getInstances): Ditto.
+ (performInstanceAction): Do not do any special actions for EC2 clouds, namely
+ deleting a key if stopping.
+ (refreshInstance): Do not reset the key.
+ (createInstance): Do not look for EC2 type, do not create a key, but just check if a
keyname is specified.
+ Do not save the key if specified as this is done when creating the instance.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java: Add MOCK type.
+
+2010-08-26 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (createKey): Remove
+ any empty lines so the key will work with RSE.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (notifyImageListListeners): Pass
new
+ cloud argument to listeners.
+ (notifyInstanceListListeners): Ditto.
+ (refreshInstance): Fix the check for states to be in the String realm rather than
+ the State realm.
+ * src/org/jboss/tools/deltacloud/core/IImageListListener.java: Add new cloud argument
+ to listChanged notifier method.
+ * src/org/jboss/tools/deltacloud/core/IInstanceListListener.java: Ditto.
+
+2010-08-23 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/Instance.java (getKey): New method.
+ (setKey): Ditto.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getCurrInstances): Fix to
+ call getInstances if there aren't any instances yet.
+ (getCurrImages): New method.
+ (refreshInstance): Pass any instance key into the new instance.
+ (getImages): Synchronize on imageLock.
+ (loadChildren): New method that loads the children in a thread.
+ (createInstance): Save the key if generated into the instance.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (getKey): New method.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadClouds): Ditto.
+
+2010-08-20 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (DCNS): Add KEYS.
+ (deleteKey): New method to delete a keypair.
+ (createKey): New method to create a keypair.
+ (checkForErrors): Add extra check for status 404.
+ (createInstance): New method with additional keyname parameter to create instance using
a
+ specified keypair.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloud.java (getType): New method.
+ (DeltaCloud): Add type parameter and add keys collection.
+ (performInstanceAction): Add check for EC2 STOP action in which case look for a key in
the key
+ collection and if found, delete it.
+ (createInstance): If EC2 cloud, create a key and pass the name to the new client
createInstance
+ API that takes a keypair name.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (setGivenName): New method
to store
+ the name chosen by the user in the dialog.
+ (getGivenName): New method to get the name chosen by the user in the dialog.
+ * src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java (loadClouds): Add type
support.
+ (saveClouds): Ditto.
+
2010-08-18 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java (checkForErrors):
Make
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/Activator.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/Activator.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/Activator.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
import java.lang.reflect.InvocationTargetException;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloud.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
import java.net.MalformedURLException;
@@ -6,6 +16,7 @@
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.equinox.security.storage.EncodingUtils;
import org.eclipse.equinox.security.storage.ISecurePreferences;
@@ -24,21 +35,26 @@
private String name;
private String username;
private String url;
+ private String type;
private DeltaCloudClient client;
private ArrayList<DeltaCloudInstance> instances;
+ private ArrayList<DeltaCloudImage> images;
+ private Object imageLock = new Object();
+ private Object instanceLock = new Object();
ListenerList instanceListeners = new ListenerList();
ListenerList imageListeners = new ListenerList();
public DeltaCloud(String name, String url, String username, String passwd) throws
MalformedURLException {
- this(name, url, username, passwd, false);
+ this(name, url, username, passwd, null, false);
}
- public DeltaCloud(String name, String url, String username, String passwd, boolean
persistent) throws MalformedURLException {
+ public DeltaCloud(String name, String url, String username, String passwd, String type,
boolean persistent) throws MalformedURLException {
this.client = new DeltaCloudClient(new URL(url + "/api"), username, passwd);
//$NON-NLS-1$
this.url = url;
this.name = name;
this.username = username;
+ this.type = type;
if (persistent) {
ISecurePreferences root = SecurePreferencesFactory.getDefault();
String key = DeltaCloud.getPreferencesKey(url, username);
@@ -69,6 +85,23 @@
return username;
}
+ public String getType() {
+ return type;
+ }
+
+ public void loadChildren() {
+ Thread t = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ getImages();
+ getInstances();
+ }
+
+ });
+ t.start();
+ }
+
public void addInstanceListListener(IInstanceListListener listener) {
instanceListeners.add(listener);
}
@@ -80,7 +113,7 @@
public void notifyInstanceListListeners(DeltaCloudInstance[] array) {
Object[] listeners = instanceListeners.getListeners();
for (int i = 0; i < listeners.length; ++i)
- ((IInstanceListListener)listeners[i]).listChanged(array);
+ ((IInstanceListListener)listeners[i]).listChanged(this, array);
}
public void addImageListListener(IImageListListener listener) {
@@ -94,30 +127,36 @@
public void notifyImageListListeners(DeltaCloudImage[] array) {
Object[] listeners = imageListeners.getListeners();
for (int i = 0; i < listeners.length; ++i)
- ((IImageListListener)listeners[i]).listChanged(array);
+ ((IImageListListener)listeners[i]).listChanged(this, array);
}
public DeltaCloudInstance[] getInstances() {
- instances = new ArrayList<DeltaCloudInstance>();
- try {
- List<Instance> list = client.listInstances();
- for (Iterator<Instance> i = list.iterator(); i.hasNext();) {
- DeltaCloudInstance instance = new DeltaCloudInstance(i.next());
- instances.add(instance);
+ synchronized (instanceLock) {
+ instances = new ArrayList<DeltaCloudInstance>();
+ try {
+ List<Instance> list = client.listInstances();
+ for (Iterator<Instance> i = list.iterator(); i.hasNext();) {
+ DeltaCloudInstance instance = new DeltaCloudInstance(i.next());
+ instances.add(instance);
+ }
+ } catch (DeltaCloudClientException e) {
+ Activator.log(e);
}
- } catch (DeltaCloudClientException e) {
- Activator.log(e);
+ DeltaCloudInstance[] instanceArray = new DeltaCloudInstance[instances.size()];
+ instanceArray = instances.toArray(instanceArray);
+ notifyInstanceListListeners(instanceArray);
+ return instanceArray;
}
- DeltaCloudInstance[] instanceArray = new DeltaCloudInstance[instances.size()];
- instanceArray = instances.toArray(instanceArray);
- notifyInstanceListListeners(instanceArray);
- return instanceArray;
}
public DeltaCloudInstance[] getCurrInstances() {
- DeltaCloudInstance[] instanceArray = new DeltaCloudInstance[instances.size()];
- instanceArray = instances.toArray(instanceArray);
- return instanceArray;
+ synchronized (instanceLock) {
+ if (instances == null)
+ return getInstances();
+ DeltaCloudInstance[] instanceArray = new DeltaCloudInstance[instances.size()];
+ instanceArray = instances.toArray(instanceArray);
+ return instanceArray;
+ }
}
public DeltaCloudInstance[] destroyInstance(String instanceId) {
@@ -138,7 +177,43 @@
notifyInstanceListListeners(instanceArray);
return instanceArray;
}
+
+ public void createKey(String keyname, String keystoreLocation) throws
DeltaCloudException {
+ try {
+ client.createKey(keyname, keystoreLocation);
+ } catch (DeltaCloudClientException e) {
+ throw new DeltaCloudException(e);
+ }
+ }
+ public void deleteKey(String keyname) throws DeltaCloudException {
+ try {
+ client.deleteKey(keyname);
+ } catch (DeltaCloudClientException e) {
+ throw new DeltaCloudException(e);
+ }
+ }
+
+ public void addReplaceInstance(DeltaCloudInstance instance) {
+ String instanceId = instance.getId();
+ if (instance != null) {
+ boolean found = false;
+ for (int i = 0; i < instances.size(); ++i) {
+ DeltaCloudInstance inst = instances.get(i);
+ if (inst.getId().equals(instanceId)) {
+ found = true;
+ instances.set(i, instance);
+ }
+ }
+ if (!found) {
+ instances.add(instance);
+ }
+ DeltaCloudInstance[] instanceArray = new DeltaCloudInstance[instances.size()];
+ instanceArray = instances.toArray(instanceArray);
+ notifyInstanceListListeners(instanceArray);
+ }
+ }
+
public DeltaCloudInstance refreshInstance(String instanceId) {
DeltaCloudInstance retVal = null;
try {
@@ -148,7 +223,7 @@
DeltaCloudInstance inst = instances.get(i);
if (inst.getId().equals(instanceId)) {
// FIXME: remove BOGUS state when server fixes state problems
- if (!(instance.getState().equals(DeltaCloudInstance.BOGUS)) &&
!(inst.getState().equals(instance.getState()))) {
+ if (!(retVal.getState().equals(DeltaCloudInstance.BOGUS)) &&
!(inst.getState().equals(retVal.getState()))) {
instances.set(i, retVal);
DeltaCloudInstance[] instanceArray = new DeltaCloudInstance[instances.size()];
instanceArray = instances.toArray(instanceArray);
@@ -158,7 +233,7 @@
}
}
} catch (DeltaCloudClientException e) {
- e.printStackTrace();
+ // will get here when a pending instance is being checked
}
return retVal;
}
@@ -188,19 +263,34 @@
}
public DeltaCloudImage[] getImages() {
- ArrayList<DeltaCloudImage> images = new ArrayList<DeltaCloudImage>();
- try {
- List<Image> list = client.listImages();
- for (Iterator<Image> i = list.iterator(); i.hasNext();) {
- DeltaCloudImage image = new DeltaCloudImage(i.next());
- images.add(image);
+ synchronized (imageLock) {
+ images = new ArrayList<DeltaCloudImage>();
+ try {
+ List<Image> list = client.listImages();
+ for (Iterator<Image> i = list.iterator(); i.hasNext();) {
+ DeltaCloudImage image = new DeltaCloudImage(i.next());
+ images.add(image);
+ }
+ } catch (DeltaCloudClientException e) {
+ Activator.log(e);
}
- } catch (DeltaCloudClientException e) {
- Activator.log(e);
+ DeltaCloudImage[] imageArray = new DeltaCloudImage[images.size()];
+ imageArray = images.toArray(imageArray);
+ notifyImageListListeners(imageArray);
+ return imageArray;
}
- return images.toArray(new DeltaCloudImage[images.size()]);
}
+ public DeltaCloudImage[] getCurrImages() {
+ synchronized(imageLock) {
+ if (images == null)
+ return getImages();
+ DeltaCloudImage[] imageArray = new DeltaCloudImage[images.size()];
+ imageArray = images.toArray(imageArray);
+ return imageArray;
+ }
+ }
+
public boolean testConnection() {
String instanceId = "madeupValue"; //$NON-NLS-1$
try {
@@ -228,11 +318,17 @@
}
public DeltaCloudInstance createInstance(String name, String imageId, String realmId,
String profileId,
- String memory, String storage) throws DeltaCloudException {
+ String keyname, String memory, String storage) throws DeltaCloudException {
try {
- Instance instance = client.createInstance(imageId, profileId, realmId, name, memory,
storage);
+ Instance instance = null;
+ if (keyname != null) {
+ instance = client.createInstance(imageId, profileId, realmId, name, keyname, memory,
storage);
+ } else {
+ instance = client.createInstance(imageId, profileId, realmId, name, memory,
storage);
+ }
if (instance != null) {
DeltaCloudInstance newInstance = new DeltaCloudInstance(instance);
+ newInstance.setGivenName(name);
instances.add(newInstance);
DeltaCloudInstance[] instanceArray = new DeltaCloudInstance[instances.size()];
instanceArray = instances.toArray(instanceArray);
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudException.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudException.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudException.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
public class DeltaCloudException extends Exception {
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProfile.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
import java.util.ArrayList;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudHardwareProperty.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
import java.util.List;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudImage.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
import org.jboss.tools.deltacloud.core.client.Image;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
import java.util.List;
@@ -18,7 +28,11 @@
public final static String REBOOT = Instance.Action.REBOOT.toString();
public final static String DESTROY = Instance.Action.DESTROY.toString();
+ public final static String EC2_TYPE = "EC2"; //$NON-NLS-1$
+ public final static String MOCK_TYPE = "MOCK"; //$NON-NLS-1$
+
private Instance instance;
+ private String givenName;
public DeltaCloudInstance(Instance instance) {
this.instance = instance;
@@ -28,6 +42,14 @@
return instance.getName();
}
+ public String getGivenName() {
+ return givenName;
+ }
+
+ public void setGivenName(String name) {
+ givenName = name;
+ }
+
public String getId() {
return instance.getId();
}
@@ -40,6 +62,10 @@
return instance.getState().toString();
}
+ public String getKey() {
+ return instance.getKey();
+ }
+
public List<String> getActions() {
return instance.getActionNames();
}
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
import java.io.BufferedWriter;
@@ -51,16 +61,19 @@
Node nameNode = attrs.getNamedItem("name"); // $NON-NLS-1$
Node urlNode = attrs.getNamedItem("url"); // $NON-NLS-1$
Node usernameNode = attrs.getNamedItem("username"); // $NON-NLS-1$
+ Node typeNode = attrs.getNamedItem("type"); // $NON-NLS-1$
String name = nameNode.getNodeValue();
String url = urlNode.getNodeValue();
String username = usernameNode.getNodeValue();
+ String type = typeNode.getNodeValue();
String key = DeltaCloud.getPreferencesKey(url, username);
ISecurePreferences root = SecurePreferencesFactory.getDefault();
ISecurePreferences node = root.node(key);
String password;
try {
password = node.get("password", null); //$NON-NLS-1$
- DeltaCloud cloud = new DeltaCloud(name, url, username, password);
+ DeltaCloud cloud = new DeltaCloud(name, url, username, password, type, false);
+ cloud.loadChildren();
clouds.add(cloud);
} catch (Exception e1) {
Activator.log(e1);
@@ -90,7 +103,8 @@
for (DeltaCloud d : clouds) {
p.println("<cloud name=\"" + d.getName() + "\"
url=\"" //$NON-NLS-1$ //$NON-NLS-2$
+ d.getURL() +
- "\" username=\"" + d.getUsername() +
"\"/>"); //$NON-NLS-1$ //$NON-NLS-2$
+ "\" username=\"" + d.getUsername() +
+ "\" type=\"" + d.getType() + "\"/>");
//$NON-NLS-1$ //$NON-NLS-2$
}
p.println("</clouds>"); //$NON-NLS-1$
p.close();
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudRealm.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
import org.jboss.tools.deltacloud.core.client.Realm;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
public interface ICloudManagerListener {
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageListListener.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageListListener.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageListListener.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
public interface IImageListListener {
@@ -2,3 +12,3 @@
- public void listChanged(DeltaCloudImage[] list);
+ public void listChanged(DeltaCloud cloud, DeltaCloudImage[] list);
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceListListener.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceListListener.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceListListener.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core;
public interface IInstanceListListener {
@@ -2,3 +12,3 @@
- public void listChanged(DeltaCloudInstance[] list);
+ public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] list);
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/API.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/API.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/API.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.client;
import java.util.List;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AddressList.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AddressList.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/AddressList.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.client;
import java.util.List;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudAuthException.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.client;
public class DeltaCloudAuthException extends DeltaCloudClientException {
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClient.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,6 +1,18 @@
+/*******************************************************************************
+ * 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.core.client;
import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -31,6 +43,7 @@
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.log4j.Logger;
+import org.eclipse.core.runtime.Path;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -43,7 +56,7 @@
private static enum DCNS
{
- INSTANCES, REALMS, IMAGES, HARDWARE_PROFILES, START, STOP, REBOOT, DESTROY;
+ INSTANCES, REALMS, IMAGES, HARDWARE_PROFILES, KEYS, START, STOP, REBOOT, DESTROY;
@Override
public String toString()
@@ -163,16 +176,23 @@
@Override
public Instance createInstance(String imageId, String profileId, String realmId, String
name) throws DeltaCloudClientException
{
- return createInstance(imageId, profileId, realmId, name, null, null);
+ return createInstance(imageId, profileId, realmId, name, null, null, null);
}
-
+
public Instance createInstance(String imageId, String profileId, String realmId, String
name, String memory, String storage) throws DeltaCloudClientException
{
+ return createInstance(imageId, profileId, realmId, name, null, memory, storage);
+ }
+
+ public Instance createInstance(String imageId, String profileId, String realmId, String
name, String keyname, String memory, String storage) throws DeltaCloudClientException
+ {
String query = "?image_id=" + imageId + "&hwp_id=" + profileId
+ "&realm_id=" + realmId + "&name=" + name;
if (memory != null)
query += "&hwp_memory=" + memory;
if (storage != null)
query += "&hwp_storage=" + storage;
+ if (keyname != null)
+ query += "&keyname=" + keyname;
query += "&commit=create";
return buildInstance(sendRequest(DCNS.INSTANCES + query, RequestType.POST));
}
@@ -227,6 +247,42 @@
return JAXB.unmarshal(sendRequest(DCNS.REALMS + "/" + realmId,
RequestType.GET), Realm.class);
}
+ public void createKey(String keyname, String keyStoreLocation) throws
DeltaCloudClientException {
+ String xml = sendRequest(DCNS.KEYS + "?name=" + keyname, RequestType.POST);
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+ Document document = db.parse(new InputSource(new StringReader(xml)));
+ List<String> keyText = getElementText(document, "pem"); //$NON-NLS-1$
+ File keyFile = Path.fromOSString(keyStoreLocation).append(keyname +
".pem").toFile(); //$NON-NLS-1$
+ if (!keyFile.exists())
+ keyFile.createNewFile();
+ keyFile.setReadable(false, false);
+ keyFile.setWritable(true, true);
+ keyFile.setReadable(true, true);
+ StringBuffer sb = new StringBuffer();
+ String line;
+ BufferedReader reader = new BufferedReader(new StringReader(keyText.get(0)));
+ while ((line = reader.readLine()) != null)
+ {
+ // We must trim off the white-space from the xml
+ // Complete white-space lines are to be ignored.
+ String trimmedLine = line.trim();
+ if (trimmedLine.length() > 0)
+ sb.append(trimmedLine).append("\n");
+ }
+ FileWriter w = new FileWriter(keyFile);
+ w.write(sb.toString());
+ w.close();
+ } catch (Exception e) {
+ throw new DeltaCloudClientException(e);
+ }
+ }
+
+ public void deleteKey(String keyname) throws DeltaCloudClientException {
+ sendRequest(DCNS.KEYS + "/" + keyname, RequestType.DELETE);
+ }
+
@Override
public void rebootInstance(String instanceId) throws DeltaCloudClientException
{
@@ -262,6 +318,8 @@
String status = node.getAttributes().getNamedItem("status").getNodeValue();
if (status.equals("403"))
throw new DeltaCloudAuthException("Authorization error");
+ else if (status.equals("404"))
+ throw new DeltaCloudClientException("Not found");
else
throw new DeltaCloudClientException("Connection error");
}
@@ -285,6 +343,7 @@
getProfileProperties(instance, getPropertyNodes(document,
"hardware_profile")); //$NON-NLS-1$
instance.setRealmId(getIdFromHref(getAttributeValues(document, "realm",
"href").get(0))); //$NON-NLS-1$ //$NON-NLS-2$
instance.setState(getElementText(document, "state").get(0)); //$NON-NLS-1$
+ getAuthentication(document, instance);
ArrayList<Instance.Action> actions = new ArrayList<Instance.Action>();
for(String s : getAttributeValues(document, "link", "rel"))
//$NON-NLS-1$ //$NON-NLS-2$
@@ -404,6 +463,31 @@
return values;
}
+ private void getAuthentication(Document document, Instance instance) {
+ NodeList elements = document.getElementsByTagName("authentication");
+ for (int i = 0; i < elements.getLength(); i++)
+ {
+ Node element = elements.item(i);
+ NamedNodeMap attrs = element.getAttributes();
+ Node type = attrs.getNamedItem("type"); //$NON-NLS-1$
+ if (type.getNodeValue().equals("key")) { //$NON-NLS-1$
+ NodeList children = element.getChildNodes();
+ for (int j = 0; j < children.getLength(); ++j) {
+ Node child = children.item(j);
+ if (child.getNodeName().equals("login")) { //$NON-NLS-1$
+ NodeList loginChildren = child.getChildNodes();
+ for (int k = 0; k < loginChildren.getLength(); ++k) {
+ Node loginChild = loginChildren.item(k);
+ if (loginChild.getNodeName().equals("keyname")) { //$NON-NLS-1$
+ instance.setKey(loginChild.getTextContent());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
private void getProfileProperties(Instance instance, List<Node> propertyNodes) {
if (propertyNodes != null) {
for (Iterator<Node> i = propertyNodes.iterator(); i.hasNext();) {
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudClientException.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.client;
public class DeltaCloudClientException extends Exception
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/DeltaCloudObject.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.client;
import java.io.Serializable;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/HardwareProfile.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.client;
import java.util.ArrayList;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Image.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.client;
import javax.xml.bind.annotation.XmlElement;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Instance.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.client;
import java.util.ArrayList;
@@ -31,6 +41,8 @@
private String realmId;
+ private String keyname;
+
@XmlElement
private State state;
@@ -99,6 +111,14 @@
}
}
+ public void setKey(String keyname) {
+ this.keyname = keyname;
+ }
+
+ public String getKey() {
+ return keyname;
+ }
+
@SuppressWarnings("unused")
private void setPrivateAddresses(AddressList privateAddresses)
{
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Property.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.client;
import java.util.List;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Realm.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Realm.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/client/Realm.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.core.client;
import javax.xml.bind.annotation.XmlElement;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,148 @@
+2010-09-03 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java
(WatchCreateJob.run): Add
+ instance logic fixed.
+
+2010-09-01 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/CustomWizardDialog.java: New file.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeys.java: New file.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/ManageKeysPage.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java: Add a constant
+ for default key directory.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (..run): Fix to
getInstances,
+ not getImages.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
(.widgetSelected):
+ Open ManageKeysDialog when Manage button is pressed.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties: Add new
+ messages.
+
+2010-08-30 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/Activator.java: Add Copyright and License info.
+ * src/org/jboss/tools/deltacloud/ui/CustomProgressMonitorDialog.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/DeltaCloudPerspective.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVMessages.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/ImageComparator.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/ImageView.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java: Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java:
Ditto.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java: Ditto.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java:
Ditto.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java: Ditto.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java: Ditto.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java: Ditto.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java: Ditto.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties: Ditto.
+ * META-INF/MANIFEST.MF: Back-versioning to 0.0.1 as not in 1.0.0 state yet.
+
+2010-08-27 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java: Add new
constant
+ for the last EC2 key used.
+ * src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties: Change keyname message.
+ * src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
(getPropertyValue):
+ Add support for keyname.
+ (getPropertyDescriptors): Ditto.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java (performFinish):
Return
+ the return code of the create instance which might fail because the key is invalid in
which
+ case allow the user to enter a new key.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
(.widgetSelected):
+ (createControl): Add a keyname text field and a Manage button if the cloud type is EC2.
+ (validate): Check the keyname field is filled in for EC2.
+ (getKeyName): New method.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties: Add new
+ messages.
+
+2010-08-26 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (.run): For RSE
+ action, set the default userid to root when the host is created.
+
+2010-08-26 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java (listChanged):
Add new
+ cloud argument.
+ * src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java (listChanged):
Ditto.
+ * src/org/jboss/tools/deltacloud/ui/views/ImageView.java (listChanged): Ditto.
+ (.modifyText): Decouple image list listener using the currCloud right away
+ before it is reset.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java:
+ (listChanged): Add new cloud argument and use to verify that the cloud matches
+ the one for the new list.
+ (makeActions): Add refresh action.
+ (.modifyText): Decouple instance list listener using the currCloud right away
+ before it is reset.
+ (fillLocalPullDown): Add refresh action.
+ (PerformInstanceActionThread.run): Don't perform refresh in a Display thread, just
+ run it in the current thread.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
(inputChanged):
+ For a cloud input, use getCurrInstances rather than getInstances method of cloud.
+
+2010-08-25 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java (.menuAboutToShow): New
+ listener to properly set up pull-down menu.
+ (contributeToActionBars): Add a menu listener for pull down so we can set
enabled/disabled
+ at pull-down time.
+ (fillLocalPullDown): Add check for item selected.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (.run): Experiment with
RSE.
+
+2010-08-23 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/DeltaCloudPerspective.java (createInitialLayout):
Add Images
+ view.
+ * src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java (getChildren): Return
+ super getChildren.
+ * src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java (getChildren):
+ (loadChildren): New method that runs a thread to load instances and images.
+ * src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java (getChildren):
Use
+ getCurrInstances method of cloud instead of getInstances.
+ * src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java (fillLocalPullDown):
Don't enable
+ the remove cloud and refresh cloud unless item selected.
+ (.run): Change refresh action to refresh the cloud, not whole view.
+ * src/org/jboss/tools/deltacloud/ui/views/ImageView.java:
+ (makeActions): Add refresh view action and remove double click action.
+ (fillLocalPullDown): Add refresh view action.
+ * src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java
(inputChanged): Call
+ getCurrImages rather than getImages method of DeltaCloud.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (.run): Add RSE action.
+
+2010-08-20 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java
(performFinish): Store the
+ type of cloud connection when it is created for real.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java
(getType): New method.
+ * src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java (performFinish):
Return true on
+ failure so dialog closes.
+
2010-08-19 Jeff Johnston <jjohnstn(a)redhat.com>
* META-INF/MANIFEST.MF: Add dependency on rse.
@@ -7,7 +152,7 @@
RSE action.
(fillContextMenu): Add connect to RSE action skeleton and enable/disable depending on
instance
state.
-
+
2010-08-18 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java (listChanged):
Get
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/Activator.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/Activator.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/Activator.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.lang.reflect.InvocationTargetException;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/CustomProgressMonitorDialog.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/CustomProgressMonitorDialog.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/CustomProgressMonitorDialog.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.dialogs.IDialogConstants;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudPerspective.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudPerspective.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/DeltaCloudPerspective.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.ui.IPageLayout;
@@ -13,6 +23,8 @@
0.80f, IPageLayout.ID_EDITOR_AREA);
layout.addView("org.jboss.tools.deltacloud.ui.views.InstanceView",
IPageLayout.BOTTOM,
0.80f, IPageLayout.ID_EDITOR_AREA);
+ layout.addView("org.jboss.tools.deltacloud.ui.views.ImageView",
IPageLayout.BOTTOM,
+ 0.80f, IPageLayout.ID_EDITOR_AREA);
}
}
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/IDeltaCloudPreferenceConstants.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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;
public interface IDeltaCloudPreferenceConstants {
@@ -3,4 +13,6 @@
public final static String DONT_CONFIRM_CREATE_INSTANCE =
"dont_confirm_create_instance"; //$NON-NLS-1$
+ public final static String LAST_EC2_KEYNAME = "last_ec2_keyname";
//$NON-NLS-1$
+ public final static String DEFAULT_KEY_DIR = "default_key_directory";
//$NON-NLS-1$
}
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.net.MalformedURLException;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/DeltaCloudPreferencePage.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.preferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.preferences;
import java.text.MessageFormat;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/preferences/PreferenceMessages.properties 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1 +1,11 @@
+#################################################################################
+# 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
+#################################################################################
LaunchWarnPreference.msg=Do not warn me when launching an instance
\ No newline at end of file
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,10 +1,18 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-public class CVCategoryElement extends CloudViewElement {
+public abstract class CVCategoryElement extends CloudViewElement {
public final static int INSTANCES = 0;
public final static int IMAGES = 1;
@@ -19,18 +27,6 @@
@Override
public Object[] getChildren() {
- if (!initialized) {
- DeltaCloud cloud = (DeltaCloud)getElement();
- if (type == IMAGES) {
- DeltaCloudImage[] images = cloud.getImages();
- for (int i = 0; i < images.length; ++i) {
- DeltaCloudImage d = images[i];
- CVImageElement element = new CVImageElement(d, d.getName());
- addChild(element);
- }
- initialized = true;
- }
- }
return super.getChildren();
}
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.viewers.Viewer;
@@ -32,8 +42,8 @@
DeltaCloud cloud = (DeltaCloud)getElement();
CVCategoryElement c1 = new CVInstancesCategoryElement(cloud,
CVMessages.getString(INSTANCE_CATEGORY_NAME),
viewer);
- CVCategoryElement c2 = new CVCategoryElement(cloud,
CVMessages.getString(IMAGE_CATEGORY_NAME),
- CVCategoryElement.IMAGES);
+ CVCategoryElement c2 = new CVImagesCategoryElement(cloud,
CVMessages.getString(IMAGE_CATEGORY_NAME),
+ viewer);
addChild(c1);
addChild(c2);
}
@@ -46,4 +56,8 @@
return new CloudPropertySource(getElement());
}
+ public void loadChildren() {
+ DeltaCloud cloud = (DeltaCloud)getElement();
+ cloud.loadChildren();
+ }
}
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.ui.views.properties.IPropertySource;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.ui.views.properties.IPropertySource;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.viewers.TreeViewer;
@@ -31,7 +41,7 @@
if (!initialized) {
DeltaCloud cloud = (DeltaCloud)getElement();
cloud.removeInstanceListListener(this);
- DeltaCloudInstance[] instances = cloud.getInstances();
+ DeltaCloudInstance[] instances = cloud.getCurrInstances();
for (int i = 0; i < instances.length; ++i) {
DeltaCloudInstance d = instances[i];
CVInstanceElement element = new CVInstanceElement(d, d.getName());
@@ -44,7 +54,7 @@
}
@Override
- public void listChanged(DeltaCloudInstance[] instances) {
+ public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] instances) {
clearChildren();
for (int i = 0; i < instances.length; ++i) {
DeltaCloudInstance d = instances[i];
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import java.text.MessageFormat;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+#################################################################################
+# 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
+#################################################################################
InstanceCategoryName=Instances
ImageCategoryName=Images
CloudViewName=Cloud View
@@ -6,6 +16,7 @@
PropertyId.title=Id
PropertyOwnerId.title=Owner Id
PropertyHostname.title=Hostname
+PropertyKeyname.title=Key Name
PropertyState.title=State
PropertyProfileId.title=Hardware Profile
PropertyRealmId.title=Realm Id
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.viewers.ISelection;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.ui.views.properties.IPropertySheetEntry;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.ui.views.properties.PropertySheetPage;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.viewers.TreeViewer;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.viewers.TreeNode;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.viewers.ITreeContentProvider;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import java.util.ArrayList;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.viewers.LabelProvider;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.action.Action;
@@ -27,7 +37,6 @@
import org.eclipse.ui.part.ViewPart;
import org.eclipse.ui.views.properties.IPropertySheetPage;
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
@@ -117,7 +126,13 @@
private void contributeToActionBars() {
IActionBars bars = getViewSite().getActionBars();
- fillLocalPullDown(bars.getMenuManager());
+ IMenuManager menuMgr = bars.getMenuManager();
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ DeltaCloudView.this.fillLocalPullDown(manager);
+ }
+ });
+ fillLocalPullDown(menuMgr);
fillLocalToolBar(bars.getToolBarManager());
}
@@ -127,7 +142,14 @@
}
private void fillLocalPullDown(IMenuManager manager) {
+ manager.removeAll();
manager.add(removeCloud);
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ CloudViewElement element = (CloudViewElement)selection.getFirstElement();
+ if (element == null)
+ removeCloud.setEnabled(false);
+ else
+ removeCloud.setEnabled(true);
manager.add(refreshAction);
}
@@ -197,7 +219,15 @@
refreshAction = new Action() {
public void run() {
- viewer.setInput(new CVRootElement(viewer));
+ ISelection selection = viewer.getSelection();
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ if (obj instanceof CloudViewElement) {
+ CloudViewElement element = (CloudViewElement)obj;
+ while (!(element instanceof CVCloudElement))
+ element = (CloudViewElement)element.getParent();
+ CVCloudElement cloud = (CVCloudElement)element;
+ cloud.loadChildren();
+ }
}
};
refreshAction.setText(CVMessages.getString(REFRESH));
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageComparator.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageComparator.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageComparator.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.viewers.TableViewer;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.action.Action;
@@ -6,11 +16,8 @@
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -37,6 +44,7 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
@@ -51,6 +59,7 @@
private final static String CLOUD_SELECTOR_LABEL = "CloudSelector.label";
//$NON-NLS-1$
private final static String LAUNCH_INSTANCE = "CreateInstance.label";
//$NON-NLS-1$
+ private static final String REFRESH = "Refresh.label"; //$NON-NLS-1$
private TableViewer viewer;
private Composite container;
@@ -63,7 +72,7 @@
private ImageViewLabelAndContentProvider contentProvider;
- private Action doubleClickAction;
+ private Action refreshAction;
private Action launchAction;
private ImageView parentView;
@@ -77,13 +86,15 @@
@Override
public void modifyText(ModifyEvent e) {
int index = cloudSelector.getSelectionIndex();
+ if (currCloud != null)
+ currCloud.removeImageListListener(parentView);
currCloud = clouds[index];
+ viewer.setInput(new DeltaCloudImage[0]);
+ viewer.refresh();
Display.getCurrent().asyncExec(new Runnable() {
@Override
public void run() {
- // TODO Auto-generated method stub
- currCloud.removeImageListListener(parentView);
viewer.setInput(currCloud);
currCloud.addImageListListener(parentView);
viewer.refresh();
@@ -206,7 +217,6 @@
PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(),
"org.jboss.tools.deltacloud.ui.viewer");
makeActions();
hookContextMenu();
- hookDoubleClickAction();
hookSelection();
contributeToActionBars();
@@ -247,7 +257,7 @@
}
private void fillLocalPullDown(IMenuManager manager) {
- //TODO
+ manager.add(refreshAction);
}
private void fillContextMenu(IMenuManager manager) {
@@ -261,13 +271,25 @@
}
private void makeActions() {
- doubleClickAction = new Action() {
+ refreshAction = new Action() {
public void run() {
- ISelection selection = viewer.getSelection();
- Object obj = ((IStructuredSelection)selection).getFirstElement();
- showMessage("Double-click detected on "+obj.toString());
+ Thread t = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ if (currCloud != null) {
+ currCloud.getImages();
+ }
+ }
+
+ });
+ t.start();
}
};
+ refreshAction.setText(CVMessages.getString(REFRESH));
+ refreshAction.setToolTipText(CVMessages.getString(REFRESH));
+ refreshAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+ getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
launchAction = new Action() {
public void run() {
@@ -293,21 +315,6 @@
launchAction.setToolTipText(CVMessages.getString(LAUNCH_INSTANCE));
}
- private void hookDoubleClickAction() {
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- doubleClickAction.run();
- }
- });
- }
-
- private void showMessage(String message) {
- MessageDialog.openInformation(
- viewer.getControl().getShell(),
- CVMessages.getString("CloudViewName"), //$NON-NLS-1$
- message);
- }
-
@Override
public void setFocus() {
// TODO Auto-generated method stub
@@ -354,19 +361,21 @@
cloudSelector.addModifyListener(cloudModifyListener);
}
- public void listChanged(DeltaCloudImage[] list) {
+ public void listChanged(DeltaCloud cloud, DeltaCloudImage[] list) {
final DeltaCloudImage[] finalList = list;
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- // TODO Auto-generated method stub
- currCloud.removeImageListListener(parentView);
- viewer.setInput(finalList);
- currCloud.addImageListListener(parentView);
- viewer.refresh();
- }
-
- });
+ if (cloud.getName().equals(currCloud.getName())) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ // TODO Auto-generated method stub
+ currCloud.removeImageListListener(parentView);
+ viewer.setInput(finalList);
+ currCloud.addImageListListener(parentView);
+ viewer.refresh();
+ }
+
+ });
+ }
}
}
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import java.util.EnumSet;
@@ -74,7 +84,7 @@
images = (DeltaCloudImage[])newInput;
} else {
cloud = (DeltaCloud)newInput;
- images = cloud.getImages();
+ images = cloud.getCurrImages();
}
}
}
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceComparator.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import org.eclipse.jface.viewers.TableViewer;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import java.util.List;
@@ -14,6 +24,7 @@
public static final String PROPERTY_OWNER =
"deltacloud.views.instance.owner"; //$NON-NLS-1$
public static final String PROPERTY_STATE =
"deltacloud.views.instance.state"; //$NON-NLS-1$
private static final String PROPERTY_HOSTNAME =
"deltacloud.views.instance.hostname"; //$NON-NLS-1$
+ private static final String PROPERTY_KEYNAME =
"deltacloud.views.instance.keyname"; //$NON-NLS-1$
private static final String PROPERTY_PROFILEID =
"deltacloud.views.instance.profileid"; //$NON-NLS-1$
private static final String PROPERTY_REALMID =
"deltacloud.views.instance.realmid"; //$NON-NLS-1$
private static final String PROPERTY_IMAGEID =
"deltacloud.views.instance.imageid"; //$NON-NLS-1$
@@ -22,6 +33,7 @@
private static final String PROPERTY_OWNER_TITLE = "PropertyOwnerId.title";
//$NON-NLS-1$
private static final String PROPERTY_STATE_TITLE = "PropertyState.title";
//$NON-NLS-1$
private static final String PROPERTY_HOSTNAME_TITLE =
"PropertyHostname.title"; //$NON-NLS-1$
+ private static final String PROPERTY_KEYNAME_TITLE = "PropertyKeyname.title";
//$NON-NLS-1$
private static final String PROPERTY_PROFILEID_TITLE =
"PropertyProfileId.title"; //$NON-NLS-1$
private static final String PROPERTY_REALMID_TITLE = "PropertyRealmId.title";
//$NON-NLS-1$
private static final String PROPERTY_IMAGEID_TITLE = "PropertyImageId.title";
//$NON-NLS-1$
@@ -57,6 +69,8 @@
CVMessages.getString(PROPERTY_IMAGEID_TITLE));
PropertyDescriptor hostnameDescriptor = new PropertyDescriptor(PROPERTY_HOSTNAME,
CVMessages.getString(PROPERTY_HOSTNAME_TITLE));
+ PropertyDescriptor keyDescriptor = new PropertyDescriptor(PROPERTY_KEYNAME,
+ CVMessages.getString(PROPERTY_KEYNAME_TITLE));
propertyDescriptors = new IPropertyDescriptor[] {
nameDescriptor,
@@ -64,6 +78,7 @@
ownerDescriptor,
stateDescriptor,
hostnameDescriptor,
+ keyDescriptor,
hardwareDescriptor,
realmDescriptor,
imageDescriptor,
@@ -86,6 +101,8 @@
return instance.getRealmId();
if (id.equals(PROPERTY_IMAGEID))
return instance.getImageId();
+ if (id.equals(PROPERTY_KEYNAME))
+ return instance.getKey();
if (id.equals(PROPERTY_STATE)) {
return instance.getState();
}
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import java.util.HashMap;
@@ -14,17 +24,16 @@
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.TableColumnLayout;
import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
+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;
@@ -46,9 +55,11 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
+import org.jboss.tools.deltacloud.ui.Activator;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
@@ -72,6 +83,7 @@
private final static String REBOOTING_INSTANCE_MSG = "RebootingInstance.msg";
//$NON-NLS-1$
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 static final String REFRESH = "Refresh.label"; //$NON-NLS-1$
private TableViewer viewer;
@@ -84,7 +96,7 @@
private InstanceViewLabelAndContentProvider contentProvider;
- private Action doubleClickAction;
+ private Action refreshAction;
private Action startAction;
private Action stopAction;
private Action destroyAction;
@@ -105,17 +117,18 @@
@Override
public void modifyText(ModifyEvent e) {
int index = cloudSelector.getSelectionIndex();
+ if (currCloud != null)
+ currCloud.removeInstanceListListener(parentView);
currCloud = clouds[index];
+ viewer.setInput(new DeltaCloudInstance[0]);
+ viewer.refresh();
Display.getCurrent().asyncExec(new Runnable() {
@Override
public void run() {
- // TODO Auto-generated method stub
- currCloud.removeInstanceListListener(parentView);
viewer.setInput(currCloud);
currCloud.addInstanceListListener(parentView);
viewer.refresh();
-
}
});
@@ -234,7 +247,6 @@
PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(),
"org.jboss.tools.deltacloud.ui.viewer");
makeActions();
hookContextMenu();
- hookDoubleClickAction();
hookSelection();
contributeToActionBars();
@@ -275,7 +287,7 @@
}
private void fillLocalPullDown(IMenuManager manager) {
- //TODO
+ manager.add(refreshAction);
}
private void fillContextMenu(IMenuManager manager) {
@@ -342,20 +354,15 @@
}
currentPerformingActions.put(instance.getId(), this);
cloud.performInstanceAction(instance.getId(), action);
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- while (instance != null && !(instance.getState().equals(expectedState))
- && !(instance.getState().equals(DeltaCloudInstance.TERMINATED))) {
- instance = refreshInstance(instance);
- try {
- Thread.sleep(300);
- } catch (InterruptedException e) {
- break;
- }
- }
+ while (instance != null && !(instance.getState().equals(expectedState))
+ && !(instance.getState().equals(DeltaCloudInstance.TERMINATED))) {
+ instance = refreshInstance(instance);
+ try {
+ Thread.sleep(300);
+ } catch (InterruptedException e) {
+ break;
}
- });
+ }
} catch (DeltaCloudException e) {
// do nothing..action had problem executing..perhaps illegal
} finally {
@@ -397,13 +404,26 @@
}
private void makeActions() {
- doubleClickAction = new Action() {
+ refreshAction = new Action() {
public void run() {
- ISelection selection = viewer.getSelection();
- Object obj = ((IStructuredSelection)selection).getFirstElement();
- showMessage("Double-click detected on "+obj.toString());
+ Thread t = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ if (currCloud != null) {
+ currCloud.getInstances();
+ }
+ }
+
+ });
+ t.start();
}
};
+ refreshAction.setText(CVMessages.getString(REFRESH));
+ refreshAction.setToolTipText(CVMessages.getString(REFRESH));
+ refreshAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+ getImageDescriptor(ISharedImages.IMG_TOOL_REDO));
+
startAction = new Action() {
public void run() {
ISelection selection = viewer.getSelection();
@@ -469,7 +489,23 @@
DeltaCloudInstance instance =
(DeltaCloudInstance)((IStructuredSelection)selection).getFirstElement();
String hostname = instance.getHostName();
ISystemRegistry registry = SystemStartHere.getSystemRegistry();
+ RSECorePlugin rsep = RSECorePlugin.getDefault();
+ IRSECoreRegistry coreRegistry = rsep.getCoreRegistry();
+ IRSESystemType[] sysTypes = coreRegistry.getSystemTypes();
+ IRSESystemType sshType = null;
+ for (IRSESystemType sysType : sysTypes) {
+ if (sysType.getId().equals(IRSESystemType.SYSTEMTYPE_SSH_ONLY_ID))
+ sshType = sysType;
+ }
String connectionName = instance.getName() + " [" + instance.getId() +
"]"; //$NON-NLS-1$ //$NON-NLS-2$
+ try {
+ IHost host = registry.createHost(sshType, connectionName, hostname, null);
+ if (host != null)
+ host.setDefaultUserId("root"); //$NON-NLS-1$
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ Activator.log(e);
+ }
}
};
rseAction.setText(CVMessages.getString(RSE_LABEL));
@@ -493,21 +529,6 @@
return null;
}
- private void hookDoubleClickAction() {
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- doubleClickAction.run();
- }
- });
- }
-
- private void showMessage(String message) {
- MessageDialog.openInformation(
- viewer.getControl().getShell(),
- CVMessages.getString("CloudViewName"), //$NON-NLS-1$
- message);
- }
-
@Override
public void setFocus() {
// TODO Auto-generated method stub
@@ -529,10 +550,10 @@
public void changeEvent(int type) {
String currName = null;
- clouds = DeltaCloudManager.getDefault().getClouds();
if (currCloud != null) {
currName = currCloud.getName();
}
+ clouds = DeltaCloudManager.getDefault().getClouds();
String[] cloudNames = new String[clouds.length];
int index = 0;
for (int i = 0; i < clouds.length; ++i) {
@@ -554,20 +575,22 @@
cloudSelector.addModifyListener(cloudModifyListener);
}
- public void listChanged(DeltaCloudInstance[] list) {
+ public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] list) {
// Run following under Display thread since this can be
// triggered by a non-display thread notifying listeners.
final DeltaCloudInstance[] finalList = list;
- Display.getDefault().syncExec(new Runnable() {
- @Override
- public void run() {
- // TODO Auto-generated method stub
- currCloud.removeInstanceListListener(parentView);
- viewer.setInput(finalList);
- currCloud.addInstanceListListener(parentView);
- viewer.refresh();
- }
- });
+ if (cloud.getName().equals(currCloud.getName())) {
+ Display.getDefault().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ // TODO Auto-generated method stub
+ currCloud.removeInstanceListListener(parentView);
+ viewer.setInput(finalList);
+ currCloud.addInstanceListListener(parentView);
+ viewer.refresh();
+ }
+ });
+ }
}
}
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.views;
import java.util.EnumSet;
@@ -74,7 +84,7 @@
instances = (DeltaCloudInstance[])newInput;
} else {
cloud = (DeltaCloud)newInput;
- instances = cloud.getInstances();
+ instances = cloud.getCurrInstances();
}
}
}
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnection.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.internal.deltacloud.ui.wizards;
import java.net.MalformedURLException;
@@ -56,8 +66,9 @@
String url = mainPage.getURL();
String username = mainPage.getUsername();
String password = mainPage.getPassword();
+ String type = mainPage.getType();
try {
- DeltaCloud newCloud = new DeltaCloud(name, url, username, password, true);
+ DeltaCloud newCloud = new DeltaCloud(name, url, username, password, type, true);
DeltaCloudManager.getDefault().addCloud(newCloud);
} catch (MalformedURLException e) {
Activator.log(e);
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewCloudConnectionPage.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.internal.deltacloud.ui.wizards;
import java.io.BufferedReader;
@@ -154,6 +164,10 @@
return password;
}
+ public String getType() {
+ return typeText.getText();
+ }
+
private void validate() {
boolean complete = true;
boolean errorFree = true;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstance.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.internal.deltacloud.ui.wizards;
import java.io.UnsupportedEncodingException;
@@ -16,7 +26,6 @@
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.ui.Activator;
import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
import org.osgi.service.prefs.Preferences;
@@ -72,12 +81,13 @@
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);
boolean finished = false;
while (!finished && !pm.isCanceled()) {
- DeltaCloudInstance instance = cloud.refreshInstance(instanceId);
+ instance = cloud.refreshInstance(instanceId);
if (instance != null &&
!instance.getState().equals(DeltaCloudInstance.PENDING))
break;
Thread.sleep(400);
@@ -87,12 +97,7 @@
// do nothing
} finally {
if (!pm.isCanceled()) {
- // cause a refresh to occur to all instance watchers
- // NOTE: this could be done also by getting current
- // instances and refreshing the one instance, but this
- // method is already being run in a job and we might
- // as well get updates for all instances
- cloud.getInstances();
+ cloud.addReplaceInstance(instance);
}
pm.done();
}
@@ -112,6 +117,7 @@
String realmId = mainPage.getRealmId();
String memory = mainPage.getMemoryProperty();
String storage = mainPage.getStorageProperty();
+ String keyname = mainPage.getKeyName();
String name = null;
try {
name = URLEncoder.encode(mainPage.getInstanceName(), "UTF-8");
@@ -140,7 +146,7 @@
prefs.putBoolean(IDeltaCloudPreferenceConstants.DONT_CONFIRM_CREATE_INSTANCE,
true);
}
}
- instance = cloud.createInstance(name, imageId, realmId, profileId, memory, storage);
+ instance = cloud.createInstance(name, imageId, realmId, profileId, keyname, memory,
storage);
if (instance != null)
result = true;
if (instance != null &&
instance.getState().equals(DeltaCloudInstance.PENDING)) {
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/NewInstancePage.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.internal.deltacloud.ui.wizards;
import java.util.ArrayList;
@@ -2,9 +12,19 @@
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
@@ -14,12 +34,17 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudHardwareProfile;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
import org.jboss.tools.deltacloud.core.DeltaCloudRealm;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+import org.osgi.service.prefs.Preferences;
public class NewInstancePage extends WizardPage {
@@ -32,7 +57,12 @@
private static final String ARCH_LABEL = "Arch.label"; //$NON-NLS-1$
private static final String HARDWARE_LABEL = "Profile.label"; //$NON-NLS-1$
private static final String REALM_LABEL = "Realm.label"; //$NON-NLS-1$
+ private static final String KEY_LABEL = "Key.label"; //$NON-NLS-1$
+ private static final String MANAGE_BUTTON_LABEL = "ManageButton.label";
//$NON-NLS-1$
private static final String PROPERTIES_LABEL = "Properties.label";
//$NON-NLS-1$
+
+ private static final String PEM_NAME = "Pem.name"; //$NON-NLS-1$
+
private static final String NONE_RESPONSE = "None.response"; //$NON-NLS-1$
@SuppressWarnings("unused")
private static final String NAME_ALREADY_IN_USE = "ErrorNameInUse.text";
//$NON-NLS-1$
@@ -43,14 +73,15 @@
private ArrayList<DeltaCloudHardwareProfile> profiles;
private Text nameText;
+ private Text keyText;
private Combo hardware;
+ private Button keyManage;
private Control realm;
private String[] profileIds;
private ProfileComposite currPage;
private ProfileComposite[] profilePages;
private ArrayList<String> realmIds;
-
-
+
private ModifyListener textListener = new ModifyListener() {
@Override
@@ -70,6 +101,22 @@
}
};
+ private SelectionListener manageListener = new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent event) {
+ Shell shell = getShell();
+ ManageKeys wizard = new ManageKeys(cloud, ".pem"); //$NON-NLS-1$
+ WizardDialog dialog = new CustomWizardDialog(shell, wizard,
+ IDialogConstants.OK_LABEL);
+ dialog.create();
+ dialog.open();
+ String keyname = wizard.getKeyName();
+ if (keyname != null)
+ keyText.setText(keyname);
+ }
+
+ };
+
public NewInstancePage(DeltaCloud cloud, DeltaCloudImage image) {
super(WizardMessages.getString(NAME));
this.cloud = cloud;
@@ -110,6 +157,10 @@
return nameText.getText();
}
+ public String getKeyName() {
+ return keyText.getText();
+ }
+
private void validate() {
boolean complete = true;
boolean errorFree = true;
@@ -120,6 +171,20 @@
if (name.length() == 0) {
complete = false;
}
+
+ if (cloud.getType().equals(DeltaCloudInstance.EC2_TYPE)) {
+ String keyname = keyText.getText();
+ if (keyname.length() == 0)
+ complete = false;
+ else {
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ try {
+ prefs.put(IDeltaCloudPreferenceConstants.LAST_EC2_KEYNAME, keyname);
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+ }
if (errorFree)
setErrorMessage(null);
@@ -177,9 +242,11 @@
Label realmLabel = new Label(container, SWT.NULL);
realmLabel.setText(WizardMessages.getString(REALM_LABEL));
+
nameText = new Text(container, SWT.BORDER | SWT.SINGLE);
nameText.addModifyListener(textListener);
-
+
+
DeltaCloudRealm[] realms = cloud.getRealms();
realmIds = new ArrayList<String>();
ArrayList<String> realmNames = new ArrayList<String>();
@@ -270,13 +337,51 @@
f.right = new FormAttachment(100, 0);
realm.setLayoutData(f);
+ Control control = realm;
+
+ if (cloud.getType().equals(DeltaCloudInstance.EC2_TYPE)) {
+ Label keyLabel = new Label(container, SWT.NULL);
+ keyLabel.setText(WizardMessages.getString(KEY_LABEL));
+
+ keyText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ Preferences prefs = new InstanceScope().getNode(Activator.PLUGIN_ID);
+ String defaultKeyname = prefs.get(IDeltaCloudPreferenceConstants.LAST_EC2_KEYNAME,
"");
+ keyText.setText(defaultKeyname);
+ keyText.addModifyListener(textListener);
+
+ keyManage = new Button(container, SWT.NULL);
+ keyManage.setText(WizardMessages.getString(MANAGE_BUTTON_LABEL));
+ keyManage.addSelectionListener(manageListener);
+
+ f = new FormData();
+ f.top = new FormAttachment(realm, 11);
+ f.left = new FormAttachment(0, 0);
+ keyLabel.setLayoutData(f);
+
+ f = new FormData();
+ int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
+ Point minSize = keyManage.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
+ f.width = Math.max(widthHint, minSize.x);
+ f.top = new FormAttachment(realm, 8);
+ f.right = new FormAttachment(realm, 0, SWT.RIGHT);
+ keyManage.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(realm, 8);
+ f.left = new FormAttachment(hardwareLabel, 5);
+ f.right = new FormAttachment(keyManage, -10);
+ keyText.setLayoutData(f);
+
+ control = keyText;
+ }
+
f = new FormData();
- f.top = new FormAttachment(realm, 11);
+ f.top = new FormAttachment(control, 11);
f.left = new FormAttachment(0, 0);
hardwareLabel.setLayoutData(f);
f = new FormData();
- f.top = new FormAttachment(realm, 8);
+ f.top = new FormAttachment(control, 8);
f.left = new FormAttachment(hardwareLabel, 5);
f.right = new FormAttachment(100, 0);
hardware.setLayoutData(f);
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/ProfileComposite.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.internal.deltacloud.ui.wizards;
import java.util.List;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.java 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.internal.deltacloud.ui.wizards;
import java.text.MessageFormat;
Modified:
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties
===================================================================
---
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2010-09-03
16:36:35 UTC (rev 24710)
+++
branches/jbosstools-3.2.0.M2/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/WizardMessages.properties 2010-09-03
16:47:53 UTC (rev 24711)
@@ -1,3 +1,13 @@
+#################################################################################
+# 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
+#################################################################################
NewCloudConnection.desc=Specify connection details for a cloud you wish to access
NewCloudConnection.title=Cloud Connection
NewCloudConnection.name=Cloud Connection
@@ -19,7 +29,14 @@
Memory.label=Memory:
Realm.label=Realm:
Storage.label=Storage:
+Key.label=Key Name:
+BrowseButton.label=Browse...
+ManageButton.label=Manage...
+NewButton.label=New...
+DeleteButton.label=Delete
+Pem.name=PEM file (*.pem)
+
BackGround.label=Run In Background
AlwaysRunInBackground.msg=Always run in the background
Progress.msg=Progress
@@ -41,10 +58,23 @@
ErrorNameInUse.text=Error: the name chosen is already in use
ErrorInvalidURL.text=URL specified is invalid
ErrorNonCloudURL.text=URL specified is not a valid Delta-cloud address
+ErrorInvalidPem.text=File specified is not a valid existing key
NewInstance.desc=Specify details for a new instance you wish to launch based on an image
NewInstance.title=Launch Instance
NewInstance.name=Launch Instance
+ManageKeys.desc=Select a physical key to use when creating an instance so that it may be
accessed remotely.
+ManageKeys.title=Manage Keys
+ManageKeys.name=Manage Keys
+
+ErrorInvalidDirectory.text=Specified directory is not a valid existing directory
+Directory.label=Directory
+
+CreateKey.title=Create Key
+CreateKey.msg=Specify a unique name for a new key:
+ConfirmKeyDelete.title=Confirm Key Delete
+ConfirmKeyDelete.msg=Confirm deletion of key: {0}
+
StartingInstance.title=Starting Instance
StartingInstance.msg=Starting Instance: {0}
\ No newline at end of file