From 78ac2dbfa24b0cca4d0724e9c5a04cba289ec5c3 Mon Sep 17 00:00:00 2001 From: Roger Ferrel Date: Thu, 27 Sep 2012 15:18:07 -0500 Subject: [PATCH] Issue #1196 Changes for ScriptOutputDlg. Change-Id: If2b7bbd6f3a7936cc8d9536553413f3b63e65d11 Former-commit-id: 3620e3a0de65b3fcc0d3001baff617ea9a57172f [formerly b96eb0eafdb8613953f97d5e4e73781153056ed1] [formerly 3620e3a0de65b3fcc0d3001baff617ea9a57172f [formerly b96eb0eafdb8613953f97d5e4e73781153056ed1] [formerly 7696aef2c9f293939d84e3da5f973e0baf82c0be [formerly c8cd5ba07fda1b8f8aa674e71f48967d02f8333a]]] Former-commit-id: 7696aef2c9f293939d84e3da5f973e0baf82c0be Former-commit-id: 1856aa0833c32a6a11de11c9ea3b7c6053228b1a [formerly fcbe86e8ac1e8b8ff3a8e0d6ec79cb1707e84b9a] Former-commit-id: f62a105dd33522578156f640cd922bc7e3527959 --- .../texteditor/dialogs/TextEditorDialog.java | 57 +++++++++++-------- .../scripting/dialogs/ScriptEditorDialog.java | 3 - .../scripting/dialogs/ScriptOutputDlg.java | 3 +- .../viz/warngen/gui/ValidPeriodDialog.java | 1 - 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java index f859d38610..9f9b42a961 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java @@ -291,6 +291,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox; * 20SEP2012 1196 rferrel Refactor dialogs to prevent blocking. * 25SEP2012 1196 lvenable Refactor dialogs to prevent blocking. * 26SEP2012 1196 lvenable Refactor dialogs to prevent blocking. + * 27SEP2012 1196 rferrel Changes for non-blocking ScriptOutputDlg. * * * @author lvenable @@ -5702,38 +5703,48 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, && !scriptsShowOutputItem.isDisposed()) { scriptsShowOutputItem.setSelection(true); } - // create the script output window - if (scriptOutput == null) { - scriptOutput = new ScriptOutputDlg(shell, token); - } + // update the script editor window if (scriptEditor != null) { scriptEditor.setScriptOutputState(true); } - // open the script output window - scriptOutput.open(); - // update the menu following close - if (scriptsShowOutputItem != null - && !scriptsShowOutputItem.isDisposed()) { - scriptsShowOutputItem.setSelection(false); + + // create the script output window + if (scriptOutput == null || !scriptOutput.isDisposed()) { + scriptOutput = new ScriptOutputDlg(shell, token); + // open the script output window + scriptOutput.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + // update the menu following close + if (scriptsShowOutputItem != null + && !scriptsShowOutputItem.isDisposed()) { + scriptsShowOutputItem.setSelection(false); + } + // update script editor window + if (scriptEditor != null) { + scriptEditor.setScriptOutputState(false); + } + scriptOutput = null; + } + }); + scriptOutput.open(); + } else { + scriptOutput.bringToTop(); } - // update script editor window - if (scriptEditor != null) { - scriptEditor.setScriptOutputState(false); - } - scriptOutput = null; } else { if (scriptOutput != null) { scriptOutput.close(); + } else { + if (scriptsShowOutputItem != null + && !scriptsShowOutputItem.isDisposed()) { + scriptsShowOutputItem.setSelection(false); + } + if (scriptEditor != null) { + scriptEditor.setScriptOutputState(false); + } } - if (scriptsShowOutputItem != null - && !scriptsShowOutputItem.isDisposed()) { - scriptsShowOutputItem.setSelection(false); - } - if (scriptEditor != null) { - scriptEditor.setScriptOutputState(false); - } - scriptOutput = null; } } diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptEditorDialog.java index 19229cf332..108728ff7d 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptEditorDialog.java @@ -87,9 +87,6 @@ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { /** the observer to pass to results from a running script */ private final IScriptEditorObserver observer; - /** the script output window */ - ScriptOutputDlg scriptOutput = null; - /** the text editor ID token */ private final String token; diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptOutputDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptOutputDlg.java index db04b76e5a..502a4e6c5b 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptOutputDlg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptOutputDlg.java @@ -43,6 +43,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jun 29, 2009 mfegan Initial creation + * Sep 27, 2012 1196 rferrel No longer blocks. * * * @@ -61,7 +62,7 @@ public class ScriptOutputDlg extends CaveSWTDialog implements SelectionListener */ public ScriptOutputDlg(Shell parent, String token) { super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK); setText(String.format(DLG_TITLE_FMT, token)); } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/ValidPeriodDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/ValidPeriodDialog.java index 07fe75d070..a244394fd3 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/ValidPeriodDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/ValidPeriodDialog.java @@ -378,7 +378,6 @@ public class ValidPeriodDialog extends CaveSWTDialog { @Override protected void disposed() { timer.cancel(); - super.disposed(); } private void calculateDuration() {