From 116a5993ec4a58002821818c81b95d978048625b Mon Sep 17 00:00:00 2001 From: Roger Ferrel Date: Thu, 20 Sep 2012 14:45:10 -0500 Subject: [PATCH] Issue #1196 Changes for RemoteSiteRequestDlg. Change-Id: I1ba3b9b4239c8d2a4e44912628013cba48471f40 Former-commit-id: 56c28012a50bb28f705005ce5b1e149cea51f432 [formerly 8f892d7f80cfa84e85a74d0d1496f388d80bb50d] [formerly 56c28012a50bb28f705005ce5b1e149cea51f432 [formerly 8f892d7f80cfa84e85a74d0d1496f388d80bb50d] [formerly 4f0ab091a480be72954465dde6993288e9ef6bb1 [formerly d05224479c8ca8ea9730253785eafb99e64d52da]]] Former-commit-id: 4f0ab091a480be72954465dde6993288e9ef6bb1 Former-commit-id: 7b73a0f166de29b75d51b8977631c96bd6a55e65 [formerly 5fe74144a9d7fc36b4d324e3c2a437e93f794ed1] Former-commit-id: 4d0ef5a4378479f79c9aca470fed60e00fa049c9 --- .../dialogs/RemoteSiteRequestDlg.java | 3 +- .../texteditor/dialogs/TextEditorDialog.java | 42 +++++++++++-------- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java index 0e5f24b74c..3200c03e78 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/RemoteSiteRequestDlg.java @@ -124,7 +124,8 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog implements * Parent shell. */ public RemoteSiteRequestDlg(Shell parent) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("Send Request"); } 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 b8e843f94a..e7c7366f79 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 @@ -180,6 +180,7 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil; import com.raytheon.viz.texteditor.util.VtecObject; import com.raytheon.viz.texteditor.util.VtecUtil; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.dialogs.SWTMessageBox; /** @@ -288,6 +289,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox; * 10Sep2012 15103 M.Gamazaychikov DR15103 -do not clear AFOS command from the text box * when obs are updated and refactored executeCommand * 10SEP2012 15401 D.Friedman Fix QC problem caused by DR 15340. + * 20SEP2012 1196 rferrel Refactor dialogs to prevent blocking. * * * @author lvenable @@ -1447,14 +1449,21 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, public void widgetSelected(SelectionEvent event) { RemoteSiteRequestDlg requestDlg = new RemoteSiteRequestDlg( shell); - if (lastRemoteRetrievalRequest != null) + if (lastRemoteRetrievalRequest != null) { requestDlg.setRequest(lastRemoteRetrievalRequest); - RemoteRetrievalRequest req = (RemoteRetrievalRequest) requestDlg - .open(); - if (req != null) { - lastRemoteRetrievalRequest = req; - sendRemoteRetrievalRequest(req); } + requestDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + RemoteRetrievalRequest req = (RemoteRetrievalRequest) returnValue; + if (req != null) { + lastRemoteRetrievalRequest = req; + sendRemoteRetrievalRequest(req); + } + } + }); + requestDlg.open(); } }); @@ -5245,9 +5254,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, public String getAddressee() { return addressee; } - + public void executeCommand(ICommand command) { - executeCommand(command, false); + executeCommand(command, false); } public void executeCommand(ICommand command, boolean isObsUpdated) { @@ -5355,11 +5364,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, w, siteNode); } /* - * DR15103 - do not clear AFOS command from the text box - * when obs are updated + * DR15103 - do not clear AFOS command from the text box when + * obs are updated */ - if ( !isObsUpdated ) { - clearAfosCmdTF(); + if (!isObsUpdated) { + clearAfosCmdTF(); } clearWmoTF(); clearAwipsIdTF(); @@ -6469,11 +6478,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, @Override public void run() { - /* - * DR15103 - set the flag to 'true' before executing - * AFOS command so the AFOS command box is not cleared - * when obs are updated - */ + /* + * DR15103 - set the flag to 'true' before executing AFOS command so + * the AFOS command box is not cleared when obs are updated + */ executeCommand(command, true); }