java - Is it possible to define a new listener inside a listener? -
i have swt application on eclipse.i want create statement "if x-button not clicked, stuff".
btnprint.addselectionlistener(new selectionadapter() { public void widgetselected(selectionevent e) { //do stuff } });
i know can modify btnprint.addselectionlistener(new selectionadapter() {
part btnprint.addselectionlistener(swt.close, new selectionadapter() {
.but, since there different processes inside widgetselected method, cannot change that. clear, want able create if (x-button not clicked, stuff) inside widgetselected method without modifying addselectionlistener
structure. possible add new listener inside listener different structure?
or how can solve problem?
edit:
updated code follows:
btnprint = new toolitem(customtoolbar, swt.none); btnprint.setimage(resourcemanager.getpluginimage( "com.meta.efatura.view", "icons/actions/print.jpg")); btnprint.settext(messages.get().getvalue("print")); btnprint.addselectionlistener(new selectionadapter() { public void widgetselected(selectionevent e) { //do stuff } });
Comments
Post a Comment