View | Details | Raw Unified | Return to bug 511793 | Differences between
and this patch

Collapse All | Expand All

(-)a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentImplManager.java (-10 / +9 lines)
Lines 202-224 Link Here
202
	}
202
	}
203
203
204
	public IVirtualComponent createComponent(IProject project) {
204
	public IVirtualComponent createComponent(IProject project) {
205
		IVirtualComponent retVal = null;
205
		return createComponent(project, true);
206
		// acquire the lock that StructureEdit will need already, to prevent others from locking that before calling createComponent() - see bug 508685
206
	}
207
208
	public IVirtualComponent createComponent(IProject project, boolean checkSettings) {
207
		ILock lock = EMFWorkbenchEditContextFactory.getProjectLockObject(project);
209
		ILock lock = EMFWorkbenchEditContextFactory.getProjectLockObject(project);
208
		try{
210
		try{
209
			if(null != lock){
211
			if(null != lock){
210
				lock.acquire();
212
				lock.acquire();
211
			}
213
			}
212
			retVal = createComponent(project, true);
214
			return createComponentSynchronously(project, checkSettings);
213
		} finally{
215
		} finally{
214
			if(null != lock){
216
			if(null != lock){
215
				lock.release();
217
				lock.release();
216
			}
218
			}
217
		}
219
		}
218
		return retVal;
219
	}
220
	}
220
221
221
	public synchronized IVirtualComponent createComponent(IProject project, boolean checkSettings) {
222
	private synchronized IVirtualComponent createComponentSynchronously(IProject project, boolean checkSettings) {
222
		try {
223
		try {
223
			IVirtualComponent component = ComponentCacheManager.instance().getComponent(project);
224
			IVirtualComponent component = ComponentCacheManager.instance().getComponent(project);
224
			if(component != null) {
225
			if(component != null) {
Lines 248-258 Link Here
248
			}
249
			}
249
		}
250
		}
250
		IVirtualComponent component = new VirtualComponent(project, new Path("/")); //$NON-NLS-1$
251
		IVirtualComponent component = new VirtualComponent(project, new Path("/")); //$NON-NLS-1$
251
		if(component != null) {
252
		ComponentCacheManager.instance().setComponentImplFactory(project, null);
252
			ComponentCacheManager.instance().setComponentImplFactory(project, null);
253
		ComponentCacheManager.instance().setComponent(project, component);
253
			ComponentCacheManager.instance().setComponent(project, component);
254
		registerListener(project);
254
			registerListener(project);
255
		}
256
255
257
		return component;
256
		return component;
258
	}
257
	}

Return to bug 511793