Author: jjohnstn
Date: 2010-08-17 18:57:49 -0400 (Tue, 17 Aug 2010)
New Revision: 24230
Added:
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
Modified:
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/views/CVMessages.properties
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/InstancePropertySource.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java
Log:
2010-08-17 Jeff Johnston <jjohnstn(a)redhat.com>
* src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java: New file.
* plugin.xml: Change the PropertySection class for the Advanced Tab to point to
the new CVPropertySection class.
* src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties: Add message for owner
id property.
* src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java (getAdapter): New override
to hijack the PropertySheetPage.
(getContributorId): Required for an ITabbedPropertySheetPageContributor.
* src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java (getPropertyValue):
Add
support for owner id.
(getPropertyDescriptors): Add owner id.
* src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (fillContextMenu): Add all
possible
actions and only enable the ones supported by the selected instance.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-08-17 22:40:38
UTC (rev 24229)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2010-08-17 22:57:49
UTC (rev 24230)
@@ -1,5 +1,23 @@
2010-08-17 Jeff Johnston <jjohnstn(a)redhat.com>
+ * src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java: New file.
+ * src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java: New file.
+ * plugin.xml: Change the PropertySection class for the Advanced Tab to point to
+ the new CVPropertySection class.
+ * src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties: Add message for owner
+ id property.
+ * src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java (getAdapter): New
override
+ to hijack the PropertySheetPage.
+ (getContributorId): Required for an ITabbedPropertySheetPageContributor.
+ * src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java
(getPropertyValue): Add
+ support for owner id.
+ (getPropertyDescriptors): Add owner id.
+ * src/org/jboss/tools/deltacloud/ui/views/InstanceView.java (fillContextMenu): Add all
possible
+ actions and only enable the ones supported by the selected instance.
+
+2010-08-17 Jeff Johnston <jjohnstn(a)redhat.com>
+
* src/org/jboss/tools/deltacloud/ui/views/ImageComparator.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/ImageView.java: New file.
* src/org/jboss/tools/deltacloud/ui/views/ImageViewLabelAndContentProvider.java: New
file.
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-08-17 22:40:38
UTC (rev 24229)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/plugin.xml 2010-08-17 22:57:49
UTC (rev 24230)
@@ -62,7 +62,7 @@
<propertySections
contributorId="org.jboss.tools.deltacloud.ui.views.CloudView">
<propertySection
-
class="org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection"
+ class="org.jboss.tools.deltacloud.ui.views.CVPropertySection"
id="org.jboss.tools.deltacloud.ui.propertySection.advanced"
tab="cloudview.advancedTab">
<input
Modified:
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 2010-08-17
22:40:38 UTC (rev 24229)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVMessages.properties 2010-08-17
22:57:49 UTC (rev 24230)
@@ -4,6 +4,7 @@
PropertyName.title=Name
PropertyId.title=Id
+PropertyOwnerId.title=Owner Id
PropertyHostname.title=Hostname
PropertyState.title=State
PropertyProfileId.title=Hardware Profile
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySection.java 2010-08-17
22:57:49 UTC (rev 24230)
@@ -0,0 +1,84 @@
+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;
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetNonSorter.java 2010-08-17
22:57:49 UTC (rev 24230)
@@ -0,0 +1,12 @@
+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
+ }
+
+}
Added:
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
(rev 0)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/CVPropertySheetPage.java 2010-08-17
22:57:49 UTC (rev 24230)
@@ -0,0 +1,12 @@
+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());
+ }
+
+}
Modified:
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-08-17
22:40:38 UTC (rev 24229)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/DeltaCloudView.java 2010-08-17
22:57:49 UTC (rev 24230)
@@ -25,6 +25,9 @@
import org.eclipse.ui.IWorkbenchActionConstants;
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.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
import org.jboss.tools.deltacloud.core.DeltaCloudManager;
@@ -33,7 +36,8 @@
import org.jboss.tools.internal.deltacloud.ui.wizards.NewInstance;
-public class DeltaCloudView extends ViewPart implements ICloudManagerListener {
+public class DeltaCloudView extends ViewPart implements ICloudManagerListener,
+ITabbedPropertySheetPageContributor {
/**
* The ID of the view as specified by the extension.
@@ -237,4 +241,18 @@
public void changeEvent(int type) {
viewer.setInput(new CVRootElement(viewer));
}
+
+ @Override
+ public String getContributorId() {
+ return getSite().getId();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(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
Modified:
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-08-17
22:40:38 UTC (rev 24229)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstancePropertySource.java 2010-08-17
22:57:49 UTC (rev 24230)
@@ -11,6 +11,7 @@
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_PROFILEID =
"deltacloud.views.instance.profileid"; //$NON-NLS-1$
@@ -18,6 +19,7 @@
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_PROFILEID_TITLE =
"PropertyProfileId.title"; //$NON-NLS-1$
@@ -43,6 +45,8 @@
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,
@@ -57,6 +61,7 @@
propertyDescriptors = new IPropertyDescriptor[] {
nameDescriptor,
idDescriptor,
+ ownerDescriptor,
stateDescriptor,
hostnameDescriptor,
hardwareDescriptor,
@@ -73,6 +78,8 @@
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))
Modified:
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-08-17
22:40:38 UTC (rev 24229)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/InstanceView.java 2010-08-17
22:57:49 UTC (rev 24230)
@@ -272,8 +272,17 @@
private void fillContextMenu(IMenuManager manager) {
List<String> actions = selectedElement.getActions();
+ manager.add(instanceActions.get(DeltaCloudInstance.START));
+ instanceActions.get(DeltaCloudInstance.START).setEnabled(false);
+ manager.add(instanceActions.get(DeltaCloudInstance.STOP));
+ instanceActions.get(DeltaCloudInstance.STOP).setEnabled(false);
+ manager.add(instanceActions.get(DeltaCloudInstance.REBOOT));
+ instanceActions.get(DeltaCloudInstance.REBOOT).setEnabled(false);
+ manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
+ manager.add(instanceActions.get(DeltaCloudInstance.DESTROY));
+ instanceActions.get(DeltaCloudInstance.DESTROY).setEnabled(false);
for (String action : actions) {
- manager.add(instanceActions.get(action));
+ instanceActions.get(action).setEnabled(true);
}
// Other plug-ins can contribute there actions here
manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));