Lines 18-23
Link Here
|
18 |
import java.util.Iterator; |
18 |
import java.util.Iterator; |
19 |
import java.util.Map; |
19 |
import java.util.Map; |
20 |
import java.util.Set; |
20 |
import java.util.Set; |
|
|
21 |
|
21 |
import org.eclipse.core.resources.IProject; |
22 |
import org.eclipse.core.resources.IProject; |
22 |
import org.eclipse.core.resources.IResourceDelta; |
23 |
import org.eclipse.core.resources.IResourceDelta; |
23 |
import org.eclipse.core.runtime.IConfigurationElement; |
24 |
import org.eclipse.core.runtime.IConfigurationElement; |
Lines 202-225
Link Here
|
202 |
} |
203 |
} |
203 |
|
204 |
|
204 |
public IVirtualComponent createComponent(IProject project) { |
205 |
public IVirtualComponent createComponent(IProject project) { |
205 |
IVirtualComponent retVal = null; |
206 |
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 |
207 |
} |
|
|
208 |
|
209 |
public IVirtualComponent createComponent(IProject project, boolean checkSettings) { |
207 |
ILock lock = EMFWorkbenchEditContextFactory.getProjectLockObject(project); |
210 |
ILock lock = EMFWorkbenchEditContextFactory.getProjectLockObject(project); |
208 |
try{ |
211 |
try{ |
209 |
if(null != lock){ |
212 |
if(null != lock){ |
210 |
lock.acquire(); |
213 |
lock.acquire(); |
211 |
} |
214 |
} |
212 |
retVal = createComponent(project, true); |
215 |
return createComponentWithoutLock(project, checkSettings); |
213 |
} finally{ |
216 |
} finally{ |
214 |
if(null != lock){ |
217 |
if(null != lock){ |
215 |
lock.release(); |
218 |
lock.release(); |
216 |
} |
219 |
} |
217 |
} |
220 |
} |
218 |
return retVal; |
|
|
219 |
} |
221 |
} |
220 |
|
222 |
|
221 |
public synchronized IVirtualComponent createComponent(IProject project, boolean checkSettings) { |
223 |
private synchronized IVirtualComponent createComponentWithoutLock(IProject project, boolean checkSettings) { |
222 |
try { |
224 |
try { |
|
|
225 |
|
223 |
IVirtualComponent component = ComponentCacheManager.instance().getComponent(project); |
226 |
IVirtualComponent component = ComponentCacheManager.instance().getComponent(project); |
224 |
if(component != null) { |
227 |
if(component != null) { |
225 |
return component; |
228 |
return component; |
Lines 248-258
Link Here
|
248 |
} |
251 |
} |
249 |
} |
252 |
} |
250 |
IVirtualComponent component = new VirtualComponent(project, new Path("/")); //$NON-NLS-1$ |
253 |
IVirtualComponent component = new VirtualComponent(project, new Path("/")); //$NON-NLS-1$ |
251 |
if(component != null) { |
254 |
ComponentCacheManager.instance().setComponentImplFactory(project, null); |
252 |
ComponentCacheManager.instance().setComponentImplFactory(project, null); |
255 |
ComponentCacheManager.instance().setComponent(project, component); |
253 |
ComponentCacheManager.instance().setComponent(project, component); |
256 |
registerListener(project); |
254 |
registerListener(project); |
|
|
255 |
} |
256 |
|
257 |
|
257 |
return component; |
258 |
return component; |
258 |
} |
259 |
} |