summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Trimble2012-09-18 18:51:55 (EDT)
committerIan Trimble2012-09-18 18:51:55 (EDT)
commit8589d656fb69b3855d30343b3439f9a69d2c43a7 (patch)
tree4a382fbf0e029c71450bfe2efbba172b6528c255
parent3d168a9b84e6602ad64d467ef88732d2682bedab (diff)
downloadwebtools.jsf-8589d656fb69b3855d30343b3439f9a69d2c43a7.zip
webtools.jsf-8589d656fb69b3855d30343b3439f9a69d2c43a7.tar.gz
webtools.jsf-8589d656fb69b3855d30343b3439f9a69d2c43a7.tar.bz2
Bug 381441 - [hotbug] JSFFacetInstallDataModelProvider dispose method
does not remove all listeners it adds
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java44
1 files changed, 27 insertions, 17 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java
index 9fc0b6d..3c57b7f 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFFacetInstallDataModelProvider.java
@@ -61,6 +61,7 @@ public class JSFFacetInstallDataModelProvider extends
private final boolean jsfFacetConfigurationEnabled = JsfFacetConfigurationUtil.isJsfFacetConfigurationEnabled();
private LibraryInstallDelegate libraryInstallDelegate = null;
+ private IPropertyChangeListener propertyChangeListener=null;
private void initLibraryInstallDelegate()
{
@@ -70,27 +71,36 @@ public class JSFFacetInstallDataModelProvider extends
if( this.libraryInstallDelegate == null && fpjwc != null && fv != null )
{
this.libraryInstallDelegate = new LibraryInstallDelegate( fpjwc, fv );
+ this.propertyChangeListener=new IPropertyChangeListener()
+ {
+ public void propertyChanged( final String property,
+ final Object oldValue,
+ final Object newValue )
+ {
+ final IDataModel dm = getDataModel();
+
+ if( dm != null )
+ {
+ dm.notifyPropertyChange( LIBRARY_PROVIDER_DELEGATE, IDataModel.VALUE_CHG );
+ }
+ }
+
+ };
- this.libraryInstallDelegate.addListener
- (
- new IPropertyChangeListener()
- {
- public void propertyChanged( final String property,
- final Object oldValue,
- final Object newValue )
- {
- final IDataModel dm = getDataModel();
-
- if( dm != null )
- {
- dm.notifyPropertyChange( LIBRARY_PROVIDER_DELEGATE, IDataModel.VALUE_CHG );
- }
- }
- }
- );
+ this.libraryInstallDelegate.addListener(propertyChangeListener);
}
}
+ public void dispose()
+ {
+ if(this.libraryInstallDelegate!=null)
+ {
+ this.libraryInstallDelegate.removeListener(propertyChangeListener);
+ this.libraryInstallDelegate.dispose();
+ }
+ super.dispose();
+ }
+
private String errorMessage;