From 675041cd8c586648c6e5f330da8aca389b4a9d0f Mon Sep 17 00:00:00 2001 From: David Gillingham Date: Thu, 1 Oct 2015 15:24:18 -0500 Subject: [PATCH] Omaha #4888: Implement additional GFE DRT mode fixes. Change-Id: I800e32539f8bb884c8e8a5cbd53c55bc999008a2 Former-commit-id: 71769dea4a41e9bfcc4cd7d2e0f27ab81dc9d3c1 --- .../viz/gfe/actions/GfeShowDialogHandler.java | 25 +++++++------ .../gfe/actions/ShowSendIscGridsDialog.java | 36 ++++--------------- .../formatterlauncher/StoreTransmitDlg.java | 8 +++-- .../viz/gfe/textformatter/FormatterUtil.java | 4 +-- .../textformatter/TextProductTransmitter.java | 12 ++++++- 5 files changed, 38 insertions(+), 47 deletions(-) diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/GfeShowDialogHandler.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/GfeShowDialogHandler.java index ee599aaf17..55a8bc8c47 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/GfeShowDialogHandler.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/GfeShowDialogHandler.java @@ -37,13 +37,14 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Aug 27, 2015  4749      njensen     Initial creation
- *
+ * Oct 01, 2015  4888      dgilling    Check return value from createDialog.
+ * 
  * 
* * @author njensen @@ -66,15 +67,17 @@ public abstract class GfeShowDialogHandler extends AbstractHandler { .getShell(); dialog = createDialog(shell, dm, event); - dialog.setBlockOnOpen(false); - dialog.addCloseCallback(new ICloseCallback() { - @Override - public void dialogClosed(Object returnValue) { - dialog = null; - } + if (dialog != null) { + dialog.setBlockOnOpen(false); + dialog.addCloseCallback(new ICloseCallback() { + @Override + public void dialogClosed(Object returnValue) { + dialog = null; + } - }); - dialog.open(); + }); + dialog.open(); + } } else { dialog.bringToTop(); } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSendIscGridsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSendIscGridsDialog.java index 17e22a4626..ecc9690b55 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSendIscGridsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSendIscGridsDialog.java @@ -19,16 +19,14 @@ **/ package com.raytheon.viz.gfe.actions; -import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.PlatformUI; import com.raytheon.viz.core.mode.CAVEMode; import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.DataManagerUIFactory; import com.raytheon.viz.gfe.dialogs.isc.SendISCDialog; +import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; /** @@ -41,6 +39,7 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Sep 15, 2015 #4858 dgilling Initial creation + * Oct 01, 2015 #4888 dgilling Refactor based on GfeShowDialogHandler. * * * @@ -48,41 +47,18 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; * @version 1.0 */ -public class ShowSendIscGridsDialog extends AbstractHandler { +public class ShowSendIscGridsDialog extends GfeShowDialogHandler { - private SendISCDialog dialog; - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. - * ExecutionEvent) - */ @Override - public Object execute(ExecutionEvent event) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + protected CaveJFACEDialog createDialog(Shell shell, DataManager dm, + ExecutionEvent event) { if (!SimulatedTimeOperations.isTransmitAllowed()) { SimulatedTimeOperations.displayFeatureLevelWarning(shell, "Send ISC grids"); return null; } - DataManager dm = DataManagerUIFactory.getCurrentInstance(); - if (dm == null) { - return null; - } - - if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { - dialog = new SendISCDialog(shell, dm); - dialog.setBlockOnOpen(false); - dialog.open(); - } else { - dialog.bringToTop(); - } - - return null; + return new SendISCDialog(shell, dm); } @Override diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/StoreTransmitDlg.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/StoreTransmitDlg.java index eac097955d..4fed886177 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/StoreTransmitDlg.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/formatterlauncher/StoreTransmitDlg.java @@ -539,12 +539,16 @@ public class StoreTransmitDlg extends CaveSWTDialog { .transmitProduct(practice); sendTransmissionStatus(state); - this.parentEditor.setProductText(productText, false); - this.parentEditor.brain(); + parentEditor.setProductText(productText, false); + parentEditor.brain(); } catch (VizException e) { statusHandler.handle(Priority.CRITICAL, "Error sending product", e); sendTransmissionStatus(ConfigData.ProductStateEnum.Failed); parentEditor.revive(); + } catch (SimulatedTimeProhibitedOpException e) { + statusHandler.error(e.getLocalizedMessage(), e); + sendTransmissionStatus(ConfigData.ProductStateEnum.Failed); + parentEditor.brain(); } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/FormatterUtil.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/FormatterUtil.java index e4505405a4..1b90fc4112 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/FormatterUtil.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/FormatterUtil.java @@ -51,6 +51,7 @@ import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException; * varDict through. * Aug 26, 2015 4804 dgilling Add methods so SmartScript can run formatters. * Sep 15, 2015 4858 dgilling Disable store/transmit in DRT mode. + * Oct 01, 2015 4888 dgilling Fix javadoc for exceptions. * * * @@ -119,9 +120,6 @@ public class FormatterUtil { * @param listener * listener to fire when formatter finishes generating product * @throws SimulatedTimeProhibitedOpException - * @throws InterruptedException - * If something interrupts this thread before the formatter has - * completed. */ public static void callFromSmartScript(String productName, String dbId, String varDict, String vtecMode, DataManager dataMgr, diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/TextProductTransmitter.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/TextProductTransmitter.java index 91ddbc422a..508efe8761 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/TextProductTransmitter.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/textformatter/TextProductTransmitter.java @@ -40,6 +40,8 @@ import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData; import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData.ProductStateEnum; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations; +import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException; /** * Handles product transmission for GFE text products, using handleOUP for @@ -53,6 +55,7 @@ import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData.ProductStateEnu * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Aug 28, 2015 #4806 dgilling Initial creation + * Oct 01, 2015 #4888 dgilling Prevent transmission in DRT mode. * * * @@ -100,9 +103,16 @@ public final class TextProductTransmitter { * @throws VizException * If the transmission request threw an exception during * server-side processing. + * @throws SimulatedTimeProhibitedOpException + * If transmit is prohibited because GFE is running in DRT mode. */ public ProductStateEnum transmitProduct(boolean practice) - throws VizException { + throws VizException, SimulatedTimeProhibitedOpException { + if (SimulatedTimeOperations.isTransmitAllowed()) { + throw SimulatedTimeOperations + .constructProhibitedOpException("Transmit GFE text products."); + } + IServerRequest req = (!practice) ? constructOperationalRequest() : constructPracticeRequest(); Object response = ThriftClient.sendRequest(req);