ASM #14246 - Implemented MPE Transmit Best Estimate option

Change-Id: If6dc3df81ecfee998ebcc4de8ee47ddc2466868e

Former-commit-id: 79ae030ca6 [formerly 4a769ef560] [formerly 79ae030ca6 [formerly 4a769ef560] [formerly f2476cae94 [formerly 212076c520952d0327591b79449ae09ad063adf1]]]
Former-commit-id: f2476cae94
Former-commit-id: 7aa40a0654 [formerly 1e849a4bba]
Former-commit-id: 7226e889f8
This commit is contained in:
Loubna.Bousaidi 2015-01-08 15:31:58 +00:00
parent 96f0329ad5
commit c83ade000b
6 changed files with 240 additions and 54 deletions

View file

@ -125,7 +125,7 @@
visible="true">
</separator>
<command
commandId="com.raytheon.viz.ui.actions.notImplemented1"
commandId="com.raytheon.viz.mpe.ui.actions.transmitBestEstimateQPE"
label="Transmit Best Estimate QPE"
mnemonic="T">
</command>
@ -984,8 +984,8 @@
name="Clear MPE Data">
</command>
<command
id="com.raytheon.viz.ui.actions.notImplemented1"
name="NOT Implemented">
id="com.raytheon.viz.mpe.ui.actions.transmitBestEstimateQPE"
name="Transmit Best Estimate QPE">
</command>
<command
id="com.raytheon.viz.mpe.ui.actions.transmitRFCBias"
@ -1222,6 +1222,23 @@
definitionId="com.raytheon.viz.inMPEActionSet">
</reference>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.mpe.ui.actions.TransmitBestEstimateQPE"
commandId="com.raytheon.viz.mpe.ui.actions.transmitBestEstimateQPE">
<enabledWhen>
<with
variable="com.raytheon.viz.mpe.ui.transmitBestEstimateQPE">
<equals value="true">
</equals>
</with>
</enabledWhen>
<activeWhen>
<reference
definitionId="com.raytheon.viz.inMPEActionSet">
</reference>
</activeWhen>
</handler>
<handler
class="com.raytheon.viz.mpe.ui.actions.TransmitRFCBias"
@ -1803,9 +1820,9 @@
</extension>
<extension point="org.eclipse.ui.services">
<sourceProvider
provider="com.raytheon.viz.mpe.ui.NotImplementedSourceProvider">
provider="com.raytheon.viz.mpe.ui.TransmitBestEstimateQPEProvider">
<variable
name="com.raytheon.viz.mpe.ui.notImplemented"
name="com.raytheon.viz.mpe.ui.transmitBestEstimateQPE"
priorityLevel="activeWorkbenchWindow">
</variable>
</sourceProvider>

View file

@ -1,49 +0,0 @@
package com.raytheon.viz.mpe.ui;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.ui.AbstractSourceProvider;
public class NotImplementedSourceProvider extends AbstractSourceProvider {
private static final String[] MENU_ENABLED = new String[] { "com.raytheon.viz.mpe.ui.notImplemented" };
private final boolean enabled = false;
private final Map<String, Boolean> sourceMap = new HashMap<String, Boolean>();
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISourceProvider#dispose()
*/
@Override
public void dispose() {
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISourceProvider#getCurrentState()
*/
@Override
public Map<String, Boolean> getCurrentState() {
// System.out.println("test");
sourceMap.put(MENU_ENABLED[0], enabled);
return sourceMap;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISourceProvider#getProvidedSourceNames()
*/
@Override
public String[] getProvidedSourceNames() {
// System.out.println("test1");
// TODO Auto-generated method stub
return MENU_ENABLED;
}
}

View file

@ -0,0 +1,120 @@
/**
* 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.mpe.ui;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.ui.AbstractSourceProvider;
import org.eclipse.ui.ISources;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.services.ISourceProviderService;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.viz.ui.VizWorkbenchManager;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 05, 2015 #14246 lbousaidi Initial creation
*
* </pre>
*
* @author lbousaidi
* @version 1.0
*/
public class TransmitBestEstimateQPEProvider extends AbstractSourceProvider {
private static final String[] MENU_ENABLED = new String[] { "com.raytheon.viz.mpe.ui.transmitBestEstimateQPE" };
private final boolean enabled = false;
private final Map<String, Boolean> sourceMap = new HashMap<String, Boolean>();
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISourceProvider#dispose()
*/
@Override
public void dispose() {
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISourceProvider#getCurrentState()
*/
@Override
public Map<String, Boolean> getCurrentState() {
sourceMap.put(MENU_ENABLED[0], enabled);
return sourceMap;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.ISourceProvider#getProvidedSourceNames()
*/
@Override
public String[] getProvidedSourceNames() {
// TODO Auto-generated method stub
return MENU_ENABLED;
}
public static void setEnabled(boolean enabled) {
AppsDefaults appsDefaults = AppsDefaults.getInstance();
boolean transmitFlag=appsDefaults.getBoolean("mpe_send_qpe_to_sbn", false);
IWorkbenchWindow window = VizWorkbenchManager.getInstance()
.getCurrentWindow();
if (window != null) {
ISourceProviderService service = (ISourceProviderService) window
.getService(ISourceProviderService.class);
TransmitBestEstimateQPEProvider provider =
(TransmitBestEstimateQPEProvider) service
.getSourceProvider(MENU_ENABLED[0]);
Map<String, Boolean> sourceMap = new HashMap<String, Boolean>();
sourceMap.put(MENU_ENABLED[0], transmitFlag?enabled:false);
provider.fireSourceChanged(ISources.ACTIVE_WORKBENCH_WINDOW,
sourceMap);
}
}
public static TransmitBestEstimateQPEProvider getProvider(ExecutionEvent event) {
ISourceProviderService service = (ISourceProviderService) HandlerUtil
.getActiveWorkbenchWindow(event).getService(
ISourceProviderService.class);
return (TransmitBestEstimateQPEProvider) service
.getSourceProvider(MENU_ENABLED[0]);
}
}

View file

@ -25,6 +25,7 @@ import org.eclipse.ui.IEditorPart;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.viz.mpe.ui.TransmitBestEstimateQPEProvider;
import com.raytheon.viz.mpe.ui.TransmitRFCBiasProvider;
import com.raytheon.viz.ui.EditorUtil;
@ -40,6 +41,8 @@ import com.raytheon.viz.ui.EditorUtil;
* ------------ ---------- ----------- --------------------------
* Jan 3, 2012 mschenke Initial creation
* Feb 26, 2014 2842 mpduff Use PlatformUI rather than HandlerUtil.
* Jan 05, 2015 14246 lbousaidi disable TransmitBestEstimateQPE when you
* clear data.
*
* </pre>
*
@ -69,6 +72,7 @@ public class ClearMPEData extends FullScreen {
// Ensure in full screen
super.execute(event);
TransmitRFCBiasProvider.setEnabled(false);
TransmitBestEstimateQPEProvider.setEnabled(false);
return null;
}
}

View file

@ -0,0 +1,91 @@
/**
* 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.mpe.ui.actions;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.viz.core.IDisplayPane;
import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 05 , 2015 #14246 lbousaidi Initial creation
*
* </pre>
*
* @author lbousaidi
* @version 1.0
*/
public class TransmitBestEstimateQPE extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = EditorUtil.getActiveEditor();
IDisplayPane pane = null;
if (editor instanceof IMultiPaneEditor) {
IMultiPaneEditor multiPane = (IMultiPaneEditor) editor;
if (multiPane.getNumberofPanes() > 1
&& multiPane.displayedPaneCount() > 1) {
pane = multiPane.getSelectedPane(IMultiPaneEditor.LOAD_ACTION);
} else {
pane = ((IDisplayPaneContainer) editor).getDisplayPanes()[0];
}
}
MPEDisplayManager dm = MPEDisplayManager.getInstance(pane);
Date currentDate = dm.getCurrentEditDate();
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHH");
String transmitDate = formatter.format(currentDate);
AppsDefaults appsDefaults = AppsDefaults.getInstance();
String scriptDir = appsDefaults.getToken("pproc_bin");
String scriptName = "transmit_rfc_qpe";
ProcessBuilder pb = new ProcessBuilder(scriptDir + "/" + scriptName,
transmitDate);
try {
pb.start();
} catch (IOException e) {
e.printStackTrace();
}
// TODO Auto-generated method stub
return null;
}
}

View file

@ -49,6 +49,7 @@ import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.viz.mpe.core.MPEDataManager;
import com.raytheon.viz.mpe.core.MPEDataManager.MPEDateInfo;
import com.raytheon.viz.mpe.ui.MPEDisplayManager;
import com.raytheon.viz.mpe.ui.TransmitBestEstimateQPEProvider;
import com.raytheon.viz.mpe.ui.TransmitRFCBiasProvider;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
@ -65,6 +66,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor;
* Apr 30, 2013 lbousaidi made seconds in the date/Time
* fields visible.
* Aug 26, 2014 14578 snaples Added Ending Hydrologic Date selection.
* Jan 05, 2015 14246 lbousaidi enable Transmit Best Estimate QPE.
* </pre>
*
* @author randerso
@ -319,6 +321,7 @@ public class ChooseDataPeriodDialog extends CaveJFACEDialog {
restore();
}
TransmitRFCBiasProvider.setEnabled(true);
TransmitBestEstimateQPEProvider.setEnabled(true);
}
});