Author: adietish
Date: 2010-12-07 03:34:15 -0500 (Tue, 07 Dec 2010)
New Revision: 27203
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetNonSorter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CloudPropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/ImagePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ITableContentAndLabelProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java
Removed:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementTableView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElementCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVNumericFoldingElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ITableContentAndLabelProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/LoadingCloudViewElement.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/TableViewerColumnComparator.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
Log:
[JBIDE-7819] I now show the user that things are being loaded ("Loading..."
node). Since I now load data async now, nodes are added in #listChanged and I have to add
children to the tree manually (and not return them on #getChildren)
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/DeltaCloudManager.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -188,19 +188,19 @@
public void addCloud(DeltaCloud d) throws DeltaCloudException {
doGetClouds().add(d);
saveClouds();
- notifyListeners(ICloudManagerListener.ADD_EVENT);
+ notifyListeners(ICloudManagerListener.ADD_EVENT, d);
}
public void removeCloud(DeltaCloud d) throws DeltaCloudException {
doGetClouds().remove(d);
d.dispose();
saveClouds();
- notifyListeners(ICloudManagerListener.REMOVE_EVENT);
+ notifyListeners(ICloudManagerListener.REMOVE_EVENT, d);
}
- public void notifyCloudRename() throws DeltaCloudException {
+ public void notifyCloudRename(DeltaCloud cloud) throws DeltaCloudException {
saveClouds();
- notifyListeners(ICloudManagerListener.RENAME_EVENT);
+ notifyListeners(ICloudManagerListener.RENAME_EVENT, cloud);
}
public void addCloudManagerListener(ICloudManagerListener listener) {
@@ -214,11 +214,11 @@
cloudManagerListeners.remove(listener);
}
- public void notifyListeners(int type) {
+ public void notifyListeners(int type, DeltaCloud cloud) {
if (cloudManagerListeners != null) {
Object[] listeners = cloudManagerListeners.getListeners();
for (int i = 0; i < listeners.length; ++i) {
- ((ICloudManagerListener) listeners[i]).cloudsChanged(type);
+ ((ICloudManagerListener) listeners[i]).cloudsChanged(type, cloud);
}
}
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudManagerListener.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -16,5 +16,5 @@
public static int REMOVE_EVENT = 2;
public static int RENAME_EVENT = 3;
- void cloudsChanged(int type);
+ void cloudsChanged(int type, DeltaCloud cloud);
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-07 08:22:00
UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-12-07 08:34:15
UTC (rev 27203)
@@ -1,3 +1,17 @@
+2010-12-07 André Dietisheim <adietish(a)redhat.com>
+
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java
(setLoadingIndicator):
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java:
+ [JBIDE-7819] I now show the user that things are being loaded ("Loading..."
node)
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java
(listChanged):
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java
(listChanged):
+ * src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java
+ (addChild):
+ (addChildren):
+ (removeChild):
+ [JBIDE-7819] since loading data async now, nodes are added in #listChanged and I have to
add children
+ to the tree manually (and not return them on #getChildren)
+
2010-12-06 André Dietisheim <adietish(a)redhat.com>
* src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java (validate):
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-07 08:22:00
UTC (rev 27202)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-12-07 08:34:15
UTC (rev 27203)
@@ -11,19 +11,19 @@
name="%CloudViewerName"
icon="icons/delta.gif"
category="org.jboss.tools.deltacloud.ui"
- class="org.jboss.tools.deltacloud.ui.views.DeltaCloudView"
+ class="org.jboss.tools.deltacloud.ui.views.cloud.DeltaCloudView"
id="org.jboss.tools.deltacloud.ui.views.CloudView">
</view>
<view
category="org.jboss.tools.deltacloud.ui"
- class="org.jboss.tools.deltacloud.ui.views.InstanceView"
+
class="org.jboss.tools.deltacloud.ui.views.cloudelements.InstanceView"
icon="icons/delta.gif"
id="org.jboss.tools.deltacloud.ui.views.InstanceView"
name="%InstanceViewer.name">
</view>
<view
category="org.jboss.tools.deltacloud.ui"
- class="org.jboss.tools.deltacloud.ui.views.ImageView"
+
class="org.jboss.tools.deltacloud.ui.views.cloudelements.ImageView"
icon="icons/delta.gif"
id="org.jboss.tools.deltacloud.ui.views.ImageView"
name="%ImageViewer.name"
@@ -40,7 +40,7 @@
point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
<propertyContributor
contributorId="org.jboss.tools.deltacloud.ui.views.CloudView"
- typeMapper="org.jboss.tools.deltacloud.ui.views.CVTypeMapper">
+
typeMapper="org.jboss.tools.deltacloud.ui.views.cloud.CVTypeMapper">
<propertyCategory
category="main"></propertyCategory>
</propertyContributor>
@@ -61,11 +61,11 @@
<propertySections
contributorId="org.jboss.tools.deltacloud.ui.views.CloudView">
<propertySection
- class="org.jboss.tools.deltacloud.ui.views.CVPropertySection"
+
class="org.jboss.tools.deltacloud.ui.views.cloud.property.CVPropertySection"
id="org.jboss.tools.deltacloud.ui.propertySection.advanced"
tab="cloudview.advancedTab">
<input
-
type="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+
type="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</input>
</propertySection>
</propertySections>
@@ -116,7 +116,7 @@
variable="selection">
<iterate>
<instanceof
-
value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+
value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</instanceof>
</iterate>
</with>
@@ -136,7 +136,7 @@
variable="selection">
<iterate>
<instanceof
-
value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+
value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</instanceof>
</iterate>
</with>
@@ -158,7 +158,7 @@
<count value="+" />
<iterate>
<instanceof
-
value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+
value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</instanceof>
</iterate>
</and>
@@ -177,7 +177,7 @@
<activeWhen>
<with
variable="activePart">
- <instanceof value="org.jboss.tools.deltacloud.ui.views.InstanceView"
/>
+ <instanceof
value="org.jboss.tools.deltacloud.ui.views.cloudelements.InstanceView" />
</with>
</activeWhen>
</handler>
@@ -187,15 +187,9 @@
<activeWhen>
<with
variable="activePart">
- <instanceof value="org.jboss.tools.deltacloud.ui.views.ImageView"
/>
+ <instanceof
value="org.jboss.tools.deltacloud.ui.views.cloudelements.ImageView" />
</with>
</activeWhen>
- <enabledWhen>
- <with
- variable="selection">
- <count value="+" />
- </with>
- </enabledWhen>
</handler>
</extension>
<extension
@@ -305,7 +299,7 @@
variable="selection">
<iterate>
<instanceof
-
value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+
value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</instanceof>
</iterate>
</with>
@@ -681,7 +675,7 @@
variable="selection">
<iterate>
<instanceof
-
value="org.jboss.tools.deltacloud.ui.views.CVImageElement">
+
value="org.jboss.tools.deltacloud.ui.views.cloud.CVImageElement">
</instanceof>
</iterate>
</with>
@@ -705,11 +699,11 @@
<iterate>
<and>
<instanceof
-
value="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+
value="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement">
</instanceof>
<not>
<instanceof
-
value="org.jboss.tools.deltacloud.ui.views.CVImageElement">
+
value="org.jboss.tools.deltacloud.ui.views.cloud.CVImageElement">
</instanceof>
</not>
</and>
@@ -876,7 +870,7 @@
<extension
point="org.eclipse.core.runtime.adapters">
<factory
-
adaptableType="org.jboss.tools.deltacloud.ui.views.CloudViewElement"
+
adaptableType="org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement"
class="org.jboss.tools.deltacloud.ui.adapter.CloudViewElementAdapterFactory">
<adapter
type="org.jboss.tools.deltacloud.core.DeltaCloudInstance">
@@ -885,7 +879,7 @@
type="org.jboss.tools.deltacloud.core.DeltaCloud">
</adapter>
<adapter
-
type="org.jboss.tools.deltacloud.ui.views.InstancePropertySource">
+
type="org.jboss.tools.deltacloud.ui.views.cloud.property.InstancePropertySource">
</adapter>
<adapter
type="org.jboss.tools.deltacloud.core.DeltaCloudImage">
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/adapter/CloudViewElementAdapterFactory.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -16,9 +16,9 @@
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.views.CVImageElement;
-import org.jboss.tools.deltacloud.ui.views.CVInstanceElement;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVImageElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVInstanceElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
public class CloudViewElementAdapterFactory implements IAdapterFactory {
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/CreateInstanceHandler2.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -21,8 +21,8 @@
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
import org.jboss.tools.internal.deltacloud.ui.wizards.NewInstanceWizard2;
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/DisconnectCloudHandler.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -37,9 +37,9 @@
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
/**
* @author Andre Dietisheim
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/EditConnectionHandler.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -21,8 +21,8 @@
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.ui.handlers.HandlerUtil;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
import org.jboss.tools.internal.deltacloud.ui.wizards.EditCloudConnectionWizard;
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/commands/RefreshCloudHandler.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -25,7 +25,7 @@
import org.jboss.tools.deltacloud.core.DeltaCloudException;
import org.jboss.tools.deltacloud.core.DeltaCloudMultiException;
import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementTableView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementTableView.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementTableView.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,402 +0,0 @@
-/*******************************************************************************
- * 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;
-import java.util.List;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.layout.TableColumnLayout;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TableViewer;
-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.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.ViewPart;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudManager;
-import org.jboss.tools.deltacloud.core.ICloudManagerListener;
-import org.jboss.tools.deltacloud.core.IDeltaCloudElement;
-import org.jboss.tools.deltacloud.core.IInstanceFilter;
-import org.jboss.tools.deltacloud.ui.Activator;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.internal.deltacloud.ui.preferences.TextPreferenceValue;
-import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
-
-/**
- * A common superclass for viewers that operate on IDeltaCloudElements
- * (currently DeltaCloudImage and DeltaCloudInstance)
- *
- * @see InstanceView
- * @see ImageView
- *
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public abstract class AbstractCloudElementTableView<CLOUDELEMENT extends
IDeltaCloudElement> extends ViewPart implements
- ICloudManagerListener {
-
- private final static String CLOUD_SELECTOR_LABEL = "CloudSelector.label";
//$NON-NLS-1$
-
- private static final String FILTERED_LABEL = "Filtered.label"; //$NON-NLS-1$
- private static final String FILTERED_TOOLTIP = "FilteredImages.tooltip";
//$NON-NLS-1$
-
- private Combo currentCloudSelector;
- private Label currentCloudSelectorLabel;
- private TableViewer viewer;
-
- private DeltaCloud currentCloud;
-
- private TextPreferenceValue lastSelectedCloudPref;
-
- private ModifyListener cloudModifyListener = new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- int index = currentCloudSelector.getSelectionIndex();
- if (index < 0) {
- return;
- }
-
-// removeListener(currentCloud);
-
- AbstractCloudElementTableView.this.currentCloud = getCurrentCloud(index,
getClouds());
- if (currentCloud != null) {
- lastSelectedCloudPref.store(currentCloud.getName());
- Display.getCurrent().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- setViewerInput(currentCloud);
-// addListener(currentCloud);
- }
- });
- }
- }
- };
-
- private ISelectionListener workbenchSelectionListener = new ISelectionListener() {
-
- @Override
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- DeltaCloud cloud = UIUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
- if (cloud != null) {
- currentCloudSelector.select(getCloudIndex(cloud, getClouds()));
- }
- }
- };
-
-// private Job viewerInputJob = new Job("") {
-//
-// @Override
-// protected IStatus run(IProgressMonitor monitor) {
-//
-// return Status.OK_STATUS;
-// }
-// };
-
- public AbstractCloudElementTableView() {
- lastSelectedCloudPref = new TextPreferenceValue(getSelectedCloudPrefsKey(),
Activator.getDefault());
- }
-
- private class ColumnListener extends SelectionAdapter {
-
- private int column;
-
- public ColumnListener(int column) {
- this.column = column;
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- TableViewerColumnComparator comparator = (TableViewerColumnComparator)
viewer.getComparator();
- Table t = viewer.getTable();
- if (comparator.getColumn() == column) {
- comparator.reverseDirection();
- }
- comparator.setColumn(column);
- TableColumn tc = (TableColumn) e.getSource();
- t.setSortColumn(tc);
- t.setSortDirection(SWT.NONE);
- viewer.refresh();
- }
- };
-
- protected abstract String getSelectedCloudPrefsKey();
-
- @Override
- public void dispose() {
- DeltaCloudManager.getDefault().removeCloudManagerListener(this);
- super.dispose();
- }
-
- @Override
- public void createPartControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- FormLayout layout = new FormLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- container.setLayout(layout);
-
- DeltaCloud[] clouds = getClouds();
-
- createCloudSelector(container);
- initCloudSelector(lastSelectedCloudPref.get(), currentCloudSelector, clouds);
-
- Label filterLabel = new Label(container, SWT.NULL);
- filterLabel.setText(CVMessages.getString(FILTERED_LABEL));
- filterLabel.setToolTipText(CVMessages.getString(FILTERED_TOOLTIP));
-
- Composite tableArea = new Composite(container, SWT.NULL);
- viewer = createTableViewer(tableArea);
-
- currentCloud = getCurrentCloud(currentCloudSelector.getSelectionIndex(), clouds);
-
-// addListener(currentCloud);
- setViewerInput(currentCloud);
- setFilterLabelVisible(currentCloud, filterLabel);
-
- Point p1 = currentCloudSelectorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point p2 = currentCloudSelector.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- int centering = (p2.y - p1.y + 1) / 2;
-
- FormData f = new FormData();
- f.top = new FormAttachment(0, 5 + centering);
- f.left = new FormAttachment(0, 30);
- currentCloudSelectorLabel.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(0, 5);
- f.left = new FormAttachment(currentCloudSelectorLabel, 5);
- currentCloudSelector.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(0, 5 + centering);
- f.right = new FormAttachment(100, -10);
- filterLabel.setLayoutData(f);
-
- f = new FormData();
- f.top = new FormAttachment(currentCloudSelector, 8);
- f.left = new FormAttachment(0, 0);
- f.right = new FormAttachment(100, 0);
- f.bottom = new FormAttachment(100, 0);
- tableArea.setLayoutData(f);
-
- // Create the help context id for the viewer's control
- PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(),
"org.jboss.tools.deltacloud.ui.viewer");
- hookContextMenu(viewer.getControl());
- getSite().setSelectionProvider(viewer);
- getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(workbenchSelectionListener);
-
- DeltaCloudManager.getDefault().addCloudManagerListener(this);
- }
-
- private TableViewer createTableViewer(Composite tableArea) {
- TableColumnLayout tableLayout = new TableColumnLayout();
- tableArea.setLayout(tableLayout);
-
- TableViewer viewer = new TableViewer(tableArea,
- SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI);
- Table table = viewer.getTable();
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- ITableContentAndLabelProvider provider = getContentAndLabelProvider();
- viewer.setContentProvider(provider);
- viewer.setLabelProvider(provider);
- createColumns(tableLayout, table);
-
- viewer.setComparator(new TableViewerColumnComparator());
- table.setSortDirection(SWT.NONE);
-
- return viewer;
- }
-
- protected abstract ITableContentAndLabelProvider getContentAndLabelProvider();
-
- private void setViewerInput(DeltaCloud cloud) {
- if (currentCloud != null) {
- viewer.setInput(currentCloud);
- }
- }
-
- /**
- * Gets the clouds that are available in the model.
- *
- * @return the clouds
- */
- private DeltaCloud[] getClouds() {
- DeltaCloud[] clouds = new DeltaCloud[] {};
- try {
- clouds = DeltaCloudManager.getDefault().getClouds();
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- "Could not get all clouds",
- e, Display.getDefault().getActiveShell());
- }
- return clouds;
- }
-
- private int getCloudIndex(DeltaCloud cloud, DeltaCloud[] clouds) {
- if (cloud == null) {
- return 0;
- }
- return getCloudIndex(cloud.getName(), clouds);
- }
-
- private int getCloudIndex(String cloudName, DeltaCloud[] clouds) {
- int index = 0;
- if (cloudName != null && clouds.length > 0) {
- for (int i = 0; i < clouds.length; i++) {
- DeltaCloud cloud = clouds[i];
- if (cloudName != null && cloudName.equals(cloud.getName())) {
- index = i;
- break;
- }
- }
- }
- return index;
- }
-
- private void setFilterLabelVisible(DeltaCloud currentCloud, Label filterLabel) {
- if (currentCloud == null) {
- filterLabel.setVisible(false);
- return;
- }
-
- IInstanceFilter filter = currentCloud.getInstanceFilter();
- filterLabel.setVisible(!filter.toString().equals(IInstanceFilter.ALL_STRING));
- }
-
- private DeltaCloud getCurrentCloud(int cloudIndex, DeltaCloud[] clouds) {
- if (cloudIndex < 0 || cloudIndex >= clouds.length) {
- return null;
- }
-
- return clouds[cloudIndex];
- }
-
- private void createColumns(TableColumnLayout tableLayout, Table table) {
- for (int i = 0; i < InstanceViewLabelAndContentProvider.Column.getSize(); ++i) {
- InstanceViewLabelAndContentProvider.Column c =
- InstanceViewLabelAndContentProvider.Column.getColumn(i);
- TableColumn tc = new TableColumn(table, SWT.NONE);
- if (i == 0) {
- table.setSortColumn(tc);
- }
- tc.setText(CVMessages.getString(c.name()));
- tableLayout.setColumnData(tc, new ColumnWeightData(c.getWeight(), true));
- tc.addSelectionListener(new ColumnListener(i));
- }
- }
-
- private void createCloudSelector(Composite parent) {
- this.currentCloudSelectorLabel = new Label(parent, SWT.NULL);
- currentCloudSelectorLabel.setText(CVMessages.getString(CLOUD_SELECTOR_LABEL));
-
- this.currentCloudSelector = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
- currentCloudSelector.addModifyListener(cloudModifyListener);
- // Following is a kludge so that on Linux the Combo is read-only but
- // has a white background.
- currentCloudSelector.addVerifyListener(new VerifyListener() {
- @Override
- public void verifyText(VerifyEvent e) {
- e.doit = false;
- }
- });
- }
-
- private void hookContextMenu(Control control) {
- IMenuManager contextMenu = UIUtils.createContextMenu(control);
- UIUtils.registerContributionManager(UIUtils.getContextMenuId(getViewID()), contextMenu,
control);
- }
-
- protected abstract String getViewID();
-
- private void initCloudSelector(String cloudNameToSelect, Combo cloudSelector,
DeltaCloud[] clouds) {
- if (clouds.length > 0
- && cloudNameToSelect != null && cloudNameToSelect.length() > 0) {
- cloudSelector.setItems(toCloudNames(clouds));
- cloudSelector.select(getCloudIndex(cloudNameToSelect, clouds));
- }
- }
-
- public void cloudsChanged(int type) {
- int currIndex = 0;
- if (currentCloud != null) {
- currIndex = currentCloudSelector.getSelectionIndex();
- }
- DeltaCloud[] clouds = getClouds();
- int index = getCloudIndex(currentCloud, getClouds());
- if (type == ICloudManagerListener.RENAME_EVENT) {
- index = currIndex; // no change in cloud displayed
- }
-
- String[] cloudNames = toCloudNames(clouds);
- setCloudSelectorItems(cloudNames, currentCloudSelector);
- this.currentCloud = getCurrentCloud(index, clouds);
-
- if (cloudNames.length > 0) {
- currentCloudSelector.setText(cloudNames[index]);
- setViewerInput(currentCloud);
- } else {
- currentCloudSelector.setText("");
- setViewerInput(null);
- }
- }
-
- private String[] toCloudNames(DeltaCloud[] clouds) {
- List<String> cloudNames = new ArrayList<String>();
- for (DeltaCloud cloud : clouds) {
- if (cloud != null) {
- cloudNames.add(cloud.getName());
- }
- }
- return (String[]) cloudNames.toArray(new String[cloudNames.size()]);
- }
-
- private void setCloudSelectorItems(String[] cloudNames, Combo cloudSelector) {
- cloudSelector.removeModifyListener(cloudModifyListener);
- cloudSelector.setItems(cloudNames);
- cloudSelector.addModifyListener(cloudModifyListener);
- }
-
- /**
- * Refresh the states of the commands in the toolbar.
- */
- protected abstract void refreshToolbarCommandStates();
-
- @Override
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * 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.core.runtime.Assert;
-import org.eclipse.jface.viewers.BaseLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Display;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.ICloudElementFilter;
-import org.jboss.tools.deltacloud.core.IDeltaCloudElement;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-
-/**
- * A common superclass for content- and label-providers that operate on
- * IDeltaCloudElements (currently DeltaCloudImage and DeltaCloudInstance)
- *
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public abstract class AbstractCloudElementViewLabelAndContentProvider<CLOUDELEMENT
extends IDeltaCloudElement> extends
- BaseLabelProvider implements ITableContentAndLabelProvider {
-
- private DeltaCloud currentCloud;
- private ICloudElementFilter<CLOUDELEMENT> localFilter;
- private TableViewer viewer;
-
- @Override
- public Object[] getElements(Object input) {
- return new Object[] {};
- }
-
- public void setFilter(ICloudElementFilter<CLOUDELEMENT> filter) {
- this.localFilter = filter;
- }
-
- @Override
- public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) {
- if (!(newInput instanceof DeltaCloud)) {
- return;
- }
- Assert.isTrue(viewer instanceof TableViewer);
- this.viewer = (TableViewer) viewer;
- removeListener(currentCloud);
- this.currentCloud = (DeltaCloud) newInput;
- addListener(currentCloud);
- // TODO internationalize strings
- asyncGetCloudElements(currentCloud);
- }
-
- public void listChanged(final DeltaCloud cloud, final CLOUDELEMENT[] cloudElements) {
- if (isCurrentCloud(cloud)) {
- addToViewer(cloudElements);
- }
- }
-
- private boolean isCurrentCloud(final DeltaCloud cloud) {
- return cloud != null
- && currentCloud != null
- && cloud.getName().equals(currentCloud.getName());
- }
-
- private void addToViewer(final CLOUDELEMENT[] cloudElements) {
- viewer.getControl().getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- try {
- Object[] elements = filter(getFilter(currentCloud), cloudElements);
- viewer.add(elements);
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- "Could not get elements of clouds " + currentCloud.getName(),
- e, Display.getDefault().getActiveShell());
-
- }
- }
- });
- }
-
- private ICloudElementFilter<CLOUDELEMENT> getFilter(DeltaCloud cloud) {
- if (localFilter != null) {
- return localFilter;
- } else {
- return getCloudFilter(cloud);
- }
- }
-
- protected Object[] filter(ICloudElementFilter<CLOUDELEMENT> filter, CLOUDELEMENT[]
cloudElements)
- throws DeltaCloudException {
- if (cloudElements == null) {
- return new Object[] {};
- }
- if (filter == null) {
- return cloudElements;
- } else {
- return filter.filter(cloudElements).toArray();
- }
- }
-
- @Override
- public void dispose() {
- removeListener(currentCloud);
- }
-
- protected abstract void addListener(DeltaCloud cloud);
-
- protected abstract void removeListener(DeltaCloud cloud);
-
- protected abstract ICloudElementFilter<CLOUDELEMENT> getCloudFilter(DeltaCloud
cloud);
-
- protected abstract void asyncGetCloudElements(DeltaCloud cloud);
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVCloudElement extends CloudViewElement {
-
- private TreeViewer viewer;
-
- public CVCloudElement(Object element, String name, TreeViewer viewer) {
- super(element, viewer);
- this.viewer = viewer;
- }
-
- public String getName() {
- Object element = getElement();
- if (element instanceof DeltaCloud) {
- return ((DeltaCloud) element).getName();
- } else {
- return "";
- }
- }
-
- @Override
- public boolean hasChildren() {
- return true;
- }
-
- @Override
- public synchronized Object[] getChildren() {
- if (!initialized.get()) {
- DeltaCloud cloud = (DeltaCloud) getElement();
- CVCloudElementCategoryElement instances = new CVInstancesCategoryElement(cloud,
viewer);
- addCategory(instances);
- CVCloudElementCategoryElement images = new CVImagesCategoryElement(cloud, viewer);
- addCategory(images);
- }
- initialized.set(true);
- return super.getChildren();
- }
-
- private void addCategory(CVCloudElementCategoryElement categoryElement) {
- children.add(categoryElement);
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return new CloudPropertySource(getElement());
- }
-
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElementCategoryElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElementCategoryElement.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElementCategoryElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public abstract class CVCloudElementCategoryElement extends CloudViewElement {
-
- public CVCloudElementCategoryElement(Object element, TreeViewer viewer) {
- super(element, viewer);
- addCloudElementListener(getCloud());
- }
-
- @Override
- public boolean hasChildren() {
- return true;
- }
-
- @Override
- public Object[] getChildren() {
- if (!initialized.get()) {
- setLoadingIndicator();
- asyncGetCloudElements();
- initialized.set(true);
- }
- return super.getChildren();
- }
-
- private void setLoadingIndicator() {
- children.add(new LoadingCloudViewElement(getViewer()));
- }
-
- protected abstract void asyncGetCloudElements();
-
- protected void addChildren(Object[] modelElements) {
- if (modelElements.length > CVNumericFoldingElement.FOLDING_SIZE) {
- addFoldedChildren(modelElements);
- } else {
- addChildren(getElements(modelElements, 0, modelElements.length));
- }
- }
-
- protected void addFoldedChildren(Object[] modelElements) {
- int min = 0;
- int max = CVNumericFoldingElement.FOLDING_SIZE;
- int length = modelElements.length;
- while (length > CVNumericFoldingElement.FOLDING_SIZE) {
- CVNumericFoldingElement f = new CVNumericFoldingElement(min, max, getViewer());
- addChild(f);
- f.addChildren(getElements(modelElements, min, max));
- min += CVNumericFoldingElement.FOLDING_SIZE;
- max += CVNumericFoldingElement.FOLDING_SIZE;
- length -= CVNumericFoldingElement.FOLDING_SIZE;
- }
- if (length > 0) {
- CVNumericFoldingElement f = new CVNumericFoldingElement(min, max, getViewer());
- addChild(f);
- f.addChildren(getElements(modelElements, min, min + length));
- }
- }
-
- protected abstract CloudViewElement[] getElements(Object[] modelElements, int
startIndex, int stopIndex);
-
- @Override
- public IPropertySource getPropertySource() {
- // no property source for cathegories
- return null;
- }
-
- protected DeltaCloud getCloud() {
- return (DeltaCloud) getElement();
- }
-
- @Override
- protected void dispose() {
- removeCloudElementListener(getCloud());
- }
-
- protected abstract void addCloudElementListener(DeltaCloud cloud);
-
- protected abstract void removeCloudElementListener(DeltaCloud cloud);
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVImageElement extends CloudViewElement {
-
- public CVImageElement(Object element, TreeViewer viewer) {
- super(element, viewer);
- }
-
- public String getName() {
- Object element = getElement();
- if (element instanceof DeltaCloudImage) {
- return ((DeltaCloudImage) element).getName();
- } else {
- return "";
- }
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return new ImagePropertySource(getElement());
- }
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImagesCategoryElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * 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;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-import org.jboss.tools.deltacloud.core.GetImagesCommand;
-import org.jboss.tools.deltacloud.core.IImageFilter;
-import org.jboss.tools.deltacloud.core.IImageListListener;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVImagesCategoryElement extends CVCloudElementCategoryElement implements
IImageListListener {
-
- private static final String IMAGE_CATEGORY_NAME = "ImageCategoryName";
//$NON-NLS-1$
-
- public CVImagesCategoryElement(Object element, TreeViewer viewer) {
- super(element, viewer);
- }
-
- public String getName() {
- return CVMessages.getString(IMAGE_CATEGORY_NAME);
- }
-
- protected void asyncGetCloudElements() {
- new GetImagesCommand(getCloud()).execute();
- }
-
- @Override
- protected CloudViewElement[] getElements(Object[] modelElements, int startIndex, int
stopIndex) {
- CloudViewElement[] elements = new CloudViewElement[stopIndex - startIndex];
- for (int i = startIndex; i < stopIndex; ++i) {
- elements[i - startIndex] = new CVImageElement(modelElements[i], getViewer());
- }
- return elements;
- }
-
- @Override
- public synchronized void listChanged(DeltaCloud cloud, DeltaCloudImage[] newImages) {
- try {
- clearChildren();
- initialized.set(false);
- DeltaCloudImage[] images = filter(newImages);
- addChildren(images);
-// refresh();
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- MessageFormat.format("Could not get images from cloud \"{0}\"",
cloud.getName()), e,
- getViewer().getControl().getShell());
- } finally {
- initialized.set(true);
- }
- // refresh();
- }
-
- // private void refresh() {
- // getViewer().getControl().getDisplay().asyncExec(new Runnable() {
- //
- // @Override
- // public void run() {
- // getViewer().refresh(this, true);
- // }
- // });
- // }
-
- public DeltaCloudImage[] filter(DeltaCloudImage[] images) throws DeltaCloudException {
- DeltaCloud cloud = (DeltaCloud) getElement();
- IImageFilter f = cloud.getImageFilter();
- return f.filter(images).toArray(new DeltaCloudImage[images.length]);
- }
-
- protected void addCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.addImageListListener(this);
- }
- }
-
- protected void removeCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.removeImageListListener(this);
- }
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVInstanceElement extends CloudViewElement {
-
- public CVInstanceElement(Object element, TreeViewer viewer) {
- super(element, viewer);
- }
-
- public String getName() {
- Object element = getElement();
- StringBuilder sb = new StringBuilder();
- if (element instanceof DeltaCloudInstance) {
- DeltaCloudInstance instance = (DeltaCloudInstance) element;
- if (instance.getName() != null) {
- sb.append(instance.getName());
- }
- if (instance.getId() != null) {
- sb.append(" [").append(instance.getId()).append("] ");
- }
- }
- return sb.toString();
-
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return new InstancePropertySource(this, getElement());
- }
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstancesCategoryElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.core.GetInstancesCommand;
-import org.jboss.tools.deltacloud.core.IInstanceFilter;
-import org.jboss.tools.deltacloud.core.IInstanceListListener;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVInstancesCategoryElement extends CVCloudElementCategoryElement implements
IInstanceListListener {
-
- private static final String INSTANCE_CATEGORY_NAME = "InstanceCategoryName";
//$NON-NLS-1$
-
- public CVInstancesCategoryElement(Object element, TreeViewer viewer) {
- super(element, viewer);
- }
-
- public String getName() {
- return CVMessages.getString(INSTANCE_CATEGORY_NAME);
- }
-
- protected void asyncGetCloudElements() {
- new GetInstancesCommand(getCloud()).execute();
- }
-
- @Override
- protected CloudViewElement[] getElements(Object[] modelElements, int startIndex, int
stopIndex) {
- CloudViewElement[] elements = new CloudViewElement[stopIndex - startIndex];
- for (int i = startIndex; i < stopIndex; ++i) {
- elements[i - startIndex] = new CVInstanceElement(modelElements[i], getViewer());
- }
- return elements;
- }
-
- protected void addChildrenFor(Object[] modelElements, int startIndex, int stopIndex) {
- for (int i = startIndex; i < stopIndex; ++i) {
- addChild(new CVInstanceElement(modelElements[i], getViewer()));
- }
- }
-
- @Override
- public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] newInstances) {
- try {
- initialized.set(false);
- clearChildren();
- final DeltaCloudInstance[] instances = filter(newInstances);
- addChildren(instances);
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- MessageFormat.format("Could not get instanceso from cloud
\"{0}\"", cloud.getName()), e,
- getViewer().getControl().getShell());
- } finally {
- initialized.set(true);
- }
- }
-
- public DeltaCloudInstance[] filter(DeltaCloudInstance[] instances) throws
DeltaCloudException {
- IInstanceFilter f = getCloud().getInstanceFilter();
- return f.filter(instances).toArray(new DeltaCloudInstance[instances.length]);
- }
-
- protected void addCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.addInstanceListListener(this);
- }
- }
-
- protected void removeCloudElementListener(DeltaCloud cloud) {
- if (cloud != null) {
- cloud.removeInstanceListListener(this);
- }
- }
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVNumericFoldingElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVNumericFoldingElement.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVNumericFoldingElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVNumericFoldingElement extends CloudViewElement {
-
- public static int FOLDING_SIZE = 50;
- private Object min;
- private int max;
-
- public CVNumericFoldingElement(int min, int max, TreeViewer viewer) {
- super(null, viewer);
- this.min = min;
- this.max = max;
- }
-
- @Override
- public String getName() {
- return new StringBuilder()
- .append("[")
- .append(min)
- .append("..")
- .append(max - 1)
- .append("]").toString();
- }
-
- @Override
- public Object[] getChildren() {
- return super.getChildren();
- }
-
- @Override
- public boolean hasChildren() {
- return true;
- }
-
- @Override
- public IPropertySource getPropertySource() {
- return null;
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
-import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
-
-public class CVPropertySection extends AbstractPropertySection {
-
- /**
- * The Property Sheet Page.
- */
- protected PropertySheetPage page;
-
- /**
- * @see
org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
- * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
- */
- public void createControls(Composite parent, final TabbedPropertySheetPage
atabbedPropertySheetPage) {
- super.createControls(parent, atabbedPropertySheetPage);
-
- Composite composite = getWidgetFactory().createFlatFormComposite(parent);
- page = new CVPropertySheetPage();
- page.createControl(composite);
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, 0);
- data.right = new FormAttachment(100, 0);
- data.top = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(100, 0);
- page.getControl().setLayoutData(data);
-
- page.getControl().addControlListener(new ControlAdapter() {
-
- public void controlResized(ControlEvent e) {
- atabbedPropertySheetPage.resizeScrolledComposite();
- }
- });
- }
-
- /**
- * @see
org.eclipse.ui.views.properties.tabbed.ISection#setInput(org.eclipse.ui.IWorkbenchPart,
- * org.eclipse.jface.viewers.ISelection)
- */
- public void setInput(IWorkbenchPart part, ISelection selection) {
- super.setInput(part, selection);
- page.selectionChanged(part, selection);
- }
-
- /**
- * @see org.eclipse.ui.views.properties.tabbed.ISection#dispose()
- */
- public void dispose() {
- super.dispose();
-
- if (page != null) {
- page.dispose();
- page = null;
- }
-
- }
-
- /**
- * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
- */
- public void refresh() {
- page.refresh();
- }
-
- /**
- * @see org.eclipse.ui.views.properties.tabbed.ISection#shouldUseExtraSpace()
- */
- public boolean shouldUseExtraSpace() {
- return true;
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.ui.views.properties.PropertySheetSorter;
-
-public class CVPropertySheetNonSorter extends PropertySheetSorter {
-
- public void sort(IPropertySheetEntry[] entries) {
- // do nothing
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * 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;
-
-public class CVPropertySheetPage extends PropertySheetPage {
-
- public CVPropertySheetPage() {
- super();
- setSorter(new CVPropertySheetNonSorter());
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVRootElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudManager;
-import org.jboss.tools.deltacloud.core.ICloudManagerListener;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class CVRootElement extends CloudViewElement implements ICloudManagerListener {
-
- public CVRootElement(TreeViewer viewer) {
- super(DeltaCloudManager.getDefault(), viewer); //$NON-NLS-1$
- DeltaCloudManager.getDefault().addCloudManagerListener(this);
- }
-
- @Override
- public String getName() {
- return "root"; //$NON-NLS-1$
- }
-
- @Override
- public IPropertySource getPropertySource() {
- // no property source for the root element
- return null;
- }
-
- @Override
- public Object[] getChildren() {
- if (!initialized.get()) {
- DeltaCloudManager m = DeltaCloudManager.getDefault();
- try {
- addClouds(m.getClouds());
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError("Error", "Could not get clouds", e,
Display.getDefault().getActiveShell());
- } finally {
- initialized.set(true);
- }
- }
- return super.getChildren();
- }
-
- private void addClouds(DeltaCloud[] clouds) {
- for (DeltaCloud cloud : clouds) {
- CVCloudElement e = new CVCloudElement(cloud, cloud.getName(), getViewer());
- children.add(e);
- }
- }
-
- @Override
- public void dispose() {
- DeltaCloudManager.getDefault().removeCloudManagerListener(this);
- }
-
- public void cloudsChanged(int type) {
- DeltaCloudManager m = DeltaCloudManager.getDefault();
- try {
- DeltaCloud[] clouds = m.getClouds();
- addClouds(clouds);
- initialized.set(true);
- } catch (DeltaCloudException e) {
- // TODO: internationalize strings
- ErrorUtils.handleError(
- "Error",
- "Could not get all clouds",
- e, Display.getDefault().getActiveShell());
- }
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.ui.views.properties.tabbed.AbstractTypeMapper;
-
-public class CVTypeMapper extends AbstractTypeMapper {
-
- @SuppressWarnings("rawtypes")
- @Override
- public Class mapType(Object object) {
- if (object instanceof TreeNode) {
- return ((TreeNode) object).getValue().getClass();
- }
- return super.mapType(object);
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-
-public class CloudPropertySource implements IPropertySource {
-
- private static final String PROPERTY_NAME = "deltacloud.views.cloud.name";
//$NON-NLS-1$
- private static final String PROPERTY_URL = "deltacloud.views.cloud.id";
//$NON-NLS-1$
- private static final String PROPERTY_USERNAME =
"deltacloud.views.cloud.username"; //$NON-NLS-1$
- private static final String PROPERTY_NAME_TITLE = "PropertyName.title";
//$NON-NLS-1$
- private static final String PROPERTY_URL_TITLE = "PropertyURL.title";
//$NON-NLS-1$
- private static final String PROPERTY_USERNAME_TITLE =
"PropertyUsername.title"; //$NON-NLS-1$
-
- private IPropertyDescriptor[] propertyDescriptors;
- private DeltaCloud cloud;
-
- public CloudPropertySource(Object o) {
- cloud = (DeltaCloud)o;
- }
-
- @Override
- public Object getEditableValue() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public IPropertyDescriptor[] getPropertyDescriptors() {
- if (propertyDescriptors == null) {
- PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
- CVMessages.getString(PROPERTY_NAME_TITLE));
- PropertyDescriptor urlDescriptor = new PropertyDescriptor(PROPERTY_URL,
- CVMessages.getString(PROPERTY_URL_TITLE));
- PropertyDescriptor userDescriptor = new PropertyDescriptor(PROPERTY_USERNAME,
- CVMessages.getString(PROPERTY_USERNAME_TITLE));
-
- propertyDescriptors = new IPropertyDescriptor[] {
- nameDescriptor,
- urlDescriptor,
- userDescriptor,
- };
- }
- return propertyDescriptors;
- }
-
- @Override
- public Object getPropertyValue(Object id) {
- if (id.equals(PROPERTY_NAME))
- return cloud.getName();
- if (id.equals(PROPERTY_URL))
- return cloud.getURL();
- if (id.equals(PROPERTY_USERNAME))
- return cloud.getUsername();
- return null;
- }
-
- @Override
- public boolean isPropertySet(Object id) {
- return false;
- }
-
-
- @Override
- public void resetPropertyValue(Object id) {
- // do nothing
- }
-
- @Override
- public void setPropertyValue(Object id, Object value) {
- // TODO Auto-generated method stub
-
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.jface.viewers.Viewer;
-
-public class CloudViewContentProvider implements ITreeContentProvider {
-
- private CloudViewElement root;
-
- @Override
- public Object[] getChildren(Object parentElement) {
- CloudViewElement e = (CloudViewElement)parentElement;
- return e.getChildren();
- }
-
- @Override
- public Object getParent(Object element) {
- CloudViewElement e = (CloudViewElement)element;
- return e.getParent();
- }
-
- @Override
- public boolean hasChildren(Object element) {
- CloudViewElement e = (CloudViewElement)element;
- return e.hasChildren();
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- return root.getChildren();
- }
-
- @Override
- public void dispose() {
-
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- root = (CloudViewElement)newInput;
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * 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;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public abstract class CloudViewElement implements IAdaptable {
-
- private TreeViewer viewer;
- private Object element;
- private CloudViewElement parent;
- protected Collection<CloudViewElement> children =
- Collections.synchronizedCollection(new ArrayList<CloudViewElement>());
- protected AtomicBoolean initialized = new AtomicBoolean();
-
- public CloudViewElement(Object element, TreeViewer viewer) {
- this.element = element;
- this.viewer = viewer;
- initDisposeListener(viewer);
- }
-
- public abstract String getName();
-
- public Object[] getChildren() {
- return children.toArray();
- }
-
- protected void clearChildren() {
- children.clear();
- }
-
- public boolean hasChildren() {
- return children.size() > 0;
- }
-
- public Object getParent() {
- return parent;
- }
-
- public void addChild(final CloudViewElement e) {
- addChildToModel(e);
- getViewer().getControl().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- getViewer().add(this, e);
- }
- });
- }
-
- public void addChildToModel(CloudViewElement element) {
- children.add(element);
- element.setParent(this);
- }
-
- public void addChildren(final CloudViewElement[] elements) {
- for (CloudViewElement element : elements) {
- addChildToModel(element);
- }
-
- getViewer().getControl().getDisplay().asyncExec(new Runnable() {
- @Override
- public void run() {
- getViewer().add(this, elements);
- }
- });
- }
-
- public void setParent(CloudViewElement e) {
- parent = e;
- }
-
- public Object getElement() {
- return element;
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public Object getAdapter(Class adapter) {
- if (adapter == IPropertySource.class) {
- IPropertySource p = getPropertySource();
- return p;
- }
- return null;
- }
-
- public abstract IPropertySource getPropertySource();
-
- protected TreeViewer getViewer() {
- return viewer;
- }
-
- private void initDisposeListener(Viewer viewer) {
- final Control control = viewer.getControl();
- control.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- control.addDisposeListener(new DisposeListener() {
-
- @Override
- public void widgetDisposed(DisposeEvent e) {
- dispose();
- }
- });
- }
- });
- }
-
- protected void dispose() {
- // nothing to do
- }
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.swt.graphics.Image;
-import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
-
-public class CloudViewLabelProvider extends LabelProvider {
-
- @Override
- public Image getImage(Object element) {
- if (element instanceof CVCloudElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_CLOUD);
- } else if (element instanceof CVCloudElementCategoryElement ||
- element instanceof CVNumericFoldingElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_FOLDER);
- } else if (element instanceof CVInstanceElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_INSTANCE);
- } else if (element instanceof CVImageElement) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_IMAGE);
- }
- return null;
- }
-
- @Override
- public String getText(Object element) {
- CloudViewElement e = (CloudViewElement)element;
- return e.getName();
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
-import org.jboss.tools.deltacloud.core.DeltaCloudManager;
-import org.jboss.tools.deltacloud.core.ICloudManagerListener;
-import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
-import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
-
-public class DeltaCloudView extends ViewPart implements ICloudManagerListener,
- ITabbedPropertySheetPageContributor {
-
- /**
- * The ID of the view as specified by the extension.
- */
- public static final String ID =
"org.jboss.tools.deltacloud.ui.views.DeltaCloudView";
-
- public static final String COLLAPSE_ALL = "CollapseAll.label"; //$NON-NLS-1$
- private static final String HELP_CONTEXTID =
"org.jboss.tools.deltacloud.ui.viewer";
-
- private TreeViewer viewer;
-
- private Action collapseall;
-
- public void createPartControl(Composite parent) {
- viewer = createTreeViewer(parent);
-
- // Create the help context id for the viewer's control
- PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(),
HELP_CONTEXTID);
- makeActions();
- hookContextMenu(viewer.getTree());
- contributeToActionBars();
- DeltaCloudManager.getDefault().addCloudManagerListener(this);
- }
-
- private TreeViewer createTreeViewer(Composite parent) {
- TreeViewer viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL |
SWT.BORDER);
- viewer.setContentProvider(new CloudViewContentProvider());
- viewer.setLabelProvider(new CloudViewLabelProvider());
- viewer.setUseHashlookup(true);
- viewer.setInput(new CVRootElement(viewer));
- viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
- getSite().setSelectionProvider(viewer);
- return viewer;
- }
-
- @Override
- public void dispose() {
- DeltaCloudManager.getDefault().removeCloudManagerListener(this);
- super.dispose();
- }
-
- private void hookContextMenu(Control control) {
- IMenuManager contextMenu = UIUtils.createContextMenu(control);
- UIUtils.registerContributionManager(UIUtils.getContextMenuId(ID), contextMenu,
control);
- }
-
- private void contributeToActionBars() {
- // TODO: replace by declarative command
- fillLocalToolBar(getViewSite().getActionBars().getToolBarManager());
- }
-
- private void fillLocalToolBar(IToolBarManager manager) {
- manager.add(collapseall);
- }
-
- private void makeActions() {
- collapseall = createCollapseAllAction();
- }
-
- private Action createCollapseAllAction() {
- Action collapseAll = new Action() {
- public void run() {
- viewer.collapseAll();
- }
- };
- collapseAll.setText(CVMessages.getString(COLLAPSE_ALL));
- collapseAll.setToolTipText(CVMessages.getString(COLLAPSE_ALL));
- collapseAll.setImageDescriptor(SWTImagesFactory.DESC_COLLAPSE_ALL);
- return collapseAll;
- }
-
- @Override
- public void setFocus() {
- viewer.getControl().setFocus();
- }
-
- @Override
- public void cloudsChanged(int type) {
- viewer.setInput(new CVRootElement(viewer));
- }
-
- @Override
- public String getContributorId() {
- return getSite().getId();
- }
-
- public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
- if (adapter == IPropertySheetPage.class)
- // If Tabbed view is desired, then change the
- // following to new TabbedPropertySheetPage(this)
- return new CVPropertySheetPage();
- return super.getAdapter(adapter);
- }
-}
\ No newline at end of file
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ITableContentAndLabelProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ITableContentAndLabelProvider.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ITableContentAndLabelProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-
-/**
- * @author Andre Dietisheim
- */
-public interface ITableContentAndLabelProvider extends IStructuredContentProvider,
ITableLabelProvider{
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * 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;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-
-public class ImagePropertySource implements IPropertySource {
-
- private static final String PROPERTY_NAME = "deltacloud.views.image.name";
//$NON-NLS-1$
- private static final String PROPERTY_ID = "deltacloud.views.image.id";
//$NON-NLS-1$
- private static final String PROPERTY_ARCH = "deltacloud.views.image.arch";
//$NON-NLS-1$
- private static final String PROPERTY_DESCRIPTION =
"deltacloud.views.image.description"; //$NON-NLS-1$
- private static final String PROPERTY_NAME_TITLE = "PropertyName.title";
//$NON-NLS-1$
- private static final String PROPERTY_ID_TITLE = "PropertyId.title";
//$NON-NLS-1$
- private static final String PROPERTY_ARCH_TITLE = "PropertyArch.title";
//$NON-NLS-1$
- private static final String PROPERTY_DESCRIPTION_TITLE =
"PropertyDescription.title"; //$NON-NLS-1$
-
- private IPropertyDescriptor[] propertyDescriptors;
- private DeltaCloudImage image;
-
- public ImagePropertySource(Object o) {
- image = (DeltaCloudImage)o;
- }
-
- @Override
- public Object getEditableValue() {
- return null;
- }
-
- @Override
- public IPropertyDescriptor[] getPropertyDescriptors() {
- if (propertyDescriptors == null) {
- PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
- CVMessages.getString(PROPERTY_NAME_TITLE));
- PropertyDescriptor idDescriptor = new PropertyDescriptor(PROPERTY_ID,
- CVMessages.getString(PROPERTY_ID_TITLE));
- PropertyDescriptor archDescriptor = new PropertyDescriptor(PROPERTY_ARCH,
- CVMessages.getString(PROPERTY_ARCH_TITLE));
- PropertyDescriptor descDescriptor = new PropertyDescriptor(PROPERTY_DESCRIPTION,
- CVMessages.getString(PROPERTY_DESCRIPTION_TITLE));
-
- propertyDescriptors = new IPropertyDescriptor[] {
- nameDescriptor,
- idDescriptor,
- archDescriptor,
- descDescriptor,
- };
- }
- return propertyDescriptors;
- }
-
- @Override
- public Object getPropertyValue(Object id) {
- if (id.equals(PROPERTY_NAME))
- return image.getName();
- if (id.equals(PROPERTY_ID))
- return image.getId();
- if (id.equals(PROPERTY_ARCH))
- return image.getArchitecture();
- if (id.equals(PROPERTY_DESCRIPTION))
- return image.getDescription();
- return null;
- }
-
- @Override
- public boolean isPropertySet(Object id) {
- return false;
- }
-
-
- @Override
- public void resetPropertyValue(Object id) {
- }
-
- @Override
- public void setPropertyValue(Object id, Object value) {
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * 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.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
-
-/**
- * A view that displays images of a DeltaCloud.
- *
- * @see DeltaCloud#getImages()
- *
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class ImageView extends AbstractCloudElementTableView<DeltaCloudImage> {
//implements IImageListListener {
-
- @Override
- protected String getSelectedCloudPrefsKey() {
- return IDeltaCloudPreferenceConstants.LAST_CLOUD_IMAGE_VIEW;
- }
-
- @Override
- protected String getViewID() {
- return "org.jboss.tools.deltacloud.ui.views.ImageView";
- }
-
- @Override
- protected ITableContentAndLabelProvider getContentAndLabelProvider() {
- return new ImageViewLabelAndContentProvider();
- }
-
- @Override
- protected void refreshToolbarCommandStates() {
- // do nothing
- }
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * 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;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Image;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudImage;
-import org.jboss.tools.deltacloud.core.GetImagesCommand;
-import org.jboss.tools.deltacloud.core.ICloudElementFilter;
-import org.jboss.tools.deltacloud.core.IImageListListener;
-
-/**
- * @author Jeff Johnston
- * @author André Dietisheim
- */
-public class ImageViewLabelAndContentProvider extends
AbstractCloudElementViewLabelAndContentProvider<DeltaCloudImage>
- implements ITableContentAndLabelProvider, IImageListListener {
-
- public enum Column {
- NAME(0, 20),
- ID(1, 20),
- ARCH(2, 20),
- DESC(3, 40);
-
- private int column;
- private int weight;
- private static final Map<Integer, Column> lookup = new HashMap<Integer,
Column>();
-
- static {
- for (Column c : EnumSet.allOf(Column.class))
- lookup.put(c.getColumnNumber(), c);
- }
-
- private Column(int column, int weight) {
- this.column = column;
- this.weight = weight;
- }
-
- public int getColumnNumber() {
- return column;
- }
-
- public int getWeight() {
- return weight;
- }
-
- public static Column getColumn(int number) {
- return lookup.get(number);
- }
-
- public static int getSize() {
- return lookup.size();
- }
-
- };
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- Column c = Column.getColumn(columnIndex);
- DeltaCloudImage i = (DeltaCloudImage) element;
- switch (c) {
- case NAME:
- return i.getName();
- case ID:
- return i.getId();
- case ARCH:
- return i.getArchitecture();
- case DESC:
- return i.getDescription();
- }
- return "";
- }
-
- protected ICloudElementFilter<DeltaCloudImage> getCloudFilter(DeltaCloud cloud) {
- return cloud.getImageFilter();
- }
-
- @Override
- protected void asyncGetCloudElements(DeltaCloud cloud) {
- new GetImagesCommand(cloud).execute();
- }
-
- @Override
- protected void addListener(DeltaCloud currentCloud) {
- if (currentCloud != null) {
- currentCloud.addImageListListener(this);
- }
- }
-
- @Override
- protected void removeListener(DeltaCloud currentCloud) {
- if (currentCloud != null) {
- currentCloud.removeImageListListener(this);
- }
- }
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * 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;
-
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.PropertyDescriptor;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudException;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.ErrorUtils;
-import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
-
-public class InstancePropertySource implements IPropertySource {
-
- private static final String PROPERTY_NAME = "deltacloud.views.instance.name";
//$NON-NLS-1$
- private static final String PROPERTY_ID = "deltacloud.views.instance.id";
//$NON-NLS-1$
- 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$
- private static final String PROPERTY_NAME_TITLE = "PropertyName.title";
//$NON-NLS-1$
- private static final String PROPERTY_ID_TITLE = "PropertyId.title";
//$NON-NLS-1$
- 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$
-
- private IPropertyDescriptor[] propertyDescriptors;
- private DeltaCloudInstance instance;
- private DeltaCloud cloud;
-
- public InstancePropertySource(CVInstanceElement element, Object o) {
- cloud = CloudViewElementUtils.getCloud(element);
- instance = (DeltaCloudInstance) o;
- }
-
- @Override
- public Object getEditableValue() {
- return null;
- }
-
- @Override
- public IPropertyDescriptor[] getPropertyDescriptors() {
- if (propertyDescriptors == null) {
- PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
- CVMessages.getString(PROPERTY_NAME_TITLE));
- PropertyDescriptor idDescriptor = new PropertyDescriptor(PROPERTY_ID,
- CVMessages.getString(PROPERTY_ID_TITLE));
- PropertyDescriptor ownerDescriptor = new PropertyDescriptor(PROPERTY_OWNER,
- CVMessages.getString(PROPERTY_OWNER_TITLE));
- PropertyDescriptor stateDescriptor = new PropertyDescriptor(PROPERTY_STATE,
- CVMessages.getString(PROPERTY_STATE_TITLE));
- PropertyDescriptor hardwareDescriptor = new PropertyDescriptor(PROPERTY_PROFILEID,
- CVMessages.getString(PROPERTY_PROFILEID_TITLE));
- PropertyDescriptor realmDescriptor = new PropertyDescriptor(PROPERTY_REALMID,
- CVMessages.getString(PROPERTY_REALMID_TITLE));
- PropertyDescriptor imageDescriptor = new PropertyDescriptor(PROPERTY_IMAGEID,
- 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,
- idDescriptor,
- ownerDescriptor,
- stateDescriptor,
- hostnameDescriptor,
- keyDescriptor,
- hardwareDescriptor,
- realmDescriptor,
- imageDescriptor,
- };
- }
- return propertyDescriptors;
- }
-
- @Override
- public Object getPropertyValue(Object id) {
- if (id.equals(PROPERTY_NAME))
- return instance.getName();
- if (id.equals(PROPERTY_ID))
- return instance.getId();
- if (id.equals(PROPERTY_OWNER))
- return instance.getOwnerId();
- if (id.equals(PROPERTY_PROFILEID))
- return instance.getProfileId();
- if (id.equals(PROPERTY_REALMID))
- return instance.getRealmId();
- if (id.equals(PROPERTY_IMAGEID))
- return instance.getImageId();
- if (id.equals(PROPERTY_KEYNAME)) {
- return getKey();
- }
- if (id.equals(PROPERTY_STATE)) {
- return instance.getState();
- }
- if (id.equals(PROPERTY_HOSTNAME)) {
- List<String> hostnames = instance.getHostNames();
- if (hostnames.size() >= 1)
- return hostnames.get(0);
- }
- return null;
- }
-
- private Object getKey() {
- // At present (Deltacloud 0.0.7), the keyname is omitted
- // in the data passed back from a listInstances request.
- // If an instance is running and the keyname is missing,
- // we can refresh the instance by its id and this will give us
- // the full data. We can then replace the instance so that
- // it will be complete for future requests until a refresh gets the
- // entire list again.
- String key = null;
- try {
- key = instance.getKey();
- if (!cloud.getType().equals(DeltaCloud.MOCK_TYPE)) {
- if (instance.getState().equals(DeltaCloudInstance.RUNNING) && (key == null ||
key.length() == 0)) {
- instance = cloud.refreshInstance(instance.getId());
- if (instance != null) {
- key = instance.getKey();
- if (key != null && key.length() > 0)
- cloud.replaceInstance(instance);
- }
- }
- }
- } catch (DeltaCloudException e) {
- ErrorUtils.handleError(
- "Error", "Could not get key for instance " +
instance.getName(),
- e, Display.getDefault().getActiveShell());
- }
- return key;
- }
-
- @Override
- public boolean isPropertySet(Object id) {
- return false;
- }
-
- @Override
- public void resetPropertyValue(Object id) {
- // do nothing
- }
-
- @Override
- public void setPropertyValue(Object id, Object value) {
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * 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.PlatformUI;
-import org.eclipse.ui.services.IEvaluationService;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
-
-/**
- * A view that displays instances of a DeltaCloud
- *
- * @see DeltaCloud#getInstances()
- *
- * @author Jeff Johnston
- * @author Andre Dietisheim
- */
-public class InstanceView extends AbstractCloudElementTableView<DeltaCloudInstance>
{
-
- protected String getSelectedCloudPrefsKey() {
- return IDeltaCloudPreferenceConstants.LAST_CLOUD_INSTANCE_VIEW;
- }
-
- @Override
- protected String getViewID() {
- return "org.jboss.tools.deltacloud.ui.views.InstanceView";
- }
-
- @Override
- protected ITableContentAndLabelProvider getContentAndLabelProvider() {
- return new InstanceViewLabelAndContentProvider();
- }
-
- @Override
- protected void refreshToolbarCommandStates() {
- IEvaluationService evaluationService = (IEvaluationService)
PlatformUI.getWorkbench().getService(
- IEvaluationService.class);
- evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canStart");
- evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canStop");
- evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canReboot");
- evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canDestroy");
- }
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * 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;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
-import org.jboss.tools.deltacloud.core.GetInstancesCommand;
-import org.jboss.tools.deltacloud.core.ICloudElementFilter;
-import org.jboss.tools.deltacloud.core.IInstanceListListener;
-import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
-
-/**
- * @author Jeff Jonhston
- * @author Andre Dietisheim
- */
-public class InstanceViewLabelAndContentProvider extends
- AbstractCloudElementViewLabelAndContentProvider<DeltaCloudInstance> implements
ITableContentAndLabelProvider, IInstanceListListener {
-
- public enum Column {
- NAME(0, 20),
- ID(1, 20),
- STATUS(2, 6),
- HOSTNAME(3, 40);
-
- private int column;
- private int weight;
- private static final Map<Integer, Column> lookup = new HashMap<Integer,
Column>();
-
- static {
- for (Column c : EnumSet.allOf(Column.class))
- lookup.put(c.getColumnNumber(), c);
- }
-
- private Column(int column, int weight) {
- this.column = column;
- this.weight = weight;
- }
-
- public int getColumnNumber() {
- return column;
- }
-
- public int getWeight() {
- return weight;
- }
-
- public static Column getColumn(int number) {
- return lookup.get(number);
- }
-
- public static int getSize() {
- return lookup.size();
- }
-
- };
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- Column c = Column.getColumn(columnIndex);
- DeltaCloudInstance i = (DeltaCloudInstance) element;
- switch (c) {
- case STATUS:
- return getStatusIcon(i.getState());
- default:
- return null;
- }
- }
-
- private Image getStatusIcon(String status) {
- if (DeltaCloudInstance.STOPPED.equals(status)) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_STOPPED);
- } else if (DeltaCloudInstance.RUNNING.equals(status)) {
- return SWTImagesFactory.get(SWTImagesFactory.IMG_RUNNING);
- } else if (DeltaCloudInstance.BOGUS.equals(status)) {
- return PlatformUI.getWorkbench().getSharedImages().
- getImage(ISharedImages.IMG_DEC_FIELD_WARNING);
- } else {
- return null;
- }
- }
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- Column c = Column.getColumn(columnIndex);
- DeltaCloudInstance i = (DeltaCloudInstance) element;
- if (i != null) {
- switch (c) {
- case NAME:
- return i.getName();
- case ID:
- return i.getId();
- case STATUS:
- return "";
- case HOSTNAME:
- return i.getHostName();
- }
- }
- return "";
- }
-
- @Override
- public void dispose() {
- }
-
- protected ICloudElementFilter<DeltaCloudInstance> getCloudFilter(DeltaCloud cloud)
{
- return cloud.getInstanceFilter();
- }
-
- @Override
- protected void asyncGetCloudElements(DeltaCloud cloud) {
- new GetInstancesCommand(cloud).execute();
- }
-
- @Override
- protected void addListener(DeltaCloud currentCloud) {
- if (currentCloud != null) {
- currentCloud.addInstanceListListener(this);
- }
- }
-
- @Override
- protected void removeListener(DeltaCloud currentCloud) {
- if (currentCloud != null) {
- currentCloud.removeInstanceListListener(this);
- }
- }
-
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/LoadingCloudViewElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/LoadingCloudViewElement.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/LoadingCloudViewElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.deltacloud.ui.views;
-
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * A tree element that shows the user that the tree is currently loading
- * elements
- */
-public class LoadingCloudViewElement extends CloudViewElement {
- protected LoadingCloudViewElement(TreeViewer viewer) {
- super(null, viewer);
- }
-
- @Override
- public IPropertySource getPropertySource() {
- // no property source for this element
- return null;
- }
-
- @Override
- public String getName() {
- // TODO: internationalize strings
- return "Loading...";
- }
-}
Deleted:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/TableViewerColumnComparator.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/TableViewerColumnComparator.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/TableViewerColumnComparator.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * 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.core.runtime.Assert;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-
-/**
- * A viewer comparator that compares labels in a column of a table.<br>
- * This implementation was extracted out of the former Image- and
- * InstanceComparator which were mostly identical.
- *
- * @see ViewerComparator
- *
- * @author Jeff Johnston
- * @author André Dietisheim
- */
-public class TableViewerColumnComparator extends ViewerComparator {
-
- private final static int UP = 1;
-
- private int column;
- private int direction;
-
- public TableViewerColumnComparator() {
- this(0);
- }
-
- public TableViewerColumnComparator(int column) {
- this.column = column;
- this.direction = UP;
- }
-
- public void setColumn(int newColumn) {
- if (column != newColumn)
- direction = UP;
- column = newColumn;
- }
-
- public int getColumn() {
- return column;
- }
-
- public void reverseDirection() {
- direction *= -1;
- }
-
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- int tmp = compareByColumn(viewer, e1, e2);
- return tmp * direction;
- }
-
- private int compareByColumn(Viewer viewer, Object e1, Object e2) {
- Assert.isTrue(viewer instanceof TableViewer
- && ((TableViewer) viewer).getLabelProvider() instanceof
ITableLabelProvider);
-
- ITableLabelProvider provider = (ITableLabelProvider) ((TableViewer)
viewer).getLabelProvider();
- String s1 = provider.getColumnText(e1, column);
- String s2 = provider.getColumnText(e2, column);
- return s1.compareToIgnoreCase(s2);
- }
-}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.CloudPropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVCloudElement extends CloudViewElement {
+
+ private TreeViewer viewer;
+
+ public CVCloudElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ super(element, parent, viewer);
+ this.viewer = viewer;
+ }
+
+ public String getName() {
+ Object element = getElement();
+ if (element instanceof DeltaCloud) {
+ return ((DeltaCloud) element).getName();
+ } else {
+ return "";
+ }
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return true;
+ }
+
+ @Override
+ public synchronized Object[] getChildren() {
+ if (!initialized.get()) {
+ DeltaCloud cloud = (DeltaCloud) getElement();
+ CVCloudElementCategoryElement instances = new CVInstancesCategoryElement(cloud, this,
viewer);
+ addCategory(instances);
+ CVCloudElementCategoryElement images = new CVImagesCategoryElement(cloud, this,
viewer);
+ addCategory(images);
+ }
+ initialized.set(true);
+ return super.getChildren();
+ }
+
+ private void addCategory(CVCloudElementCategoryElement categoryElement) {
+ children.add(categoryElement);
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new CloudPropertySource(getElement());
+ }
+
+
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVCloudElementCategoryElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public abstract class CVCloudElementCategoryElement extends CloudViewElement {
+
+ public CVCloudElementCategoryElement(Object element, CloudViewElement parent, TreeViewer
viewer) {
+ super(element, parent, viewer);
+ addCloudElementListener(getCloud());
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return true;
+ }
+
+ @Override
+ public Object[] getChildren() {
+ if (!initialized.get()) {
+ setLoadingIndicator();
+ asyncGetCloudElements();
+ initialized.set(true);
+ }
+ return super.getChildren();
+ }
+
+ private void setLoadingIndicator() {
+ children.add(new LoadingCloudViewElement(this, viewer));
+ }
+
+ protected abstract void asyncGetCloudElements();
+
+ protected void addChildren(Object[] modelElements) {
+ if (modelElements.length > CVNumericFoldingElement.FOLDING_SIZE) {
+ addFoldedChildren(modelElements);
+ } else {
+ addChildren(getElements(modelElements, 0, modelElements.length));
+ }
+ }
+
+ protected void addFoldedChildren(Object[] modelElements) {
+ int min = 0;
+ int max = CVNumericFoldingElement.FOLDING_SIZE;
+ int length = modelElements.length;
+ while (length > CVNumericFoldingElement.FOLDING_SIZE) {
+ CVNumericFoldingElement f = new CVNumericFoldingElement(min, max, this, viewer);
+ addChild(f);
+ f.addChildren(getElements(modelElements, min, max));
+ min += CVNumericFoldingElement.FOLDING_SIZE;
+ max += CVNumericFoldingElement.FOLDING_SIZE;
+ length -= CVNumericFoldingElement.FOLDING_SIZE;
+ }
+ if (length > 0) {
+ CVNumericFoldingElement f = new CVNumericFoldingElement(min, max, this, viewer);
+ addChild(f);
+ f.addChildren(getElements(modelElements, min, min + length));
+ }
+ }
+
+ protected abstract CloudViewElement[] getElements(Object[] modelElements, int
startIndex, int stopIndex);
+
+ @Override
+ public IPropertySource getPropertySource() {
+ // no property source for cathegories
+ return null;
+ }
+
+ protected DeltaCloud getCloud() {
+ return (DeltaCloud) getElement();
+ }
+
+ @Override
+ protected void dispose() {
+ removeCloudElementListener(getCloud());
+ }
+
+ protected abstract void addCloudElementListener(DeltaCloud cloud);
+
+ protected abstract void removeCloudElementListener(DeltaCloud cloud);
+
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImageElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.ImagePropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVImageElement extends CloudViewElement {
+
+ public CVImageElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ super(element, parent, viewer);
+ }
+
+ public String getName() {
+ Object element = getElement();
+ if (element instanceof DeltaCloudImage) {
+ return ((DeltaCloudImage) element).getName();
+ } else {
+ return "";
+ }
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new ImagePropertySource(getElement());
+ }
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVImagesCategoryElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.GetImagesCommand;
+import org.jboss.tools.deltacloud.core.IImageFilter;
+import org.jboss.tools.deltacloud.core.IImageListListener;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVImagesCategoryElement extends CVCloudElementCategoryElement implements
IImageListListener {
+
+ private static final String IMAGE_CATEGORY_NAME = "ImageCategoryName";
//$NON-NLS-1$
+
+ public CVImagesCategoryElement(Object element, CloudViewElement parent, TreeViewer
viewer) {
+ super(element, parent, viewer);
+ }
+
+ public String getName() {
+ return CVMessages.getString(IMAGE_CATEGORY_NAME);
+ }
+
+ protected void asyncGetCloudElements() {
+ new GetImagesCommand(getCloud()).execute();
+ }
+
+ @Override
+ protected CloudViewElement[] getElements(Object[] modelElements, int startIndex, int
stopIndex) {
+ CloudViewElement[] elements = new CloudViewElement[stopIndex - startIndex];
+ for (int i = startIndex; i < stopIndex; ++i) {
+ elements[i - startIndex] = new CVImageElement(modelElements[i], this, viewer);
+ }
+ return elements;
+ }
+
+ @Override
+ public synchronized void listChanged(DeltaCloud cloud, DeltaCloudImage[] newImages) {
+ try {
+ clearChildren();
+ initialized.set(false);
+ DeltaCloudImage[] images = filter(newImages);
+ addChildren(images);
+ expand();
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ MessageFormat.format("Could not get images from cloud \"{0}\"",
cloud.getName()), e,
+ viewer.getControl().getShell());
+ } finally {
+ initialized.set(true);
+ }
+ }
+
+ public DeltaCloudImage[] filter(DeltaCloudImage[] images) throws DeltaCloudException {
+ DeltaCloud cloud = (DeltaCloud) getElement();
+ IImageFilter f = cloud.getImageFilter();
+ return f.filter(images).toArray(new DeltaCloudImage[images.length]);
+ }
+
+ protected void addCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.addImageListListener(this);
+ }
+ }
+
+ protected void removeCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.removeImageListListener(this);
+ }
+ }
+
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstanceElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.InstancePropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVInstanceElement extends CloudViewElement {
+
+ public CVInstanceElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ super(element, parent, viewer);
+ }
+
+ public String getName() {
+ Object element = getElement();
+ StringBuilder sb = new StringBuilder();
+ if (element instanceof DeltaCloudInstance) {
+ DeltaCloudInstance instance = (DeltaCloudInstance) element;
+ if (instance.getName() != null) {
+ sb.append(instance.getName());
+ }
+ if (instance.getId() != null) {
+ sb.append(" [").append(instance.getId()).append("] ");
+ }
+ }
+ return sb.toString();
+
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new InstancePropertySource(this, getElement());
+ }
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVInstancesCategoryElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import java.text.MessageFormat;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.GetInstancesCommand;
+import org.jboss.tools.deltacloud.core.IInstanceFilter;
+import org.jboss.tools.deltacloud.core.IInstanceListListener;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVInstancesCategoryElement extends CVCloudElementCategoryElement implements
IInstanceListListener {
+
+ private static final String INSTANCE_CATEGORY_NAME = "InstanceCategoryName";
//$NON-NLS-1$
+
+ public CVInstancesCategoryElement(Object element, CloudViewElement parent, TreeViewer
viewer) {
+ super(element, parent, viewer);
+ }
+
+ public String getName() {
+ return CVMessages.getString(INSTANCE_CATEGORY_NAME);
+ }
+
+ protected void asyncGetCloudElements() {
+ new GetInstancesCommand(getCloud()).execute();
+ }
+
+ @Override
+ protected CloudViewElement[] getElements(Object[] modelElements, int startIndex, int
stopIndex) {
+ CloudViewElement[] elements = new CloudViewElement[stopIndex - startIndex];
+ for (int i = startIndex; i < stopIndex; ++i) {
+ elements[i - startIndex] = new CVInstanceElement(modelElements[i], this, viewer);
+ }
+ return elements;
+ }
+
+ @Override
+ public void listChanged(DeltaCloud cloud, DeltaCloudInstance[] newInstances) {
+ try {
+ clearChildren();
+ initialized.set(false);
+ final DeltaCloudInstance[] instances = filter(newInstances);
+ addChildren(instances);
+ expand();
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ MessageFormat.format("Could not get instanceso from cloud
\"{0}\"", cloud.getName()), e,
+ viewer.getControl().getShell());
+ } finally {
+ initialized.set(true);
+ }
+ }
+
+ public DeltaCloudInstance[] filter(DeltaCloudInstance[] instances) throws
DeltaCloudException {
+ IInstanceFilter f = getCloud().getInstanceFilter();
+ return f.filter(instances).toArray(new DeltaCloudInstance[instances.length]);
+ }
+
+ protected void addCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.addInstanceListListener(this);
+ }
+ }
+
+ protected void removeCloudElementListener(DeltaCloud cloud) {
+ if (cloud != null) {
+ cloud.removeInstanceListListener(this);
+ }
+ }
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVNumericFoldingElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVNumericFoldingElement extends CloudViewElement {
+
+ public static int FOLDING_SIZE = 50;
+ private Object min;
+ private int max;
+
+ public CVNumericFoldingElement(int min, int max, CloudViewElement parent, TreeViewer
viewer) {
+ super(null, parent, viewer);
+ this.min = min;
+ this.max = max;
+ }
+
+ @Override
+ public String getName() {
+ return new StringBuilder()
+ .append("[")
+ .append(min)
+ .append("..")
+ .append(max - 1)
+ .append("]").toString();
+ }
+
+ @Override
+ public Object[] getChildren() {
+ return super.getChildren();
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return true;
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return null;
+ }
+
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVRootElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.core.ICloudManagerListener;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class CVRootElement extends CloudViewElement implements ICloudManagerListener {
+
+ public CVRootElement(TreeViewer viewer) {
+ super(DeltaCloudManager.getDefault(), null, viewer); //$NON-NLS-1$
+ DeltaCloudManager.getDefault().addCloudManagerListener(this);
+ }
+
+ @Override
+ public String getName() {
+ return "root"; //$NON-NLS-1$
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ // no property source for the root element
+ return null;
+ }
+
+ @Override
+ public Object[] getChildren() {
+ if (!initialized.get()) {
+ DeltaCloudManager m = DeltaCloudManager.getDefault();
+ try {
+ addClouds(m.getClouds());
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError("Error", "Could not get clouds", e,
Display.getDefault().getActiveShell());
+ } finally {
+ initialized.set(true);
+ }
+ }
+ return super.getChildren();
+ }
+
+ private void addClouds(DeltaCloud[] clouds) {
+ for (DeltaCloud cloud : clouds) {
+ addCloud(cloud);
+ }
+ }
+
+ private void addCloud(DeltaCloud cloud) {
+ CVCloudElement e = new CVCloudElement(cloud, this, viewer);
+ children.add(e);
+ }
+
+ private CloudViewElement getCloudViewElement(DeltaCloud cloudToMatch) {
+ for (CloudViewElement cloudElement : children) {
+ DeltaCloud cloud = (DeltaCloud) cloudElement.getElement();
+ if (cloudToMatch.equals(cloud)) {
+ return cloudElement;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ DeltaCloudManager.getDefault().removeCloudManagerListener(this);
+ }
+
+ public void cloudsChanged(int type, DeltaCloud cloud) {
+ switch (type) {
+ case ICloudManagerListener.ADD_EVENT:
+ addChild(new CVCloudElement(cloud, this, viewer));
+ break;
+ case ICloudManagerListener.REMOVE_EVENT:
+ removeChild(getCloudViewElement(cloud));
+ break;
+ case ICloudManagerListener.RENAME_EVENT:
+ CloudViewElement cloudViewElement = getCloudViewElement(cloud);
+ viewer.refresh(cloudViewElement);
+ break;
+ }
+ initialized.set(true);
+ }
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CVTypeMapper.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.ui.views.properties.tabbed.AbstractTypeMapper;
+
+public class CVTypeMapper extends AbstractTypeMapper {
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Class mapType(Object object) {
+ if (object instanceof TreeNode) {
+ return ((TreeNode) object).getValue().getClass();
+ }
+ return super.mapType(object);
+ }
+
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewContentProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+public class CloudViewContentProvider implements ITreeContentProvider {
+
+ private CloudViewElement root;
+
+ @Override
+ public Object[] getChildren(Object element) {
+ if (element instanceof CloudViewElement) {
+ return ((CloudViewElement) element).getChildren();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ if (element instanceof CloudViewElement) {
+ return ((CloudViewElement) element).getParent();
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ CloudViewElement e = (CloudViewElement) element;
+ return e.hasChildren();
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return root.getChildren();
+ }
+
+ @Override
+ public void dispose() {
+
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ root = (CloudViewElement) newInput;
+ }
+
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public abstract class CloudViewElement implements IAdaptable {
+
+ private Object element;
+ private CloudViewElement parent;
+ protected List<CloudViewElement> children =
+ Collections.synchronizedList(new ArrayList<CloudViewElement>());
+ protected TreeViewer viewer;
+ protected AtomicBoolean initialized = new AtomicBoolean();
+
+ public CloudViewElement(Object element, CloudViewElement parent, TreeViewer viewer) {
+ this.element = element;
+ this.parent = parent;
+ this.viewer = viewer;
+ initDisposeListener(viewer);
+ }
+
+ public abstract String getName();
+
+ public Object[] getChildren() {
+ return children.toArray();
+ }
+
+ protected void clearChildren() {
+ getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ // viewer.getTree().setRedraw(false);
+ for (final CloudViewElement element : children) {
+ viewer.remove(element);
+ }
+ // viewer.getTree().setRedraw(true);
+ }
+ });
+ children.clear();
+ }
+
+ public boolean hasChildren() {
+ return children.size() > 0;
+ }
+
+ public Object getParent() {
+ return parent;
+ }
+
+ public void addChild(final CloudViewElement element) {
+ children.add(element);
+
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ viewer.add(CloudViewElement.this, element);
+ }
+ });
+ }
+
+ public void addChildren(final CloudViewElement[] elements) {
+ for (CloudViewElement element : elements) {
+ children.add(element);
+ }
+
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ viewer.add(CloudViewElement.this, elements);
+ }
+ });
+ }
+
+ public void removeChild(final CloudViewElement element) {
+
+ getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (element != null) {
+ int index = children.indexOf(element);
+ viewer.remove(CloudViewElement.this, index);
+ }
+ }
+ });
+ }
+
+ protected void expand() {
+ getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ viewer.setExpandedState(CloudViewElement.this, true);
+ }
+ });
+ }
+
+ public Object getElement() {
+ return element;
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ IPropertySource p = getPropertySource();
+ return p;
+ }
+ return null;
+ }
+
+ public abstract IPropertySource getPropertySource();
+
+ private void initDisposeListener(Viewer viewer) {
+ final Control control = viewer.getControl();
+ control.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ control.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ dispose();
+ }
+ });
+ }
+ });
+ }
+
+ protected Display getDisplay() {
+ return viewer.getControl().getDisplay();
+ }
+
+ protected void dispose() {
+ // nothing to do
+ }
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/CloudViewLabelProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+
+public class CloudViewLabelProvider extends LabelProvider {
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof CVCloudElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_CLOUD);
+ } else if (element instanceof CVCloudElementCategoryElement ||
+ element instanceof CVNumericFoldingElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_FOLDER);
+ } else if (element instanceof CVInstanceElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_INSTANCE);
+ } else if (element instanceof CVImageElement) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_IMAGE);
+ }
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ CloudViewElement e = (CloudViewElement)element;
+ return e.getName();
+ }
+
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/DeltaCloudView.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * 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.cloud;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.deltacloud.ui.views.cloud.property.CVPropertySheetPage;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+
+public class DeltaCloudView extends ViewPart implements
ITabbedPropertySheetPageContributor {
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID =
"org.jboss.tools.deltacloud.ui.views.DeltaCloudView";
+
+ public static final String COLLAPSE_ALL = "CollapseAll.label"; //$NON-NLS-1$
+ private static final String HELP_CONTEXTID =
"org.jboss.tools.deltacloud.ui.viewer";
+
+ private TreeViewer viewer;
+
+ private Action collapseall;
+
+ public void createPartControl(Composite parent) {
+ viewer = createTreeViewer(parent);
+
+ // Create the help context id for the viewer's control
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(),
HELP_CONTEXTID);
+ makeActions();
+ hookContextMenu(viewer.getTree());
+ contributeToActionBars();
+ }
+
+ private TreeViewer createTreeViewer(Composite parent) {
+ TreeViewer viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL |
SWT.BORDER);
+ viewer.setContentProvider(new CloudViewContentProvider());
+ viewer.setLabelProvider(new CloudViewLabelProvider());
+ viewer.setUseHashlookup(true);
+ viewer.setInput(new CVRootElement(viewer));
+ viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
+ getSite().setSelectionProvider(viewer);
+ return viewer;
+ }
+
+ private void hookContextMenu(Control control) {
+ IMenuManager contextMenu = UIUtils.createContextMenu(control);
+ UIUtils.registerContributionManager(UIUtils.getContextMenuId(ID), contextMenu,
control);
+ }
+
+ private void contributeToActionBars() {
+ // TODO: replace by declarative command
+ fillLocalToolBar(getViewSite().getActionBars().getToolBarManager());
+ }
+
+ private void fillLocalToolBar(IToolBarManager manager) {
+ manager.add(collapseall);
+ }
+
+ private void makeActions() {
+ collapseall = createCollapseAllAction();
+ }
+
+ private Action createCollapseAllAction() {
+ Action collapseAll = new Action() {
+ public void run() {
+ viewer.collapseAll();
+ }
+ };
+ collapseAll.setText(CVMessages.getString(COLLAPSE_ALL));
+ collapseAll.setToolTipText(CVMessages.getString(COLLAPSE_ALL));
+ collapseAll.setImageDescriptor(SWTImagesFactory.DESC_COLLAPSE_ALL);
+ return collapseAll;
+ }
+
+ @Override
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+
+ @Override
+ public String getContributorId() {
+ return getSite().getId();
+ }
+
+ public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
+ if (adapter == IPropertySheetPage.class)
+ // If Tabbed view is desired, then change the
+ // following to new TabbedPropertySheetPage(this)
+ return new CVPropertySheetPage();
+ return super.getAdapter(adapter);
+ }
+}
\ No newline at end of file
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/LoadingCloudViewElement.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloud;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * A tree element that shows the user that the tree is currently loading
+ * elements
+ */
+public class LoadingCloudViewElement extends CloudViewElement {
+ protected LoadingCloudViewElement(CloudViewElement parent, TreeViewer viewer) {
+ super(null, parent, viewer);
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ // no property source for this element
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ // TODO: internationalize strings
+ return "Loading...";
+ }
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java
(from rev 27061,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySection.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * 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.cloud.property;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.events.ControlAdapter;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.PropertySheetPage;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+public class CVPropertySection extends AbstractPropertySection {
+
+ /**
+ * The Property Sheet Page.
+ */
+ protected PropertySheetPage page;
+
+ /**
+ * @see
org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
+ * org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
+ */
+ public void createControls(Composite parent, final TabbedPropertySheetPage
atabbedPropertySheetPage) {
+ super.createControls(parent, atabbedPropertySheetPage);
+
+ Composite composite = getWidgetFactory().createFlatFormComposite(parent);
+ page = new CVPropertySheetPage();
+ page.createControl(composite);
+
+ FormData data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.top = new FormAttachment(0, 0);
+ data.bottom = new FormAttachment(100, 0);
+ page.getControl().setLayoutData(data);
+
+ page.getControl().addControlListener(new ControlAdapter() {
+
+ public void controlResized(ControlEvent e) {
+ atabbedPropertySheetPage.resizeScrolledComposite();
+ }
+ });
+ }
+
+ /**
+ * @see
org.eclipse.ui.views.properties.tabbed.ISection#setInput(org.eclipse.ui.IWorkbenchPart,
+ * org.eclipse.jface.viewers.ISelection)
+ */
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ super.setInput(part, selection);
+ page.selectionChanged(part, selection);
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#dispose()
+ */
+ public void dispose() {
+ super.dispose();
+
+ if (page != null) {
+ page.dispose();
+ page = null;
+ }
+
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#refresh()
+ */
+ public void refresh() {
+ page.refresh();
+ }
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.ISection#shouldUseExtraSpace()
+ */
+ public boolean shouldUseExtraSpace() {
+ return true;
+ }
+
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetNonSorter.java
(from rev 27061,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetNonSorter.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetNonSorter.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.cloud.property;
+
+import org.eclipse.ui.views.properties.IPropertySheetEntry;
+import org.eclipse.ui.views.properties.PropertySheetSorter;
+
+public class CVPropertySheetNonSorter extends PropertySheetSorter {
+
+ public void sort(IPropertySheetEntry[] entries) {
+ // do nothing
+ }
+
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
(from rev 27061,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.cloud.property;
+
+import org.eclipse.ui.views.properties.PropertySheetPage;
+
+public class CVPropertySheetPage extends PropertySheetPage {
+
+ public CVPropertySheetPage() {
+ super();
+ setSorter(new CVPropertySheetNonSorter());
+ }
+
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CloudPropertySource.java
(from rev 27061,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CloudPropertySource.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CloudPropertySource.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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.cloud.property;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+
+public class CloudPropertySource implements IPropertySource {
+
+ private static final String PROPERTY_NAME = "deltacloud.views.cloud.name";
//$NON-NLS-1$
+ private static final String PROPERTY_URL = "deltacloud.views.cloud.id";
//$NON-NLS-1$
+ private static final String PROPERTY_USERNAME =
"deltacloud.views.cloud.username"; //$NON-NLS-1$
+ private static final String PROPERTY_NAME_TITLE = "PropertyName.title";
//$NON-NLS-1$
+ private static final String PROPERTY_URL_TITLE = "PropertyURL.title";
//$NON-NLS-1$
+ private static final String PROPERTY_USERNAME_TITLE =
"PropertyUsername.title"; //$NON-NLS-1$
+
+ private IPropertyDescriptor[] propertyDescriptors;
+ private DeltaCloud cloud;
+
+ public CloudPropertySource(Object o) {
+ cloud = (DeltaCloud)o;
+ }
+
+ @Override
+ public Object getEditableValue() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ if (propertyDescriptors == null) {
+ PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
+ CVMessages.getString(PROPERTY_NAME_TITLE));
+ PropertyDescriptor urlDescriptor = new PropertyDescriptor(PROPERTY_URL,
+ CVMessages.getString(PROPERTY_URL_TITLE));
+ PropertyDescriptor userDescriptor = new PropertyDescriptor(PROPERTY_USERNAME,
+ CVMessages.getString(PROPERTY_USERNAME_TITLE));
+
+ propertyDescriptors = new IPropertyDescriptor[] {
+ nameDescriptor,
+ urlDescriptor,
+ userDescriptor,
+ };
+ }
+ return propertyDescriptors;
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id.equals(PROPERTY_NAME))
+ return cloud.getName();
+ if (id.equals(PROPERTY_URL))
+ return cloud.getURL();
+ if (id.equals(PROPERTY_USERNAME))
+ return cloud.getUsername();
+ return null;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ return false;
+ }
+
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ // do nothing
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/ImagePropertySource.java
(from rev 27061,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/ImagePropertySource.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/ImagePropertySource.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.cloud.property;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+
+public class ImagePropertySource implements IPropertySource {
+
+ private static final String PROPERTY_NAME = "deltacloud.views.image.name";
//$NON-NLS-1$
+ private static final String PROPERTY_ID = "deltacloud.views.image.id";
//$NON-NLS-1$
+ private static final String PROPERTY_ARCH = "deltacloud.views.image.arch";
//$NON-NLS-1$
+ private static final String PROPERTY_DESCRIPTION =
"deltacloud.views.image.description"; //$NON-NLS-1$
+ private static final String PROPERTY_NAME_TITLE = "PropertyName.title";
//$NON-NLS-1$
+ private static final String PROPERTY_ID_TITLE = "PropertyId.title";
//$NON-NLS-1$
+ private static final String PROPERTY_ARCH_TITLE = "PropertyArch.title";
//$NON-NLS-1$
+ private static final String PROPERTY_DESCRIPTION_TITLE =
"PropertyDescription.title"; //$NON-NLS-1$
+
+ private IPropertyDescriptor[] propertyDescriptors;
+ private DeltaCloudImage image;
+
+ public ImagePropertySource(Object o) {
+ image = (DeltaCloudImage)o;
+ }
+
+ @Override
+ public Object getEditableValue() {
+ return null;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ if (propertyDescriptors == null) {
+ PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
+ CVMessages.getString(PROPERTY_NAME_TITLE));
+ PropertyDescriptor idDescriptor = new PropertyDescriptor(PROPERTY_ID,
+ CVMessages.getString(PROPERTY_ID_TITLE));
+ PropertyDescriptor archDescriptor = new PropertyDescriptor(PROPERTY_ARCH,
+ CVMessages.getString(PROPERTY_ARCH_TITLE));
+ PropertyDescriptor descDescriptor = new PropertyDescriptor(PROPERTY_DESCRIPTION,
+ CVMessages.getString(PROPERTY_DESCRIPTION_TITLE));
+
+ propertyDescriptors = new IPropertyDescriptor[] {
+ nameDescriptor,
+ idDescriptor,
+ archDescriptor,
+ descDescriptor,
+ };
+ }
+ return propertyDescriptors;
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id.equals(PROPERTY_NAME))
+ return image.getName();
+ if (id.equals(PROPERTY_ID))
+ return image.getId();
+ if (id.equals(PROPERTY_ARCH))
+ return image.getArchitecture();
+ if (id.equals(PROPERTY_DESCRIPTION))
+ return image.getDescription();
+ return null;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ return false;
+ }
+
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ }
+
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java
(from rev 27061,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/InstancePropertySource.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * 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.cloud.property;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVInstanceElement;
+import org.jboss.tools.internal.deltacloud.ui.utils.CloudViewElementUtils;
+
+public class InstancePropertySource implements IPropertySource {
+
+ private static final String PROPERTY_NAME = "deltacloud.views.instance.name";
//$NON-NLS-1$
+ private static final String PROPERTY_ID = "deltacloud.views.instance.id";
//$NON-NLS-1$
+ 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$
+ private static final String PROPERTY_NAME_TITLE = "PropertyName.title";
//$NON-NLS-1$
+ private static final String PROPERTY_ID_TITLE = "PropertyId.title";
//$NON-NLS-1$
+ 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$
+
+ private IPropertyDescriptor[] propertyDescriptors;
+ private DeltaCloudInstance instance;
+ private DeltaCloud cloud;
+
+ public InstancePropertySource(CVInstanceElement element, Object o) {
+ cloud = CloudViewElementUtils.getCloud(element);
+ instance = (DeltaCloudInstance) o;
+ }
+
+ @Override
+ public Object getEditableValue() {
+ return null;
+ }
+
+ @Override
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ if (propertyDescriptors == null) {
+ PropertyDescriptor nameDescriptor = new PropertyDescriptor(PROPERTY_NAME,
+ CVMessages.getString(PROPERTY_NAME_TITLE));
+ PropertyDescriptor idDescriptor = new PropertyDescriptor(PROPERTY_ID,
+ CVMessages.getString(PROPERTY_ID_TITLE));
+ PropertyDescriptor ownerDescriptor = new PropertyDescriptor(PROPERTY_OWNER,
+ CVMessages.getString(PROPERTY_OWNER_TITLE));
+ PropertyDescriptor stateDescriptor = new PropertyDescriptor(PROPERTY_STATE,
+ CVMessages.getString(PROPERTY_STATE_TITLE));
+ PropertyDescriptor hardwareDescriptor = new PropertyDescriptor(PROPERTY_PROFILEID,
+ CVMessages.getString(PROPERTY_PROFILEID_TITLE));
+ PropertyDescriptor realmDescriptor = new PropertyDescriptor(PROPERTY_REALMID,
+ CVMessages.getString(PROPERTY_REALMID_TITLE));
+ PropertyDescriptor imageDescriptor = new PropertyDescriptor(PROPERTY_IMAGEID,
+ 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,
+ idDescriptor,
+ ownerDescriptor,
+ stateDescriptor,
+ hostnameDescriptor,
+ keyDescriptor,
+ hardwareDescriptor,
+ realmDescriptor,
+ imageDescriptor,
+ };
+ }
+ return propertyDescriptors;
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id.equals(PROPERTY_NAME))
+ return instance.getName();
+ if (id.equals(PROPERTY_ID))
+ return instance.getId();
+ if (id.equals(PROPERTY_OWNER))
+ return instance.getOwnerId();
+ if (id.equals(PROPERTY_PROFILEID))
+ return instance.getProfileId();
+ if (id.equals(PROPERTY_REALMID))
+ return instance.getRealmId();
+ if (id.equals(PROPERTY_IMAGEID))
+ return instance.getImageId();
+ if (id.equals(PROPERTY_KEYNAME)) {
+ return getKey();
+ }
+ if (id.equals(PROPERTY_STATE)) {
+ return instance.getState();
+ }
+ if (id.equals(PROPERTY_HOSTNAME)) {
+ List<String> hostnames = instance.getHostNames();
+ if (hostnames.size() >= 1)
+ return hostnames.get(0);
+ }
+ return null;
+ }
+
+ private Object getKey() {
+ // At present (Deltacloud 0.0.7), the keyname is omitted
+ // in the data passed back from a listInstances request.
+ // If an instance is running and the keyname is missing,
+ // we can refresh the instance by its id and this will give us
+ // the full data. We can then replace the instance so that
+ // it will be complete for future requests until a refresh gets the
+ // entire list again.
+ String key = null;
+ try {
+ key = instance.getKey();
+ if (!cloud.getType().equals(DeltaCloud.MOCK_TYPE)) {
+ if (instance.getState().equals(DeltaCloudInstance.RUNNING) && (key == null ||
key.length() == 0)) {
+ instance = cloud.refreshInstance(instance.getId());
+ if (instance != null) {
+ key = instance.getKey();
+ if (key != null && key.length() > 0)
+ cloud.replaceInstance(instance);
+ }
+ }
+ }
+ } catch (DeltaCloudException e) {
+ ErrorUtils.handleError(
+ "Error", "Could not get key for instance " +
instance.getName(),
+ e, Display.getDefault().getActiveShell());
+ }
+ return key;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ return false;
+ }
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ // do nothing
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ }
+
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
(from rev 27175,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementTableView.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,403 @@
+/*******************************************************************************
+ * 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.cloudelements;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.TableViewer;
+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.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+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.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+import org.jboss.tools.deltacloud.core.ICloudManagerListener;
+import org.jboss.tools.deltacloud.core.IDeltaCloudElement;
+import org.jboss.tools.deltacloud.core.IInstanceFilter;
+import org.jboss.tools.deltacloud.ui.Activator;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+import org.jboss.tools.deltacloud.ui.views.CVMessages;
+import org.jboss.tools.internal.deltacloud.ui.preferences.TextPreferenceValue;
+import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+
+/**
+ * A common superclass for viewers that operate on IDeltaCloudElements
+ * (currently DeltaCloudImage and DeltaCloudInstance)
+ *
+ * @see InstanceView
+ * @see ImageView
+ *
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public abstract class AbstractCloudElementTableView<CLOUDELEMENT extends
IDeltaCloudElement> extends ViewPart implements
+ ICloudManagerListener {
+
+ private final static String CLOUD_SELECTOR_LABEL = "CloudSelector.label";
//$NON-NLS-1$
+
+ private static final String FILTERED_LABEL = "Filtered.label"; //$NON-NLS-1$
+ private static final String FILTERED_TOOLTIP = "FilteredImages.tooltip";
//$NON-NLS-1$
+
+ private Combo currentCloudSelector;
+ private Label currentCloudSelectorLabel;
+ private TableViewer viewer;
+
+ private DeltaCloud currentCloud;
+
+ private TextPreferenceValue lastSelectedCloudPref;
+
+ private ModifyListener cloudModifyListener = new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ int index = currentCloudSelector.getSelectionIndex();
+ if (index < 0) {
+ return;
+ }
+
+// removeListener(currentCloud);
+
+ AbstractCloudElementTableView.this.currentCloud = getCurrentCloud(index,
getClouds());
+ if (currentCloud != null) {
+ lastSelectedCloudPref.store(currentCloud.getName());
+ Display.getCurrent().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ setViewerInput(currentCloud);
+// addListener(currentCloud);
+ }
+ });
+ }
+ }
+ };
+
+ private ISelectionListener workbenchSelectionListener = new ISelectionListener() {
+
+ @Override
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ DeltaCloud cloud = UIUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
+ if (cloud != null) {
+ currentCloudSelector.select(getCloudIndex(cloud, getClouds()));
+ }
+ }
+ };
+
+// private Job viewerInputJob = new Job("") {
+//
+// @Override
+// protected IStatus run(IProgressMonitor monitor) {
+//
+// return Status.OK_STATUS;
+// }
+// };
+
+ public AbstractCloudElementTableView() {
+ lastSelectedCloudPref = new TextPreferenceValue(getSelectedCloudPrefsKey(),
Activator.getDefault());
+ }
+
+ private class ColumnListener extends SelectionAdapter {
+
+ private int column;
+
+ public ColumnListener(int column) {
+ this.column = column;
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TableViewerColumnComparator comparator = (TableViewerColumnComparator)
viewer.getComparator();
+ Table t = viewer.getTable();
+ if (comparator.getColumn() == column) {
+ comparator.reverseDirection();
+ }
+ comparator.setColumn(column);
+ TableColumn tc = (TableColumn) e.getSource();
+ t.setSortColumn(tc);
+ t.setSortDirection(SWT.NONE);
+ viewer.refresh();
+ }
+ };
+
+ protected abstract String getSelectedCloudPrefsKey();
+
+ @Override
+ public void dispose() {
+ DeltaCloudManager.getDefault().removeCloudManagerListener(this);
+ super.dispose();
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ container.setLayout(layout);
+
+ DeltaCloud[] clouds = getClouds();
+
+ createCloudSelector(container);
+ initCloudSelector(lastSelectedCloudPref.get(), currentCloudSelector, clouds);
+
+ Label filterLabel = new Label(container, SWT.NULL);
+ filterLabel.setText(CVMessages.getString(FILTERED_LABEL));
+ filterLabel.setToolTipText(CVMessages.getString(FILTERED_TOOLTIP));
+
+ Composite tableArea = new Composite(container, SWT.NULL);
+ viewer = createTableViewer(tableArea);
+
+ currentCloud = getCurrentCloud(currentCloudSelector.getSelectionIndex(), clouds);
+
+// addListener(currentCloud);
+ setViewerInput(currentCloud);
+ setFilterLabelVisible(currentCloud, filterLabel);
+
+ Point p1 = currentCloudSelectorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point p2 = currentCloudSelector.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ int centering = (p2.y - p1.y + 1) / 2;
+
+ FormData f = new FormData();
+ f.top = new FormAttachment(0, 5 + centering);
+ f.left = new FormAttachment(0, 30);
+ currentCloudSelectorLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(0, 5);
+ f.left = new FormAttachment(currentCloudSelectorLabel, 5);
+ currentCloudSelector.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(0, 5 + centering);
+ f.right = new FormAttachment(100, -10);
+ filterLabel.setLayoutData(f);
+
+ f = new FormData();
+ f.top = new FormAttachment(currentCloudSelector, 8);
+ f.left = new FormAttachment(0, 0);
+ f.right = new FormAttachment(100, 0);
+ f.bottom = new FormAttachment(100, 0);
+ tableArea.setLayoutData(f);
+
+ // Create the help context id for the viewer's control
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(),
"org.jboss.tools.deltacloud.ui.viewer");
+ hookContextMenu(viewer.getControl());
+ getSite().setSelectionProvider(viewer);
+ getSite().getWorkbenchWindow().getSelectionService().addPostSelectionListener(workbenchSelectionListener);
+
+ DeltaCloudManager.getDefault().addCloudManagerListener(this);
+ }
+
+ private TableViewer createTableViewer(Composite tableArea) {
+ TableColumnLayout tableLayout = new TableColumnLayout();
+ tableArea.setLayout(tableLayout);
+
+ TableViewer viewer = new TableViewer(tableArea,
+ SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI);
+ Table table = viewer.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+ ITableContentAndLabelProvider provider = getContentAndLabelProvider();
+ viewer.setContentProvider(provider);
+ viewer.setLabelProvider(provider);
+ createColumns(tableLayout, table);
+
+ viewer.setComparator(new TableViewerColumnComparator());
+ table.setSortDirection(SWT.NONE);
+
+ return viewer;
+ }
+
+ protected abstract ITableContentAndLabelProvider getContentAndLabelProvider();
+
+ private void setViewerInput(DeltaCloud cloud) {
+ if (currentCloud != null) {
+ viewer.setInput(currentCloud);
+ }
+ }
+
+ /**
+ * Gets the clouds that are available in the model.
+ *
+ * @return the clouds
+ */
+ private DeltaCloud[] getClouds() {
+ DeltaCloud[] clouds = new DeltaCloud[] {};
+ try {
+ clouds = DeltaCloudManager.getDefault().getClouds();
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ "Could not get all clouds",
+ e, Display.getDefault().getActiveShell());
+ }
+ return clouds;
+ }
+
+ private int getCloudIndex(DeltaCloud cloud, DeltaCloud[] clouds) {
+ if (cloud == null) {
+ return 0;
+ }
+ return getCloudIndex(cloud.getName(), clouds);
+ }
+
+ private int getCloudIndex(String cloudName, DeltaCloud[] clouds) {
+ int index = 0;
+ if (cloudName != null && clouds.length > 0) {
+ for (int i = 0; i < clouds.length; i++) {
+ DeltaCloud cloud = clouds[i];
+ if (cloudName != null && cloudName.equals(cloud.getName())) {
+ index = i;
+ break;
+ }
+ }
+ }
+ return index;
+ }
+
+ private void setFilterLabelVisible(DeltaCloud currentCloud, Label filterLabel) {
+ if (currentCloud == null) {
+ filterLabel.setVisible(false);
+ return;
+ }
+
+ IInstanceFilter filter = currentCloud.getInstanceFilter();
+ filterLabel.setVisible(!filter.toString().equals(IInstanceFilter.ALL_STRING));
+ }
+
+ private DeltaCloud getCurrentCloud(int cloudIndex, DeltaCloud[] clouds) {
+ if (cloudIndex < 0 || cloudIndex >= clouds.length) {
+ return null;
+ }
+
+ return clouds[cloudIndex];
+ }
+
+ private void createColumns(TableColumnLayout tableLayout, Table table) {
+ for (int i = 0; i < InstanceViewLabelAndContentProvider.Column.getSize(); ++i) {
+ InstanceViewLabelAndContentProvider.Column c =
+ InstanceViewLabelAndContentProvider.Column.getColumn(i);
+ TableColumn tc = new TableColumn(table, SWT.NONE);
+ if (i == 0) {
+ table.setSortColumn(tc);
+ }
+ tc.setText(CVMessages.getString(c.name()));
+ tableLayout.setColumnData(tc, new ColumnWeightData(c.getWeight(), true));
+ tc.addSelectionListener(new ColumnListener(i));
+ }
+ }
+
+ private void createCloudSelector(Composite parent) {
+ this.currentCloudSelectorLabel = new Label(parent, SWT.NULL);
+ currentCloudSelectorLabel.setText(CVMessages.getString(CLOUD_SELECTOR_LABEL));
+
+ this.currentCloudSelector = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
+ currentCloudSelector.addModifyListener(cloudModifyListener);
+ // Following is a kludge so that on Linux the Combo is read-only but
+ // has a white background.
+ currentCloudSelector.addVerifyListener(new VerifyListener() {
+ @Override
+ public void verifyText(VerifyEvent e) {
+ e.doit = false;
+ }
+ });
+ }
+
+ private void hookContextMenu(Control control) {
+ IMenuManager contextMenu = UIUtils.createContextMenu(control);
+ UIUtils.registerContributionManager(UIUtils.getContextMenuId(getViewID()), contextMenu,
control);
+ }
+
+ protected abstract String getViewID();
+
+ private void initCloudSelector(String cloudNameToSelect, Combo cloudSelector,
DeltaCloud[] clouds) {
+ if (clouds.length > 0
+ && cloudNameToSelect != null && cloudNameToSelect.length() > 0) {
+ cloudSelector.setItems(toCloudNames(clouds));
+ cloudSelector.select(getCloudIndex(cloudNameToSelect, clouds));
+ }
+ }
+
+ public void cloudsChanged(int type, DeltaCloud cloud) {
+ int currIndex = 0;
+ if (currentCloud != null) {
+ currIndex = currentCloudSelector.getSelectionIndex();
+ }
+ DeltaCloud[] clouds = getClouds();
+ int index = getCloudIndex(currentCloud, getClouds());
+ if (type == ICloudManagerListener.RENAME_EVENT) {
+ index = currIndex; // no change in cloud displayed
+ }
+
+ String[] cloudNames = toCloudNames(clouds);
+ setCloudSelectorItems(cloudNames, currentCloudSelector);
+ this.currentCloud = getCurrentCloud(index, clouds);
+
+ if (cloudNames.length > 0) {
+ currentCloudSelector.setText(cloudNames[index]);
+ setViewerInput(currentCloud);
+ } else {
+ currentCloudSelector.setText("");
+ setViewerInput(null);
+ }
+ }
+
+ private String[] toCloudNames(DeltaCloud[] clouds) {
+ List<String> cloudNames = new ArrayList<String>();
+ for (DeltaCloud cloud : clouds) {
+ if (cloud != null) {
+ cloudNames.add(cloud.getName());
+ }
+ }
+ return (String[]) cloudNames.toArray(new String[cloudNames.size()]);
+ }
+
+ private void setCloudSelectorItems(String[] cloudNames, Combo cloudSelector) {
+ cloudSelector.removeModifyListener(cloudModifyListener);
+ cloudSelector.setItems(cloudNames);
+ cloudSelector.addModifyListener(cloudModifyListener);
+ }
+
+ /**
+ * Refresh the states of the commands in the toolbar.
+ */
+ protected abstract void refreshToolbarCommandStates();
+
+ @Override
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementViewLabelAndContentProvider.java
(from rev 27190,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/AbstractCloudElementViewLabelAndContentProvider.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementViewLabelAndContentProvider.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementViewLabelAndContentProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * 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.cloudelements;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.BaseLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudException;
+import org.jboss.tools.deltacloud.core.ICloudElementFilter;
+import org.jboss.tools.deltacloud.core.IDeltaCloudElement;
+import org.jboss.tools.deltacloud.ui.ErrorUtils;
+
+/**
+ * A common superclass for content- and label-providers that operate on
+ * IDeltaCloudElements (currently DeltaCloudImage and DeltaCloudInstance)
+ *
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public abstract class AbstractCloudElementViewLabelAndContentProvider<CLOUDELEMENT
extends IDeltaCloudElement> extends
+ BaseLabelProvider implements ITableContentAndLabelProvider {
+
+ private DeltaCloud currentCloud;
+ private ICloudElementFilter<CLOUDELEMENT> localFilter;
+ private TableViewer viewer;
+
+ @Override
+ public Object[] getElements(Object input) {
+ return new Object[] {};
+ }
+
+ public void setFilter(ICloudElementFilter<CLOUDELEMENT> filter) {
+ this.localFilter = filter;
+ }
+
+ @Override
+ public void inputChanged(final Viewer viewer, Object oldInput, Object newInput) {
+ if (!(newInput instanceof DeltaCloud)) {
+ return;
+ }
+ Assert.isTrue(viewer instanceof TableViewer);
+ this.viewer = (TableViewer) viewer;
+ removeListener(currentCloud);
+ this.currentCloud = (DeltaCloud) newInput;
+ addListener(currentCloud);
+ // TODO internationalize strings
+ asyncGetCloudElements(currentCloud);
+ }
+
+ public void listChanged(final DeltaCloud cloud, final CLOUDELEMENT[] cloudElements) {
+ if (isCurrentCloud(cloud)) {
+ addToViewer(cloudElements);
+ }
+ }
+
+ private boolean isCurrentCloud(final DeltaCloud cloud) {
+ return cloud != null
+ && currentCloud != null
+ && cloud.getName().equals(currentCloud.getName());
+ }
+
+ private void addToViewer(final CLOUDELEMENT[] cloudElements) {
+ viewer.getControl().getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ Object[] elements = filter(getFilter(currentCloud), cloudElements);
+ viewer.add(elements);
+ } catch (DeltaCloudException e) {
+ // TODO: internationalize strings
+ ErrorUtils.handleError(
+ "Error",
+ "Could not get elements of clouds " + currentCloud.getName(),
+ e, Display.getDefault().getActiveShell());
+
+ }
+ }
+ });
+ }
+
+ private ICloudElementFilter<CLOUDELEMENT> getFilter(DeltaCloud cloud) {
+ if (localFilter != null) {
+ return localFilter;
+ } else {
+ return getCloudFilter(cloud);
+ }
+ }
+
+ protected Object[] filter(ICloudElementFilter<CLOUDELEMENT> filter, CLOUDELEMENT[]
cloudElements)
+ throws DeltaCloudException {
+ if (cloudElements == null) {
+ return new Object[] {};
+ }
+ if (filter == null) {
+ return cloudElements;
+ } else {
+ return filter.filter(cloudElements).toArray();
+ }
+ }
+
+ @Override
+ public void dispose() {
+ removeListener(currentCloud);
+ }
+
+ protected abstract void addListener(DeltaCloud cloud);
+
+ protected abstract void removeListener(DeltaCloud cloud);
+
+ protected abstract ICloudElementFilter<CLOUDELEMENT> getCloudFilter(DeltaCloud
cloud);
+
+ protected abstract void asyncGetCloudElements(DeltaCloud cloud);
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementViewLabelAndContentProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ITableContentAndLabelProvider.java
(from rev 27084,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ITableContentAndLabelProvider.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ITableContentAndLabelProvider.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ITableContentAndLabelProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloudelements;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+
+/**
+ * @author Andre Dietisheim
+ */
+public interface ITableContentAndLabelProvider extends IStructuredContentProvider,
ITableLabelProvider{
+
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ITableContentAndLabelProvider.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java
(from rev 27175,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageView.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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.cloudelements;
+
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
+
+/**
+ * A view that displays images of a DeltaCloud.
+ *
+ * @see DeltaCloud#getImages()
+ *
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class ImageView extends AbstractCloudElementTableView<DeltaCloudImage> {
+
+ @Override
+ protected String getSelectedCloudPrefsKey() {
+ return IDeltaCloudPreferenceConstants.LAST_CLOUD_IMAGE_VIEW;
+ }
+
+ @Override
+ protected String getViewID() {
+ return "org.jboss.tools.deltacloud.ui.views.ImageView";
+ }
+
+ @Override
+ protected ITableContentAndLabelProvider getContentAndLabelProvider() {
+ return new ImageViewLabelAndContentProvider();
+ }
+
+ @Override
+ protected void refreshToolbarCommandStates() {
+ // do nothing
+ }
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java
(from rev 27185,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageViewLabelAndContentProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * 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.cloudelements;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.GetImagesCommand;
+import org.jboss.tools.deltacloud.core.ICloudElementFilter;
+import org.jboss.tools.deltacloud.core.IImageListListener;
+
+/**
+ * @author Jeff Johnston
+ * @author André Dietisheim
+ */
+public class ImageViewLabelAndContentProvider extends
AbstractCloudElementViewLabelAndContentProvider<DeltaCloudImage>
+ implements ITableContentAndLabelProvider, IImageListListener {
+
+ public enum Column {
+ NAME(0, 20),
+ ID(1, 20),
+ ARCH(2, 20),
+ DESC(3, 40);
+
+ private int column;
+ private int weight;
+ private static final Map<Integer, Column> lookup = new HashMap<Integer,
Column>();
+
+ static {
+ for (Column c : EnumSet.allOf(Column.class))
+ lookup.put(c.getColumnNumber(), c);
+ }
+
+ private Column(int column, int weight) {
+ this.column = column;
+ this.weight = weight;
+ }
+
+ public int getColumnNumber() {
+ return column;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public static Column getColumn(int number) {
+ return lookup.get(number);
+ }
+
+ public static int getSize() {
+ return lookup.size();
+ }
+
+ };
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ Column c = Column.getColumn(columnIndex);
+ DeltaCloudImage i = (DeltaCloudImage) element;
+ switch (c) {
+ case NAME:
+ return i.getName();
+ case ID:
+ return i.getId();
+ case ARCH:
+ return i.getArchitecture();
+ case DESC:
+ return i.getDescription();
+ }
+ return "";
+ }
+
+ protected ICloudElementFilter<DeltaCloudImage> getCloudFilter(DeltaCloud cloud) {
+ return cloud.getImageFilter();
+ }
+
+ @Override
+ protected void asyncGetCloudElements(DeltaCloud cloud) {
+ new GetImagesCommand(cloud).execute();
+ }
+
+ @Override
+ protected void addListener(DeltaCloud currentCloud) {
+ if (currentCloud != null) {
+ currentCloud.addImageListListener(this);
+ }
+ }
+
+ @Override
+ protected void removeListener(DeltaCloud currentCloud) {
+ if (currentCloud != null) {
+ currentCloud.removeImageListListener(this);
+ }
+ }
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java
(from rev 27175,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ *
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.deltacloud.ui.views.cloudelements;
+
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.services.IEvaluationService;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
+
+/**
+ * A view that displays instances of a DeltaCloud
+ *
+ * @see DeltaCloud#getInstances()
+ *
+ * @author Jeff Johnston
+ * @author Andre Dietisheim
+ */
+public class InstanceView extends AbstractCloudElementTableView<DeltaCloudInstance>
{
+
+ protected String getSelectedCloudPrefsKey() {
+ return IDeltaCloudPreferenceConstants.LAST_CLOUD_INSTANCE_VIEW;
+ }
+
+ @Override
+ protected String getViewID() {
+ return "org.jboss.tools.deltacloud.ui.views.InstanceView";
+ }
+
+ @Override
+ protected ITableContentAndLabelProvider getContentAndLabelProvider() {
+ return new InstanceViewLabelAndContentProvider();
+ }
+
+ @Override
+ protected void refreshToolbarCommandStates() {
+ IEvaluationService evaluationService = (IEvaluationService)
PlatformUI.getWorkbench().getService(
+ IEvaluationService.class);
+ evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canStart");
+ evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canStop");
+ evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canReboot");
+ evaluationService.requestEvaluation("org.jboss.tools.deltacloud.ui.commands.canDestroy");
+ }
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java
(from rev 27185,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceViewLabelAndContentProvider.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceViewLabelAndContentProvider.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * 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.cloudelements;
+
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+import org.jboss.tools.deltacloud.core.GetInstancesCommand;
+import org.jboss.tools.deltacloud.core.ICloudElementFilter;
+import org.jboss.tools.deltacloud.core.IInstanceListListener;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+
+/**
+ * @author Jeff Jonhston
+ * @author Andre Dietisheim
+ */
+public class InstanceViewLabelAndContentProvider extends
+ AbstractCloudElementViewLabelAndContentProvider<DeltaCloudInstance> implements
ITableContentAndLabelProvider, IInstanceListListener {
+
+ public enum Column {
+ NAME(0, 20),
+ ID(1, 20),
+ STATUS(2, 6),
+ HOSTNAME(3, 40);
+
+ private int column;
+ private int weight;
+ private static final Map<Integer, Column> lookup = new HashMap<Integer,
Column>();
+
+ static {
+ for (Column c : EnumSet.allOf(Column.class))
+ lookup.put(c.getColumnNumber(), c);
+ }
+
+ private Column(int column, int weight) {
+ this.column = column;
+ this.weight = weight;
+ }
+
+ public int getColumnNumber() {
+ return column;
+ }
+
+ public int getWeight() {
+ return weight;
+ }
+
+ public static Column getColumn(int number) {
+ return lookup.get(number);
+ }
+
+ public static int getSize() {
+ return lookup.size();
+ }
+
+ };
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ Column c = Column.getColumn(columnIndex);
+ DeltaCloudInstance i = (DeltaCloudInstance) element;
+ switch (c) {
+ case STATUS:
+ return getStatusIcon(i.getState());
+ default:
+ return null;
+ }
+ }
+
+ private Image getStatusIcon(String status) {
+ if (DeltaCloudInstance.STOPPED.equals(status)) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_STOPPED);
+ } else if (DeltaCloudInstance.RUNNING.equals(status)) {
+ return SWTImagesFactory.get(SWTImagesFactory.IMG_RUNNING);
+ } else if (DeltaCloudInstance.BOGUS.equals(status)) {
+ return PlatformUI.getWorkbench().getSharedImages().
+ getImage(ISharedImages.IMG_DEC_FIELD_WARNING);
+ } else {
+ return null;
+ }
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ Column c = Column.getColumn(columnIndex);
+ DeltaCloudInstance i = (DeltaCloudInstance) element;
+ if (i != null) {
+ switch (c) {
+ case NAME:
+ return i.getName();
+ case ID:
+ return i.getId();
+ case STATUS:
+ return "";
+ case HOSTNAME:
+ return i.getHostName();
+ }
+ }
+ return "";
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ protected ICloudElementFilter<DeltaCloudInstance> getCloudFilter(DeltaCloud cloud)
{
+ return cloud.getInstanceFilter();
+ }
+
+ @Override
+ protected void asyncGetCloudElements(DeltaCloud cloud) {
+ new GetInstancesCommand(cloud).execute();
+ }
+
+ @Override
+ protected void addListener(DeltaCloud currentCloud) {
+ if (currentCloud != null) {
+ currentCloud.addInstanceListListener(this);
+ }
+ }
+
+ @Override
+ protected void removeListener(DeltaCloud currentCloud) {
+ if (currentCloud != null) {
+ currentCloud.removeInstanceListListener(this);
+ }
+ }
+
+}
Copied:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java
(from rev 27084,
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/TableViewerColumnComparator.java)
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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.cloudelements;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+
+/**
+ * A viewer comparator that compares labels in a column of a table.<br>
+ * This implementation was extracted out of the former Image- and
+ * InstanceComparator which were mostly identical.
+ *
+ * @see ViewerComparator
+ *
+ * @author Jeff Johnston
+ * @author André Dietisheim
+ */
+public class TableViewerColumnComparator extends ViewerComparator {
+
+ private final static int UP = 1;
+
+ private int column;
+ private int direction;
+
+ public TableViewerColumnComparator() {
+ this(0);
+ }
+
+ public TableViewerColumnComparator(int column) {
+ this.column = column;
+ this.direction = UP;
+ }
+
+ public void setColumn(int newColumn) {
+ if (column != newColumn)
+ direction = UP;
+ column = newColumn;
+ }
+
+ public int getColumn() {
+ return column;
+ }
+
+ public void reverseDirection() {
+ direction *= -1;
+ }
+
+ @Override
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ int tmp = compareByColumn(viewer, e1, e2);
+ return tmp * direction;
+ }
+
+ private int compareByColumn(Viewer viewer, Object e1, Object e2) {
+ Assert.isTrue(viewer instanceof TableViewer
+ && ((TableViewer) viewer).getLabelProvider() instanceof
ITableLabelProvider);
+
+ ITableLabelProvider provider = (ITableLabelProvider) ((TableViewer)
viewer).getLabelProvider();
+ String s1 = provider.getColumnText(e1, column);
+ String s2 = provider.getColumnText(e2, column);
+ return s1.compareToIgnoreCase(s2);
+ }
+}
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/TableViewerColumnComparator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/utils/CloudViewElementUtils.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -11,8 +11,8 @@
package org.jboss.tools.internal.deltacloud.ui.utils;
import org.jboss.tools.deltacloud.core.DeltaCloud;
-import org.jboss.tools.deltacloud.ui.views.CVCloudElement;
-import org.jboss.tools.deltacloud.ui.views.CloudViewElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CVCloudElement;
+import org.jboss.tools.deltacloud.ui.views.cloud.CloudViewElement;
public class CloudViewElementUtils {
@@ -46,7 +46,8 @@
* @see CVCloudElement
*/
public static CVCloudElement getCVCloudElement(CloudViewElement element) {
- while (!(element instanceof CVCloudElement)) {
+ while (!(element instanceof CVCloudElement)
+ && element != null) {
element = (CloudViewElement) element.getParent();
}
return (CVCloudElement) element;
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/EditCloudConnectionWizard.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -33,7 +33,7 @@
initialCloud.editCloud(name, url, username, password, type);
DeltaCloudManager.getDefault().saveClouds();
if (!name.equals(oldName)) {
- DeltaCloudManager.getDefault().notifyCloudRename();
+ DeltaCloudManager.getDefault().notifyCloudRename(initialCloud);
}
} catch (Exception e) {
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java 2010-12-07
08:22:00 UTC (rev 27202)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/internal/deltacloud/ui/wizards/FindImagePage.java 2010-12-07
08:34:15 UTC (rev 27203)
@@ -30,8 +30,8 @@
import org.jboss.tools.deltacloud.core.ImageFilter;
import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
import org.jboss.tools.deltacloud.ui.views.CVMessages;
-import org.jboss.tools.deltacloud.ui.views.ImageViewLabelAndContentProvider;
-import org.jboss.tools.deltacloud.ui.views.TableViewerColumnComparator;
+import
org.jboss.tools.deltacloud.ui.views.cloudelements.ImageViewLabelAndContentProvider;
+import org.jboss.tools.deltacloud.ui.views.cloudelements.TableViewerColumnComparator;
public class FindImagePage extends WizardPage implements IImageListListener {