From 59b171d6dcb03a8024bdcd8a400e01eb3d9ac6e8 Mon Sep 17 00:00:00 2001 From: Roger Ferrel Date: Thu, 18 Oct 2012 07:36:31 -0500 Subject: [PATCH] Issue #1229 Changes for non-blocking SetTimeDialog. Change-Id: I0a5d497a29b5a6e9e7441e130ce081058e78f4e3 Former-commit-id: 55954ce256657e1a08d8ebfda82896659ffb7b7f [formerly abd0476b6abdffff1ff0af529ba31ba62e9abc39] [formerly 40fb3f97297dfccd9dc568772fdb57e42a9efcfe] [formerly 4cd2f1c851193ba8252d943e1d323a7bb2f8225c [formerly 40fb3f97297dfccd9dc568772fdb57e42a9efcfe [formerly 5e4edda802714c236334500a12c2020386770dd2]]] Former-commit-id: 4cd2f1c851193ba8252d943e1d323a7bb2f8225c Former-commit-id: a77c3dafa757a1372691237bce3bc51d14c2aa81 [formerly 7a095d2d997c8bd2662303f5bcfd13fd8922447c] Former-commit-id: d51dc932483ccc68486d39a2a68b9d8f9aaf1bad --- .../viz/ui/actions/ShowTimeDialog.java | 5 +- .../viz/ui/dialogs/SetTimeDialog.java | 49 ++++++++++++++----- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ShowTimeDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ShowTimeDialog.java index 970b2930bb..3c0fcc4a9f 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ShowTimeDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ShowTimeDialog.java @@ -39,6 +39,7 @@ import com.raytheon.viz.ui.dialogs.SetTimeDialog; * Aug 23,2012 #1087 dgilling Allow DRT mode to be engaged * regardless of practice or * operational mode. + * Oct 17, 2012 1229 rferrel Changes for non-blocking SetTimeDialog. * * * @@ -49,9 +50,7 @@ public class ShowTimeDialog extends AbstractHandler { @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - if (!SetTimeDialog.getInstance().isOpen()) { - SetTimeDialog.getInstance().open(); - } + SetTimeDialog.openDialog(); return null; } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SetTimeDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SetTimeDialog.java index e52fa2a056..b2855b2207 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SetTimeDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SetTimeDialog.java @@ -53,6 +53,7 @@ import com.raytheon.viz.ui.VizWorkbenchManager; * Dec 03,2007 461 bphillip Added action functionality * May 21, 2008 1122 ebabin Updated to use new StatusBarDisplay. * 09JUL2008 1234 ebabin Updates for color, and display issues. + * Oct 17, 2012 1229 rferrel Made dialog non-blocking. * * * @@ -108,16 +109,18 @@ public class SetTimeDialog extends CaveSWTDialog { private static SetTimeDialog instance; - public static synchronized SetTimeDialog getInstance() { - if (instance == null) { + /** + * This allows only one instance of this dialog to be displayed. + */ + public static synchronized void openDialog() { + if (instance == null || instance.getShell() == null + || instance.isDisposed()) { instance = new SetTimeDialog(VizWorkbenchManager.getInstance() .getCurrentWindow().getShell()); + instance.open(); + } else { + instance.bringToTop(); } - return instance; - } - - public SetTimeDialog(Shell parent) { - this(parent, "Set Time"); } /** @@ -128,19 +131,39 @@ public class SetTimeDialog extends CaveSWTDialog { * @param title * Window title. */ - public SetTimeDialog(Shell parent, String title) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); - if (title == null) { - title = "Set Time"; - } - setText(title); + private SetTimeDialog(Shell parent) { + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); + setText("Set Time"); } + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed() + */ + @Override + protected synchronized void disposed() { + instance = null; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout() + */ @Override protected Layout constructShellLayout() { return new GridLayout(1, true); } + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org + * .eclipse.swt.widgets.Shell) + */ @Override protected void initializeComponents(Shell shell) { createTopRadioButtons();