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
* ------------ ---------- ----------- --------------------------
* Feb 27, 2008 Eric Babin Initial Creation
* Oct 23, 2012 1287 rferrel Changes for non-blocking CopyGridsDialog.
*
* </pre>
*
@ -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;
}

View file

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