Issue #1229 Changes for non-blocking SetTimeDialog.

Change-Id: I0a5d497a29b5a6e9e7441e130ce081058e78f4e3

Former-commit-id: 5e4edda802714c236334500a12c2020386770dd2
This commit is contained in:
Roger Ferrel 2012-10-18 07:36:31 -05:00
parent d319101ed9
commit 4cd2f1c851
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
* regardless of practice or
* operational mode.
* Oct 17, 2012 1229 rferrel Changes for non-blocking SetTimeDialog.
*
* </pre>
*
@ -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;
}

View file

@ -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.
*
* </pre>
*
@ -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();