Bug 340221 - Setting enablement context variable on LibraryInstallDelegate causes refresh, even if no change
diff --git a/plugins/org.eclipse.jst.common.project.facet.core/src/org/eclipse/jst/common/project/facet/core/libprov/LibraryInstallDelegate.java b/plugins/org.eclipse.jst.common.project.facet.core/src/org/eclipse/jst/common/project/facet/core/libprov/LibraryInstallDelegate.java index 2e1a371..3302869 100644 --- a/plugins/org.eclipse.jst.common.project.facet.core/src/org/eclipse/jst/common/project/facet/core/libprov/LibraryInstallDelegate.java +++ b/plugins/org.eclipse.jst.common.project.facet.core/src/org/eclipse/jst/common/project/facet/core/libprov/LibraryInstallDelegate.java
@@ -17,6 +17,7 @@ import static org.eclipse.wst.common.project.facet.core.util.internal.ProgressMonitorUtil.done; import static org.eclipse.wst.common.project.facet.core.util.internal.ProgressMonitorUtil.submon; import static org.eclipse.wst.common.project.facet.core.util.internal.ProgressMonitorUtil.worked; +import static org.eclipse.wst.common.project.facet.core.util.internal.MiscUtil.equal; import java.util.ArrayList; import java.util.Collections; @@ -42,7 +43,6 @@ import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent; import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener; import org.eclipse.wst.common.project.facet.core.util.internal.CollectionsUtil; -import org.eclipse.wst.common.project.facet.core.util.internal.MiscUtil; /** * Used for configuring and then installing a library via the Library Provider Framework. @@ -244,7 +244,7 @@ throw new IllegalArgumentException(); } - if( ! MiscUtil.equal( this.selectedProvider, provider ) ) + if( ! equal( this.selectedProvider, provider ) ) { final ILibraryProvider oldSelectedProvider = this.selectedProvider; @@ -315,16 +315,21 @@ public synchronized void setEnablementContextVariable( final String name, final Object value ) { - if( value == null ) - { - this.customEnablementContextVariables.remove( name ); - } - else - { - this.customEnablementContextVariables.put( name, value ); - } + final Object currentValue = this.customEnablementContextVariables.get( name ); - refresh(); + if( ! equal( currentValue, value ) ) + { + if( value == null ) + { + this.customEnablementContextVariables.remove( name ); + } + else + { + this.customEnablementContextVariables.put( name, value ); + } + + refresh(); + } } /** @@ -430,7 +435,7 @@ notifyListeners( PROP_AVAILABLE_PROVIDERS, oldProviders, this.providersReadOnly ); - if( ! MiscUtil.equal( oldSelectedProvider, this.selectedProvider ) ) + if( ! equal( oldSelectedProvider, this.selectedProvider ) ) { notifyListeners( PROP_SELECTED_PROVIDER, oldSelectedProvider, this.selectedProvider ); }