Omaha #4858: Do not allow GFE to publish grids, transmit/generate text products or use ISC mode when DRT mode is enabled for operational mode.

Change-Id: Iefe86516fa941d6043b12fa6c7cebdd0803feff6

Former-commit-id: 5461d2ce24a95372902d58c8c8d43963d93ccd36
This commit is contained in:
David Gillingham 2015-09-09 11:27:51 -05:00
parent c1d2ca74a5
commit a2c9879dbc
19 changed files with 537 additions and 303 deletions

View file

@ -65,6 +65,7 @@
# time regardless of setting of os.environ['TZ']
# Jan 13, 2015 3955 randerso Added optional parameter to availableParms to specify desired databases.
# Fixed createGrid to accept a DatabaseID for model
# Sep 11, 2015 4858 dgilling Remove notification processing from publishElements.
########################################################################
import types, string, time, sys
from math import *
@ -1915,16 +1916,7 @@ class SmartScript(BaseTool.BaseTool):
cgr = CommitGridRequest(parm.getParmID(), publishTimeRange.toJavaObj())
requests.add(cgr)
resp = self.__dataMgr.getClient().commitGrid(requests)
r = resp.getPayload()
size = r.size()
for x in range(size):
notify = r.get(x)
pid = notify.getParmId()
p = self.__parmMgr.getParm(pid)
if not p:
p = self.__parmMgr.addParm(pid, False, False)
p.inventoryArrived(notify.getReplacementTimeRange(), notify.getHistories())
self.__parmOp.publish(requests)
def combineMode(self):
from com.raytheon.viz.gfe.core.parm import ParmState

View file

@ -149,6 +149,12 @@
<command id="com.raytheon.viz.gfe.actions.ShowLoadSampleSetDialog"
name="ShowLoadSampleSetDialog">
</command>
<command id="com.raytheon.viz.gfe.actions.ShowSendIsc"
name="ShowSendIscGridsDialog">
</command>
<command id="com.raytheon.viz.gfe.actions.ShowIscRequestReply"
name="ShowIscRequestReplyDialog">
</command>
<command id="com.raytheon.viz.gfe.actions.ShowSaveDeleteSampleSetDialog"
name="ShowSaveDeleteSampleSetDialog">
<commandParameter
@ -997,6 +1003,24 @@
definitionId="com.raytheon.viz.gfe.inGFEActionSet">
</reference>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.gfe.actions.ShowSendIscGridsDialog"
commandId="com.raytheon.viz.gfe.actions.ShowSendIsc">
<activeWhen>
<reference
definitionId="com.raytheon.viz.gfe.inGFEActionSet">
</reference>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.gfe.actions.ShowIscRequestReplyDialog"
commandId="com.raytheon.viz.gfe.actions.ShowIscRequestReply">
<activeWhen>
<reference
definitionId="com.raytheon.viz.gfe.inGFEActionSet">
</reference>
</activeWhen>
</handler>
</extension>
<extension point="com.raytheon.uf.viz.core.resource">
@ -1303,7 +1327,15 @@
name="com.raytheon.viz.gfe.separator2"
visible="true">
</separator>
<dynamic class="com.raytheon.viz.gfe.menu.ISCMenuEnabler" id="com.raytheon.viz.gfe.menu.ISCMenuEnabler"/>
<command
commandId="com.raytheon.viz.gfe.actions.ShowSendIsc"
label="Send Intersite Grids" />
<command
commandId="com.raytheon.viz.gfe.actions.ShowIscRequestReply"
label="ISC Request/Reply" />
<command
commandId="com.raytheon.viz.gfe.iscSendEnable"
label="ISC Send Enable" style="toggle" />
</menu>
<menu label="Products" mnemonic="P">
<visibleWhen>

View file

@ -28,6 +28,7 @@ import org.eclipse.ui.PlatformUI;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
/**
* Displays Formatter Launcher dialog.
@ -42,6 +43,8 @@ import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog;
* Oct 23, 2012 1287 rferrel Changes for non-blocking FormatterLauncherDialog.
* Apr 24, 2013 1936 dgilling Pass DataManager to
* FormatterLauncherDialog via constructor.
* Sep 15, 2015 4858 dgilling Prevent dialog from being launched in DRT
* mode.
*
* </pre>
*
@ -62,10 +65,16 @@ public class FormatterlauncherAction extends AbstractHandler {
*/
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
if (!SimulatedTimeOperations.isTransmitAllowed()) {
SimulatedTimeOperations.displayFeatureLevelWarning(shell,
"Formatter Launcher");
return null;
}
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
DataManager dm = DataManagerUIFactory.getCurrentInstance();
dialog = new FormatterLauncherDialog(shell, dm);
dialog.setBlockOnOpen(false);

View file

@ -24,15 +24,23 @@ import java.util.Map;
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 org.eclipse.ui.commands.IElementUpdater;
import org.eclipse.ui.menus.UIElement;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
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.core.msgs.ISCSendStatusChangedMsg;
import com.raytheon.viz.gfe.core.msgs.Message;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
/**
* TODO Add Description
* Menu handler for enabling and disabling send of ISC grids from GFE client.
*
* <pre>
*
@ -40,6 +48,7 @@ import com.raytheon.viz.gfe.core.msgs.Message;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 25, 2010 randerso Initial creation
* Sep 15, 2015 #4858 dgilling Add isEnabled.
*
* </pre>
*
@ -50,36 +59,43 @@ import com.raytheon.viz.gfe.core.msgs.Message;
public class IscSendEnableHandler extends AbstractHandler implements
IElementUpdater {
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
* ExecutionEvent)
*/
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(getClass());
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
DataManager dm = DataManager.getCurrentInstance();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
if (!SimulatedTimeOperations.isTransmitAllowed()) {
SimulatedTimeOperations.displayFeatureLevelWarning(shell,
"ISC Send Enable");
return null;
}
DataManager dm = DataManagerUIFactory.getCurrentInstance();
if (dm != null) {
boolean newState = !Message.inquireLastMessage(
ISCSendStatusChangedMsg.class).isEnabled();
try {
dm.enableISCsend(newState);
} catch (SimulatedTimeProhibitedOpException e) {
statusHandler.error(e.getLocalizedMessage(), e);
}
}
return null;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.commands.IElementUpdater#updateElement(org.eclipse.ui.
* menus.UIElement, java.util.Map)
*/
@Override
public boolean isEnabled() {
DataManager dm = DataManagerUIFactory.getCurrentInstance();
return (dm != null) ? CAVEMode.getMode().equals(CAVEMode.OPERATIONAL)
&& dm.requestISC() : false;
}
@Override
public void updateElement(UIElement element, Map parameters) {
element.setChecked(Message.inquireLastMessage(
ISCSendStatusChangedMsg.class).isEnabled());
}
}

View file

@ -0,0 +1,96 @@
/**
* 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.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.ISCRequestReplyDlg;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
/**
* Action to launch ISC request/reply dialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 15, 2015 #4858 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public class ShowIscRequestReplyDialog extends AbstractHandler {
private ISCRequestReplyDlg iscRequestDlg;
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
if (!SimulatedTimeOperations.isTransmitAllowed()) {
SimulatedTimeOperations.displayFeatureLevelWarning(shell,
"ISC Request/Reply");
return null;
}
if (iscRequestDlg == null || iscRequestDlg.getShell() == null
|| iscRequestDlg.isDisposed()) {
iscRequestDlg = new ISCRequestReplyDlg(shell);
iscRequestDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
iscRequestDlg = null;
}
});
iscRequestDlg.open();
} else {
iscRequestDlg.bringToTop();
}
return null;
}
@Override
public boolean isEnabled() {
DataManager dm = DataManagerUIFactory.getCurrentInstance();
if (dm != null) {
return (!dm.sendIscOnSave() || !dm.sendIscOnPublish())
&& CAVEMode.getMode().equals(CAVEMode.OPERATIONAL)
&& dm.requestISC();
}
return false;
}
}

View file

@ -26,7 +26,9 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.dialogs.ProductScriptsDialog;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
/**
* Action to launch product generation script dialog.
@ -37,6 +39,7 @@ import com.raytheon.viz.gfe.dialogs.ProductScriptsDialog;
* ------------ ---------- ----------- --------------------------
* Mar 6, 2008 Eric Babin Initial Creation
* Oct 25, 2012 12878 rferrel Changes for non-blocking ProductScriptsDialog.
* Sep 21, 2015 4858 dgilling Disable in DRT mode.
*
* </pre>
*
@ -56,15 +59,20 @@ public class ShowProductScriptsDialog extends AbstractHandler {
*/
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
DataManager dm = DataManager.getCurrentInstance();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
if (!SimulatedTimeOperations.isTransmitAllowed()) {
SimulatedTimeOperations.displayFeatureLevelWarning(shell,
"Product Scripts dialog");
return null;
}
DataManager dm = DataManagerUIFactory.getCurrentInstance();
if (dm == null) {
return null;
}
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
dialog = new ProductScriptsDialog(shell, dm);
dialog.setBlockOnOpen(false);
dialog.open();

View file

@ -26,7 +26,9 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.core.DataManagerUIFactory;
import com.raytheon.viz.gfe.dialogs.PublishDialog;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
/**
* Action to launch publish to official dialog.
@ -37,6 +39,8 @@ import com.raytheon.viz.gfe.dialogs.PublishDialog;
* ------------ ---------- ----------- --------------------------
* Mar 6, 2008 Eric Babin Initial Creation
* Oct 25, 2012 1287 rferrel Changes for non-blocking PublishDialog.
* Sep 09, 2015 4858 dgilling Don't allow publishing when
* SimulatedTime is enabled.
*
* </pre>
*
@ -45,6 +49,7 @@ import com.raytheon.viz.gfe.dialogs.PublishDialog;
*/
public class ShowPublishDialog extends AbstractHandler {
private PublishDialog dialog;
/*
@ -56,17 +61,21 @@ public class ShowPublishDialog extends AbstractHandler {
*/
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
DataManager dm = DataManager.getCurrentInstance();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
if (!SimulatedTimeOperations.isTransmitAllowed()) {
SimulatedTimeOperations.displayFeatureLevelWarning(shell,
"Publish Grids to Official");
return null;
}
DataManager dm = DataManagerUIFactory.getCurrentInstance();
if (dm == null) {
return null;
}
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
PublishDialog dialog = new PublishDialog(shell, dm);
dialog = new PublishDialog(shell, dm);
dialog.setBlockOnOpen(false);
dialog.open();
} else {
@ -87,12 +96,11 @@ public class ShowPublishDialog extends AbstractHandler {
return false;
}
DataManager dm = DataManager.getCurrentInstance();
DataManager dm = DataManagerUIFactory.getCurrentInstance();
if (dm != null) {
return !dm.getParmManager().getMutableDatabase()
.equals(dm.getParmManager().getProductDB());
}
return false;
}
}

View file

@ -0,0 +1,99 @@
/**
* 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.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.simulatedtime.SimulatedTimeOperations;
/**
* Action to launch Send ISC grids dialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 15, 2015 #4858 dgilling Initial creation
*
* </pre>
*
* @author dgilling
* @version 1.0
*/
public class ShowSendIscGridsDialog extends AbstractHandler {
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();
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;
}
@Override
public boolean isEnabled() {
DataManager dm = DataManagerUIFactory.getCurrentInstance();
if (dm != null) {
return (!dm.sendIscOnSave() || !dm.sendIscOnPublish())
&& CAVEMode.getMode().equals(CAVEMode.OPERATIONAL)
&& dm.requestISC();
}
return false;
}
}

View file

@ -48,6 +48,8 @@ import com.raytheon.uf.common.python.PythonScript;
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.common.time.ISimulatedTimeChangeListener;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.exception.VizException;
@ -75,6 +77,8 @@ import com.raytheon.viz.gfe.smarttool.script.SmartToolFactory;
import com.raytheon.viz.gfe.smarttool.script.SmartToolJobPool;
import com.raytheon.viz.gfe.smarttool.script.SmartToolUIController;
import com.raytheon.viz.gfe.textformatter.TextProductManager;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
/**
* DataManager is the central singleton in GFE upon which other managers are
@ -104,6 +108,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager;
* 09/09/2014 3592 randerso Added call to SampleSetManager.dispose()
* 10/30/2014 3775 randerso Added parmCacheInit to initStatus
* 04/20/2015 4027 randerso Let TextProductManager know we are not running in a GUI
* 09/15/2015 4858 dgilling Disable ISC when DRT mode is enabled.
*
* </pre>
*
@ -111,7 +116,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager;
* @version 1.0
*/
public class DataManager {
public class DataManager implements ISimulatedTimeChangeListener {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(DataManager.class);
@ -204,6 +209,8 @@ public class DataManager {
private final SmartToolJobPool toolJobPool;
private boolean previousIscSendState;
public IISCDataAccess getIscDataAccess() {
return iscDataAccess;
}
@ -270,8 +277,14 @@ public class DataManager {
// set the ISC send state, which initially sends the message
new ISCSendStatusChangedMsg(false).send(); // initial state
if (CAVEMode.getMode().equals(CAVEMode.OPERATIONAL)) {
if (CAVEMode.getMode().equals(CAVEMode.OPERATIONAL)
&& ((SimulatedTime.getSystemTime().isRealTime()))
|| (SimulatedTimeOperations.isTransmitAllowedinSimulatedTime())) {
try {
enableISCsend(true);
} catch (SimulatedTimeProhibitedOpException e) {
statusHandler.error(e.getLocalizedMessage(), e);
}
}
// this.queryString = "siteID='" + this.getSiteID() + "'";
this.router.start();
@ -282,6 +295,11 @@ public class DataManager {
this.autoSaveJob = new AutoSaveJob(this);
new ParmEvictor();
if (CAVEMode.getMode() == CAVEMode.OPERATIONAL) {
SimulatedTime.getSystemTime().addSimulatedTimeChangeListener(this);
}
this.previousIscSendState = clientISCSendStatus();
}
/**
@ -333,6 +351,11 @@ public class DataManager {
killPoolsThread.setDaemon(false);
killPoolsThread.start();
if (CAVEMode.getMode() == CAVEMode.OPERATIONAL) {
SimulatedTime.getSystemTime().removeSimulatedTimeChangeListener(
this);
}
NotificationManagerJob.removeObserver("edex.alerts.gfe", router);
}
@ -684,8 +707,15 @@ public class DataManager {
* Sets the overall isc send capability for this user.
*
* @param state
* @throws SimulatedTimeProhibitedOperationException
*/
public void enableISCsend(boolean state) {
public void enableISCsend(boolean state)
throws SimulatedTimeProhibitedOpException {
if (state && !SimulatedTimeOperations.isTransmitAllowed()) {
throw SimulatedTimeOperations
.constructProhibitedOpException("ISC Send");
}
if (state == iscSendState) {
return; // do nothing
}
@ -721,4 +751,34 @@ public class DataManager {
public SmartToolJobPool getSmartToolJobPool() {
return toolJobPool;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.time.ISimulatedTimeChangeListener#timechanged()
*/
@Override
public void timechanged() {
boolean tryToEnable = SimulatedTimeOperations.isTransmitAllowed();
boolean newState;
if (tryToEnable) {
newState = previousIscSendState;
} else {
newState = false;
previousIscSendState = clientISCSendStatus();
}
try {
enableISCsend(newState);
} catch (SimulatedTimeProhibitedOpException e) {
/*
* We should never hit this state...but better to log something just
* in case.
*/
statusHandler.handle(Priority.WARN,
"ISC send status got into an invalid state trying to change state to "
+ newState, e);
}
}
}

View file

@ -69,6 +69,8 @@ import com.raytheon.viz.gfe.core.internal.IFPClient;
import com.raytheon.viz.gfe.core.parm.Parm.InterpState;
import com.raytheon.viz.gfe.core.parm.ParmState.InterpMode;
import com.raytheon.viz.gfe.core.wxvalue.WxValue;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
/**
* A ParmOp provides global functions to affect all parms.
@ -89,6 +91,8 @@ import com.raytheon.viz.gfe.core.wxvalue.WxValue;
* overlapping grids since this is now done on
* the server side
* 08/20/2014 #1664 randerso Fixed invalid thread access
* 09/15/2015 #4858 dgilling Disable publish and ISC send when DRT
* mode is enabled.
*
* </pre>
*
@ -478,9 +482,17 @@ public class ParmOp {
* Publish
*
* @param req
* @throws SimulatedTimeProhibitedOperationException
*/
public void publish(List<CommitGridRequest> req) {
public void publish(List<CommitGridRequest> req)
throws SimulatedTimeProhibitedOpException {
CAVEMode mode = CAVEMode.getMode();
if (!SimulatedTimeOperations.isTransmitAllowed()) {
throw SimulatedTimeOperations
.constructProhibitedOpException("Publish GFE grids");
}
if (mode.equals(CAVEMode.PRACTICE) || mode.equals(CAVEMode.TEST)) {
statusHandler.handle(Priority.EVENTA, "PUBLISH Simulated. ");
return;
@ -1057,10 +1069,17 @@ public class ParmOp {
* This function is called to send grids.
*
* @param req
* @throws SimulatedTimeProhibitedOperationException
*/
public void sendISC(List<SendISCRequest> req) {
public void sendISC(List<SendISCRequest> req)
throws SimulatedTimeProhibitedOpException {
CAVEMode mode = CAVEMode.getMode();
if (!SimulatedTimeOperations.isTransmitAllowed()) {
throw SimulatedTimeOperations
.constructProhibitedOpException("Send ISC grids");
}
if (mode.equals(CAVEMode.PRACTICE) || mode.equals(CAVEMode.TEST)) {
statusHandler.handle(Priority.EVENTA, "SEND ISC Simulated. ");
return;

View file

@ -54,6 +54,7 @@ import com.raytheon.viz.gfe.smartscript.FieldDefinition.FieldType;
import com.raytheon.viz.gfe.tasks.TaskManager;
import com.raytheon.viz.gfe.ui.runtimeui.ValuesDialog;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
import com.raytheon.viz.ui.widgets.ToggleSelectList;
/**
@ -75,6 +76,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
* Oct 23, 2013 DR16203 equintin Restore the "-c" argument when the command
* for Png Images... is rebuilt after
* return from the dialog.
* Sep 15, 2015 4858 dgilling Disable all features in DRT mode.
*
* </pre>
*
@ -146,7 +148,12 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
@Override
protected void buttonPressed(int buttonId) {
if (buttonId != IDialogConstants.CANCEL_ID) {
if (SimulatedTimeOperations.isTransmitAllowed()) {
runScripts();
} else {
SimulatedTimeOperations.displayFeatureLevelWarning(getShell(),
"Run Product Scripts");
}
}
super.buttonPressed(buttonId);
}
@ -240,12 +247,11 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
// Keep this a blocking dialog so the loop will only display
// one dialog at a time.
fieldDefs.add(new FieldDefinition((Object) entry[1],
entry[1], FieldType.ALPHANUMERIC,
(Object) entry[2], Arrays.asList(Arrays.asList(
configFile).toArray(
fieldDefs.add(new FieldDefinition(entry[1], entry[1],
FieldType.ALPHANUMERIC, entry[2], Arrays
.asList(Arrays.asList(configFile).toArray(
new Object[configFile.length])),
(float) 1.0, (int) 3));
(float) 1.0, 3));
if (start == 0) {
start = entryIdx;
@ -253,7 +259,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
start = entryIdx;
}
if (entry[1].equals("ConfigFile")) { //DR 16203 eeq 10/23/2013
if (entry[1].equals("ConfigFile")) { // DR 16203 eeq
// 10/23/2013
endIdx = endEntryIdx;
}
}
@ -277,15 +284,15 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
fieldDefs
.add(new FieldDefinition(
(Object) entry[1],
entry[1],
entry[1],
FieldType.RADIO,
(Object) fields[0],
fields[0],
Arrays.asList(Arrays
.asList(fields)
.toArray(
new Object[fields.length])),
(float) 1.0, (int) 3));
(float) 1.0, 3));
if (start == 0) {
start = entryIdx;
} else if ((start > 0) && (start > entryIdx)
@ -318,7 +325,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
fieldDefs
.add(new FieldDefinition(
(Object) entry[1],
entry[1],
entry[1],
FieldType.CHECK,
(Object) null,
@ -326,7 +333,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
.asList(fields)
.toArray(
new Object[fields.length])),
(float) 1.0, (int) 3));
(float) 1.0, 3));
if (start == 0) {
start = entryIdx;
} else if ((start > 0) && (start > entryIdx)
@ -365,7 +372,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
}
if (endIdx > 0) {
cmd = cmd.replace(cmd.substring(start, endIdx+2), returnMsg);
cmd = cmd.replace(cmd.substring(start, endIdx + 2),
returnMsg);
} else {
start = start - 3;
cmd = cmd.substring(0, start) + returnMsg;
@ -403,7 +411,12 @@ public class ProductScriptsDialog extends CaveJFACEDialog {
publishToOfficialButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (SimulatedTimeOperations.isTransmitAllowed()) {
launchPublishToOfficial();
} else {
SimulatedTimeOperations.displayFeatureLevelWarning(
getShell(), "Publish Grids to Official");
}
}
});

View file

@ -35,6 +35,8 @@ import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.TabFolder;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog;
@ -44,6 +46,7 @@ import com.raytheon.viz.gfe.tasks.TaskManager;
import com.raytheon.viz.gfe.textformatter.FormatterUtil;
import com.raytheon.viz.gfe.textformatter.TextProductFinishListener;
import com.raytheon.viz.gfe.textformatter.TextProductManager;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
/**
* Composite containing the product area and its controls.
@ -68,6 +71,7 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager;
* Passed dataMgr instance to FormatterUtil.runFormatterScript
* 12 FEB 2014 2801 randerso Added prompting if formatter is run against non-normal database
* 20 APR 2015 4027 randerso Fixes for GFE formatter auto tests to support mixed case WA
* 15 SEP 2015 4858 dgilling Handle exception from runFormatterScript.
*
* </pre>
*
@ -77,6 +81,10 @@ import com.raytheon.viz.gfe.textformatter.TextProductManager;
*/
public class ProductAreaComp extends Composite implements
TextProductFinishListener, ITransmissionState {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(getClass());
/**
* Zone combiner image.
*/
@ -404,10 +412,14 @@ public class ProductAreaComp extends Composite implements
// Get the source database
zoneCombiner.applyZoneCombo();
try {
FormatterUtil.runFormatterScript(dataMgr,
textProductMgr, productName,
dbId.toString(), vtecMode,
ProductAreaComp.this);
} catch (SimulatedTimeProhibitedOpException e) {
statusHandler.error(e.getLocalizedMessage(), e);
}
}
}
}

View file

@ -119,6 +119,7 @@ import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData.ProductStateEnu
import com.raytheon.viz.gfe.product.ProductFileUtil;
import com.raytheon.viz.gfe.product.TextDBUtil;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
/**
* Composite containing the product editor controls.
@ -168,6 +169,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* 04/20/2015 4027 randerso Renamed ProductStateEnum with an initial capital
* Expunged Calendar from ActiveTableRecord
* 08/10/2015 4721 randerso Changed getNNNid() to use the productID field (not textdbPil)
* 09/15/2015 4858 dgilling Disable store/transmit in DRT mode.
* </pre>
*
* @author lvenable
@ -1082,9 +1084,14 @@ public class ProductEditorComp extends Composite implements
* dialog. AUTOSTORE: implement autoStore
*/
private void storeTransmit(Action action) {
if (!SimulatedTimeOperations.isTransmitAllowed()) {
SimulatedTimeOperations.displayFeatureLevelWarning(getShell(),
"Text Product Store/Transmit");
brain();
return;
}
ProductDataStruct pds = textComp.getProductDataStruct();
if (pds == null) {
String msg = "There is no product to transmit.\n\nAction cancelled.";
MessageBox mb = new MessageBox(getShell(), SWT.OK

View file

@ -60,6 +60,8 @@ import com.raytheon.viz.gfe.product.TextDBUtil;
import com.raytheon.viz.gfe.vtec.GFEVtecUtil;
import com.raytheon.viz.texteditor.util.VtecObject;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
/**
* Display the Store/Transmit dialog.
@ -89,6 +91,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Feb 26, 2015 4126 randerso Ensure transmit/store is properly cancelled if dialog is closed
* Code cleanup
* Apr 20, 2015 4027 randerso Renamed ProductStateEnum with an initial capital
* Sep 15, 2015 4858 dgilling Disable store/transmit in DRT mode.
*
* </pre>
*
@ -432,6 +435,11 @@ public class StoreTransmitDlg extends CaveSWTDialog {
transmitProduct(true);
}
} else {
if (!SimulatedTimeOperations.isTransmitAllowed()) {
throw SimulatedTimeOperations
.constructProhibitedOpException("Store/Transmit GFE text products");
}
if (isStoreDialog) {
TextDBUtil.storeProduct(pid, productText,
parentEditor.isTestVTEC());
@ -443,7 +451,11 @@ public class StoreTransmitDlg extends CaveSWTDialog {
statusHandler.handle(Priority.CRITICAL,
"Error preparing product for transmission.", e);
sendTransmissionStatus(ConfigData.ProductStateEnum.Failed);
StoreTransmitDlg.this.parentEditor.revive();
parentEditor.revive();
} catch (SimulatedTimeProhibitedOpException e) {
statusHandler.error(e.getLocalizedMessage(), e);
sendTransmissionStatus(ConfigData.ProductStateEnum.Failed);
parentEditor.brain();
}
}
@ -621,7 +633,7 @@ public class StoreTransmitDlg extends CaveSWTDialog {
} catch (VizException e) {
statusHandler.handle(Priority.CRITICAL, "Error sending product", e);
sendTransmissionStatus(ConfigData.ProductStateEnum.Failed);
this.parentEditor.revive();
parentEditor.revive();
}
SEQ_NUMBER++;

View file

@ -44,6 +44,8 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID;
import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID;
import com.raytheon.uf.common.dataplugin.gfe.server.request.SendISCRequest;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.PythonPreferenceStore;
@ -52,6 +54,7 @@ import com.raytheon.viz.gfe.core.IParmManager;
import com.raytheon.viz.gfe.core.ISelectTimeRangeManager;
import com.raytheon.viz.gfe.core.parm.ParmOp;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
import com.raytheon.viz.ui.widgets.ToggleSelectList;
/**
@ -66,6 +69,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
* 08/20/09 1995 lvenable Initial creation
* 09/02/09 #1370 randerso Make the same as PublishDialog
* 10/26/2012 1287 rferrel Code cleanup for non-blocking dialog.
* 09/15/2015 4858 dgilling Handle exception from ParmOp.sendISC.
*
* </pre>
*
@ -74,6 +78,9 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
*/
public class SendISCDialog extends CaveJFACEDialog {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(getClass());
private final int MAX_LIST_HEIGHT = 10;
private final PythonPreferenceStore prefs = Activator.getDefault()
@ -438,7 +445,11 @@ public class SendISCDialog extends CaveJFACEDialog {
// LogStream.logUse("Send ISC: ", requests);
// send the data by calling the parm op command
try {
parmOp.sendISC(requests);
} catch (SimulatedTimeProhibitedOpException e) {
statusHandler.error(e.getLocalizedMessage(), e);
}
}
protected TimeRange getTR(ParmID parm) {

View file

@ -1,177 +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.gfe.menu;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IContributionItem;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.CompoundContributionItem;
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.core.msgs.ISCSendStatusChangedMsg;
import com.raytheon.viz.gfe.core.msgs.Message;
import com.raytheon.viz.gfe.dialogs.isc.ISCRequestReplyDlg;
import com.raytheon.viz.gfe.dialogs.isc.SendISCDialog;
/**
* Menu handler for enabling and disabling ISC related menu items
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jun 20, 2011 bphillip Initial creation
* Oct 25, 2012 1287 rferrel Changes for non-blocking SendISCDialog
* and ISCRequestReplyDlg.
* Aug 29, 2014 3527 mapeters Check for current DataManager instance to not
* be null before requesting ISC, updated deprecated
* {@link DataManager#getCurrentInstance()} calls.
*
* </pre>
*
* @author bphillip
* @version 1.0
*/
public class ISCMenuEnabler extends CompoundContributionItem {
private SendISCDialog sendISCDlg;
private ISCRequestReplyDlg iscRequestDlg;
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
*/
@Override
protected IContributionItem[] getContributionItems() {
ActionContributionItem sendIntersiteItem = new ActionContributionItem(
new Action("Send Intersite Grids") {
public void run() {
Shell shell = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell();
DataManager dm = DataManagerUIFactory
.getCurrentInstance();
if (dm == null) {
return;
}
if (sendISCDlg == null || sendISCDlg.getShell() == null
|| sendISCDlg.isDisposed()) {
sendISCDlg = new SendISCDialog(shell, dm);
sendISCDlg.setBlockOnOpen(false);
sendISCDlg.open();
} else {
sendISCDlg.bringToTop();
}
}
@Override
public boolean isEnabled() {
DataManager dm = DataManagerUIFactory
.getCurrentInstance();
if (dm == null) {
return false;
} else {
return (!dm.sendIscOnSave() || !dm
.sendIscOnPublish())
&& CAVEMode.getMode().equals(
CAVEMode.OPERATIONAL)
&& dm.requestISC();
}
}
});
ActionContributionItem iscRequestReplyItem = new ActionContributionItem(
new Action("ISC Request/Reply") {
@Override
public boolean isEnabled() {
DataManager dm = DataManagerUIFactory
.getCurrentInstance();
if (dm == null) {
return false;
} else {
return CAVEMode.getMode().equals(
CAVEMode.OPERATIONAL)
&& dm.requestISC();
}
}
@Override
public void run() {
if (iscRequestDlg == null
|| iscRequestDlg.getShell() == null
|| iscRequestDlg.isDisposed()) {
Shell shell = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell();
iscRequestDlg = new ISCRequestReplyDlg(shell);
iscRequestDlg.open();
} else {
iscRequestDlg.bringToTop();
}
}
});
ActionContributionItem iscSendEnableItem = new ActionContributionItem(
new Action("ISC Send Enable", IAction.AS_CHECK_BOX) {
@Override
public boolean isEnabled() {
return getIscEnabled();
}
public void run() {
DataManager dm = DataManagerUIFactory
.getCurrentInstance();
if (dm != null) {
boolean newState = !Message.inquireLastMessage(
ISCSendStatusChangedMsg.class).isEnabled();
dm.enableISCsend(newState);
}
}
private boolean getIscEnabled() {
DataManager dm = DataManagerUIFactory
.getCurrentInstance();
return (dm != null) ? CAVEMode.getMode().equals(
CAVEMode.OPERATIONAL)
&& dm.requestISC() : false;
}
public boolean isChecked() {
return Message.inquireLastMessage(
ISCSendStatusChangedMsg.class).isEnabled();
}
});
return new IContributionItem[] { sendIntersiteItem,
iscRequestReplyItem, iscSendEnableItem };
}
}

View file

@ -19,6 +19,7 @@
**/
package com.raytheon.viz.gfe.perspective;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.commands.Command;
@ -44,6 +45,7 @@ import org.eclipse.ui.keys.IBindingService;
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.common.time.ISimulatedTimeChangeListener;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
@ -53,7 +55,6 @@ import com.raytheon.uf.viz.core.drawables.ResourcePair;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.maps.MapManager;
import com.raytheon.viz.core.mode.CAVEMode;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.PythonPreferenceStore;
import com.raytheon.viz.gfe.actions.FormatterlauncherAction;
@ -69,6 +70,7 @@ import com.raytheon.viz.ui.cmenu.ZoomMenuAction;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.perspectives.AbstractCAVEPerspectiveManager;
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
/**
* Manages the life cycle of the GFE Perspectives
@ -91,17 +93,26 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
* Dec 09, 2013 #2367 dgilling Remove shutdown of ProcedureJob and
* SmartToolJob.
* Jan 14, 2014 2594 bclement added low memory notification
* Aug 31, 2015 #17970 yteng Notify user to close GFE if not in real-time
* Sep 21, 2015 4858 dgilling Display warning message when DRT mode is enabled.
* </pre>
*
* @author randerso
* @version 1.0
*/
public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager
implements ISimulatedTimeChangeListener {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GFEPerspectiveManager.class);
private static final String PERSPECTIVE_NAME = "GFE";
private static final List<String> FEATURES_DISABLED_IN_SIM_TIME = Arrays
.asList("ISC send", "Publishing grids",
"Running text formatters and/or transmitting products",
"Running scripts from the Product Scripts Dialog");
/** The GFE Perspective Class */
public static final String GFE_PERSPECTIVE = "com.raytheon.viz.ui.GFEPerspective";
@ -179,21 +190,16 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
+ GFESpatialDisplayManager.class.getName());
}
}
SimulatedTime.getSystemTime().addSimulatedTimeChangeListener(this);
}
@Override
public void activate() {
if (CAVEMode.getMode().equals(CAVEMode.OPERATIONAL) &&
!SimulatedTime.getSystemTime().isRealTime()
&& !CAVEMode.getFlagInDRT()) {
UFStatus.getHandler().handle(
Priority.WARN,
"CAVE in OPERATIONAL mode and CAVE clock is not set to real-time. Please close all GFE sessions, if any.");
}
super.activate();
displaySimulatedTimeWarning();
// Hack to disable editor closing
IWorkbenchPage activePage = perspectiveWindow.getActivePage();
if (activePage != null) {
@ -227,6 +233,8 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
public void close() {
super.close();
SimulatedTime.getSystemTime().removeSimulatedTimeChangeListener(this);
try {
DataManager dm = DataManagerUIFactory
.findInstance(perspectiveWindow);
@ -423,4 +431,21 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager {
+ "\n\nConsider saving Fcst grids to free up memory.";
}
@Override
public void timechanged() {
String activePerspective = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().getPerspective()
.getId();
if (GFE_PERSPECTIVE.equals(activePerspective)) {
displaySimulatedTimeWarning();
}
}
private void displaySimulatedTimeWarning() {
if (!SimulatedTimeOperations.isTransmitAllowed()) {
SimulatedTimeOperations.displayPerspectiveLevelWarning(
perspectiveWindow.getShell(), PERSPECTIVE_NAME,
FEATURES_DISABLED_IN_SIM_TIME);
}
}
}

View file

@ -23,14 +23,14 @@ import java.text.SimpleDateFormat;
import java.util.TimeZone;
import com.raytheon.uf.common.activetable.ActiveTableMode;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.common.time.TimeRange;
import com.raytheon.viz.core.mode.CAVEMode;
import com.raytheon.viz.gfe.core.DataManager;
import com.raytheon.viz.gfe.dialogs.formatterlauncher.ConfigData;
import com.raytheon.viz.gfe.tasks.TaskManager;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeOperations;
import com.raytheon.viz.ui.simulatedtime.SimulatedTimeProhibitedOpException;
/**
* Utilities for text formatter
@ -46,6 +46,7 @@ import com.raytheon.viz.gfe.tasks.TaskManager;
* Removed call to TextProductManager.reloadModule
* Apr 20, 2015 4027 randerso Renamed ProductStateEnum with an initial capital
* Fixed hard coded active table mode in runFormatterScript
* Sep 15, 2015 4858 dgilling Prevent formatters from being run in DRT mode.
*
* </pre>
*
@ -54,11 +55,10 @@ import com.raytheon.viz.gfe.tasks.TaskManager;
*/
public class FormatterUtil {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(FormatterUtil.class);
public static String[] VTEC_MODES = { "Normal: NoVTEC", "Normal: O-Vtec",
"Normal: E-Vtec", "Normal: X-Vtec", "Test: NoVTEC", "Test: T-Vtec" };
public static final String[] VTEC_MODES = { "Normal: NoVTEC",
"Normal: O-Vtec", "Normal: E-Vtec", "Normal: X-Vtec",
"Test: NoVTEC", "Test: T-Vtec" };
/**
* Runs a text formatter script for a given product
@ -76,10 +76,12 @@ public class FormatterUtil {
* VTEC mode
* @param finish
* listener to fire when formatter finishes generating product
* @throws SimulatedTimeProhibitedOperationException
*/
public static void runFormatterScript(DataManager dataMgr,
TextProductManager productMgr, String productName, String dbId,
String vtecMode, TextProductFinishListener finish) {
String vtecMode, TextProductFinishListener finish)
throws SimulatedTimeProhibitedOpException {
int testMode = 0;
ActiveTableMode atMode = ActiveTableMode.OPERATIONAL;
@ -129,11 +131,15 @@ public class FormatterUtil {
public static void runFormatterScript(String name, String vtecMode,
String databaseID, String varDict, String vtecActiveTable,
String drtTime, int testMode, TextProductFinishListener finish) {
String drtTime, int testMode, TextProductFinishListener finish)
throws SimulatedTimeProhibitedOpException {
if (!SimulatedTimeOperations.isTransmitAllowed()) {
throw SimulatedTimeOperations
.constructProhibitedOpException("GFE Text formatters");
}
TextFormatter formatter = new TextFormatter(name, vtecMode, databaseID,
varDict, vtecActiveTable, drtTime, testMode, finish);
// Thread thread = new Thread(formatter);
// thread.start();
finish.textProductQueued(ConfigData.ProductStateEnum.Queued);
TaskManager.getInstance().queueFormatter(formatter);
}

View file

@ -19,9 +19,6 @@
**/
package com.raytheon.viz.warngen.gui;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.ResourcePair;
@ -29,7 +26,6 @@ import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.tools.GenericToolsResourceData;
import com.raytheon.uf.viz.core.rsc.tools.action.AbstractGenericToolAction;
import com.raytheon.viz.core.mode.CAVEMode;
import com.raytheon.viz.ui.input.EditableManager;
/**
@ -44,7 +40,6 @@ import com.raytheon.viz.ui.input.EditableManager;
* Oct 10, 2010 6990 Qinglu Lin Used D. Friedman short solution,
* with minor changes.
* Aug 15, 2013 DR 16418 D. Friedman Always show the dialog.
* Sep 3, 2015 DR 17886 Qinglu Lin Updated for popping up alertViz when switching to DRT.
*
* </pre>
*
@ -69,20 +64,11 @@ public class WarngenAction extends AbstractGenericToolAction<WarngenLayer> {
protected WarngenLayer getResource(LoadProperties loadProperties,
IDescriptor descriptor) throws VizException {
if (CAVEMode.getMode().equals(CAVEMode.OPERATIONAL) &&
!SimulatedTime.getSystemTime().isRealTime() &&
!CAVEMode.getFlagInDRT()) {
UFStatus.getHandler().handle(Priority.WARN,
"WarnGen cannot be launched while " +
"CAVE in OPERATIONAL mode and the CAVE clock is not set to real-time.");
return null;
}
for (IDisplayPane pane : getSelectedPanes()) {
for (ResourcePair rp : pane.getDescriptor().getResourceList()) {
if (rp.getResource() instanceof WarngenLayer) {
EditableManager.makeEditable(rp.getResource(), true);
((WarngenLayer) rp.getResource())
.showDialog(true);
((WarngenLayer) rp.getResource()).showDialog(true);
return (WarngenLayer) rp.getResource();
}
}