Author: jjohnstn
Date: 2010-07-23 18:11:17 -0400 (Fri, 23 Jul 2010)
New Revision: 23719
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.classpath
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.project
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.core.prefs
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/build.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/contexts.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/cloud.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/collapseall.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/delta.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/folder.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/image.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/instance.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/running.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/sample.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/stopped.gif
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/Activator.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.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/CVImageElement.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/CVMessages.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties
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/ImagePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
Log:
2010-07-23 Jeff Johnston <jjohnstn(a)redhat.com>
* .classpath: New file.
* .project: New file.
* .settings/org.eclipse.jdt.core.prefs: New file.
* build.properties: New file.
* contexts.xml: New file.
* icons/cloud.gif: New file.
* icons/collapseall.gif: New file.
* icons/delta.gif: New file.
* icons/folder.gif: New file.
* icons/image.gif: New file.
* icons/instance.gif: New file.
* icons/running.gif: New file.
* icons/sample.gif: New file.
* icons/stopped.gif: New file.
* META-INF/MANIFEST.MF: New file.
* plugin.properties: New file.
* plugin.xml: New file.
* src/org/jboss/tools/deltacloud/ui/Activator.java: New file.
* src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVMessages.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java: New file.
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.classpath
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.classpath
(rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.classpath 2010-07-23 22:11:17
UTC (rev 23719)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.project
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.project
(rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.project 2010-07-23 22:11:17
UTC (rev 23719)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.deltacloud.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/.settings/org.eclipse.jdt.core.prefs 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,8 @@
+#Tue Jul 20 18:00:15 EDT 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
(rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-07-23 22:11:17
UTC (rev 23719)
@@ -0,0 +1,35 @@
+2010-07-23 Jeff Johnston <jjohnstn(a)redhat.com>
+
+ * .classpath: New file.
+ * .project: New file.
+ * .settings/org.eclipse.jdt.core.prefs: New file.
+ * build.properties: New file.
+ * contexts.xml: New file.
+ * icons/cloud.gif: New file.
+ * icons/collapseall.gif: New file.
+ * icons/delta.gif: New file.
+ * icons/folder.gif: New file.
+ * icons/image.gif: New file.
+ * icons/instance.gif: New file.
+ * icons/running.gif: New file.
+ * icons/sample.gif: New file.
+ * icons/stopped.gif: New file.
+ * META-INF/MANIFEST.MF: New file.
+ * plugin.properties: New file.
+ * plugin.xml: New file.
+ * src/org/jboss/tools/deltacloud/ui/Activator.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVMessages.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java: New file.
\ No newline at end of file
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF
(rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/META-INF/MANIFEST.MF 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Deltacloud UI
+Bundle-SymbolicName: org.jboss.tools.deltacloud.ui; singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.deltacloud.ui.Activator
+Bundle-Vendor: Red Hat Inc.
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.ui.views;bundle-version="3.4.1",
+ org.eclipse.ui.views.properties.tabbed;bundle-version="3.5.0",
+ org.jboss.tools.deltacloud.core;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/build.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/build.properties
(rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/build.properties 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ contexts.xml
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/contexts.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/contexts.xml
(rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/contexts.xml 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,12 @@
+<contexts>
+ <context id="viewer" title="Sample View">
+ <description>This is the context help for the sample view with a table viewer. It
was generated by a PDE template.</description>
+ <topic
href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm"
label="Context-sensitive help">
+ <enablement>
+ <with variable="platform">
+ <test property="org.eclipse.core.runtime.isBundleInstalled"
args="org.eclipse.platform.doc.isv"/>
+ </with>
+ </enablement>
+ </topic>
+ </context>
+</contexts>
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/cloud.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/cloud.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/collapseall.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/collapseall.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/delta.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/delta.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/folder.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/folder.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/image.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/image.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/instance.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/instance.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/running.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/running.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/sample.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/sample.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/stopped.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/icons/stopped.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties
(rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.properties 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,4 @@
+DeltaCloudCategory=Delta Cloud
+CloudViewerName=Cloud Viewer
+
+Advanced.label=Advanced
\ No newline at end of file
Added: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
(rev 0)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-07-23 22:11:17
UTC (rev 23719)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="org.jboss.tools.deltacloud.ui"
+ name="%DeltaCloudCategory">
+ </category>
+ <view
+ name="%CloudViewerName"
+ icon="icons/delta.gif"
+ category="org.jboss.tools.deltacloud.ui"
+ class="org.jboss.tools.deltacloud.ui.views.DeltaCloudView"
+ id="org.jboss.tools.deltacloud.ui.views.CloudView">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.help.contexts">
+ <contexts
+ file="contexts.xml">
+ </contexts>
+ </extension>
+ <extension
+
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">
+ <propertyCategory
+ category="main"></propertyCategory>
+ </propertyContributor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <propertyTabs
+ contributorId="org.jboss.tools.deltacloud.ui.views.CloudView">
+ <propertyTab
+ category="main"
+ id="cloudview.advancedTab"
+ label="%Advanced.label">
+ </propertyTab>
+ </propertyTabs>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <propertySections
+ contributorId="org.jboss.tools.deltacloud.ui.views.CloudView">
+ <propertySection
+
class="org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection"
+ id="org.jboss.tools.deltacloud.ui.propertySection.advanced"
+ tab="cloudview.advancedTab">
+ <input
+
type="org.jboss.tools.deltacloud.ui.views.CloudViewElement">
+ </input>
+ </propertySection>
+ </propertySections>
+ </extension>
+
+</plugin>
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/Activator.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/Activator.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/Activator.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,85 @@
+package org.jboss.tools.deltacloud.ui;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.deltacloud.ui";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public static void log(IStatus status) {
+ Activator.getDefault().getLog().log(status);
+ }
+
+ public static void logErrorMessage(String message) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, message, null));
+ }
+
+ public static void log(Throwable e) {
+ if (e instanceof InvocationTargetException)
+ e = ((InvocationTargetException) e).getTargetException();
+ IStatus status = null;
+ if (e instanceof CoreException)
+ status = ((CoreException) e).getStatus();
+ else
+ status = new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, e.getMessage(), e);
+ log(status);
+ }
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/SWTImagesFactory.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,85 @@
+package org.jboss.tools.deltacloud.ui;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+
+public class SWTImagesFactory {
+ // The plugin registry
+ private static ImageRegistry imageRegistry = Activator.getDefault().getImageRegistry();
+
+ // Subdirectory (under the package containing this class) where 16 color images are
+ private static URL fgIconBaseURL;
+
+ static {
+ try {
+ fgIconBaseURL= new URL(Activator.getDefault().getBundle().getEntry("/"),
"icons/" ); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (MalformedURLException e) {
+ Activator.log(e);
+ }
+ }
+ private static final String NAME_PREFIX= Activator.PLUGIN_ID + '.';
+ private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length();
+ public static final String IMG_CLOUD= NAME_PREFIX + "cloud.gif";
//$NON-NLS-1$
+ public static final String IMG_FOLDER= NAME_PREFIX + "folder.gif";
//$NON-NLS-1$
+ public static final String IMG_INSTANCE= NAME_PREFIX + "instance.gif";
//$NON-NLS-1$
+ public static final String IMG_IMAGE= NAME_PREFIX + "image.gif";
//$NON-NLS-1$
+ public static final String IMG_COLLAPSE_ALL= NAME_PREFIX + "collapseall.gif";
//$NON-NLS-1$
+ public static final ImageDescriptor DESC_CLOUD= createManaged("",
IMG_CLOUD);
+ public static final ImageDescriptor DESC_FOLDER= createManaged("",
IMG_FOLDER);
+ public static final ImageDescriptor DESC_INSTANCE= createManaged("",
IMG_INSTANCE);
+ public static final ImageDescriptor DESC_IMAGE= createManaged("", IMG_IMAGE);
+ public static final ImageDescriptor DESC_COLLAPSE_ALL= createManaged("",
IMG_COLLAPSE_ALL);
+
+ private static ImageDescriptor createManaged(String prefix, String name) {
+ return createManaged(imageRegistry, prefix, name);
+ }
+
+ private static ImageDescriptor createManaged(ImageRegistry registry, String prefix,
String name) {
+ ImageDescriptor result= ImageDescriptor.createFromURL(makeIconFileURL(prefix,
name.substring(NAME_PREFIX_LENGTH)));
+ registry.put(name, result);
+ return result;
+ }
+
+ public static Image get(String key) {
+ return imageRegistry.get(key);
+ }
+
+ private static ImageDescriptor create(String prefix, String name) {
+ return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
+ }
+
+ private static URL makeIconFileURL(String prefix, String name) {
+ StringBuffer buffer= new StringBuffer(prefix);
+ buffer.append(name);
+ try {
+ return new URL(fgIconBaseURL, buffer.toString());
+ } catch (MalformedURLException e) {
+ Activator.log(e);
+ return null;
+ }
+ }
+
+ /**
+ * Sets all available image descriptors for the given action.
+ */
+ public static void setImageDescriptors(IAction action, String type, String relPath) {
+ if (relPath.startsWith(NAME_PREFIX))
+ relPath= relPath.substring(NAME_PREFIX_LENGTH);
+ action.setDisabledImageDescriptor(create("d" + type, relPath));
//$NON-NLS-1$
+ action.setImageDescriptor(create("e" + type, relPath)); //$NON-NLS-1$
+
+ }
+
+ /**
+ * Helper method to access the image registry from the CUIPlugin class.
+ */
+ static ImageRegistry getImageRegistry() {
+ return imageRegistry;
+ }
+
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCategoryElement.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,58 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import java.util.ArrayList;
+
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.DeltaCloudInstance;
+
+public class CVCategoryElement extends CloudViewElement {
+
+ public final static int INSTANCES = 0;
+ public final static int IMAGES = 1;
+
+ private int type;
+ private boolean initialized;
+
+ public CVCategoryElement(Object element, String name, int type) {
+ super(element, name);
+ this.type = type;
+ }
+
+ @Override
+ public Object[] getChildren() {
+ if (!initialized) {
+ DeltaCloud cloud = (DeltaCloud)getElement();
+ if (type == INSTANCES) {
+ DeltaCloudInstance[] instances = cloud.getInstances();
+ for (int i = 0; i < instances.length; ++i) {
+ DeltaCloudInstance d = instances[i];
+ CVInstanceElement element = new CVInstanceElement(d, d.getName());
+ addChild(element);
+ }
+ initialized = true;
+ } else if (type == IMAGES) {
+ DeltaCloudImage[] images = cloud.getImages();
+ for (int i = 0; i < images.length; ++i) {
+ DeltaCloudImage d = images[i];
+ CVImageElement element = new CVImageElement(d, d.getName());
+ addChild(element);
+ }
+ initialized = true;
+ }
+ }
+ return super.getChildren();
+ }
+
+ @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/CVCloudElement.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVCloudElement.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,16 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import org.eclipse.ui.views.properties.IPropertySource;
+
+public class CVCloudElement extends CloudViewElement {
+
+ public CVCloudElement(Object element, String name) {
+ super(element, name);
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new CloudPropertySource(getElement());
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVImageElement.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,16 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import org.eclipse.ui.views.properties.IPropertySource;
+
+public class CVImageElement extends CloudViewElement {
+
+ public CVImageElement(Object element, String name) {
+ super(element, name);
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new ImagePropertySource(getElement());
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVInstanceElement.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,16 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import org.eclipse.ui.views.properties.IPropertySource;
+
+public class CVInstanceElement extends CloudViewElement {
+
+ public CVInstanceElement(Object element, String name) {
+ super(element, name);
+ }
+
+ @Override
+ public IPropertySource getPropertySource() {
+ return new InstancePropertySource(getElement());
+ }
+
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,20 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class CVMessages {
+
+ private static final String BUNDLE_NAME = CVMessages.class.getName();
+
+ public static String getString(String key) {
+ try {
+ return ResourceBundle.getBundle(BUNDLE_NAME).getString(key);
+ } catch (MissingResourceException e) {
+ return '!' + key + '!';
+ } catch (NullPointerException e) {
+ return '#' + key + '#';
+ }
+ }
+
+}
Added:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,17 @@
+InstanceCategoryName=Instances
+ImageCategoryName=Images
+CloudViewName=Cloud View
+
+PropertyName.title=Name
+PropertyId.title=Id
+PropertyHostname.title=Hostname
+PropertyState.title=State
+PropertyFlavorId.title=Flavor Id
+PropertyRealmId.title=Realm Id
+PropertyImageId.title=Image Id
+PropertyArch.title=Architecture
+PropertyDescription.title=Description
+PropertyURL.title=URL
+PropertyUsername.title=User
+
+CollapseAll.label=Collapse All
\ No newline at end of file
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVTypeMapper.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,17 @@
+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("unchecked")
+ @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/CloudPropertySource.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudPropertySource.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,77 @@
+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
+
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewContentProvider.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,71 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IViewSite;
+import org.jboss.tools.deltacloud.core.DeltaCloud;
+import org.jboss.tools.deltacloud.core.DeltaCloudManager;
+
+public class CloudViewContentProvider implements ITreeContentProvider {
+
+ private CloudViewElement[] elements;
+ private static final String INSTANCE_CATEGORY_NAME = "InstanceCategoryName";
//$NON-NLS-1$
+ private static final String IMAGE_CATEGORY_NAME = "ImageCategoryName";
//$NON-NLS-1$
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IViewSite)
+ return elements;
+ 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 elements;
+ }
+
+ @Override
+ public void dispose() {
+ // TODO Auto-generated method stub
+
+ }
+
+ private void createElements() {
+ ArrayList<CloudViewElement> list = new ArrayList<CloudViewElement>();
+ DeltaCloudManager m = DeltaCloudManager.getDefault();
+ DeltaCloud[] clouds = m.getClouds();
+ for (int i = 0; i < clouds.length; ++i) {
+ DeltaCloud cloud = clouds[i];
+ CVCloudElement e = new CVCloudElement(cloud, cloud.getName());
+ CVCategoryElement c1 = new CVCategoryElement(cloud,
CVMessages.getString(INSTANCE_CATEGORY_NAME),
+ CVCategoryElement.INSTANCES);
+ CVCategoryElement c2 = new CVCategoryElement(cloud,
CVMessages.getString(IMAGE_CATEGORY_NAME),
+ CVCategoryElement.IMAGES);
+ e.addChild(c1);
+ e.addChild(c2);
+ list.add(e);
+ }
+ elements = list.toArray(new CloudViewElement[list.size()]);
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ createElements();
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewElement.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,61 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+public abstract class CloudViewElement implements IAdaptable {
+
+ private Object element;
+ private CloudViewElement parent;
+ private ArrayList<CloudViewElement> children;
+ private String name;
+
+ public abstract IPropertySource getPropertySource();
+
+ public Object[] getChildren() {
+ return children.toArray();
+ }
+
+ public boolean hasChildren() {
+ return children.size() > 0;
+ }
+
+ public Object getParent() {
+ return parent;
+ }
+
+ public void addChild(CloudViewElement e) {
+ children.add(e);
+ e.setParent(this);
+ }
+
+ public void setParent(CloudViewElement e) {
+ parent = e;
+ }
+
+ public CloudViewElement(Object element, String name) {
+ this.element = element;
+ this.name = name;
+ children = new ArrayList<CloudViewElement>();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Object getElement() {
+ return element;
+ }
+
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ IPropertySource p = getPropertySource();
+ return p;
+ }
+ return null;
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CloudViewLabelProvider.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,29 @@
+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 CVCategoryElement) {
+ 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/DeltaCloudView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,163 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+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.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+import org.jboss.tools.deltacloud.ui.SWTImagesFactory;
+
+
+public class DeltaCloudView extends ViewPart {
+
+ /**
+ * 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";
+
+ private TreeViewer viewer;
+ private Action action1;
+ private Action action2;
+ private Action collapseall;
+ private Action doubleClickAction;
+
+
+ /**
+ * The constructor.
+ */
+ public DeltaCloudView() {
+ }
+
+ /**
+ * This is a callback that will allow us
+ * to create the viewer and initialize it.
+ */
+ public void createPartControl(Composite parent) {
+ viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ viewer.setContentProvider(new CloudViewContentProvider());
+ viewer.setLabelProvider(new CloudViewLabelProvider());
+ viewer.setInput(getViewSite());
+ viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
+ getSite().setSelectionProvider(viewer); // for tabbed properties
+
+ // Create the help context id for the viewer's control
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(),
"org.jboss.tools.deltacloud.ui.viewer");
+ makeActions();
+ hookContextMenu();
+ hookDoubleClickAction();
+ contributeToActionBars();
+ }
+
+ private void hookContextMenu() {
+ MenuManager menuMgr = new MenuManager("#PopupMenu");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ DeltaCloudView.this.fillContextMenu(manager);
+ }
+ });
+ Menu menu = menuMgr.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(menuMgr, viewer);
+ }
+
+ private void contributeToActionBars() {
+ IActionBars bars = getViewSite().getActionBars();
+ fillLocalPullDown(bars.getMenuManager());
+ fillLocalToolBar(bars.getToolBarManager());
+ }
+
+ private void fillLocalPullDown(IMenuManager manager) {
+ manager.add(action1);
+ manager.add(new Separator());
+ manager.add(action2);
+ }
+
+ private void fillContextMenu(IMenuManager manager) {
+ manager.add(action1);
+ manager.add(action2);
+ // Other plug-ins can contribute there actions here
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ private void fillLocalToolBar(IToolBarManager manager) {
+ manager.add(collapseall);
+ }
+
+ private void makeActions() {
+ action1 = new Action() {
+ public void run() {
+ showMessage("Action 1 executed");
+ }
+ };
+ action1.setText("Action 1");
+ action1.setToolTipText("Action 1 tooltip");
+ action1.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+ getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+
+ action2 = new Action() {
+ public void run() {
+ showMessage("Action 2 executed");
+ }
+ };
+ action2.setText("Action 2");
+ action2.setToolTipText("Action 2 tooltip");
+ action2.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+ getImageDescriptor(ISharedImages.IMG_OBJS_INFO_TSK));
+ doubleClickAction = new Action() {
+ public void run() {
+ ISelection selection = viewer.getSelection();
+ Object obj = ((IStructuredSelection)selection).getFirstElement();
+ showMessage("Double-click detected on "+obj.toString());
+ }
+ };
+ 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);
+ }
+
+ private void hookDoubleClickAction() {
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ doubleClickAction.run();
+ }
+ });
+ }
+ private void showMessage(String message) {
+ MessageDialog.openInformation(
+ viewer.getControl().getShell(),
+ CVMessages.getString("CloudViewName"), //$NON-NLS-1$
+ message);
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
+}
\ No newline at end of file
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/ImagePropertySource.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,84 @@
+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() {
+ // 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 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) {
+ // do nothing
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java 2010-07-23
22:11:17 UTC (rev 23719)
@@ -0,0 +1,110 @@
+package org.jboss.tools.deltacloud.ui.views;
+
+import java.util.List;
+
+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.DeltaCloudInstance;
+
+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$
+ private 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_FLAVORID =
"deltacloud.views.instance.flavorid"; //$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_STATE_TITLE = "PropertyState.title";
//$NON-NLS-1$
+ private static final String PROPERTY_HOSTNAME_TITLE =
"PropertyHostname.title"; //$NON-NLS-1$
+ private static final String PROPERTY_FLAVORID_TITLE =
"PropertyFlavorId.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;
+
+ public InstancePropertySource(Object o) {
+ instance = (DeltaCloudInstance)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 idDescriptor = new PropertyDescriptor(PROPERTY_ID,
+ CVMessages.getString(PROPERTY_ID_TITLE));
+ PropertyDescriptor stateDescriptor = new PropertyDescriptor(PROPERTY_STATE,
+ CVMessages.getString(PROPERTY_STATE_TITLE));
+ PropertyDescriptor flavorDescriptor = new PropertyDescriptor(PROPERTY_FLAVORID,
+ CVMessages.getString(PROPERTY_FLAVORID_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));
+
+ propertyDescriptors = new IPropertyDescriptor[] {
+ nameDescriptor,
+ idDescriptor,
+ stateDescriptor,
+ hostnameDescriptor,
+ flavorDescriptor,
+ 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_FLAVORID))
+ return instance.getFlavorId();
+ if (id.equals(PROPERTY_REALMID))
+ return instance.getRealmId();
+ if (id.equals(PROPERTY_IMAGEID))
+ return instance.getImageId();
+ 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;
+ }
+
+ @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
+
+ }
+
+}