Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [resources] thread safety - project occassionally programmatically invisible
[resources] thread safety - project occassionally programmatically invisible [message #484027] Thu, 03 September 2009 19:19 Go to previous message
Will Horn is currently offline Will Horn
Messages: 265
Registered: July 2009
Senior Member
I have a unit test where a project is created and opened during the setup:

workspace = ResourcesPlugin.getWorkspace();
workspace.run(new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
workspace.getRoot().delete(true, null);
testProject = workspace.getRoot().getProject("test");
testProject.create(null);
testProject.open(null);
}
}, null);

Later on, there is code that tries to find that project in a ModalContext
thread:

workspace.run(new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
System.out.println(workspace.getRoot().findMember("/test"));
}
}, null);

The result of the above call is unpredictable. Sometimes I get the project
but most every time it is null. Am I doing something unsafe here?

It's baffling me! Thanks for any help,

Will
 
Read Message
Read Message
Read Message
Previous Topic:Re: How to open URL contents in editor.
Next Topic:Dont show a view under Windows->Show View
Goto Forum:
  


Current Time: Tue May 21 07:47:55 EDT 2013

Powered by FUDForum. Page generated in 0.02145 seconds