Issue #1196 - more dialog refactoring for blocking dialogs.
Former-commit-id: 9d8d34bd684928733a718916a6242990c77081ec
This commit is contained in:
parent
d376c07465
commit
fb0d81ca3e
6 changed files with 61 additions and 48 deletions
|
@ -290,6 +290,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
|||
* 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.
|
||||
* 26SEP2012 1196 lvenable Refactor dialogs to prevent blocking.
|
||||
* </pre>
|
||||
*
|
||||
* @author lvenable
|
||||
|
@ -1114,6 +1115,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
/** LDAD fax sites dialog */
|
||||
private LdadFaxSitesDlg ldadFaxSitesDlg;
|
||||
|
||||
/** Fax all message dialog */
|
||||
private FaxMessageDlg faxAllMsgDlg;
|
||||
|
||||
/** Fax message dialog */
|
||||
private FaxMessageDlg faxMsgDlg;
|
||||
|
||||
private enum HeaderEditSession {
|
||||
CLOSE_ON_EXIT, IN_EDITOR
|
||||
}
|
||||
|
@ -1125,16 +1132,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
.getTimeZone(TimeTools.ZULU_TIMEZONE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent shell.
|
||||
*/
|
||||
public TextEditorDialog(Shell parent) {
|
||||
this(parent, "Text Display", false, null, "0", false, false, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor with additional cave style rules
|
||||
*
|
||||
|
@ -1353,24 +1350,33 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
|||
new MenuItem(fileMenu, SWT.SEPARATOR);
|
||||
|
||||
faxAllItem = new MenuItem(fileMenu, SWT.NONE);
|
||||
faxAllItem.setText("Fax All");
|
||||
faxAllItem.setText("Fax All...");
|
||||
faxAllItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
FaxMessageDlg faxMsgDlg = new FaxMessageDlg(shell);
|
||||
faxMsgDlg.setInitialText(textEditor.getText());
|
||||
faxMsgDlg.open();
|
||||
|
||||
if (faxAllMsgDlg == null || faxAllMsgDlg.isDisposed()) {
|
||||
faxAllMsgDlg = new FaxMessageDlg(shell);
|
||||
faxAllMsgDlg.setInitialText(textEditor.getText());
|
||||
faxAllMsgDlg.open();
|
||||
} else {
|
||||
faxAllMsgDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
faxSelectionItem = new MenuItem(fileMenu, SWT.NONE);
|
||||
faxSelectionItem.setText("Fax Selection");
|
||||
faxSelectionItem.setText("Fax Selection...");
|
||||
faxSelectionItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
FaxMessageDlg faxMsgDlg = new FaxMessageDlg(shell);
|
||||
faxMsgDlg.setInitialText(textEditor.getSelectionText());
|
||||
faxMsgDlg.open();
|
||||
if (faxMsgDlg == null || faxMsgDlg.isDisposed()) {
|
||||
faxMsgDlg = new FaxMessageDlg(shell);
|
||||
faxMsgDlg.setInitialText(textEditor.getSelectionText());
|
||||
faxMsgDlg.open();
|
||||
} else {
|
||||
faxMsgDlg.bringToTop();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 31, 2010 lvenable Initial creation
|
||||
* 26Sep2012 1196 lvenable Prevent dialog from blocking.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -63,7 +64,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
// TODO - need to replace CaveSWTDialogStub with CaveSWTDialog
|
||||
|
||||
public class FaxMessageDlg extends CaveSWTDialog {
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(FaxMessageDlg.class);
|
||||
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FaxMessageDlg.class);
|
||||
|
||||
private Text faxNumberTF;
|
||||
|
||||
private Text recipientTF;
|
||||
|
@ -79,7 +82,7 @@ public class FaxMessageDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
public FaxMessageDlg(Shell parent) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
|
||||
setText("Fax Message");
|
||||
}
|
||||
|
||||
|
@ -284,8 +287,7 @@ public class FaxMessageDlg extends CaveSWTDialog {
|
|||
try {
|
||||
Object retval = ThriftClient.sendRequest(faxReq);
|
||||
if (retval instanceof String && !"Success".equals(retval)) {
|
||||
statusHandler.handle(Priority.SIGNIFICANT,
|
||||
(String) retval);
|
||||
statusHandler.handle(Priority.SIGNIFICANT, (String) retval);
|
||||
}
|
||||
} catch (VizException e) {
|
||||
statusHandler.handle(Priority.SIGNIFICANT,
|
||||
|
|
|
@ -47,6 +47,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 1, 2010 lvenable Initial creation
|
||||
* 26Sep2012 1196 lvenable Update for dialog refactor to not block the dialog on open.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -71,7 +72,8 @@ public class FaxSiteEditorDlg extends CaveSWTDialog {
|
|||
private LdadFaxSitesDlg callback;
|
||||
|
||||
public FaxSiteEditorDlg(Shell parent, LdadFaxSitesDlg callback) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE,
|
||||
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK);
|
||||
setText("Fax Message");
|
||||
this.callback = callback;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.viz.core.exception.VizException;
|
||||
import com.raytheon.uf.viz.core.requests.ThriftClient;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
|
@ -373,22 +374,16 @@ public class LdadFaxSitesDlg extends CaveSWTDialog {
|
|||
}
|
||||
|
||||
private void addSiteAction() {
|
||||
if (faxSiteEditorDlg == null) {
|
||||
if (faxSiteEditorDlg == null || faxSiteEditorDlg.isDisposed()) {
|
||||
faxSiteEditorDlg = new FaxSiteEditorDlg(shell, this);
|
||||
faxSiteEditorDlg.open();
|
||||
|
||||
/*
|
||||
* TODO : if you need to, grab any information from the Fax Site
|
||||
* Editor dialog
|
||||
*/
|
||||
|
||||
faxSiteEditorDlg = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void editSiteAction() {
|
||||
faxSiteEditorDlg = new FaxSiteEditorDlg(shell, this);
|
||||
|
||||
if (faxSiteTree.getSelection().length > 0) {
|
||||
faxSiteEditorDlg = new FaxSiteEditorDlg(shell, this);
|
||||
for (TreeItem treeItem : faxSiteTree.getSelection()) {
|
||||
if (null != treeItem.getParentItem()) {
|
||||
TreeItem parent = treeItem.getParentItem();
|
||||
|
@ -411,8 +406,14 @@ public class LdadFaxSitesDlg extends CaveSWTDialog {
|
|||
}
|
||||
}
|
||||
}
|
||||
faxSiteEditorDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
faxSiteEditorDlg = null;
|
||||
}
|
||||
});
|
||||
faxSiteEditorDlg.open();
|
||||
faxSiteEditorDlg = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,12 +23,11 @@ package com.raytheon.viz.textworkstation;
|
|||
import org.eclipse.core.commands.AbstractHandler;
|
||||
import org.eclipse.core.commands.ExecutionEvent;
|
||||
import org.eclipse.core.commands.ExecutionException;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* Action for unimplemented features. To be used temporarily until final
|
||||
* behavior is implemented.
|
||||
|
@ -42,13 +41,14 @@ import org.eclipse.ui.PlatformUI;
|
|||
* 6/27/06 randerso Initial creation.
|
||||
* 10/11/2007 482 grichard Reformatted file.
|
||||
* 08/03/2011 9572 rferrel Allow single instance of the dialog.
|
||||
* 26Sep2012 1196 lvenable Update for the dialog refactor.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author randerso
|
||||
*
|
||||
*/
|
||||
public class TextWorkstationAction extends AbstractHandler implements Listener {
|
||||
public class TextWorkstationAction extends AbstractHandler {
|
||||
|
||||
private static TextWorkstationDlg textWorkstationDlg;
|
||||
|
||||
|
@ -58,17 +58,18 @@ public class TextWorkstationAction extends AbstractHandler implements Listener {
|
|||
.getShell();
|
||||
if (textWorkstationDlg == null || textWorkstationDlg.isDisposed()) {
|
||||
textWorkstationDlg = new TextWorkstationDlg(shell);
|
||||
textWorkstationDlg.addListener(SWT.Dispose, this);
|
||||
textWorkstationDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
textWorkstationDlg = null;
|
||||
}
|
||||
});
|
||||
textWorkstationDlg.open();
|
||||
} else {
|
||||
textWorkstationDlg.bringToTop();
|
||||
}
|
||||
textWorkstationDlg.open();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
if (event.type == SWT.Dispose) {
|
||||
textWorkstationDlg = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -143,7 +143,8 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
|
|||
|
||||
public TextWorkstationDlg(Shell parent) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE,
|
||||
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.INDEPENDENT_SHELL);
|
||||
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.INDEPENDENT_SHELL
|
||||
| CAVE.DO_NOT_BLOCK);
|
||||
setText("Text Workstation");
|
||||
|
||||
TextDisplayModel.getInstance().setTextAviation(
|
||||
|
|
Loading…
Add table
Reference in a new issue