Issue #1229 Changes for non-blocking SetTimeDialog.

Change-Id: I0a5d497a29b5a6e9e7441e130ce081058e78f4e3

Former-commit-id: 55954ce256 [formerly abd0476b6a] [formerly 40fb3f9729] [formerly 4cd2f1c851 [formerly 40fb3f9729 [formerly 5e4edda802714c236334500a12c2020386770dd2]]]
Former-commit-id: 4cd2f1c851
Former-commit-id: a77c3dafa757a1372691237bce3bc51d14c2aa81 [formerly 7a095d2d99]
Former-commit-id: d51dc93248
This commit is contained in:
Roger Ferrel 2012-10-18 07:36:31 -05:00
parent 2244937369
commit 59b171d6dc
2 changed files with 38 additions and 16 deletions

View file

@ -39,6 +39,7 @@ import com.raytheon.viz.ui.dialogs.SetTimeDialog;
* Aug 23,2012 #1087 dgilling Allow DRT mode to be engaged * Aug 23,2012 #1087 dgilling Allow DRT mode to be engaged
* regardless of practice or * regardless of practice or
* operational mode. * operational mode.
* Oct 17, 2012 1229 rferrel Changes for non-blocking SetTimeDialog.
* *
* </pre> * </pre>
* *
@ -49,9 +50,7 @@ public class ShowTimeDialog extends AbstractHandler {
@Override @Override
public Object execute(ExecutionEvent arg0) throws ExecutionException { public Object execute(ExecutionEvent arg0) throws ExecutionException {
if (!SetTimeDialog.getInstance().isOpen()) { SetTimeDialog.openDialog();
SetTimeDialog.getInstance().open();
}
return null; return null;
} }

View file

@ -53,6 +53,7 @@ import com.raytheon.viz.ui.VizWorkbenchManager;
* Dec 03,2007 461 bphillip Added action functionality * Dec 03,2007 461 bphillip Added action functionality
* May 21, 2008 1122 ebabin Updated to use new StatusBarDisplay. * May 21, 2008 1122 ebabin Updated to use new StatusBarDisplay.
* 09JUL2008 1234 ebabin Updates for color, and display issues. * 09JUL2008 1234 ebabin Updates for color, and display issues.
* Oct 17, 2012 1229 rferrel Made dialog non-blocking.
* *
* </pre> * </pre>
* *
@ -108,16 +109,18 @@ public class SetTimeDialog extends CaveSWTDialog {
private static SetTimeDialog instance; 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() instance = new SetTimeDialog(VizWorkbenchManager.getInstance()
.getCurrentWindow().getShell()); .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 * @param title
* Window title. * Window title.
*/ */
public SetTimeDialog(Shell parent, String title) { private SetTimeDialog(Shell parent) {
super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT
if (title == null) { | CAVE.DO_NOT_BLOCK);
title = "Set Time"; setText("Set Time");
}
setText(title);
} }
/*
* (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 @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
return new GridLayout(1, true); return new GridLayout(1, true);
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
createTopRadioButtons(); createTopRadioButtons();