[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: SWTException discussion

Hello,
 
I want to find a place where this control was created using AspectJ like this:
 
 after() returning(Control c): call(Control+.new(..))   {
  ControlRegistry.put(c, new Throwable());
 }
ControlRegistry then contains an information where each control is created.
This information can be acquired from Throwable by calling printStackTrace() method on it.
 
Jan
Hello,
 
You have to know that operation causing SWTException(calling method on disposed widget) is in UI thread is called assynchronously, so there is no way how to find a place where was the cause. This is what I'm trying to solve.
 
The problem is finding of the cause of SWTException.
When there is e.g. attached a listener to Control which is already disposed and in this listener is this Control accessed, them there is trown SWTException from UI thread. And there is no information describing from which Control this Exception was thrown. Things work in a way that when some Control is already disposed but we are trying to call any method on this Control, SWTException is thrown. In order to find a place telling me as a programmer which Control is accessed when is disposed I wanted to use this trick. Basically I have in eclipse breakpoint for SWTException, and when it happens, I want to find a place where is object throwing exception created (meaning java file + line number, which can be acquired from Throwable by printing its stack trace). And what I wanted to call to acquire this information is looking in my map which is in another plugin than SWT UI thread of Eclipse application. And I want to it.
 
I hope its clearer a little bit.
 
 
Jan
"Ed Merks" <merks@xxxxxxxxxx> wrote in message news:fvrtji$ute$1@xxxxxxxxxxxxxxxxx...
Jan,

I don't really understand this problem of not having access to your map.  If you know the ID of the bundle for a class you can use  Platform.getBundle(<bundle-ID>).loadClass(<className>).  But it seems to me if you have code that's doing something, that code would live in your plugin and would not need to use reflection to find a class in your plugin. 


Jan wrote:
Hello,

I wanted to use AspectJ in a way that I remember all instances of Control 
subclass
and also a place where it was created.
Write this information into the Map, and ask for Throwable containing that
contains information about the source code location which caused 
isDisposed() and so on.

BUT THE PROBLEM IS CLASSPATH, from GUI thread I don't have an access to my
map from UI thread context, but I can only access Control subclass there but 
nothing more. :(
It's due to the PLUG-IN system dependencies and classpath visibility. :(
It's a problem for debugging such kind of things.
I would need to change some implementation of bundle loading system
(Equinox) or to have only 1 classloaded for all plugins.


Do you know any trick for solving it?

I also have similar problems with detection of causes of No MORE HANDLES 
ERROR.


Thanks,
Jan

"Ed Merks" <merks@xxxxxxxxxx> wrote in message 
news:fvpqt1$hd$2@xxxxxxxxxxxxxxxxx...
  
Jan,

You print out the full stack trace and look at where the exception was 
thrown.  If you use -consolelog when you launch the application, any 
logged stack traces will be printed in the console and you'll be able to 
click on the stack frames to navigate to the source.


Jan wrote:
    
Hello,

how do you find a cause of SWTException?

I'd like to discuss this topic.

Thanks,
Jan