diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowHistoryList.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowHistoryList.java index 2bd23785f7..62951b3a00 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowHistoryList.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowHistoryList.java @@ -38,6 +38,7 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.HistoryListDlg; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Sep 13, 2007 chammack Initial Creation. + * Oct 16, 2012 1229 rferrel Changes for non-blocking HistoryListDlg. * * * @@ -46,6 +47,8 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.HistoryListDlg; */ public class ShowHistoryList extends AbstractHandler { + private HistoryListDlg dialog; + /* * (non-Javadoc) * @@ -55,9 +58,12 @@ public class ShowHistoryList extends AbstractHandler { */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - HistoryListDlg dlg = new HistoryListDlg( - HandlerUtil.getActiveShell(event)); - dlg.open(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + dialog = new HistoryListDlg(HandlerUtil.getActiveShell(event)); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/ImageBlinkDialog.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/ImageBlinkDialog.java index f49d385070..fad38bdba8 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/ImageBlinkDialog.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/ImageBlinkDialog.java @@ -52,7 +52,7 @@ import com.raytheon.viz.ui.dialogs.colordialog.ColorData; import com.raytheon.viz.ui.dialogs.colordialog.IColorBarAction; /** - * TODO Add Description + * This is a dialog to determine what range of a rendered display should blink. * *
  * 
@@ -60,6 +60,8 @@ import com.raytheon.viz.ui.dialogs.colordialog.IColorBarAction;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Sep 13, 2010            mschenke     Initial creation
+ * Oct 16, 2012 1229       rferrel     Updated to use bringToTop to
+ *                                      activate existing dialog.
  * 
  * 
* @@ -92,18 +94,36 @@ public class ImageBlinkDialog extends CaveSWTDialog implements private static Map, ImageBlinkDialog> dialogMap = new HashMap, ImageBlinkDialog>(); + /** + * If needed creates an instance of this dialog and associates it with the + * resource and opens the dialog or activates the dialog if one already + * exists for the resource. + * + * @param rates + * @param currRate + * @param resource + * @param rscProps + * @param displays + */ public static synchronized void openDialog(float[] rates, float currRate, AbstractVizResource resource, ResourceProperties rscProps, D2DMapRenderableDisplay[] displays) { ImageBlinkDialog dlg = dialogMap.get(resource); - if (dlg == null) { + if (dlg == null || dlg.getShell() == null || dlg.isDisposed()) { dlg = new ImageBlinkDialog(new Shell(Display.getCurrent()), rates, currRate, resource, rscProps, displays); dialogMap.put(resource, dlg); + dlg.open(); + } else { + dlg.bringToTop(); } - dlg.open(); } + /** + * Removes the dialog associated with the resource. + * + * @param resource + */ public static synchronized void removeDialog( AbstractVizResource resource) { dialogMap.remove(resource); @@ -146,10 +166,8 @@ public class ImageBlinkDialog extends CaveSWTDialog implements @Override public void widgetDisposed(DisposeEvent e) { removeDialog(resource); - resource - .unregisterListener((IDisposeListener) ImageBlinkDialog.this); - resource - .unregisterListener((IPaintListener) ImageBlinkDialog.this); + resource.unregisterListener((IDisposeListener) ImageBlinkDialog.this); + resource.unregisterListener((IPaintListener) ImageBlinkDialog.this); } }); Composite mainComp = new Composite(shell, SWT.NONE); @@ -186,9 +204,8 @@ public class ImageBlinkDialog extends CaveSWTDialog implements cbo.add(BlinkToggleAction.NO_BLINK); - cbo - .setText(rate == BlinkToggleAction.NO_BLINK_VALUE ? BlinkToggleAction.NO_BLINK - : "" + rate); + cbo.setText(rate == BlinkToggleAction.NO_BLINK_VALUE ? BlinkToggleAction.NO_BLINK + : "" + rate); cbo.addSelectionListener(new SelectionAdapter() { @Override diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/AlterBundleDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/AlterBundleDlg.java index a2b2ec49b7..ed80b11e6f 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/AlterBundleDlg.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/AlterBundleDlg.java @@ -66,7 +66,8 @@ import com.raytheon.viz.ui.widgets.MenuButton; * trying to perform a load. * Jul 31, 2012 #875 rferrel Use MenuButton to organize entries * in menus. - * Oct 03, 2012 #1248 rferrel Bundle change listners added. + * Oct 03, 2012 #1248 rferrel Bundle change listeners added. + * Oct 16, 2012 #1229 rferrel Made dialog non-blocking. * * * @@ -74,16 +75,16 @@ import com.raytheon.viz.ui.widgets.MenuButton; * @version 1.0 */ public class AlterBundleDlg extends CaveSWTDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(AlterBundleDlg.class); - private static final String Top_MENU_KEY = ""; + private final String Top_MENU_KEY = ""; - private static final String MENU_SEP = IAlterBundleContributor.MENU_SEPARATOR; + private final String MENU_SEP = IAlterBundleContributor.MENU_SEPARATOR; - private static final String MI_SEP = IAlterBundleContributor.MI_SEPARATOR; + private final String MI_SEP = IAlterBundleContributor.MI_SEPARATOR; - private static final int MENU_SEP_LEN = MENU_SEP.length(); + private final int MENU_SEP_LEN = MENU_SEP.length(); private static class AlterBundleEntry { @@ -110,7 +111,7 @@ public class AlterBundleDlg extends CaveSWTDialog { private Map menuButtonMap; protected AlterBundleDlg(Bundle bundle, Shell parentShell) { - super(parentShell); + super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); setText("Alter Bundle on Loading"); this.bundle = bundle; diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/HistoryListDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/HistoryListDlg.java index 9270ef9196..eb1edf11b5 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/HistoryListDlg.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/HistoryListDlg.java @@ -50,10 +50,29 @@ import com.raytheon.viz.ui.UiUtil; import com.raytheon.viz.ui.actions.LoadSerializedXml; import com.raytheon.viz.ui.actions.SaveBundle; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.editor.AbstractEditor; +/** + * Dialog to get user options on history to display. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ *                                     Initial creation
+ * Oct 16, 2012 1229       rferrel     Changes for non-blocking AlterBundleDlg.
+ * Oct 16, 2012 1229       rferrel     Make dialog non-blocking.
+ * 
+ * 
+ * + * @author rferrel + * @version 1.0 + */ public class HistoryListDlg extends CaveSWTDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(HistoryListDlg.class); private List dataList; @@ -72,8 +91,10 @@ public class HistoryListDlg extends CaveSWTDialog { private Button closeBtn; + private AlterBundleDlg alterDlg; + public HistoryListDlg(Shell parent) { - super(parent, SWT.DIALOG_TRIM | SWT.RESIZE); + super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK); setText("History List"); try { @@ -273,7 +294,7 @@ public class HistoryListDlg extends CaveSWTDialog { closeBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - shell.dispose(); + close(); } }); } @@ -284,14 +305,24 @@ public class HistoryListDlg extends CaveSWTDialog { } try { - Bundle b = HistoryList.getInstance().getBundle( - dataList.getSelectionIndex(), false); - AlterBundleDlg dlg = new AlterBundleDlg(b, getParent()); - b = (Bundle) dlg.open(); + if (mustCreate(alterDlg)) { + Bundle b = HistoryList.getInstance().getBundle( + dataList.getSelectionIndex(), false); + alterDlg = new AlterBundleDlg(b, getShell()); + alterDlg.setCloseCallback(new ICloseCallback() { - if (b != null) { - // Load was issued in alterBundleDlg - loadAlterBundle(b); + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Bundle) { + // Load was issued in alterBundleDlg + Bundle b = (Bundle) returnValue; + loadAlterBundle(b); + } + } + }); + alterDlg.open(); + } else { + alterDlg.bringToTop(); } } catch (VizException e) { final String err = "Error altering bundle"; diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java index cd0eae8c30..6323ab2da1 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java @@ -82,6 +82,7 @@ import com.raytheon.viz.ui.HistoryList; import com.raytheon.viz.ui.UiUtil; import com.raytheon.viz.ui.actions.SaveBundle; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.editor.AbstractEditor; /** @@ -89,20 +90,22 @@ import com.raytheon.viz.ui.editor.AbstractEditor; * Dialog for loading or modifying procedures. * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- *
+ *                                     Initial Creation
+ * Oct 16, 2012 1229       rferrel     Changes for non-blocking AlterBundleDlg.
+ * 
  * 
- * + * * @author unknown * @version 1.0 */ public class ProcedureDlg extends CaveSWTDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(ProcedureDlg.class); public static final String ORIGINAL = "Original Location"; @@ -131,9 +134,9 @@ public class ProcedureDlg extends CaveSWTDialog { private Button firstNextBtn; - private static final String FIRST = "First"; + private final String FIRST = "First"; - private static final String NEXT = "Next"; + private final String NEXT = "Next"; private Button loadBtn; @@ -167,6 +170,8 @@ public class ProcedureDlg extends CaveSWTDialog { private final java.util.List bundles; + private AlterBundleDlg alterDlg; + private ProcedureDlg(String fileName, Procedure p, Shell parent) { // Win32 super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL @@ -877,19 +882,34 @@ public class ProcedureDlg extends CaveSWTDialog { return; } try { - BundlePair bp = new BundlePair(); - bp.name = bundles.get(dataList.getSelectionIndex()).name; - bp.xml = bundles.get(dataList.getSelectionIndex()).xml; - Bundle b = Bundle.unmarshalBundle(bp.xml, null); + if (mustCreate(alterDlg)) { + final BundlePair bp = new BundlePair(); + bp.name = bundles.get(dataList.getSelectionIndex()).name; + bp.xml = bundles.get(dataList.getSelectionIndex()).xml; + Bundle b = Bundle.unmarshalBundle(bp.xml, null); - AlterBundleDlg dlg = new AlterBundleDlg(b, getParent()); - b = (Bundle) dlg.open(); + alterDlg = new AlterBundleDlg(b, getShell()); + alterDlg.setCloseCallback(new ICloseCallback() { - if (b != null) { - // Load was issued in alterBundleDlg - bp.xml = b.toXML(); - saveProcedure(); - load(b); + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Bundle) { + Bundle b = (Bundle) returnValue; + try { + // Load was issued in alterBundleDlg + bp.xml = b.toXML(); + saveProcedure(); + load(b); + } catch (VizException e) { + final String err = "Error altering bundle"; + statusHandler.handle(Priority.PROBLEM, err, e); + } + } + } + }); + alterDlg.open(); + } else { + alterDlg.bringToTop(); } } catch (VizException e) { final String err = "Error altering bundle"; @@ -1033,7 +1053,8 @@ public class ProcedureDlg extends CaveSWTDialog { } /** - * Get the ProcedureDlg for the given fileName. If the fileName is null or if there is no open dialog, create a new ProcedureDlg. + * Get the ProcedureDlg for the given fileName. If the fileName is null or + * if there is no open dialog, create a new ProcedureDlg. * * @param fileName * @param p