Reputation: 1391
Let me try and explain what I am talking about better.
Main GUI has a button that when clicked opens Dialog A Dialog A's OK button runs a method in the main GUI
public void widgetSelected(SelectionEvent e) {
baseDialog.startPrintOperation();
}
When the baseDialog.startPrintOperation()
method finishes, I want dialog A to close.
How can I close Dialog A from a method in a different class?
EDIT
Here is the okButton in Dialog A
okButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getPlotterSelection();
getSpinnerValue();
Runnable r = new Runnable() {
public void run() {
baseDialog.startPrintOperation();
}
};
if(Display.getCurrent() != null) {
r.run();
}
else {
Display.getDefault().asyncExec(r);
}
}
});
Here is the section of the printOperation method that needs to close Dialog A. This method is in the MAIN GUI class
finally {
plotOp.removeOperationListener(this);
plotOp = null;
Display.getDefault().asyncExec(new Runnable() {
public void run() {
removeAllTableRows();
plotRequestCompleted = true;
THIS is where I want to close Dialog A;
}
});
}
}
});
session.queueOperation(plotOp);
} // end startPrintOperation()
Upvotes: 0
Views: 1494
Reputation: 3085
Invoke Dialog.public boolean close()
once you finish the print call.
Upvotes: 1