From dfa857b2298d9664df1d795e0ec25abe911d51d7 Mon Sep 17 00:00:00 2001 From: Lee Venable Date: Wed, 26 Sep 2012 08:30:54 -0500 Subject: [PATCH] Issue #1196 - dialog refactor to not block. Former-commit-id: 6cbc495948aef3361a98f8866fa188e0275b6f27 [formerly 295e6707982c8935327ae13624e0d4a1953d9f68] [formerly 6cbc495948aef3361a98f8866fa188e0275b6f27 [formerly 295e6707982c8935327ae13624e0d4a1953d9f68] [formerly 0d62ffb4105901e26d6662cc67c0822c8f01f384 [formerly 001b02d34143143479e2eea5d9e274380218ba9d]]] Former-commit-id: 0d62ffb4105901e26d6662cc67c0822c8f01f384 Former-commit-id: b97012487bc66f0194726621e069e3e6d7ef5a84 [formerly 9405751b96d9c5a9bfb233704cf6c35207ddb280] Former-commit-id: 5e33a7b508c02c3481ce2167504c8acc03553aeb --- .../texteditor/dialogs/AfosBrowserDlg.java | 3 +- .../dialogs/OffsiteDissModeDlg.java | 197 ------------------ .../texteditor/dialogs/SearchReplaceDlg.java | 4 +- .../texteditor/dialogs/TextCharWrapDlg.java | 4 +- .../texteditor/dialogs/TextEditorDialog.java | 60 ++++-- .../fax/dialogs/LdadFaxSitesDlg.java | 9 +- .../notify/GenericConfirmationDialog.java | 135 ------------ .../scripting/dialogs/ScriptEditorDialog.java | 63 +++--- .../viz/textworkstation/SelectUserIdDlg.java | 4 +- .../textworkstation/TextWorkstationDlg.java | 12 +- .../viz/warngen/gui/WarningEditDialog.java | 153 -------------- 11 files changed, 102 insertions(+), 542 deletions(-) delete mode 100755 cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/OffsiteDissModeDlg.java delete mode 100644 cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/notify/GenericConfirmationDialog.java delete mode 100644 cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarningEditDialog.java diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java index 325ab00017..f415427ec2 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java @@ -87,6 +87,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 06/01/2010 2187 cjeanbap Added StdTextProductFactory * functionality. * 06/28/2010 3283 cjeanbap Implement window resize. + * 25Sep2012 1196 lvenable Dialog refactor to prevent blocking. * * * @author lvenable @@ -229,7 +230,7 @@ public class AfosBrowserDlg extends CaveSWTDialog implements public AfosBrowserDlg(Shell parent, String browserHdr, IAfosBrowserCallback cbClient, String token) { super(parent, SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK); setText(browserHdr + " Browser"); diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/OffsiteDissModeDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/OffsiteDissModeDlg.java deleted file mode 100755 index f06a21cfc6..0000000000 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/OffsiteDissModeDlg.java +++ /dev/null @@ -1,197 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ - -package com.raytheon.viz.texteditor.dialogs; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Layout; -import org.eclipse.swt.widgets.Shell; - -import com.raytheon.viz.ui.dialogs.CaveSWTDialog; - -/** - * Offset mode dialog. - * - *
- * 
- * SOFTWARE HISTORY
- * 
- * Date       	Ticket#		Engineer	Description
- * ------------	----------	-----------	--------------------------
- * 9/13/07      368         lvenable    Initial creation.
- * 10/11/2007   482         grichard    Reformatted file.
- * 
- * 
- * - * @author lvenable - */ -public class OffsiteDissModeDlg extends CaveSWTDialog { - - /** - * Text window id. - */ - private String textWindowId; - - /** - * Operational radio button. - */ - private Button operationalRdo; - - /** - * Non-operational radio button. - */ - private Button nonOperationalRdo; - - /** - * Constructor. - * - * @param parent - * Parent shell. - * @param textWindowId - * Text window ID. - */ - public OffsiteDissModeDlg(Shell parent, String textWindowId) { - super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL, - CAVE.PERSPECTIVE_INDEPENDENT); - setText(this.textWindowId - + ": Text Product Offsite Dissemination Operational Mode"); - - this.textWindowId = textWindowId; - } - - @Override - protected Layout constructShellLayout() { - GridLayout mainLayout = new GridLayout(1, false); - mainLayout.marginHeight = 2; - mainLayout.marginWidth = 2; - return mainLayout; - } - - @Override - protected Object constructShellLayoutData() { - return new GridData(); - } - - @Override - protected void initializeComponents(Shell shell) { - setReturnValue(false); - - createInformationLabels(); - createOptionControls(); - createBottomButtons(); - - shell.setSize(600, 185); - } - - /** - * Create the information labels. - */ - private void createInformationLabels() { - - Composite labelComp = new Composite(shell, SWT.NONE); - GridLayout gridLayout = new GridLayout(1, false); - gridLayout.marginLeft = 1; - gridLayout.marginTop = 1; - labelComp.setLayout(gridLayout); - - Label noteLbl = new Label(labelComp, SWT.NONE); - noteLbl.setText("PLEASE NOTE:"); - - Label noteInfoLbl = new Label(labelComp, SWT.NONE); - noteInfoLbl - .setText("The TextWS MHS system is used to disseminate official " - + "forecast products offsite."); - } - - /** - * Create the option radio button controls. - */ - private void createOptionControls() { - Group controlsGroup = new Group(shell, SWT.NONE); - GridLayout gridLayout = new GridLayout(2, true); - gridLayout.marginLeft = 1; - gridLayout.marginTop = 1; - controlsGroup.setLayout(gridLayout); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - controlsGroup.setLayoutData(gd); - controlsGroup.setText(" Choose an appropriate operational mode for " - + textWindowId + ": "); - - // Create the operation radio button. - gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER); - gd.grabExcessHorizontalSpace = true; - operationalRdo = new Button(controlsGroup, SWT.RADIO); - operationalRdo.setText("operational"); - operationalRdo.setLayoutData(gd); - - // Create the non-operational radio button. - gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER); - gd.grabExcessHorizontalSpace = true; - nonOperationalRdo = new Button(controlsGroup, SWT.RADIO); - nonOperationalRdo.setText("non-operational"); - nonOperationalRdo.setSelection(true); - nonOperationalRdo.setLayoutData(gd); - } - - /** - * Create the bottom buttons. - */ - private void createBottomButtons() { - // Create a composite that will center added controls/composites. - Composite buttonArea = new Composite(shell, SWT.NONE); - buttonArea.setLayoutData(new GridData(SWT.CENTER, SWT.DEFAULT, true, - false)); - buttonArea.setLayout(new GridLayout(1, false)); - - // Create a composite to hold the enter and cancel buttons. - Composite buttons = new Composite(buttonArea, SWT.NONE); - buttons.setLayout(new GridLayout(2, true)); - - // Create the OK button. - Button okBtn = new Button(buttons, SWT.PUSH); - okBtn.setLayoutData(new GridData(GridData.FILL_BOTH)); - okBtn.setText("OK"); - okBtn.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent event) { - setReturnValue(true); - shell.dispose(); - } - }); - - // Create the OK button. - Button cancelBtn = new Button(buttons, SWT.PUSH); - cancelBtn.setLayoutData(new GridData(GridData.FILL_BOTH)); - cancelBtn.setText("Cancel"); - cancelBtn.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent event) { - setReturnValue(false); - shell.dispose(); - } - }); - } -} diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/SearchReplaceDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/SearchReplaceDlg.java index e4b159a76e..ba30f2eb71 100755 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/SearchReplaceDlg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/SearchReplaceDlg.java @@ -50,6 +50,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 9/13/07 368 lvenable Initial creation. * 10/11/2007 482 grichard Reformatted file. * 1/8/2008 663 grichard Implemented 'replace all'. + * 25SEP2012 1196 lvenable Refactor dialogs to prevent blocking. * * * @@ -144,7 +145,8 @@ public class SearchReplaceDlg extends CaveSWTDialog { */ public SearchReplaceDlg(Shell parent, StyledText textEditor, boolean inEditMode) { - super(parent, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("Search and Replace"); this.textEditor = textEditor; diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextCharWrapDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextCharWrapDlg.java index 5edc0da7ac..4f00514899 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextCharWrapDlg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextCharWrapDlg.java @@ -50,6 +50,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 1/10/2008 722 grichard Initial creation. + * 25SEP2012 1196 lvenable Refactor dialogs to prevent blocking. * * * @@ -93,7 +94,8 @@ public class TextCharWrapDlg extends CaveSWTDialog { public TextCharWrapDlg(Shell parent, ITextCharWrapCallback cbClient, final Integer defCharWrapCol, final int rangeStart, final int rangeEnd) { - super(parent, SWT.DIALOG_TRIM | CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM | CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("New Width"); this.defCharWrapCol = defCharWrapCol; this.rangeStart = rangeStart; diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java index f385e13376..c3ca93e56d 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java @@ -289,6 +289,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox; * when obs are updated and refactored executeCommand * 10SEP2012 15401 D.Friedman Fix QC problem caused by DR 15340. * 20SEP2012 1196 rferrel Refactor dialogs to prevent blocking. + * 25SEP2012 1196 lvenable Refactor dialogs to prevent blocking. * * * @author lvenable @@ -1107,6 +1108,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, private MouseListener updateObsListener = null; + /** Text character wrap dialog */ + private TextCharWrapDlg textCharWrapDlg; + + /** LDAD fax sites dialog */ + private LdadFaxSitesDlg ldadFaxSitesDlg; + private enum HeaderEditSession { CLOSE_ON_EXIT, IN_EDITOR } @@ -1368,12 +1375,16 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, }); configAutoFaxItem = new MenuItem(fileMenu, SWT.NONE); - configAutoFaxItem.setText("Configure Auto Fax"); + configAutoFaxItem.setText("Configure Auto Fax..."); configAutoFaxItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - LdadFaxSitesDlg ldadFaxSitesDlg = new LdadFaxSitesDlg(shell); - ldadFaxSitesDlg.open(); + if (ldadFaxSitesDlg == null || ldadFaxSitesDlg.isDisposed()) { + ldadFaxSitesDlg = new LdadFaxSitesDlg(shell); + ldadFaxSitesDlg.open(); + } else { + ldadFaxSitesDlg.bringToTop(); + } } }); @@ -1474,7 +1485,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, EditSessionRecoveryDialog recoveryDlg = new EditSessionRecoveryDialog( TextEditorDialog.this.getParent(), TextEditorDialog.this); - recoveryDlg.setBlockOnOpen(true); + recoveryDlg.setBlockOnOpen(false); recoveryDlg.open(); } }); @@ -1656,11 +1667,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, searchItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - - searchReplaceDlg = new SearchReplaceDlg(shell, textEditor, - inEditMode); - searchReplaceDlg.open(); - searchReplaceDlg = null; + if (searchReplaceDlg == null || searchReplaceDlg.isDisposed()) { + searchReplaceDlg = new SearchReplaceDlg(shell, textEditor, + inEditMode); + searchReplaceDlg.open(); + } else { + searchReplaceDlg.bringToTop(); + } } }); @@ -2621,15 +2634,24 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, private void createTextCharWrapDialog(final int rangeStart, final int rangeEnd) { // Create the text character wrap dialog. - TextCharWrapDlg textCharWrapDlg = new TextCharWrapDlg(shell, this, - otherCharWrapCol, rangeStart, rangeEnd); - Boolean rv = (Boolean) textCharWrapDlg.open(); - // If the user cancels the text character wrap dialog then - // take no action. - // Otherwise, use character wrap count to set the wrap-around. - if (rv == true) { - recompileRegex(); - wordWrapEnabled = true; + if (textCharWrapDlg == null || textCharWrapDlg.isDisposed()) { + textCharWrapDlg = new TextCharWrapDlg(shell, this, + otherCharWrapCol, rangeStart, rangeEnd); + + textCharWrapDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if ((Boolean) returnValue == true) { + recompileRegex(); + wordWrapEnabled = true; + } + } + }); + + textCharWrapDlg.open(); + } else { + textCharWrapDlg.bringToTop(); } } @@ -4310,7 +4332,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, * Display the AFOS Browser dialog. */ private void displayAfosBrowser() { - if (afosBrowser == null) { + if (afosBrowser == null || afosBrowser.isDisposed() == true) { afosBrowser = new AfosBrowserDlg(shell, shell.getText(), this, token); afosBrowser.open(); diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/fax/dialogs/LdadFaxSitesDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/fax/dialogs/LdadFaxSitesDlg.java index c64c21f4f1..db597d4cfa 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/fax/dialogs/LdadFaxSitesDlg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/fax/dialogs/LdadFaxSitesDlg.java @@ -45,10 +45,8 @@ import com.raytheon.uf.common.dataplugin.text.request.GetAutoFaxRecordsRequest; 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.Activator; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; -import com.raytheon.uf.viz.core.status.StatusConstants; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; /** @@ -61,6 +59,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Nov 1, 2010 lvenable Initial creation + * 26Sep2012 1196 lvenable Dialog refacter to not block. * * * @@ -69,7 +68,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; */ public class LdadFaxSitesDlg extends CaveSWTDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(LdadFaxSitesDlg.class); + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(LdadFaxSitesDlg.class); + private Tree faxSiteTree; private Label faxNumLbl; @@ -105,7 +106,7 @@ public class LdadFaxSitesDlg extends CaveSWTDialog { private boolean sortByPil = true; public LdadFaxSitesDlg(Shell parent) { - super(parent, SWT.DIALOG_TRIM | SWT.RESIZE); + super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK); setText("Fax Site Editor"); } diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/notify/GenericConfirmationDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/notify/GenericConfirmationDialog.java deleted file mode 100644 index 861cf67b41..0000000000 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/notify/GenericConfirmationDialog.java +++ /dev/null @@ -1,135 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.texteditor.notify; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; - -/** - * This is a generic non-blocking pop up dialog. It is modeless, so other - * controls can be used while this dialog is visible. - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#    Engineer    Description
- * ------------ ---------- ----------- --------------------------
- * 12/20/2010   7210       cjeanbap    Initial Creation
- * 2008-12-09
- * 
- * 
- * - * @author cjeanbap - * @version 1.0 - */ -public class GenericConfirmationDialog extends CaveJFACEDialog { - - private static final int MIN_WIDTH = 500; - - private static final int MIN_HEIGHT = 125; - - private Label messageText; - - private String title; - - private Composite top; - - private String message; - - /** - * @param parent - */ - public GenericConfirmationDialog(Shell parent, String title, String message) { - super(parent); - - setShellStyle(SWT.MODELESS | SWT.RESIZE | SWT.DIALOG_TRIM); - - if (title != null) { - this.title = title; - } - this.message = message; - } - - @Override - public boolean close() { - return super.close(); - } - - @Override - protected Control createDialogArea(Composite parent) { - top = (Composite) super.createDialogArea(parent); - - GridLayout mainLayout = new GridLayout(1, true); - mainLayout.marginHeight = 5; - mainLayout.marginWidth = 5; - - top.setLayout(mainLayout); - - messageText = new Label(top, SWT.CENTER); - messageText.setText(this.message); - GridData data = new GridData(SWT.FILL, SWT.DEFAULT, true, false); - data.widthHint = 500; - messageText.setLayoutData(data); - - return top; - } - - @Override - protected Control createButtonBar(Composite parent) { - Composite composite = (Composite) super.createButtonBar(parent); - GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END - | GridData.VERTICAL_ALIGN_CENTER); - composite.setLayoutData(data); - return composite; - } - - @Override - protected void createButtonsForButtonBar(Composite parent) { - super.createButton(parent, IDialogConstants.OK_ID, "OK", false); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets - * .Shell) - */ - @Override - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setMinimumSize(MIN_WIDTH, MIN_HEIGHT); - shell.setText(title); - } - - public static void main(String[] args) { - final GenericConfirmationDialog gcd = new GenericConfirmationDialog( - new Shell(), "Generic Confirmation Dialog", "Test Message"); - gcd.setBlockOnOpen(true); - gcd.open(); - } -} diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptEditorDialog.java index 343d91da4e..19229cf332 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/scripting/dialogs/ScriptEditorDialog.java @@ -47,8 +47,6 @@ import org.eclipse.swt.widgets.Shell; 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.status.StatusConstants; -import com.raytheon.viz.texteditor.Activator; import com.raytheon.viz.texteditor.dialogs.SearchReplaceDlg; import com.raytheon.viz.texteditor.scripting.dialogs.HelpRequestDlg.EnumHelpTypes; import com.raytheon.viz.texteditor.scripting.dialogs.util.FileUtilities; @@ -64,6 +62,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jun 29, 2009 mfegan Initial creation + * 25SEP2012 1196 lvenable Refactor dialogs to prevent blocking. + * 26Sep2012 1196 lvenable Dialog refactor to not block. * * * @@ -72,7 +72,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; */ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ScriptEditorDialog.class); + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(ScriptEditorDialog.class); + /* strings for dialog title creation */ private static final String FILE_DEFAULT = "untitled"; @@ -215,7 +217,7 @@ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { public ScriptEditorDialog(Shell parent, IScriptEditorObserver observer, String token, boolean outputState) { super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT | CAVE.NO_PACK); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.NO_PACK | CAVE.DO_NOT_BLOCK); this.observer = observer; this.token = token; this.outputState = outputState; @@ -260,8 +262,8 @@ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { String contents = FileUtilities.loadFileToString(path); scriptEditor.setText(contents); } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, "Unable to save load file \"" - + fileName + "\"", e); + statusHandler.handle(Priority.PROBLEM, + "Unable to save load file \"" + fileName + "\"", e); return false; } return true; @@ -300,12 +302,12 @@ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { Point size = new Point(500, 500); shell.setSize(size); shell.layout(); - smlFont = new Font(shell.getDisplay(), "Monospace", EnumFontSize.SMALL - .getSize(), SWT.NORMAL); - medFont = new Font(shell.getDisplay(), "Monospace", EnumFontSize.MEDIUM - .getSize(), SWT.NORMAL); - lrgFont = new Font(shell.getDisplay(), "Monospace", EnumFontSize.LARGE - .getSize(), SWT.NORMAL); + smlFont = new Font(shell.getDisplay(), "Monospace", + EnumFontSize.SMALL.getSize(), SWT.NORMAL); + medFont = new Font(shell.getDisplay(), "Monospace", + EnumFontSize.MEDIUM.getSize(), SWT.NORMAL); + lrgFont = new Font(shell.getDisplay(), "Monospace", + EnumFontSize.LARGE.getSize(), SWT.NORMAL); createMenuBar(); createClientArea(); @@ -363,10 +365,9 @@ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { && scriptEditor.getCaretOffset() < scriptEditor .getCharCount()) { scriptEditor.replaceTextRange( - scriptEditor.getCaretOffset(), 1, String - .valueOf(event.character)); - scriptEditor - .setCaretOffset(scriptEditor.getCaretOffset() + 1); + scriptEditor.getCaretOffset(), 1, + String.valueOf(event.character)); + scriptEditor.setCaretOffset(scriptEditor.getCaretOffset() + 1); event.doit = false; } @@ -759,11 +760,11 @@ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { try { if (!file.delete()) { statusHandler.handle(Priority.PROBLEM, "Unable to delete \"" - + result + "\""); + + result + "\""); } } catch (SecurityException e) { - statusHandler.handle(Priority.PROBLEM, "Unable to delete \"" + result - + "\"", e); + statusHandler.handle(Priority.PROBLEM, "Unable to delete \"" + + result + "\"", e); } } @@ -802,13 +803,14 @@ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { File file = new File(fileToRename); File dest = new File(newFileName); if (!file.renameTo(dest)) { - statusHandler.handle(Priority.PROBLEM, + statusHandler + .handle(Priority.PROBLEM, "Unable to rename script file \"" + fileToRename + "\""); } } catch (Exception e) { - statusHandler.handle(Priority.PROBLEM, "Unable to rename script file \"" - + fileToRename + "\"", e); + statusHandler.handle(Priority.PROBLEM, + "Unable to rename script file \"" + fileToRename + "\"", e); } } @@ -841,8 +843,8 @@ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { try { saveFile(filePath, fileName, scriptEditor.getText()); } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, "Unable to save script file \"" - + fileName + "\"", e); + statusHandler.handle(Priority.PROBLEM, + "Unable to save script file \"" + fileName + "\"", e); return; } setTitle(); @@ -927,7 +929,8 @@ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { // short circuit -- quit early if no script String script = scriptEditor.getText(); if ("".equals(script)) { - statusHandler.handle(Priority.PROBLEM, + statusHandler + .handle(Priority.PROBLEM, "No script to execute (SCRP)\nEnter/load a script and try again"); miRunScript.setEnabled(true); return; @@ -1195,9 +1198,13 @@ public class ScriptEditorDialog extends CaveSWTDialog implements IScriptEditor { handleLineEdit(false); break; case SEARCH: - searchReplaceDlg = new SearchReplaceDlg(shell, scriptEditor, true); - searchReplaceDlg.open(); - searchReplaceDlg = null; + if (searchReplaceDlg == null || searchReplaceDlg.isDisposed()) { + searchReplaceDlg = new SearchReplaceDlg(shell, scriptEditor, + true); + searchReplaceDlg.open(); + } else { + searchReplaceDlg.bringToTop(); + } break; default: System.out.println("Option " + selection + " not yet implemented"); diff --git a/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/SelectUserIdDlg.java b/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/SelectUserIdDlg.java index 5f051b9797..692bb927b7 100755 --- a/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/SelectUserIdDlg.java +++ b/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/SelectUserIdDlg.java @@ -44,6 +44,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * ------------ ---------- ----------- -------------------------- * 9/27/2007 368 lvenable Initial creation. * 10/11/2007 482 grichard Reformatted file. + * 26Sep2012 1196 lvenable Dialog refactor to not block. * * * @@ -56,7 +57,8 @@ public class SelectUserIdDlg extends CaveSWTDialog { private List userIdList; public SelectUserIdDlg(Shell parent) { - super(parent, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("Select User ID"); } diff --git a/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationDlg.java b/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationDlg.java index d6a77e7f38..151372b98e 100644 --- a/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationDlg.java +++ b/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationDlg.java @@ -87,6 +87,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 01Feb2011 7193 cjeanbap Add boolean condition to check initial start time. * 03Nov2011 11450 rferrel Change how old products pruge so it is no longer * on times on two machines being in synch. + * 26Sep2012 1196 lvenable Dialog refactor to not block. * * * @@ -137,6 +138,9 @@ public class TextWorkstationDlg extends CaveSWTDialog implements private long initStartTime; + /** Select user ID dialog */ + private SelectUserIdDlg userIdDlg; + public TextWorkstationDlg(Shell parent) { super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE, CAVE.PERSPECTIVE_INDEPENDENT | CAVE.INDEPENDENT_SHELL); @@ -243,8 +247,12 @@ public class TextWorkstationDlg extends CaveSWTDialog implements selectUserIdMenuItem.setText("Select User ID..."); selectUserIdMenuItem.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { - SelectUserIdDlg userIdDlg = new SelectUserIdDlg(shell); - userIdDlg.open(); + if (userIdDlg == null || userIdDlg.isDisposed()) { + userIdDlg = new SelectUserIdDlg(shell); + userIdDlg.open(); + } else { + userIdDlg.bringToTop(); + } } }); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarningEditDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarningEditDialog.java deleted file mode 100644 index e00aad77be..0000000000 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarningEditDialog.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * This software was developed and / or modified by Raytheon Company, - * pursuant to Contract DG133W-05-CQ-1067 with the US Government. - * - * U.S. EXPORT CONTROLLED TECHNICAL DATA - * This software product contains export-restricted data whose - * export/transfer/disclosure is restricted by U.S. law. Dissemination - * to non-U.S. persons whether in the United States or abroad requires - * an export license or other authorization. - * - * Contractor Name: Raytheon Company - * Contractor Address: 6825 Pine Street, Suite 340 - * Mail Stop B8 - * Omaha, NE 68106 - * 402.291.0100 - * - * See the AWIPS II Master Rights File ("Master Rights File.pdf") for - * further licensing information. - **/ -package com.raytheon.viz.warngen.gui; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.StyledText; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.FontData; - -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; - -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Shell; - -import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; - -/** - * Warning Edit Dialog - * - * Contains the dialog box for previewing the text of a generated WWA - * - *
- * SOFTWARE HISTORY
- * Date         Ticket#     Engineer    Description
- * ------------ ----------  ----------- --------------------------
- * Jan 26, 2007             chammack    Initial Creation.
- * Dec 11, 2007 #601        chammack    TO8 Reimplementation
- * 
- * 
- * - * @author chammack - * @version 1 - */ -public class WarningEditDialog extends CaveJFACEDialog { - - /** The title */ - private String title = "Generated Warning"; - - /** Text of the warning */ - private String warning; - - private Font font; - - /* Constructor */ - protected WarningEditDialog(Shell parentShell, String warning) { - super(parentShell); - this.warning = warning; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int) - */ - protected void buttonPressed(int buttonId) { - super.buttonPressed(buttonId); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) - */ - protected void configureShell(Shell shell) { - super.configureShell(shell); - if (title != null) { - shell.setText(title); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) - */ - protected void createButtonsForButtonBar(Composite parent) { - Button okButton = createButton(parent, IDialogConstants.OK_ID, - IDialogConstants.OK_LABEL, true); - okButton.setVisible(true); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ - protected Control createDialogArea(final Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - composite.setLayout(new GridLayout(1, false)); - - StyledText text = new StyledText(composite, SWT.BORDER | SWT.V_SCROLL - | SWT.H_SCROLL); - text.setText(warning); - FontData fd = new FontData("Courier", 9, SWT.None); - font = new Font(parent.getDisplay(), fd); - text.setFont(font); - - text.setLayout(new GridLayout(1, false)); - text.setLayoutData(new GridData(GridData.FILL_BOTH)); - - return composite; - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#close() - */ - @Override - public boolean close() { - boolean val = super.close(); - if (this.font != null && !this.font.isDisposed()) - this.font.dispose(); - - return val; - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.dialogs.Dialog#getInitialSize() - */ - @Override - protected Point getInitialSize() { - return new Point(800, 600); - } - -}