I am a beginner to swt&Jface by some tutorial ebooks.
what i have read about the Jface action is all coded like :
- Code: Select all
import org.eclipse.jface.action.*;
import org.eclipse.jface.window.*;
public class ExitAction extends Action
{
ApplicationWindow window;
public ExitAction(ApplicationWindow w)
{
window = w;
setText("E&xit");
}
public void run()
{
window.close();
}
}
but all the actions which are generated by Designer seems like:
- Code: Select all
private Action exit;
private void createActions() {
exit = new Action("&Exit") {
public void run() {
System.exit(1);
}
};
}
Though it is a very simple and convenience way to control the action itself . But ,how can make the ACTION control/access other widget component in such a createAction method ? Example, I want to change one Label's text on the shell before the System.exit ??
To declare another reference of the class itself ? And access it's component in a SWT way ?
PS:My english is so poor that I even can not describe my simple question in such a correct sentence.
thanks a lot [/code]