diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/AlarmAlertDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/AlarmAlertDlg.java index 0504a7b385..833a0aa8a2 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/AlarmAlertDlg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/AlarmAlertDlg.java @@ -373,21 +373,27 @@ public class AlarmAlertDlg extends CaveSWTDialog { } proximityAlarmDlg = new NewAlarmDlg(shell, "ALARM", new AlarmAlertProduct(isOperationalMode())); - AlarmAlertProduct prod = (AlarmAlertProduct) proximityAlarmDlg - .open(); - if (proximityAlarmDlg.haveOkEvent()) { - aapList.add(prod); - String string = ""; - if (prod.isAlarm()) { - string += " (Alarm)"; + proximityAlarmDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + AlarmAlertProduct prod = (AlarmAlertProduct) returnValue; + if (proximityAlarmDlg.haveOkEvent()) { + aapList.add(prod); + String string = ""; + if (prod.isAlarm()) { + string += " (Alarm)"; + } + if (!"".equals(prod.getSearchString())) { + string += " containing \"" + + prod.getSearchString() + "\""; + } + aaList.add(prod.getProductId() + string); + changeSaveState(true); + } } - if (!"".equals(prod.getSearchString())) { - string += " containing \"" + prod.getSearchString() - + "\""; - } - aaList.add(prod.getProductId() + string); - changeSaveState(true); - } + }); + proximityAlarmDlg.open(); } }); @@ -403,16 +409,24 @@ public class AlarmAlertDlg extends CaveSWTDialog { proximityAlarmDlg = new NewAlarmDlg(shell, "PROXIMITY", new AlarmAlertProduct(isOperationalMode())); - AlarmAlertProduct prod = (AlarmAlertProduct) proximityAlarmDlg - .open(); - if (proximityAlarmDlg.haveOkEvent()) { - prod.setOperationalMode(isOperationalMode()); - papList.add(prod); - paList.add(prod.getProductId() + " " + prod.getAlarmType() - + " " + prod.getActionCmd() + " " - + AlarmAlertFunctions.buildDistance(prod)); - changeSaveState(true); - } + proximityAlarmDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + AlarmAlertProduct prod = (AlarmAlertProduct) returnValue; + if (proximityAlarmDlg.haveOkEvent()) { + prod.setOperationalMode(isOperationalMode()); + papList.add(prod); + paList.add(prod.getProductId() + " " + + prod.getAlarmType() + " " + + prod.getActionCmd() + " " + + AlarmAlertFunctions.buildDistance(prod)); + changeSaveState(true); + } + } + }); + + proximityAlarmDlg.open(); } }); @@ -429,48 +443,64 @@ public class AlarmAlertDlg extends CaveSWTDialog { } if (aaList.getSelectionIndex() != -1) { // User might change selection while dialog is displayed. - int index = aaList.getSelectionIndex(); + final int index = aaList.getSelectionIndex(); proximityAlarmDlg = new NewAlarmDlg(shell, "ALARM", aapList .get(index - 1)); - AlarmAlertProduct prod = aapList.set(index - 1, - (AlarmAlertProduct) proximityAlarmDlg.open()); - if (proximityAlarmDlg.haveOkEvent()) { - String string = ""; - if (prod.isAlarm()) { - string += " (Alarm)"; + proximityAlarmDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + AlarmAlertProduct prod = (AlarmAlertProduct) returnValue; + prod = aapList.set(index - 1, prod); + if (proximityAlarmDlg.haveOkEvent()) { + String string = ""; + if (prod.isAlarm()) { + string += " (Alarm)"; + } + if (!"".equals(prod.getSearchString())) { + string += " \"" + prod.getSearchString() + + "\""; + } + aaList.setItem(index, prod.getProductId() + + string); + paList.deselectAll(); + aaList.select(index); + aaList.showSelection(); + changeSaveState(true); + } } - if (!"".equals(prod.getSearchString())) { - string += " \"" + prod.getSearchString() + "\""; - } - aaList.setItem(index, prod.getProductId() + string); - paList.deselectAll(); - aaList.select(index); - aaList.showSelection(); - changeSaveState(true); - } + }); + proximityAlarmDlg.open(); } else if (paList.getSelectionIndex() != -1) { // User might change selection while dialog is displayed. - int index = paList.getSelectionIndex(); + final int index = paList.getSelectionIndex(); proximityAlarmDlg = new NewAlarmDlg(shell, "PROXIMITY", papList.get(index - 1)); - AlarmAlertProduct prod = papList.set(index - 1, - (AlarmAlertProduct) proximityAlarmDlg.open()); - if (proximityAlarmDlg.haveOkEvent()) { - paList.setItem( - paList.getSelectionIndex(), - prod.getProductId() - + " " - + prod.getAlarmType() - + " " - + prod.getActionCmd() - + " " - + AlarmAlertFunctions - .buildDistance(prod)); - aaList.deselectAll(); - paList.select(index); - paList.showSelection(); - changeSaveState(true); - } + proximityAlarmDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + AlarmAlertProduct prod = (AlarmAlertProduct) returnValue; + prod = papList.set(index - 1, prod); + if (proximityAlarmDlg.haveOkEvent()) { + paList.setItem( + paList.getSelectionIndex(), + prod.getProductId() + + " " + + prod.getAlarmType() + + " " + + prod.getActionCmd() + + " " + + AlarmAlertFunctions + .buildDistance(prod)); + aaList.deselectAll(); + paList.select(index); + paList.showSelection(); + changeSaveState(true); + } + } + }); + proximityAlarmDlg.open(); } } }); diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/NewAlarmDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/NewAlarmDlg.java index 6712202717..749ece219b 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/NewAlarmDlg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/alarmalert/dialogs/NewAlarmDlg.java @@ -55,6 +55,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Sep 10, 2009 mnash Initial creation * Jun 08, 2010 5851 cjeanbap Properly stop alarm/alert observer listener; shellComp is null. * Oct 31, 2011 8510 rferrel made PRIMARY_MODEL and add check for nonblank productID. + * Sep 20, 2012 1196 rferrel No longer Blocks * * * @author mnash @@ -71,8 +72,7 @@ public class NewAlarmDlg extends CaveSWTDialog { e.text = e.text.toUpperCase(); } }; - - + private Combo alarmAlert; private Combo actionCmd; @@ -108,8 +108,8 @@ public class NewAlarmDlg extends CaveSWTDialog { */ protected NewAlarmDlg(Shell parentShell, String alarm_or_alert, AlarmAlertProduct product) { - super(parentShell, CAVE.PERSPECTIVE_INDEPENDENT | SWT.PRIMARY_MODAL - | SWT.RESIZE); + super(parentShell, SWT.PRIMARY_MODAL | SWT.RESIZE, + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK); if ("PROXIMITY".equals(alarm_or_alert)) { productType = ProductType.Proximity_Alarm; setText("New Proximity Alarm Product"); @@ -187,13 +187,13 @@ public class NewAlarmDlg extends CaveSWTDialog { */ private Text createProductIdField(Composite prods, String initValue) { Text prodIdField = new Text(prods, SWT.SINGLE | SWT.BORDER); - if(initValue != null) { + if (initValue != null) { prodIdField.setText(initValue); } prodIdField.addVerifyListener(productIdVerifier); return prodIdField; } - + private void createAlarmDialog() { Composite prods = new Composite(shellComp, SWT.NONE); GridLayout prodLayout = new GridLayout(3, false); @@ -208,8 +208,8 @@ public class NewAlarmDlg extends CaveSWTDialog { prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); prodId.setLayoutData(prodLabelData); - productId = createProductIdField(prods,prod.getProductId()); - + productId = createProductIdField(prods, prod.getProductId()); + prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); prodLabelData.grabExcessHorizontalSpace = true; prodLabelData.widthHint = 150; @@ -260,8 +260,8 @@ public class NewAlarmDlg extends CaveSWTDialog { prodId.setText("Product ID:"); prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - - productId = createProductIdField(prods,prod.getProductId()); + + productId = createProductIdField(prods, prod.getProductId()); productId.setLayoutData(prodLabelData); // separator @@ -468,7 +468,7 @@ public class NewAlarmDlg extends CaveSWTDialog { } else { prod.setSearchString(searchString.getText()); prod.setAlarm(alarmCheck.getSelection()); - if(alarmCheck.getSelection()) { + if (alarmCheck.getSelection()) { prod.setAlarmType("Alarm"); } else { prod.setAlarmType("Alert");