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 251253
Collapse All | Expand All

(-)src/org/eclipse/wst/common/project/facet/core/internal/FacetedProjectWorkingCopy.java (-29 / +34 lines)
Lines 37-42 Link Here
37
import org.eclipse.core.runtime.Platform;
37
import org.eclipse.core.runtime.Platform;
38
import org.eclipse.core.runtime.Status;
38
import org.eclipse.core.runtime.Status;
39
import org.eclipse.core.runtime.SubMonitor;
39
import org.eclipse.core.runtime.SubMonitor;
40
import org.eclipse.core.runtime.jobs.Job;
40
import org.eclipse.osgi.util.NLS;
41
import org.eclipse.osgi.util.NLS;
41
import org.eclipse.wst.common.project.facet.core.ActionConfig;
42
import org.eclipse.wst.common.project.facet.core.ActionConfig;
42
import org.eclipse.wst.common.project.facet.core.DefaultConfigurationPresetFactory;
43
import org.eclipse.wst.common.project.facet.core.DefaultConfigurationPresetFactory;
Lines 103-108 Link Here
103
     * project that doesn't exist yet, <code>null</code> otherwise.
104
     * project that doesn't exist yet, <code>null</code> otherwise.
104
     */
105
     */
105
    
106
    
107
    private Job runtimesRefreshJob = new Job("runtimesRefreshJob") //$NON-NLS-1$
108
    {
109
        
110
		protected IStatus run(IProgressMonitor monitor) {
111
            // Suspending event notification to make sure that the internal list of
112
            // targetable runtimes is updated before the AVAILABLE_RUNTIMES_CHANGED
113
            // event is received by listeners.
114
            
115
            suspendEventNotification();
116
            
117
            try
118
            {
119
                final IFacetedProjectEvent event
120
                    = new FacetedProjectEvent( FacetedProjectWorkingCopy.this, 
121
                                               IFacetedProjectEvent.Type.AVAILABLE_RUNTIMES_CHANGED );
122
                
123
                notifyListeners( event );
124
                
125
                refreshTargetableRuntimes();
126
            }
127
            finally
128
            {
129
                resumeEventNotification();
130
            }
131
            return Status.OK_STATUS;
132
        }
133
    };
106
    private IPath projectLocation;
134
    private IPath projectLocation;
107
    private IFacetedProject project;
135
    private IFacetedProject project;
108
    private Set<IProjectFacet> fixedFacets;
136
    private Set<IProjectFacet> fixedFacets;
Lines 198-231 Link Here
198
        {
226
        {
199
            public void handle()
227
            public void handle()
200
            {
228
            {
201
                final Thread runtimesRefreshThread = new Thread()
229
                getRuntimesRefreshJob().schedule();
202
                {
203
                    public void run()
204
                    {
205
                        // Suspending event notification to make sure that the internal list of
206
                        // targetable runtimes is updated before the AVAILABLE_RUNTIMES_CHANGED
207
                        // event is received by listeners.
208
                        
209
                        suspendEventNotification();
210
                        
211
                        try
212
                        {
213
                            final IFacetedProjectEvent event
214
                                = new FacetedProjectEvent( FacetedProjectWorkingCopy.this, 
215
                                                           IFacetedProjectEvent.Type.AVAILABLE_RUNTIMES_CHANGED );
216
                            
217
                            notifyListeners( event );
218
                            
219
                            refreshTargetableRuntimes();
220
                        }
221
                        finally
222
                        {
223
                            resumeEventNotification();
224
                        }
225
                    }
226
                };
227
                
228
                runtimesRefreshThread.start();
229
            }
230
            }
230
        };
231
        };
231
        
232
        
Lines 281-287 Link Here
281
                     IFacetedProjectEvent.Type.TARGETED_RUNTIMES_CHANGED );
282
                     IFacetedProjectEvent.Type.TARGETED_RUNTIMES_CHANGED );
282
    }
283
    }
283
    
284
    
284
    public String getProjectName()
285
    protected Job getRuntimesRefreshJob() {
286
		return this.runtimesRefreshJob;
287
	}
288
289
	public String getProjectName()
285
    {
290
    {
286
        synchronized( this.lock )
291
        synchronized( this.lock )
287
        {
292
        {

Return to bug 251253