Issue #1196 - dialog refactor to not block.

Former-commit-id: 6cbc495948 [formerly 295e670798] [formerly 6cbc495948 [formerly 295e670798] [formerly 0d62ffb410 [formerly 001b02d34143143479e2eea5d9e274380218ba9d]]]
Former-commit-id: 0d62ffb410
Former-commit-id: b97012487b [formerly 9405751b96]
Former-commit-id: 5e33a7b508
This commit is contained in:
Lee Venable 2012-09-26 08:30:54 -05:00
parent 763b5aa86b
commit dfa857b229
11 changed files with 102 additions and 542 deletions

View file

@ -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.
* </pre>
*
* @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");

View file

@ -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.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 9/13/07 368 lvenable Initial creation.
* 10/11/2007 482 grichard Reformatted file.
*
* </pre>
*
* @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();
}
});
}
}

View file

@ -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.
*
* </pre>
*
@ -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;

View file

@ -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.
*
* </pre>
*
@ -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;

View file

@ -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.
* </pre>
*
* @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();

View file

@ -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.
*
* </pre>
*
@ -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");
}

View file

@ -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.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 12/20/2010 7210 cjeanbap Initial Creation
* 2008-12-09
*
* </pre>
*
* @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();
}
}

View file

@ -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.
*
* </pre>
*
@ -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");

View file

@ -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.
*
* </pre>
*
@ -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");
}

View file

@ -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.
*
* </pre>
*
@ -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();
}
}
});

View file

@ -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
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 26, 2007 chammack Initial Creation.
* Dec 11, 2007 #601 chammack TO8 Reimplementation
*
* </pre>
*
* @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);
}
}