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

Changes from reviewer comments.

Change-Id: I743752720d1c770e740912e2d6c3049d516c8183

Former-commit-id: 1c7e9262a4 [formerly c132e8cc91] [formerly 1cac983c4f] [formerly e49535d318 [formerly 1cac983c4f [formerly ced609c6997ae3a4fc51d254218be600d5338ac2]]]
Former-commit-id: e49535d318
Former-commit-id: dba30e4ff57dc4eb8d6e9f8d1b228583fdf8fe7e [formerly 277c5c1a1d]
Former-commit-id: 084a35d697
This commit is contained in:
Roger Ferrel 2012-10-23 16:02:27 -05:00
parent 1f5094e0b3
commit 7c5b618d00
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,27 +72,32 @@ public class ShowCopyGridsDialog extends AbstractHandler {
return null; return null;
} }
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
.getShell(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
boolean isSelected; boolean isSelected;
String selectedOrAll = event.getParameter("selectedOrAll"); String selectedOrAll = event.getParameter("selectedOrAll");
if ("selected".equalsIgnoreCase(selectedOrAll)) { if ("selected".equalsIgnoreCase(selectedOrAll)) {
isSelected = true; isSelected = true;
} else if ("all".equalsIgnoreCase(selectedOrAll)) { } else if ("all".equalsIgnoreCase(selectedOrAll)) {
isSelected = false; 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 { } else {
statusHandler dialog.bringToTop();
.error("Invalid parmeter \""
+ selectedOrAll
+ "\" in ShowCopyGridsDialog. Value must be \"selected\" or \"all\".");
return null;
} }
CopyGridsDialog dialog = new CopyGridsDialog(shell, dm, isSelected);
dialog.setBlockOnOpen(true);
dialog.open();
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;
} }