diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/alertalarm/AlertAlarmValuesAction.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/alertalarm/AlertAlarmValuesAction.java index ce36915fbb..e9a2f4dc1c 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/alertalarm/AlertAlarmValuesAction.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/alertalarm/AlertAlarmValuesAction.java @@ -36,6 +36,7 @@ import org.eclipse.ui.PlatformUI; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 6/27/07 lvenable Initial creation. + * 12/05/12 1353 rferrel Changes for non-blocking AlertAlarmValuesDlg. * * * @@ -43,13 +44,16 @@ import org.eclipse.ui.PlatformUI; * */ public class AlertAlarmValuesAction extends AbstractHandler { + private AlertAlarmValuesDlg alertAlarmDlg; @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - AlertAlarmValuesDlg alertAlarmDlg = new AlertAlarmValuesDlg(shell); + if (alertAlarmDlg == null) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + alertAlarmDlg = new AlertAlarmValuesDlg(shell); + } alertAlarmDlg.open(); return null; diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/alertalarm/AlertAlarmValuesDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/alertalarm/AlertAlarmValuesDlg.java index f413cada34..8ab3661228 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/alertalarm/AlertAlarmValuesDlg.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/alertalarm/AlertAlarmValuesDlg.java @@ -27,8 +27,8 @@ import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.LOWER_CHECKS import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.ROC_CHECKSTR; import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.UPPER_CHECKSTR; import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.alertAlarmTimeFormat; -import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.dbDatabaseFormat; import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.db2DatabaseFormat; +import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.dbDatabaseFormat; import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.smallerTime; import java.util.ArrayList; @@ -53,6 +53,9 @@ import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; import com.raytheon.uf.viz.core.exception.VizException; @@ -60,7 +63,7 @@ import com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.AaOption; import com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.CheckOption; import com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.TypeOption; import com.raytheon.viz.hydro.timeseries.TimeSeriesDlg; -import com.raytheon.viz.hydro.timeseries.util.*; +import com.raytheon.viz.hydro.timeseries.util.TimeSeriesUtil; import com.raytheon.viz.hydrocommon.HydroConstants; import com.raytheon.viz.hydrocommon.datamanager.IhfsAlertalarmvalData; import com.raytheon.viz.hydrocommon.datamanager.IhfsLocdatalimitsData; @@ -79,6 +82,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * May, 2011 9359 Jingtao Deng Updated queryLocdatalimits(), check locdatalimits table * first, is not existing, check for datalimits table as defaults. * Both not existing, set as MISSING + * Dec 07, 2012 1353 rferrel Make dialog non-blocking. * * * @@ -88,6 +92,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; */ public class AlertAlarmValuesDlg extends CaveSWTDialog implements IhfsAlertalarmvalData, IhfsLocdatalimitsData { + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(AlertAlarmValuesDlg.class); /** * Font used for the data list. @@ -128,6 +134,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements * List containing valid times in database format. */ private java.util.List dataValidTimes = new ArrayList(); + private java.util.List dataBasisTimes = new ArrayList(); /** @@ -194,8 +201,9 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements * Currently selected location ID. */ private String selectedLid; - + private String selectedPe; + private String selectedDur; /** @@ -206,7 +214,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements */ public AlertAlarmValuesDlg(Shell parent) { - super(parent); + super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); setText("Alert and Alarm Data Values"); } @@ -494,19 +502,15 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements if (locationRdo.getSelection()) { if (getType() != TypeOption.FCST) { - myQuery - .append(" order by aav.lid, aav.validtime desc, aav.ts asc, aav.basistime desc"); + myQuery.append(" order by aav.lid, aav.validtime desc, aav.ts asc, aav.basistime desc"); } else { - myQuery - .append(" order by aav.lid, aav.validtime asc, aav.ts asc, aav.basistime desc"); + myQuery.append(" order by aav.lid, aav.validtime asc, aav.ts asc, aav.basistime desc"); } } else { if (getType() != TypeOption.FCST) { - myQuery - .append(" order by aav.validtime desc, aav.lid, aav.basistime desc"); + myQuery.append(" order by aav.validtime desc, aav.lid, aav.basistime desc"); } else { - myQuery - .append(" order by aav.validtime asc, aav.lid, aav.basistime desc"); + myQuery.append(" order by aav.validtime asc, aav.lid, aav.basistime desc"); } } @@ -514,7 +518,6 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements smallerTime.setTimeZone(TimeZone.getTimeZone("UTC")); dbDatabaseFormat.setTimeZone(TimeZone.getTimeZone("UTC")); db2DatabaseFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - try { dataList.removeAll(); @@ -527,7 +530,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements /* * don't bother showing the following fields: probability value, - * shef revision code, action time. If aa_check is not 'roc' or + * shef revision code, action time. If aa_check is not 'roc' or * 'diff', then assign the value of * 'roc' or 'diff' as "--". */ if ((rowData[8].toString().trim().equals("roc")) @@ -553,25 +556,26 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements basisTimeValue = smallerTime.format((Date) rowData[11]); } - String QcSymbol=TimeSeriesUtil.buildQcSymbol(Long.parseLong(rowData[7].toString())); + String QcSymbol = TimeSeriesUtil.buildQcSymbol(Long + .parseLong(rowData[7].toString())); tmpStr = String.format(fmtStr, rowData[0].toString(), rowData[12].toString(), rowData[1].toString(), - rowData[2], rowData[3].toString(), rowData[4] - .toString(), rowData[5], supplValue, - QcSymbol, rowData[8].toString(), rowData[9] - .toString(), smallerTime - .format((Date) rowData[10]), basisTimeValue, - rowData[11].toString()); + rowData[2], rowData[3].toString(), + rowData[4].toString(), rowData[5], supplValue, + QcSymbol, rowData[8].toString(), rowData[9].toString(), + smallerTime.format((Date) rowData[10]), basisTimeValue, + rowData[11].toString()); /* load the list strings. */ dataList.add(tmpStr); dataList.setSelection(0); dataValidTimes.add(dbDatabaseFormat.format((Date) rowData[10])); - dataBasisTimes.add(db2DatabaseFormat.format((Date) rowData[11])); - } + dataBasisTimes + .add(db2DatabaseFormat.format((Date) rowData[11])); + } } catch (VizException e) { - e.printStackTrace(); + statusHandler.handle(Priority.PROBLEM, e.getMessage(), e); } } @@ -632,7 +636,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements } } } catch (VizException e) { - e.printStackTrace(); + statusHandler.handle(Priority.PROBLEM, e.getMessage(), e); } } @@ -641,26 +645,25 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements * Prompts the user to delete the current record */ private void deleteRecord() { - if (dataList.getSelectionIndex() != -1) { - MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK - | SWT.CANCEL); + if (dataList.getSelectionIndex() != -1) { + MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK + | SWT.CANCEL); mb.setText("Delete Confirmation"); mb.setMessage("Do you wish to delete this entry?"); int result = mb.open(); if (result == SWT.OK) { - try{ - deleteAlertalarmvalSelected(dataList.getSelectionIndex()); - queryAlertalarmval(); - } catch (VizException e) { + try { + deleteAlertalarmvalSelected(dataList.getSelectionIndex()); + queryAlertalarmval(); + } catch (VizException e) { MessageBox mbFail = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK); mbFail.setText("Unable to Delete"); mbFail.setMessage("Unable to Delete Record"); mbFail.open(); - - e.printStackTrace(); + statusHandler.handle(Priority.PROBLEM, e.getMessage(), e); } } } else { @@ -670,12 +673,13 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements mb.open(); } } - + // ------------------------------------------------------------ // Delete the selected item in the data list from alertalarmval. // ------------------------------------------------------------ @Override - public void deleteAlertalarmvalSelected(int alertAlarmIndex) throws VizException { + public void deleteAlertalarmvalSelected(int alertAlarmIndex) + throws VizException { // Query 'alertalarmval' table in ihfs database and delete selected item // using SQL. StringBuilder myQuery = new StringBuilder( @@ -696,13 +700,13 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements myQuery.append(selectedLid); myQuery.append("')"); myQuery.append(" AND "); - // String selectedPe = selectedItems[index++]; + // String selectedPe = selectedItems[index++]; selectedPe = selectedItems[index++]; myQuery.append("(aav.pe = '"); myQuery.append(selectedPe); myQuery.append("')"); myQuery.append(" AND "); - // String selectedDur = selectedItems[index++]; + // String selectedDur = selectedItems[index++]; selectedDur = selectedItems[index++]; myQuery.append("(aav.dur = '"); myQuery.append(selectedDur); @@ -738,16 +742,16 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements myQuery.append("(aav.basistime = '"); myQuery.append(basisTimeStr); myQuery.append("')"); - + // ------------------------------------------------------------- // Query the Alertalarmval Table in the IHFS database using SQL. // ------------------------------------------------------------- - + try { - int status = DirectDbQuery.executeStatement(myQuery.toString(), HydroConstants.IHFS, - QueryLanguage.SQL); + DirectDbQuery.executeStatement(myQuery.toString(), + HydroConstants.IHFS, QueryLanguage.SQL); } catch (VizException e) { - e.printStackTrace(); + statusHandler.handle(Priority.PROBLEM, e.getMessage(), e); } } @@ -759,20 +763,21 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements @Override public void queryLocdatalimits() { - //retrieve from location based locdatalimits table - StringBuilder myQuery = new StringBuilder( + // retrieve from location based locdatalimits table + StringBuilder myQuery = new StringBuilder( "select ldl.alert_upper_limit, ldl.alert_lower_limit, ldl.alert_roc_limit, ldl.alert_diff_limit, ldl.alarm_upper_limit, ldl.alarm_lower_limit, ldl.alarm_roc_limit, ldl.alarm_diff_limit from locdatalimits ldl"); ArrayList loclimitData; myQuery.append(" where ldl.lid = '"); myQuery.append(selectedLid); myQuery.append("'"); - + Boolean loclimitsFound = true; Boolean deflimitsFound = true; - - //retrieve from general datalimits table - StringBuilder dlQuery = new StringBuilder("select dl.alert_upper_limit, dl.alert_lower_limit, dl.alert_roc_limit, dl.alert_diff_limit, dl.alarm_upper_limit, dl.alarm_lower_limit, dl.alarm_roc_limit, dl.alarm_diff_limit from datalimits dl"); + + // retrieve from general datalimits table + StringBuilder dlQuery = new StringBuilder( + "select dl.alert_upper_limit, dl.alert_lower_limit, dl.alert_roc_limit, dl.alert_diff_limit, dl.alarm_upper_limit, dl.alarm_lower_limit, dl.alarm_roc_limit, dl.alarm_diff_limit from datalimits dl"); ArrayList dataLimits; dlQuery.append(" where dl.pe = '"); dlQuery.append(selectedPe); @@ -780,49 +785,48 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements dlQuery.append(" and dl.dur = '"); dlQuery.append(selectedDur); dlQuery.append("'"); - - + // ------------------------------------------------------------- // Query the Locdatalimits Table in the IHFS database using SQL. // ------------------------------------------------------------- try { loclimitData = (ArrayList) DirectDbQuery.executeQuery( myQuery.toString(), HydroConstants.IHFS, QueryLanguage.SQL); - - //if location specific range is not found, check the default range*/ - if (loclimitData.size() == 0) - { - loclimitsFound = false; - - try { - dataLimits = (ArrayList) DirectDbQuery.executeQuery( - dlQuery.toString(), HydroConstants.IHFS, QueryLanguage.SQL); - if (dataLimits.size() == 0) - deflimitsFound = false; - else - { - deflimitsFound = true; - for (Object[] rowData : dataLimits) { - setField(alertUpperLbl, (Double) rowData[0]); - setField(alertLowerLbl, (Double) rowData[1]); - setField(alertRocLbl, (Double) rowData[2]); - setField(alertDiffLbl, (Double) rowData[3]); - setField(alarmUpperLbl, (Double) rowData[4]); - setField(alarmLowerLbl, (Double) rowData[5]); - setField(alarmRocLbl, (Double) rowData[6]); - setField(alarmDiffLbl, (Double) rowData[7]); - - return; - } - } - - } catch (VizException e) { - e.printStackTrace(); - } - + // if location specific range is not found, check the default + // range*/ + if (loclimitData.size() == 0) { + loclimitsFound = false; + + try { + dataLimits = (ArrayList) DirectDbQuery + .executeQuery(dlQuery.toString(), + HydroConstants.IHFS, QueryLanguage.SQL); + if (dataLimits.size() == 0) + deflimitsFound = false; + else { + deflimitsFound = true; + for (Object[] rowData : dataLimits) { + setField(alertUpperLbl, (Double) rowData[0]); + setField(alertLowerLbl, (Double) rowData[1]); + setField(alertRocLbl, (Double) rowData[2]); + setField(alertDiffLbl, (Double) rowData[3]); + + setField(alarmUpperLbl, (Double) rowData[4]); + setField(alarmLowerLbl, (Double) rowData[5]); + setField(alarmRocLbl, (Double) rowData[6]); + setField(alarmDiffLbl, (Double) rowData[7]); + + return; + } + } + + } catch (VizException e) { + statusHandler.handle(Priority.PROBLEM, e.getMessage(), e); + } + } - // location specific range is found + // location specific range is found if (loclimitsFound) { for (Object[] rowData : loclimitData) { setField(alertUpperLbl, (Double) rowData[0]); @@ -836,21 +840,21 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements setField(alarmDiffLbl, (Double) rowData[7]); } } - // both location specific range and default range are not found, set to MISSING - else if (!deflimitsFound) - { - alertUpperLbl.setText(" MISSING "); - alertLowerLbl.setText(" MISSING "); - alertRocLbl.setText(" MISSING "); - alertDiffLbl.setText(" MISSING "); + // both location specific range and default range are not found, set + // to MISSING + else if (!deflimitsFound) { + alertUpperLbl.setText(" MISSING "); + alertLowerLbl.setText(" MISSING "); + alertRocLbl.setText(" MISSING "); + alertDiffLbl.setText(" MISSING "); - alarmUpperLbl.setText(" MISSING "); - alarmLowerLbl.setText(" MISSING "); - alarmRocLbl.setText(" MISSING "); - alarmDiffLbl.setText(" MISSING "); + alarmUpperLbl.setText(" MISSING "); + alarmLowerLbl.setText(" MISSING "); + alarmRocLbl.setText(" MISSING "); + alarmDiffLbl.setText(" MISSING "); } } catch (VizException e) { - e.printStackTrace(); + statusHandler.handle(Priority.PROBLEM, e.getMessage(), e); } } @@ -1065,7 +1069,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements deleteBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - deleteRecord(); + deleteRecord(); } }); @@ -1077,7 +1081,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements closeBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - shell.dispose(); + close(); } }); } diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/AppsDefaultsAction.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/AppsDefaultsAction.java index b2a193abf8..9b198d89b4 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/AppsDefaultsAction.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/AppsDefaultsAction.java @@ -35,6 +35,8 @@ import org.eclipse.ui.PlatformUI; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 26, 2011 mpduff Initial creation + * Dec 06, 2012 1353 rferrel Changes for non blocking GetAppsDefaults. + * Changes for non blocking SHEFAppsDefaultsDlg. * * * @@ -43,6 +45,9 @@ import org.eclipse.ui.PlatformUI; */ public class AppsDefaultsAction extends AbstractHandler { + private GetAppsDefaults gad; + + private SHEFAppsDefaultsDlg dlg; /* * (non-Javadoc) @@ -57,11 +62,15 @@ public class AppsDefaultsAction extends AbstractHandler { .getShell(); String action = event.getParameter("Action"); if (action.equals("gad")) { - GetAppsDefaults gad = new GetAppsDefaults(shell); + if (gad == null) { + gad = new GetAppsDefaults(shell); + } gad.open(); } else { - SHEFAppsDefaultsDlg dlg = new SHEFAppsDefaultsDlg(shell); - dlg.open(); + if (dlg == null) { + dlg = new SHEFAppsDefaultsDlg(shell); + } + dlg.open(); } return null; } diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/GetAppsDefaults.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/GetAppsDefaults.java index d4f93291c2..5899735e2f 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/GetAppsDefaults.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/GetAppsDefaults.java @@ -21,7 +21,6 @@ package com.raytheon.viz.hydro.appsdefaults; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Font; @@ -37,20 +36,21 @@ import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; /** - * TODO Add Description + * Dialog to allow user to display desired application defaults. * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Jan 26, 2011            mpduff     Initial creation
- *
+ * Dec 07, 2012 1353       rferrel    Make dialog non-blocking.
+ * 
  * 
- * + * * @author mpduff - * @version 1.0 + * @version 1.0 */ public class GetAppsDefaults extends CaveSWTDialog { @@ -63,17 +63,17 @@ public class GetAppsDefaults extends CaveSWTDialog { * The text area. */ private Text textArea; - + /** * The search text field. */ private Text searchField; - + /** * The search button. */ private Button searchButton; - + private AppsDefaults appsDef = AppsDefaults.getInstance(); /** @@ -83,7 +83,7 @@ public class GetAppsDefaults extends CaveSWTDialog { * Parent shell. */ public GetAppsDefaults(Shell parent) { - super(parent); + super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); setText("GAD"); } @@ -109,15 +109,16 @@ public class GetAppsDefaults extends CaveSWTDialog { textArea.setFont(font); textArea.setEditable(false); textArea.setLayoutData(gd); - textArea.getVerticalBar().setSelection(textArea.getVerticalBar().getMaximum()); - + textArea.getVerticalBar().setSelection( + textArea.getVerticalBar().getMaximum()); + // Initialize search area Composite searchComp = new Composite(shell, SWT.NONE); GridLayout gl = new GridLayout(3, false); searchComp.setLayout(gl); gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); searchComp.setLayoutData(gd); - + gd = new GridData(35, SWT.DEFAULT); gd.widthHint = 175; Label l = new Label(searchComp, SWT.NONE); @@ -127,34 +128,27 @@ public class GetAppsDefaults extends CaveSWTDialog { searchField.setLayoutData(gd); searchField.setEditable(true); searchField.setFocus(); - searchField.addKeyListener(new KeyListener() { - - @Override - public void keyPressed(KeyEvent e) { - - } - + searchField.addKeyListener(new org.eclipse.swt.events.KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if ((e.keyCode == 13) || (e.keyCode == 16777296)) { gad(); } - } - }); + gd = new GridData(35, SWT.DEFAULT); gd.widthHint = 65; searchButton = new Button(searchComp, SWT.NONE); searchButton.setText("Search"); searchButton.setLayoutData(gd); searchButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - gad(); - } + @Override + public void widgetSelected(SelectionEvent event) { + gad(); + } }); - + // Close button Composite centeredComp = new Composite(shell, SWT.NONE); GridLayout gl2 = new GridLayout(1, false); @@ -169,11 +163,11 @@ public class GetAppsDefaults extends CaveSWTDialog { closeBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - shell.dispose(); + close(); } }); } - + private void gad() { String token = searchField.getText(); if ((token != null) && (token.length() > 0)) { diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/SHEFAppsDefaultsDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/SHEFAppsDefaultsDlg.java index fae2f00521..8faa917132 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/SHEFAppsDefaultsDlg.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/appsdefaults/SHEFAppsDefaultsDlg.java @@ -41,6 +41,9 @@ import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.serialization.SerializationUtil; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; /** @@ -53,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 26, 2011 mpduff Initial creation + * Dec 07, 2012 1353 rferrel Make non-blocking dialog. * * * @@ -61,6 +65,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; */ public class SHEFAppsDefaultsDlg extends CaveSWTDialog { + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(SHEFAppsDefaultsDlg.class); + private final String CONFIG_FILE_NAME = "hydro" + File.separatorChar + "shefGadTokens.xml"; @@ -83,7 +90,7 @@ public class SHEFAppsDefaultsDlg extends CaveSWTDialog { * Parent shell. */ public SHEFAppsDefaultsDlg(Shell parent) { - super(parent); + super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); setText("SHEF Apps_defaults Settings"); populateTokenList(); } @@ -166,13 +173,14 @@ public class SHEFAppsDefaultsDlg extends CaveSWTDialog { if (file != null) { configPath = file.getAbsolutePath(); try { - SHEFAppsDefaultsXML xml = (SHEFAppsDefaultsXML) SerializationUtil - .jaxbUnmarshalFromXmlFile(configPath); - for (String token: xml.getTokenList()) { + SHEFAppsDefaultsXML xml = SerializationUtil + .jaxbUnmarshalFromXmlFile(SHEFAppsDefaultsXML.class, + configPath); + for (String token : xml.getTokenList()) { tokenList.add(token); } } catch (SerializationException e) { - e.printStackTrace(); + statusHandler.handle(Priority.PROBLEM, e.getMessage(), e); } } else { MessageBox messageBox = new MessageBox(this.getParent(), SWT.ERROR); @@ -189,9 +197,6 @@ public class SHEFAppsDefaultsDlg extends CaveSWTDialog { */ @Override protected void disposed() { - super.disposed(); - if (font.isDisposed() == false) { - font.dispose(); - } + font.dispose(); } } diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/bestestimateqpe/BestEstimateQpeAction.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/bestestimateqpe/BestEstimateQpeAction.java index 61738a384b..37393eb226 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/bestestimateqpe/BestEstimateQpeAction.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/bestestimateqpe/BestEstimateQpeAction.java @@ -40,6 +40,7 @@ import org.eclipse.ui.PlatformUI; * ------------ ---------- ----------- -------------------------- * 6/27/06 randerso Initial Creation. * 8/24/2009 2258 mpduff Removed not implemented message. + * 12/05/1212 1363 rferrel Changes for non-blocking BestEstimateQpeDlg. * * * @@ -47,12 +48,15 @@ import org.eclipse.ui.PlatformUI; * */ public class BestEstimateQpeAction extends AbstractHandler { + private BestEstimateQpeDlg bestEstimateDlg; @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - BestEstimateQpeDlg bestEstimateDlg = new BestEstimateQpeDlg(shell); + if (bestEstimateDlg == null) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + bestEstimateDlg = new BestEstimateQpeDlg(shell); + } bestEstimateDlg.open(); return null; diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/bestestimateqpe/BestEstimateQpeDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/bestestimateqpe/BestEstimateQpeDlg.java index a68e785e09..f3bc4d98cc 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/bestestimateqpe/BestEstimateQpeDlg.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/bestestimateqpe/BestEstimateQpeDlg.java @@ -46,6 +46,9 @@ import org.eclipse.swt.widgets.Scale; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.drawables.IDescriptor; @@ -67,6 +70,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 29 NOV 2007 373 lvenable Initial creation. * 21 May 2009 mpduff Fixed typo in window title. * 24 Aug 2009 2258 mpduff Implemented dialog functionality. + * 07 Dec 2012 1353 rferrel Make dialog non-blocking. * * * @@ -75,6 +79,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * */ public class BestEstimateQpeDlg extends CaveSWTDialog { + private final IUFStatusHandler statusHandler = UFStatus + .getHandler(BestEstimateQpeDlg.class); /** * QPE source Local radio button. @@ -231,11 +237,6 @@ public class BestEstimateQpeDlg extends CaveSWTDialog { */ private Calendar cal = new GregorianCalendar(); - /** - * Currently looping flag. - */ - private boolean looping = false; - /** * Constructor. * @@ -243,7 +244,7 @@ public class BestEstimateQpeDlg extends CaveSWTDialog { * Parent shell. */ public BestEstimateQpeDlg(Shell parent) { - super(parent); + super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); setText("Display Best Estimate QPE"); cal.setTimeZone(TimeZone.getTimeZone("GMT")); dateTimeFmt.setTimeZone(TimeZone.getTimeZone("GMT")); @@ -711,7 +712,6 @@ public class BestEstimateQpeDlg extends CaveSWTDialog { .getActiveVizContainer(); if (container != null) { container.getLoopProperties().setLooping(false); - looping = false; } } }); @@ -734,7 +734,7 @@ public class BestEstimateQpeDlg extends CaveSWTDialog { closeBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - shell.dispose(); + close(); } }); } @@ -786,10 +786,8 @@ public class BestEstimateQpeDlg extends CaveSWTDialog { displayManager.setLabels(labelsChk.getSelection()); try { displayManager.displayQPE(); - looping = true; } catch (VizException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + statusHandler.handle(Priority.PROBLEM, e.getMessage(), e); } } }