Problema class nested [message #73479] |
Fri, 13 March 2009 18:24 |
Hitalo Messages: 4 Registered: July 2009 |
Junior Member |
|
|
public class StandardDrawingView ...{
....
protected void handleMouseEventException(Throwable t) {
JOptionPane.showMessageDialog(
this,
t.getClass().getName() + " - " + t.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE);
t.printStackTrace();
}
public class DrawingViewMouseListener extends MouseAdapter {
/**
* Handles mouse down events. The event is delegated to the
* currently active tool.
*/
public void mousePressed(MouseEvent e) {
try {
//throw Throwable
}
catch (Throwable t) {
handleMouseEventException(t);
}
}
}
...
}
AEW,
the problem is:
my aim is: extract the exception handler to aspect's without changing
the original code of the application. But I'm not able to make this
scenario above. I can not get the reference class StandardDrawingView to
use the method handleMouseEventException (t) in the treatment of exccacao.
Is there any way to do this?
Take the reference class DrawingViewMouseListener is easy, just use TARGET
or THIS. The problem is to take the class most external
StandardDrawingView.
Since already thank ...public class StandardDrawingView ...{
....
protected void handleMouseEventException(Throwable t) {
JOptionPane.showMessageDialog(
this,
t.getClass().getName() + " - " + t.getMessage(),
"Error",
JOptionPane.ERROR_MESSAGE);
t.printStackTrace();
}
public class DrawingViewMouseListener extends MouseAdapter {
/**
* Handles mouse down events. The event is delegated to the
* currently active tool.
*/
public void mousePressed(MouseEvent e) {
try {
//throw Throwable
}
catch (Throwable t) {
handleMouseEventException(t);
}
}
}
...
}
AEW,
the problem is:
my aim is: extract the exception handler to aspect's without changing
the original code of the application. But I'm not able to make this
scenario above. I can not get the reference class StandardDrawingView to
use the method handleMouseEventException (t) in the treatment of exccacao.
Is there any way to do this?
Take the reference class DrawingViewMouseListener is easy, just use TARGET
or THIS. The problem is to take the class most external
StandardDrawingView.
Since already thank ...
|
|
|
Re: Problema class nested [message #73516 is a reply to message #73479] |
Sat, 14 March 2009 17:05 |
Eclipse User |
|
|
|
Originally posted by: andrew.eisenberg.springsource.com
I think what you are trying to do is to advise calls to
handleMouseEventException so that your code will run instead of the regular
code. Assuming this is what you want to do, you can try:
void around (Throwable t) : execution ( protected void
full.package.path.StandardDrawingView. handleMouseEventException(Throwable)
&& args(t) {
// do your stuff
if (condition) {
proceed(t);
}
}
However, I think something else is going on. It looks like you are trying
to weave into a third party library. Make sure that this library is on the
aspect path of your project.
|
|
|
|
Powered by
FUDForum. Page generated in 0.02413 seconds