Reputation: 1391
This is a much simpler question.
private static AplotBaseDialog dlg;
public Object execute(final ExecutionEvent event) throws ExecutionException {
if (dlg == null){
try {
Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
dlg = new AplotBaseDialog(shell, session);
}
catch {
}
dlg.open();
return null;
}
Ok the above code checks and see if dlg is null. If it is null then create a new dialog. Then it opens the dialog.
This works when dlg is null. But if dlg is not null, I get a error at the line dlg.open(). The error is pointing to this code in the dialog class
@Override
protected Control createContents(Composite parent) {
Control contents = super.createContents(parent); <==== Right Here
setTitle("Title");
setMessage("Message");
if (image != null) {
setTitleImage(image);
}
return contents;
}
So my question is how can I open the dialog when dlg != null?
EDIT Adding some of the error message
line 110 in AplotBaseDialog
Control contents = super.createContents(parent);
line 48 in AplotDialogHandler
dlg.open();
Upvotes: 0
Views: 162
Reputation: 36884
java.lang.IllegalArgumentException: Argument not valid
...
at org.eclipse.swt.widgets.Label.setImage(Label.java:337)
JavaDoc of Label
tells you the following:
IllegalArgumentException -
ERROR_INVALID_ARGUMENT - if the image has been disposed
So, it seems like you already disposed the image you are trying to set.
There are two solutions for this:
Upvotes: 1