Author: adietish
Date: 2011-03-16 10:46:42 -0400 (Wed, 16 Mar 2011)
New Revision: 29817
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java
Log:
[JBIDE-8590]
* adding listeners only if they're not added yet
* removing propertyChangeListeners on disposal
* registering listeners for all props only (was: several for each property)
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-03-16 01:34:06
UTC (rev 29816)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/ChangeLog 2011-03-16 14:46:42
UTC (rev 29817)
@@ -1,3 +1,11 @@
+2011-03-16 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
+ (contains):
+ (addPropertyChangeListener):
+ (addPropertyChangeListener):
+ [JBIDE-8590] adding listeners only if they're not added yet
+
2011-03-11 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
* src/org/jboss/tools/deltacloud/core/DeltaCloudInstance.java (performAction):
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java 2011-03-16
01:34:06 UTC (rev 29816)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.core/src/org/jboss/tools/internal/deltacloud/core/observable/ObservablePojo.java 2011-03-16
14:46:42 UTC (rev 29817)
@@ -34,11 +34,15 @@
}
public void addPropertyChangeListener(String propertyName, PropertyChangeListener
listener) {
- propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ if (!contains(listener)) {
+ propertyChangeSupport.addPropertyChangeListener(propertyName, listener);
+ }
}
public void addPropertyChangeListener(PropertyChangeListener listener) {
- propertyChangeSupport.addPropertyChangeListener(listener);
+ if (!contains(listener)) {
+ propertyChangeSupport.addPropertyChangeListener(listener);
+ }
}
public void removePropertyChangeListener(String propertyName, PropertyChangeListener
listener) {
@@ -50,6 +54,17 @@
propertyChangeSupport.removePropertyChangeListener(listener);
}
+ protected boolean contains(PropertyChangeListener listener) {
+ boolean contains = false;
+ for (PropertyChangeListener registeredListener :
propertyChangeSupport.getPropertyChangeListeners()) {
+ if (registeredListener == listener) {
+ contains = true;
+ break;
+ }
+ }
+ return contains;
+ }
+
protected PropertyChangeSupport getPropertyChangeSupport() {
return propertyChangeSupport;
}
Modified: trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog
===================================================================
--- trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-16 01:34:06
UTC (rev 29816)
+++ trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/ChangeLog 2011-03-16 14:46:42
UTC (rev 29817)
@@ -1,3 +1,13 @@
+2011-03-16 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
+
+ * src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java:
+ * src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java:
+ *
src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
+ (dispose):
+ (addPropertyChangeListener):
+ [JBIDE-8590] removing propertyChangeListeners on disposal,
+ registering listeners for all props only (was: several for each property)
+
2011-03-14 André Dietisheim <André Dietisheim@adietisheim-thinkpad>
*
src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java 2011-03-16
01:34:06 UTC (rev 29816)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloud/property/CVPropertySheetPage.java 2011-03-16
14:46:42 UTC (rev 29817)
@@ -33,7 +33,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
Display.getDefault().syncExec(new Runnable() {
-
+
@Override
public void run() {
refresh();
@@ -74,4 +74,8 @@
}
}
+ @Override
+ public void dispose() {
+ removePropertyChangeListener(deltaCloud);
+ }
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-16
01:34:06 UTC (rev 29816)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/AbstractCloudElementTableView.java 2011-03-16
14:46:42 UTC (rev 29817)
@@ -188,6 +188,7 @@
currentCloud = getCloud(currentCloudSelector.getSelectionIndex(), clouds);
addPropertyChangeListener(currentCloud);
+
setViewerInput(currentCloud);
setFilterLabelVisible(currentCloud, filteredLabel);
@@ -431,7 +432,7 @@
protected void addPropertyChangeListener(DeltaCloud cloud) {
if (cloud != null) {
- cloud.addPropertyChangeListener(DeltaCloud.PROP_NAME, this);
+ cloud.addPropertyChangeListener(this);
}
}
@@ -469,6 +470,7 @@
@Override
public void dispose() {
+ removePropertyChangeListener(currentCloud);
getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(workbenchSelectionListener);
DeltaCloudManager.getDefault().removeCloudManagerListener(this);
super.dispose();
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java 2011-03-16
01:34:06 UTC (rev 29816)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/ImageView.java 2011-03-16
14:46:42 UTC (rev 29817)
@@ -56,14 +56,6 @@
}
@Override
- protected void addPropertyChangeListener(DeltaCloud cloud) {
- if (cloud != null) {
- super.addPropertyChangeListener(cloud);
- cloud.addPropertyChangeListener(DeltaCloud.PROP_IMAGES, this);
- }
- }
-
- @Override
protected ICloudElementFilter<DeltaCloudImage> getFilter(DeltaCloud cloud) {
return cloud.getImageFilter();
}
Modified:
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java
===================================================================
---
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java 2011-03-16
01:34:06 UTC (rev 29816)
+++
trunk/deltacloud/plugins/org.jboss.tools.deltacloud.ui/src/org/jboss/tools/deltacloud/ui/views/cloudelements/InstanceView.java 2011-03-16
14:46:42 UTC (rev 29817)
@@ -62,14 +62,6 @@
}
@Override
- protected void addPropertyChangeListener(DeltaCloud cloud) {
- if (cloud != null) {
- super.addPropertyChangeListener(cloud);
- cloud.addPropertyChangeListener(DeltaCloud.PROP_INSTANCES, this);
- }
- }
-
- @Override
protected ICloudElementFilter<DeltaCloudInstance> getFilter(DeltaCloud cloud) {
return cloud.getInstanceFilter();
}