Author: adietish
Date: 2011-03-16 11:59:52 -0400 (Wed, 16 Mar 2011)
New Revision: 29819
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudElementFilter.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllFieldMatcher.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllImageFilter.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllInstanceFilter.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/FieldMatcher.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageFilter.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceFilter.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/InstanceFilter.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java
Log:
[JBIDE-8323]
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudElementFilter.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudElementFilter.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AbstractCloudElementFilter.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -91,4 +91,9 @@
public IFieldMatcher getIdRule() {
return idRule;
}
+
+ public boolean isFiltering() {
+ return !idRule.isMatchesAll()
+ || !nameRule.isMatchesAll();
+ }
}
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllFieldMatcher.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllFieldMatcher.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllFieldMatcher.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -12,4 +12,8 @@
return "*"; //$NON-NLS-1$
}
+ public boolean isMatchesAll() {
+ return true;
+ }
+
}
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllImageFilter.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllImageFilter.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllImageFilter.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.deltacloud.core;
+import java.util.regex.PatternSyntaxException;
+
/**
* A filter for images that matches on all elements (no criteria checked)
*
@@ -33,7 +35,7 @@
}
@Override
- public void setRules(String ruleString) {
+ public void setRules(String rulesString) throws PatternSyntaxException {
// ignore, never set the rules for this filter
}
@@ -55,6 +57,10 @@
return matcher;
}
+ public boolean isFiltering() {
+ return false;
+ }
+
@Override
public String toString() {
return ALL_STRING;
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllInstanceFilter.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllInstanceFilter.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/AllInstanceFilter.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -1,5 +1,7 @@
package org.jboss.tools.deltacloud.core;
+import java.util.regex.PatternSyntaxException;
+
/**
* A filter for instances that matches on all elements (no criteria checked)
*
@@ -23,10 +25,9 @@
}
@Override
- public void setRules(String ruleString) {
+ public void setRules(String rulesString) throws PatternSyntaxException {
// ignore, never set the rules for this filter
}
-
@Override
public IFieldMatcher getNameRule() {
@@ -63,8 +64,14 @@
return matcher;
}
+ public boolean isFiltering() {
+ return false;
+ }
+
@Override
public String toString() {
return ALL_STRING;
}
+
+
}
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/FieldMatcher.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/FieldMatcher.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/FieldMatcher.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -56,4 +56,8 @@
return rule;
}
+ public boolean isMatchesAll() {
+ return false;
+ }
+
}
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ICloudElementFilter.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -29,12 +29,6 @@
public static final String ALL_MATCHER_EXPRESSION = "*"; //$NON-NLS-1$
- public static final String ALL_STRING =
- ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // name
- + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // id
- + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // arch
- + ALL_MATCHER_EXPRESSION; // desc
-
public Collection<CLOUDELEMENT> filter(CLOUDELEMENT[] cloudElements) throws
DeltaCloudException;
public void setRules(String ruleString);
@@ -42,4 +36,6 @@
public IFieldMatcher getNameRule();
public IFieldMatcher getIdRule();
+
+ public boolean isFiltering();
}
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IFieldMatcher.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -16,5 +16,6 @@
public interface IFieldMatcher {
public boolean matches(String input);
+ public boolean isMatchesAll();
}
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageFilter.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageFilter.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IImageFilter.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -16,6 +16,12 @@
*/
public interface IImageFilter extends ICloudElementFilter<DeltaCloudImage> {
+ public static final String ALL_STRING =
+ ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // name
+ + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // id
+ + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // arch
+ + ALL_MATCHER_EXPRESSION; // desc
+
public IFieldMatcher getArchRule();
public IFieldMatcher getDescRule();
}
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceFilter.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceFilter.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/IInstanceFilter.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -16,6 +16,15 @@
*/
public interface IInstanceFilter extends ICloudElementFilter<DeltaCloudInstance> {
+ public static final String ALL_STRING =
+ ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // name
+ + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // id
+ + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // imageId
+ + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // ownerId
+ + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // keynameId
+ + ALL_MATCHER_EXPRESSION + EXPRESSION_DELIMITER // realm
+ + ALL_MATCHER_EXPRESSION; // profile
+
public IFieldMatcher getImageIdRule();
public IFieldMatcher getOwnerIdRule();
public IFieldMatcher getKeyNameRule();
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/ImageFilter.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -27,6 +27,7 @@
public ImageFilter(DeltaCloud cloud) {
super(cloud);
+ setRules(ALL_STRING);
}
private IFieldMatcher descRule;
@@ -60,4 +61,11 @@
public IFieldMatcher getDescRule() {
return descRule;
}
+
+ public boolean isFiltering() {
+ return super.isFiltering()
+ || !archRule.isMatchesAll()
+ || !descRule.isMatchesAll();
+ }
+
}
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/InstanceFilter.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/InstanceFilter.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/deltacloud/core/InstanceFilter.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -31,6 +31,7 @@
public InstanceFilter(DeltaCloud cloud) {
super(cloud);
+ setRules(ALL_STRING);
}
@Override
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -47,6 +47,7 @@
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.ICloudElementFilter;
import org.jboss.tools.deltacloud.core.IDeltaCloudElement;
import org.jboss.tools.deltacloud.core.IDeltaCloudManagerListener;
import org.jboss.tools.deltacloud.core.IInstanceFilter;
@@ -56,7 +57,7 @@
import org.jboss.tools.deltacloud.ui.views.Columns;
import org.jboss.tools.deltacloud.ui.views.Columns.Column;
import org.jboss.tools.internal.deltacloud.ui.preferences.StringPreferenceValue;
-import org.jboss.tools.internal.deltacloud.ui.utils.UIUtils;
+import org.jboss.tools.internal.deltacloud.ui.utils.WorkbenchUtils;
/**
* A common superclass for viewers that operate on IDeltaCloudElements
@@ -78,10 +79,12 @@
private Combo currentCloudSelector;
private Label currentCloudSelectorLabel;
+ private Label filteredLabel;
+ private Composite container;
private TableViewer viewer;
private DeltaCloud currentCloud;
+
private StringPreferenceValue lastSelectedCloudPref;
- private Composite container;
private ModifyListener currentCloudModifyListener = new ModifyListener() {
@@ -102,6 +105,7 @@
@Override
public void run() {
+ updateFilteredLabel();
setViewerInput(currentCloud);
}
});
@@ -115,7 +119,7 @@
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
// we want to listen to selection changes in the deltacloud view
// only
- DeltaCloud cloud = UIUtils.getFirstAdaptedElement(selection, DeltaCloud.class);
+ DeltaCloud cloud = WorkbenchUtils.getFirstAdaptedElement(selection,
DeltaCloud.class);
if (isNewCloud(cloud)) {
int index = getCloudIndex(cloud, getClouds());
currentCloudSelector.select(index);
@@ -174,9 +178,10 @@
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));
+ this.filteredLabel = new Label(container, SWT.NULL);
+ filteredLabel.setText(CVMessages.getString(FILTERED_LABEL));
+ filteredLabel.setToolTipText(CVMessages.getString(FILTERED_TOOLTIP));
+ updateFilteredLabel();
Composite tableArea = new Composite(container, SWT.NULL);
viewer = createTableViewer(tableArea);
@@ -184,7 +189,7 @@
currentCloud = getCloud(currentCloudSelector.getSelectionIndex(), clouds);
addPropertyChangeListener(currentCloud);
setViewerInput(currentCloud);
- setFilterLabelVisible(currentCloud, filterLabel);
+ setFilterLabelVisible(currentCloud, filteredLabel);
Point p1 = currentCloudSelectorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
Point p2 = currentCloudSelector.computeSize(SWT.DEFAULT, SWT.DEFAULT);
@@ -203,7 +208,7 @@
f = new FormData();
f.top = new FormAttachment(0, 5 + centering);
f.right = new FormAttachment(100, -10);
- filterLabel.setLayoutData(f);
+ filteredLabel.setLayoutData(f);
f = new FormData();
f.top = new FormAttachment(currentCloudSelector, 8);
@@ -224,20 +229,17 @@
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);
+ 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<CLOUDELEMENT> provider =
getContentAndLabelProvider();
viewer.setContentProvider(provider);
viewer.setLabelProvider(provider);
- createColumns(provider, tableLayout, table);
-
+ createColumns(provider.getColumns(), tableLayout, table);
viewer.setComparator(new TableViewerColumnComparator());
table.setSortDirection(SWT.NONE);
-
return viewer;
}
@@ -296,7 +298,7 @@
}
IInstanceFilter filter = currentCloud.getInstanceFilter();
- filterLabel.setVisible(!filter.toString().equals(IInstanceFilter.ALL_STRING));
+ filterLabel.setVisible(!filter.isFiltering());
}
private DeltaCloud getCloud(int cloudIndex, DeltaCloud[] clouds) {
@@ -307,18 +309,16 @@
return clouds[cloudIndex];
}
- private void createColumns(ITableContentAndLabelProvider<CLOUDELEMENT> provider,
TableColumnLayout tableLayout,
- Table table) {
- Columns<CLOUDELEMENT> columns = provider.getColumns();
-
+ private void createColumns(Columns<CLOUDELEMENT> columns, TableColumnLayout
tableLayout, Table table) {
for (int i = 0; i < columns.getSize(); ++i) {
Column<CLOUDELEMENT> c = columns.getColumn(i);
TableColumn tc = new TableColumn(table, SWT.NONE);
if (i == 0) {
table.setSortColumn(tc);
}
- tc.setText(CVMessages.getString(c.getName()));
tableLayout.setColumnData(tc, new ColumnWeightData(c.getWeight(), true));
+ tc.setText(c.getName());
+ tc.setMoveable(true);
tc.addSelectionListener(new ColumnListener(i));
}
}
@@ -340,8 +340,8 @@
}
private void hookContextMenu(Control control) {
- IMenuManager contextMenu = UIUtils.createContextMenu(control);
- UIUtils.registerContributionManager(UIUtils.getContextMenuId(getViewID()), contextMenu,
control);
+ IMenuManager contextMenu = WorkbenchUtils.createContextMenu(control);
+ WorkbenchUtils.registerContributionManager(WorkbenchUtils.getContextMenuId(getViewID()),
contextMenu, control);
}
protected abstract String getViewID();
@@ -366,7 +366,7 @@
DeltaCloud[] clouds = getClouds();
final int index = getCloudIndex(cloud, clouds);
Display.getDefault().syncExec(new Runnable() {
-
+
@Override
public void run() {
if (index >= 0) {
@@ -382,8 +382,9 @@
currentCloudSelector.addModifyListener(currentCloudModifyListener);
}
container.layout(true, true);
+
}
-
+
private String[] getSelectorItems(final DeltaCloud cloud, final int index) {
List<String> names = new
ArrayList<String>(Arrays.asList(currentCloudSelector.getItems()));
names.set(index, cloud.getName());
@@ -481,4 +482,21 @@
return super.getAdapter(adapter);
}
}
+
+ protected void updateFilteredLabel() {
+ filteredLabel.getDisplay().syncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ boolean visible = false;
+ if (currentCloud != null) {
+ ICloudElementFilter<CLOUDELEMENT> filter = getFilter(currentCloud);
+ visible = filter.isFiltering();
+ }
+ filteredLabel.setVisible(visible);
+ }
+ });
+ }
+
+ protected abstract ICloudElementFilter<CLOUDELEMENT> getFilter(DeltaCloud cloud);
}
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -10,8 +10,11 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.ui.views.cloudelements;
+import java.beans.PropertyChangeEvent;
+
import org.jboss.tools.deltacloud.core.DeltaCloud;
import org.jboss.tools.deltacloud.core.DeltaCloudImage;
+import org.jboss.tools.deltacloud.core.ICloudElementFilter;
import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
/**
@@ -45,10 +48,15 @@
}
@Override
- protected void addPropertyChangeListener(DeltaCloud cloud) {
- if (cloud != null) {
- super.addPropertyChangeListener(cloud);
- cloud.addPropertyChangeListener(DeltaCloud.PROP_IMAGES, this);
+ public void propertyChange(PropertyChangeEvent event) {
+ super.propertyChange(event);
+ if (DeltaCloud.PROP_IMAGES.equals(event.getPropertyName())) {
+ updateFilteredLabel();
}
}
+
+ @Override
+ protected ICloudElementFilter<DeltaCloudImage> getFilter(DeltaCloud cloud) {
+ return cloud.getImageFilter();
+ }
}
Modified:
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java
===================================================================
---
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java 2011-03-16
15:11:23 UTC (rev 29818)
+++
branches/jbosstools-3.2.x/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java 2011-03-16
15:59:52 UTC (rev 29819)
@@ -10,10 +10,13 @@
*******************************************************************************/
package org.jboss.tools.deltacloud.ui.views.cloudelements;
+import java.beans.PropertyChangeEvent;
+
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.core.ICloudElementFilter;
import org.jboss.tools.deltacloud.ui.IDeltaCloudPreferenceConstants;
/**
@@ -57,4 +60,18 @@
cloud.addPropertyChangeListener(DeltaCloud.PROP_INSTANCES, this);
}
}
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ super.propertyChange(event);
+ if (DeltaCloud.PROP_INSTANCES.equals(event.getPropertyName())) {
+ updateFilteredLabel();
+ }
+ }
+
+ @Override
+ protected ICloudElementFilter<DeltaCloudInstance> getFilter(DeltaCloud cloud) {
+ return cloud.getInstanceFilter();
+ }
+
}