diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigDlg.java index 4b6711fa3c..50e793b10f 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigDlg.java @@ -59,6 +59,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 11 Oct 2012 1229 rferrel Changes for non-blocking MonitoringCriteriaDlg. * 12 Oct 2012 1229 rferrel Changes for non-blocking TafProductConfigDlg. * 12 Oct 2012 1229 rferrel Changes for non-blocking TafSiteInfoEditorDlg. + * 15 Oct 2012 1229 rferrel Changes for non-blocking TextEditorSetupDlg. * * * @@ -262,13 +263,11 @@ public class AvnconfigDlg extends CaveSWTDialog { textEditorBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (editorDlg == null || editorDlg.getParent().isDisposed()) { + if (mustCreate(editorDlg)) { editorDlg = new TextEditorSetupDlg(shell); editorDlg.open(); - editorDlg = null; } else { - editorDlg.getParent().forceActive(); - editorDlg.getParent().forceFocus(); + editorDlg.bringToTop(); } } }); diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java index 2f53b6ea1b..40a1966442 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Map; import org.apache.commons.configuration.ConfigurationException; import org.eclipse.swt.SWT; @@ -63,6 +64,7 @@ import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.vividsolutions.jts.geom.Point; /** @@ -80,6 +82,7 @@ import com.vividsolutions.jts.geom.Point; * 9 May 2011 8856 rferrel Code cleanup * 12 Oct 2012 1229 rferrel Now a subclass of CaveSWTDialog * and made non-blocking. + * 15 Oct 2012 1229 rferrel Changes for non-blocking TextEditorSetupDlg. * * * @@ -233,6 +236,11 @@ public class TafSiteInfoEditorDlg extends CaveSWTDialog { */ private Color correctColor; + /** + * Possible to have a different dialog for each issue time. + */ + Map editorDlgMap; + /** * Constructor. * @@ -242,6 +250,7 @@ public class TafSiteInfoEditorDlg extends CaveSWTDialog { public TafSiteInfoEditorDlg(Shell parent) { super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); setText("AvnFPS TAF Site Info Editor"); + editorDlgMap = new HashMap(); } @Override @@ -862,15 +871,30 @@ public class TafSiteInfoEditorDlg extends CaveSWTDialog { public void widgetSelected(SelectionEvent event) { if (isSiteIdValid()) { try { - String issueTime = issueCbo.getText().substring(0, 2); - ITafSiteConfig config = TafSiteConfigFactory - .getInstance(); - String siteId = siteIdTF.getText(); - LocalizationFile lFile = config.getTemplateFile(siteId, - issueTime); - TextEditorSetupDlg editorDlg = new TextEditorSetupDlg( - shell, lFile); - editorDlg.open(); + final String issueTime = issueCbo.getText().substring( + 0, 2); + TextEditorSetupDlg editorDlg = editorDlgMap + .get(issueTime); + if (mustCreate(editorDlg)) { + ITafSiteConfig config = TafSiteConfigFactory + .getInstance(); + String siteId = siteIdTF.getText(); + LocalizationFile lFile = config.getTemplateFile( + siteId, issueTime); + editorDlg = new TextEditorSetupDlg(shell, lFile); + editorDlgMap.put(issueTime, editorDlg); + editorDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + editorDlgMap.remove(issueTime); + } + }); + + editorDlg.open(); + } else { + editorDlg.bringToTop(); + } } catch (FileNotFoundException e) { msgStatusComp.setMessageText(e.getMessage(), new RGB( 255, 0, 0)); diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TextEditorSetupDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TextEditorSetupDlg.java index a12ac5b354..2211077731 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TextEditorSetupDlg.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TextEditorSetupDlg.java @@ -76,6 +76,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * LocalizedFile and added preOpen() to * open the LocalizedFile. * 11 OCT 2012 1229 rferrel Changes for non-blocking FindReplaceDlg. + * 15 OCT 2012 1229 rferrel Made dialog non-blocking. * * * @@ -165,7 +166,8 @@ public class TextEditorSetupDlg extends CaveSWTDialog { * When not null a localized file to load into the editor. */ public TextEditorSetupDlg(Shell parent, LocalizationFile lFile) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS Text Editor"); this.template = null;