diff --git a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentImplManager.java b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentImplManager.java index 422e468..283613a 100644 --- a/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentImplManager.java +++ b/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/util/ComponentImplManager.java @@ -202,23 +202,24 @@ } public IVirtualComponent createComponent(IProject project) { - IVirtualComponent retVal = null; - // acquire the lock that StructureEdit will need already, to prevent others from locking that before calling createComponent() - see bug 508685 + return createComponent(project, true); + } + + public IVirtualComponent createComponent(IProject project, boolean checkSettings) { ILock lock = EMFWorkbenchEditContextFactory.getProjectLockObject(project); try{ if(null != lock){ lock.acquire(); } - retVal = createComponent(project, true); + return createComponentSynchronously(project, checkSettings); } finally{ if(null != lock){ lock.release(); } } - return retVal; } - public synchronized IVirtualComponent createComponent(IProject project, boolean checkSettings) { + private synchronized IVirtualComponent createComponentSynchronously(IProject project, boolean checkSettings) { try { IVirtualComponent component = ComponentCacheManager.instance().getComponent(project); if(component != null) { @@ -248,11 +249,9 @@ } } IVirtualComponent component = new VirtualComponent(project, new Path("/")); //$NON-NLS-1$ - if(component != null) { - ComponentCacheManager.instance().setComponentImplFactory(project, null); - ComponentCacheManager.instance().setComponent(project, component); - registerListener(project); - } + ComponentCacheManager.instance().setComponentImplFactory(project, null); + ComponentCacheManager.instance().setComponent(project, component); + registerListener(project); return component; }