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..f657ce9 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 @@ -18,6 +18,7 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; + import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.runtime.IConfigurationElement; @@ -202,24 +203,26 @@ } 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 synchronized IVirtualComponent createComponent(IProject project, boolean checkSettings) { ILock lock = EMFWorkbenchEditContextFactory.getProjectLockObject(project); try{ if(null != lock){ lock.acquire(); } - retVal = createComponent(project, true); + return createComponentWithoutLock(project, checkSettings); } finally{ if(null != lock){ lock.release(); } } - return retVal; } - public synchronized IVirtualComponent createComponent(IProject project, boolean checkSettings) { + private IVirtualComponent createComponentWithoutLock(IProject project, boolean checkSettings) { try { + IVirtualComponent component = ComponentCacheManager.instance().getComponent(project); if(component != null) { return component; @@ -248,11 +251,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; }