From b9d760ac42f32e804dd3ed043015bf1226bde1e2 Mon Sep 17 00:00:00 2001 From: Roger Ferrel Date: Tue, 23 Oct 2012 16:02:27 -0500 Subject: [PATCH] Issue #1287 Changes for non-blocking but modal CopyGridsDialog. Changes from reviewer comments. Change-Id: I743752720d1c770e740912e2d6c3049d516c8183 Former-commit-id: c132e8cc91dd995cbcfdb2f8bf7e0b277aa9856d [formerly 1cac983c4fecb40f6392de97142019a05873bb40] [formerly c132e8cc91dd995cbcfdb2f8bf7e0b277aa9856d [formerly 1cac983c4fecb40f6392de97142019a05873bb40] [formerly e49535d318dfc4539e4e7a0f6d6391e0f97af631 [formerly ced609c6997ae3a4fc51d254218be600d5338ac2]]] Former-commit-id: e49535d318dfc4539e4e7a0f6d6391e0f97af631 Former-commit-id: 084a35d697e02e070e70a007a5e90a14af5161ee [formerly 277c5c1a1d8b9eed3fc7e4fa3397674260b469d6] Former-commit-id: 724ddea4d2bf40e2c4e5978178ec26d18898693f --- .../viz/gfe/actions/ShowCopyGridsDialog.java | 49 ++++++++++++------- .../viz/gfe/dialogs/CopyGridsDialog.java | 3 +- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCopyGridsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCopyGridsDialog.java index afb7617abe..d4678d3cc2 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCopyGridsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCopyGridsDialog.java @@ -38,6 +38,7 @@ import com.raytheon.viz.gfe.dialogs.CopyGridsDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 27, 2008 Eric Babin Initial Creation + * Oct 23, 2012 1287 rferrel Changes for non-blocking CopyGridsDialog. * * * @@ -47,9 +48,16 @@ import com.raytheon.viz.gfe.dialogs.CopyGridsDialog; public class ShowCopyGridsDialog extends AbstractHandler { - private static IUFStatusHandler statusHandler = UFStatus + private IUFStatusHandler statusHandler = UFStatus .getHandler(ShowCopyGridsDialog.class); + /** + * The active dialog. This assumes the dialog is modal. If the dialog is not + * modal then the current logic will bring the active dialog back to the top + * no matter which option is selected. + */ + private CopyGridsDialog dialog; + /* * (non-Javadoc) * @@ -64,27 +72,32 @@ public class ShowCopyGridsDialog extends AbstractHandler { return null; } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - boolean isSelected; - String selectedOrAll = event.getParameter("selectedOrAll"); - if ("selected".equalsIgnoreCase(selectedOrAll)) { - isSelected = true; - } else if ("all".equalsIgnoreCase(selectedOrAll)) { - isSelected = false; + boolean isSelected; + String selectedOrAll = event.getParameter("selectedOrAll"); + if ("selected".equalsIgnoreCase(selectedOrAll)) { + isSelected = true; + } else if ("all".equalsIgnoreCase(selectedOrAll)) { + isSelected = false; + } else { + statusHandler + .error("Invalid parmeter \"" + + selectedOrAll + + "\" in ShowCopyGridsDialog. Value must be \"selected\" or \"all\"."); + dialog = null; + return null; + } + + dialog = new CopyGridsDialog(shell, dm, isSelected); + dialog.setBlockOnOpen(false); + dialog.open(); } else { - statusHandler - .error("Invalid parmeter \"" - + selectedOrAll - + "\" in ShowCopyGridsDialog. Value must be \"selected\" or \"all\"."); - return null; + dialog.bringToTop(); } - CopyGridsDialog dialog = new CopyGridsDialog(shell, dm, isSelected); - dialog.setBlockOnOpen(true); - dialog.open(); - return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CopyGridsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CopyGridsDialog.java index 6f3a8fd575..fa7a0c5bfe 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CopyGridsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CopyGridsDialog.java @@ -46,6 +46,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 26, 2008 Eric Babin Initial Creation + * Oct 23, 2012 1287 rferrel Made dialog modal like AWIPS 1. * * * @@ -70,7 +71,7 @@ public class CopyGridsDialog extends CaveJFACEDialog { super(parent); this.dataManager = dataManager; this.parmMgr = dataManager.getParmManager(); - this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); + this.setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); this.isSelected = isSelectedType; }