Issue #1196 - more dialog refactoring for blocking dialogs.

Former-commit-id: 4fa032bcaf [formerly fb0d81ca3e] [formerly 4fa032bcaf [formerly fb0d81ca3e] [formerly a2aa42a981 [formerly 9d8d34bd684928733a718916a6242990c77081ec]]]
Former-commit-id: a2aa42a981
Former-commit-id: 24ed5f0fa6 [formerly 55c007131d]
Former-commit-id: 87a659d309
This commit is contained in:
Lee Venable 2012-09-26 16:52:46 -05:00
parent 93464b8a98
commit 102e4fa822
6 changed files with 61 additions and 48 deletions

View file

@ -290,6 +290,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
* 10SEP2012 15401 D.Friedman Fix QC problem caused by DR 15340. * 10SEP2012 15401 D.Friedman Fix QC problem caused by DR 15340.
* 20SEP2012 1196 rferrel Refactor dialogs to prevent blocking. * 20SEP2012 1196 rferrel Refactor dialogs to prevent blocking.
* 25SEP2012 1196 lvenable Refactor dialogs to prevent blocking. * 25SEP2012 1196 lvenable Refactor dialogs to prevent blocking.
* 26SEP2012 1196 lvenable Refactor dialogs to prevent blocking.
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -1114,6 +1115,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
/** LDAD fax sites dialog */ /** LDAD fax sites dialog */
private LdadFaxSitesDlg ldadFaxSitesDlg; private LdadFaxSitesDlg ldadFaxSitesDlg;
/** Fax all message dialog */
private FaxMessageDlg faxAllMsgDlg;
/** Fax message dialog */
private FaxMessageDlg faxMsgDlg;
private enum HeaderEditSession { private enum HeaderEditSession {
CLOSE_ON_EXIT, IN_EDITOR CLOSE_ON_EXIT, IN_EDITOR
} }
@ -1125,16 +1132,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
.getTimeZone(TimeTools.ZULU_TIMEZONE)); .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 * Constructor with additional cave style rules
* *
@ -1353,24 +1350,33 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
new MenuItem(fileMenu, SWT.SEPARATOR); new MenuItem(fileMenu, SWT.SEPARATOR);
faxAllItem = new MenuItem(fileMenu, SWT.NONE); faxAllItem = new MenuItem(fileMenu, SWT.NONE);
faxAllItem.setText("Fax All"); faxAllItem.setText("Fax All...");
faxAllItem.addSelectionListener(new SelectionAdapter() { faxAllItem.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
FaxMessageDlg faxMsgDlg = new FaxMessageDlg(shell);
faxMsgDlg.setInitialText(textEditor.getText()); if (faxAllMsgDlg == null || faxAllMsgDlg.isDisposed()) {
faxMsgDlg.open(); faxAllMsgDlg = new FaxMessageDlg(shell);
faxAllMsgDlg.setInitialText(textEditor.getText());
faxAllMsgDlg.open();
} else {
faxAllMsgDlg.bringToTop();
}
} }
}); });
faxSelectionItem = new MenuItem(fileMenu, SWT.NONE); faxSelectionItem = new MenuItem(fileMenu, SWT.NONE);
faxSelectionItem.setText("Fax Selection"); faxSelectionItem.setText("Fax Selection...");
faxSelectionItem.addSelectionListener(new SelectionAdapter() { faxSelectionItem.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
FaxMessageDlg faxMsgDlg = new FaxMessageDlg(shell); if (faxMsgDlg == null || faxMsgDlg.isDisposed()) {
faxMsgDlg.setInitialText(textEditor.getSelectionText()); faxMsgDlg = new FaxMessageDlg(shell);
faxMsgDlg.open(); faxMsgDlg.setInitialText(textEditor.getSelectionText());
faxMsgDlg.open();
} else {
faxMsgDlg.bringToTop();
}
} }
}); });

View file

@ -53,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 31, 2010 lvenable Initial creation * Oct 31, 2010 lvenable Initial creation
* 26Sep2012 1196 lvenable Prevent dialog from blocking.
* *
* </pre> * </pre>
* *
@ -63,7 +64,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
// TODO - need to replace CaveSWTDialogStub with CaveSWTDialog // TODO - need to replace CaveSWTDialogStub with CaveSWTDialog
public class FaxMessageDlg extends 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 faxNumberTF;
private Text recipientTF; private Text recipientTF;
@ -79,7 +82,7 @@ public class FaxMessageDlg extends CaveSWTDialog {
} }
public FaxMessageDlg(Shell parent) { 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"); setText("Fax Message");
} }
@ -284,8 +287,7 @@ public class FaxMessageDlg extends CaveSWTDialog {
try { try {
Object retval = ThriftClient.sendRequest(faxReq); Object retval = ThriftClient.sendRequest(faxReq);
if (retval instanceof String && !"Success".equals(retval)) { if (retval instanceof String && !"Success".equals(retval)) {
statusHandler.handle(Priority.SIGNIFICANT, statusHandler.handle(Priority.SIGNIFICANT, (String) retval);
(String) retval);
} }
} catch (VizException e) { } catch (VizException e) {
statusHandler.handle(Priority.SIGNIFICANT, statusHandler.handle(Priority.SIGNIFICANT,

View file

@ -47,6 +47,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 1, 2010 lvenable Initial creation * Nov 1, 2010 lvenable Initial creation
* 26Sep2012 1196 lvenable Update for dialog refactor to not block the dialog on open.
* *
* </pre> * </pre>
* *
@ -71,7 +72,8 @@ public class FaxSiteEditorDlg extends CaveSWTDialog {
private LdadFaxSitesDlg callback; private LdadFaxSitesDlg callback;
public FaxSiteEditorDlg(Shell parent, 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"); setText("Fax Message");
this.callback = callback; this.callback = callback;
} }

View file

@ -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.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/** /**
* TODO Add Description * TODO Add Description
@ -373,22 +374,16 @@ public class LdadFaxSitesDlg extends CaveSWTDialog {
} }
private void addSiteAction() { private void addSiteAction() {
if (faxSiteEditorDlg == null) { if (faxSiteEditorDlg == null || faxSiteEditorDlg.isDisposed()) {
faxSiteEditorDlg = new FaxSiteEditorDlg(shell, this); faxSiteEditorDlg = new FaxSiteEditorDlg(shell, this);
faxSiteEditorDlg.open(); faxSiteEditorDlg.open();
/*
* TODO : if you need to, grab any information from the Fax Site
* Editor dialog
*/
faxSiteEditorDlg = null;
} }
} }
private void editSiteAction() { private void editSiteAction() {
faxSiteEditorDlg = new FaxSiteEditorDlg(shell, this);
if (faxSiteTree.getSelection().length > 0) { if (faxSiteTree.getSelection().length > 0) {
faxSiteEditorDlg = new FaxSiteEditorDlg(shell, this);
for (TreeItem treeItem : faxSiteTree.getSelection()) { for (TreeItem treeItem : faxSiteTree.getSelection()) {
if (null != treeItem.getParentItem()) { if (null != treeItem.getParentItem()) {
TreeItem parent = 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.open();
faxSiteEditorDlg = null;
} }
} }

View file

@ -23,12 +23,11 @@ package com.raytheon.viz.textworkstation;
import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException; 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.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI; import org.eclipse.ui.PlatformUI;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/** /**
* Action for unimplemented features. To be used temporarily until final * Action for unimplemented features. To be used temporarily until final
* behavior is implemented. * behavior is implemented.
@ -42,13 +41,14 @@ import org.eclipse.ui.PlatformUI;
* 6/27/06 randerso Initial creation. * 6/27/06 randerso Initial creation.
* 10/11/2007 482 grichard Reformatted file. * 10/11/2007 482 grichard Reformatted file.
* 08/03/2011 9572 rferrel Allow single instance of the dialog. * 08/03/2011 9572 rferrel Allow single instance of the dialog.
* 26Sep2012 1196 lvenable Update for the dialog refactor.
* *
* </pre> * </pre>
* *
* @author randerso * @author randerso
* *
*/ */
public class TextWorkstationAction extends AbstractHandler implements Listener { public class TextWorkstationAction extends AbstractHandler {
private static TextWorkstationDlg textWorkstationDlg; private static TextWorkstationDlg textWorkstationDlg;
@ -58,17 +58,18 @@ public class TextWorkstationAction extends AbstractHandler implements Listener {
.getShell(); .getShell();
if (textWorkstationDlg == null || textWorkstationDlg.isDisposed()) { if (textWorkstationDlg == null || textWorkstationDlg.isDisposed()) {
textWorkstationDlg = new TextWorkstationDlg(shell); 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; return null;
} }
@Override
public void handleEvent(Event event) {
if (event.type == SWT.Dispose) {
textWorkstationDlg = null;
}
}
} }

View file

@ -143,7 +143,8 @@ public class TextWorkstationDlg extends CaveSWTDialog implements
public TextWorkstationDlg(Shell parent) { public TextWorkstationDlg(Shell parent) {
super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE, 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"); setText("Text Workstation");
TextDisplayModel.getInstance().setTextAviation( TextDisplayModel.getInstance().setTextAviation(