Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 352887
Collapse All | Expand All

(-)src/org/eclipse/jst/ws/jaxrs/core/internal/project/facet/JAXRSFacetInstallDataModelProvider.java (-15 / +24 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2009, 2010 IBM Corporation and others.
2
 * Copyright (c) 2009, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 15-20 Link Here
15
 * 20100407   308401 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet wizard page - Shared-library option should be disabled
15
 * 20100407   308401 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS facet wizard page - Shared-library option should be disabled
16
 * 20100413   307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect
16
 * 20100413   307552 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS and Java EE 6 setup is incorrect
17
 * 20100519   313576 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS tools- validation problems
17
 * 20100519   313576 ericdp@ca.ibm.com - Eric D. Peters, JAX-RS tools- validation problems
18
 * 20110817   352887 kchong@ca.ibm.com - Keith Chong, [JAXRS] JAXRSFacetInstallDataModelProvider dispose method does not remove all listeners it adds 
18
 *******************************************************************************/
19
 *******************************************************************************/
19
package org.eclipse.jst.ws.jaxrs.core.internal.project.facet;
20
package org.eclipse.jst.ws.jaxrs.core.internal.project.facet;
20
21
Lines 51-56 Link Here
51
52
52
	private String errorMessage;
53
	private String errorMessage;
53
    private LibraryInstallDelegate libraryInstallDelegate = null;
54
    private LibraryInstallDelegate libraryInstallDelegate = null;
55
    private IPropertyChangeListener propertyChangeListener = null;
54
56
55
	@SuppressWarnings("unchecked")
57
	@SuppressWarnings("unchecked")
56
	public Set<String> getPropertyNames() {
58
	public Set<String> getPropertyNames() {
Lines 152-177 Link Here
152
        if( this.libraryInstallDelegate == null && fpjwc != null && fv != null )
154
        if( this.libraryInstallDelegate == null && fpjwc != null && fv != null )
153
        {
155
        {
154
            this.libraryInstallDelegate = new LibraryInstallDelegate( fpjwc, fv );
156
            this.libraryInstallDelegate = new LibraryInstallDelegate( fpjwc, fv );
155
            
157
            this.propertyChangeListener = new IPropertyChangeListener()
156
            this.libraryInstallDelegate.addListener
158
            {
157
            ( 
159
                public void propertyChanged( final String property,
158
                new IPropertyChangeListener()
160
                                             final Object oldValue,
161
                                             final Object newValue )
159
                {
162
                {
160
                    public void propertyChanged( final String property,
163
                    final IDataModel dm = getDataModel();
161
                                                 final Object oldValue,
164
162
                                                 final Object newValue )
165
                    if( dm != null )
163
                    {
166
                    {
164
                        final IDataModel dm = getDataModel();
167
                        dm.notifyPropertyChange( LIBRARY_PROVIDER_DELEGATE, IDataModel.VALUE_CHG );
165
    
166
                        if( dm != null )
167
                        {
168
                            dm.notifyPropertyChange( LIBRARY_PROVIDER_DELEGATE, IDataModel.VALUE_CHG );
169
                        }
170
                    }
168
                    }
171
                }
169
                }
172
            );
170
            };
171
            this.libraryInstallDelegate.addListener(propertyChangeListener);
173
        }
172
        }
174
    }
173
    }
174
    
175
    @SuppressWarnings("restriction")
176
    public void dispose()
177
    {
178
    	if (this.libraryInstallDelegate != null)
179
    	{
180
    	  this.libraryInstallDelegate.removeListener(propertyChangeListener);
181
    	}
182
    	super.dispose(); // empty
183
    }
175
184
176
	private IStatus createErrorStatus(String msg) {
185
	private IStatus createErrorStatus(String msg) {
177
		return new Status(IStatus.ERROR, JAXRSCorePlugin.PLUGIN_ID, msg);
186
		return new Status(IStatus.ERROR, JAXRSCorePlugin.PLUGIN_ID, msg);

Return to bug 352887