Issue #1287 Changes for non-blocking but modal CopyGridsDialog.

Changes from reviewer comments.

Change-Id: I743752720d1c770e740912e2d6c3049d516c8183

Former-commit-id: 1cac983c4f [formerly 1cac983c4f [formerly ced609c6997ae3a4fc51d254218be600d5338ac2]]
Former-commit-id: e49535d318
Former-commit-id: 277c5c1a1d
This commit is contained in:
Roger Ferrel 2012-10-23 16:02:27 -05:00
parent f2303ba0f6
commit 724ddea4d2
2 changed files with 33 additions and 19 deletions

View file

@ -38,6 +38,7 @@ import com.raytheon.viz.gfe.dialogs.CopyGridsDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 27, 2008 Eric Babin Initial Creation * Feb 27, 2008 Eric Babin Initial Creation
* Oct 23, 2012 1287 rferrel Changes for non-blocking CopyGridsDialog.
* *
* </pre> * </pre>
* *
@ -47,9 +48,16 @@ import com.raytheon.viz.gfe.dialogs.CopyGridsDialog;
public class ShowCopyGridsDialog extends AbstractHandler { public class ShowCopyGridsDialog extends AbstractHandler {
private static IUFStatusHandler statusHandler = UFStatus private IUFStatusHandler statusHandler = UFStatus
.getHandler(ShowCopyGridsDialog.class); .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) * (non-Javadoc)
* *
@ -64,6 +72,7 @@ public class ShowCopyGridsDialog extends AbstractHandler {
return null; return null;
} }
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell(); .getShell();
@ -78,12 +87,16 @@ public class ShowCopyGridsDialog extends AbstractHandler {
.error("Invalid parmeter \"" .error("Invalid parmeter \""
+ selectedOrAll + selectedOrAll
+ "\" in ShowCopyGridsDialog. Value must be \"selected\" or \"all\"."); + "\" in ShowCopyGridsDialog. Value must be \"selected\" or \"all\".");
dialog = null;
return null; return null;
} }
CopyGridsDialog dialog = new CopyGridsDialog(shell, dm, isSelected); dialog = new CopyGridsDialog(shell, dm, isSelected);
dialog.setBlockOnOpen(true); dialog.setBlockOnOpen(false);
dialog.open(); dialog.open();
} else {
dialog.bringToTop();
}
return null; return null;
} }

View file

@ -46,6 +46,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Feb 26, 2008 Eric Babin Initial Creation * Feb 26, 2008 Eric Babin Initial Creation
* Oct 23, 2012 1287 rferrel Made dialog modal like AWIPS 1.
* *
* </pre> * </pre>
* *
@ -70,7 +71,7 @@ public class CopyGridsDialog extends CaveJFACEDialog {
super(parent); super(parent);
this.dataManager = dataManager; this.dataManager = dataManager;
this.parmMgr = dataManager.getParmManager(); this.parmMgr = dataManager.getParmManager();
this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); this.setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
this.isSelected = isSelectedType; this.isSelected = isSelectedType;
} }