I'm currently working with AspectJ the first time to get "my feet wet". I would like to add a new Button on my Main frame (class Main extends JFrame
). This is what I have so far:
public aspect MainWipe {
public static final String Main.wipeText = "Wipe";
public Button Main.wipeButton;
pointcut initAtoms() : execution(void Main.initAtoms());
after() returning() : initAtoms()
{
// Does not work, eclipse error message "wipeButton / wipeText can not be resolved to a variable"
wipeButton = new Button(wipeText);
}
}
The "Static crosscutting" of the String- as well of the Button-field works fine, but i would like to extend my initAtoms
method which is defined in Main with the button's initialization. For this i would have to access the fields defined in the same aspect, which doesn't work for me.
How can I achieve this? Somehow I'm not able to access the String and the Button.
Thanks!
EDIT:
Here is some part of my Main class:
public class Main extends JFrame{
private static final String lineText = "Line";
Button lineButton;
// Removed other methods / fields / controls
public void initAtoms() {
lineButton = new Button(lineText);
}
public void initContentPane() {
toolPanel.add(lineButton);
}
}