Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Accessing UI Thread
Accessing UI Thread [message #602590] Sun, 18 October 2009 19:00 Go to next message
No real name is currently offline No real nameFriend
Messages: 16
Registered: September 2009
Junior Member
Hello all!
I'm attempting to do an IDocument.replace (..) without getting a SWT access error. I have this code:

///........RunnableStaticDeclaration
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
// TODO Auto-generated method stub
indents = null;
result = doIndentHelper(offset,length,doc,i0,monitor,indents);

}

///......Later on
final RunnableStatic runnable = new RunnableStatic (offset,length,i0,doc);

//calculating indents
Display.getDefault().syncExec(new Runnable () {
public void run() {
result = runnable.start();
}
});

However, I get SWTAccessErrors. It points me out to the doIndentHelper function where I do a doc.replace(...) where doc is an IDocument. True, this error should occur if I wasn't running in a UI threa, but doesn't syncExec run all code which the runnable calls in a UI thread?
Re: Accessing UI Thread [message #602613 is a reply to message #602590] Mon, 19 October 2009 13:21 Go to previous message
No real name is currently offline No real nameFriend
Messages: 16
Registered: September 2009
Junior Member
Oh, and all these are static functions, and a static class for the Runnable class. If anyone needs to see more code and more details to help out, please let me know! Thx!
Previous Topic:Accessing UI Thread
Next Topic:using org.eclipse.search.ui extensions
Goto Forum:
  


Current Time: Fri Apr 19 20:25:44 GMT 2024

Powered by FUDForum. Page generated in 0.02970 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top