reworked Open Bundle (Procedure) and added Save Bundle (Procedure) for use by non-ops
Former-commit-id: 262a9d4407
This commit is contained in:
parent
19a32bf594
commit
2d424f3862
6 changed files with 419 additions and 89 deletions
|
@ -70,48 +70,61 @@
|
||||||
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
|
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
|
||||||
</reference>
|
</reference>
|
||||||
</visibleWhen>
|
</visibleWhen>
|
||||||
|
<command
|
||||||
|
commandId="org.eclipse.ui.window.newEditor"
|
||||||
|
label="New Map..."
|
||||||
|
style="push">
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.raytheon.viz.ui.loadSerialized"
|
||||||
|
label="Load Map..."
|
||||||
|
style="push">
|
||||||
|
</command>
|
||||||
<separator
|
<separator
|
||||||
name="top"
|
name="bundleSeparator"
|
||||||
visible="false">
|
visible="true">
|
||||||
|
</separator>
|
||||||
|
<command
|
||||||
|
commandId="com.raytheon.viz.ui.openAWIPSProcedure"
|
||||||
|
label="Load Bundle"
|
||||||
|
style="push">
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.raytheon.viz.ui.saveAWIPSProcedure"
|
||||||
|
label="Save Bundle"
|
||||||
|
style="push">
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.raytheon.viz.ui.deleteAWIPSProcedure"
|
||||||
|
label="Delete Bundle"
|
||||||
|
style="push">
|
||||||
|
</command>
|
||||||
|
<separator
|
||||||
|
name="saveSeparator"
|
||||||
|
visible="true">
|
||||||
|
</separator>
|
||||||
|
<command
|
||||||
|
commandId="com.raytheon.viz.ui.saveBundle"
|
||||||
|
label="Save Map Locally"
|
||||||
|
style="push">
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.raytheon.viz.ui.saveProcedure"
|
||||||
|
label="Save Bundle Locally"
|
||||||
|
style="push">
|
||||||
|
</command>
|
||||||
|
<separator
|
||||||
|
name="importExportSeparator"
|
||||||
|
visible="true">
|
||||||
</separator>
|
</separator>
|
||||||
<menu
|
<menu
|
||||||
label="Procedures">
|
id="import"
|
||||||
<command
|
label="Import">
|
||||||
commandId="com.raytheon.viz.ui.newAWIPSProcedure"
|
</menu>
|
||||||
label="New..."
|
<menu
|
||||||
style="push">
|
id="export"
|
||||||
</command>
|
label="Export">
|
||||||
<command
|
|
||||||
commandId="com.raytheon.viz.ui.openAWIPSProcedure"
|
|
||||||
label="Open..."
|
|
||||||
style="push">
|
|
||||||
</command>
|
|
||||||
<command
|
|
||||||
commandId="com.raytheon.viz.ui.deleteAWIPSProcedure"
|
|
||||||
label="Delete..."
|
|
||||||
style="push">
|
|
||||||
</command>
|
|
||||||
<command
|
|
||||||
commandId="com.raytheon.viz.ui.copyOutAWIPSProcedure"
|
|
||||||
label="Copy Display to Procedure(s)"
|
|
||||||
style="push">
|
|
||||||
</command>
|
|
||||||
</menu>
|
</menu>
|
||||||
<command
|
|
||||||
commandId="com.raytheon.viz.ui.showHistoryList"
|
|
||||||
label="History List..."
|
|
||||||
style="push">
|
|
||||||
</command>
|
|
||||||
<command
|
|
||||||
commandId="com.raytheon.uf.viz.d2d.ui.actions.showPrintDialog"
|
|
||||||
label="Print..."
|
|
||||||
style="push">
|
|
||||||
</command>
|
|
||||||
<command
|
|
||||||
commandId="com.raytheon.uf.viz.image.export.save"
|
|
||||||
label="Capture Window..."
|
|
||||||
style="push">
|
|
||||||
</command>
|
|
||||||
</menu>
|
</menu>
|
||||||
<menu
|
<menu
|
||||||
id="view"
|
id="view"
|
||||||
|
@ -192,7 +205,7 @@
|
||||||
</separator>
|
</separator>
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.uf.viz.d2d.ui.actions.changeD2DLayout"
|
commandId="com.raytheon.uf.viz.d2d.ui.actions.changeD2DLayout"
|
||||||
label="Default Pane Layout">
|
label="Full Layout">
|
||||||
<parameter
|
<parameter
|
||||||
name="sideViews"
|
name="sideViews"
|
||||||
value="4">
|
value="4">
|
||||||
|
@ -200,7 +213,7 @@
|
||||||
</command>
|
</command>
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.uf.viz.d2d.ui.actions.changeD2DLayout"
|
commandId="com.raytheon.uf.viz.d2d.ui.actions.changeD2DLayout"
|
||||||
label="Full Layout">
|
label="WFO Layout">
|
||||||
<parameter
|
<parameter
|
||||||
name="sideViews"
|
name="sideViews"
|
||||||
value="0">
|
value="0">
|
||||||
|
@ -273,6 +286,11 @@
|
||||||
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
|
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
|
||||||
</reference>
|
</reference>
|
||||||
</visibleWhen>
|
</visibleWhen>
|
||||||
|
<command
|
||||||
|
commandId="com.raytheon.viz.ui.showHistoryList"
|
||||||
|
label="History List..."
|
||||||
|
style="push">
|
||||||
|
</command>
|
||||||
<separator
|
<separator
|
||||||
name="tools.start"
|
name="tools.start"
|
||||||
visible="false">
|
visible="false">
|
||||||
|
@ -393,7 +411,7 @@
|
||||||
id="loopControls">
|
id="loopControls">
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.viz.ui.tools.looping.frameTool"
|
commandId="com.raytheon.viz.ui.tools.looping.frameTool"
|
||||||
icon="icons/first0.gif"
|
icon="icons/fast-backward.png"
|
||||||
label="First Frame"
|
label="First Frame"
|
||||||
style="push">
|
style="push">
|
||||||
<visibleWhen>
|
<visibleWhen>
|
||||||
|
@ -412,7 +430,7 @@
|
||||||
</command>
|
</command>
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.viz.ui.tools.looping.frameTool"
|
commandId="com.raytheon.viz.ui.tools.looping.frameTool"
|
||||||
icon="icons/back0.gif"
|
icon="icons/play-left.png"
|
||||||
label="Previous Frame"
|
label="Previous Frame"
|
||||||
style="push">
|
style="push">
|
||||||
<visibleWhen>
|
<visibleWhen>
|
||||||
|
@ -431,7 +449,7 @@
|
||||||
</command>
|
</command>
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.viz.ui.tools.looping.frameTool"
|
commandId="com.raytheon.viz.ui.tools.looping.frameTool"
|
||||||
icon="icons/fwd0.gif"
|
icon="icons/play-right.png"
|
||||||
label="Next Frame"
|
label="Next Frame"
|
||||||
style="push">
|
style="push">
|
||||||
<visibleWhen>
|
<visibleWhen>
|
||||||
|
@ -450,7 +468,7 @@
|
||||||
</command>
|
</command>
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.viz.ui.tools.looping.frameTool"
|
commandId="com.raytheon.viz.ui.tools.looping.frameTool"
|
||||||
icon="icons/last0.gif"
|
icon="icons/fast-forward.png"
|
||||||
label="Last Frame"
|
label="Last Frame"
|
||||||
style="push">
|
style="push">
|
||||||
<visibleWhen>
|
<visibleWhen>
|
||||||
|
@ -469,7 +487,7 @@
|
||||||
</command>
|
</command>
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.viz.ui.tools.looping.loop"
|
commandId="com.raytheon.viz.ui.tools.looping.loop"
|
||||||
icon="icons/looping0.gif"
|
icon="icons/refresh.png"
|
||||||
label="Loop"
|
label="Loop"
|
||||||
style="toggle">
|
style="toggle">
|
||||||
<visibleWhen>
|
<visibleWhen>
|
||||||
|
@ -480,7 +498,7 @@
|
||||||
</command>
|
</command>
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.viz.ui.tools.looping.loopProperties"
|
commandId="com.raytheon.viz.ui.tools.looping.loopProperties"
|
||||||
icon="icons/loopprop0.gif"
|
icon="icons/gear.png"
|
||||||
label="Loop Controls"
|
label="Loop Controls"
|
||||||
style="push">
|
style="push">
|
||||||
<visibleWhen>
|
<visibleWhen>
|
||||||
|
@ -505,7 +523,7 @@
|
||||||
</command>
|
</command>
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.viz.ui.imageProperties"
|
commandId="com.raytheon.viz.ui.imageProperties"
|
||||||
icon="icons/imageprop.gif"
|
icon="icons/picture-o.png"
|
||||||
label="Image Properties">
|
label="Image Properties">
|
||||||
<visibleWhen>
|
<visibleWhen>
|
||||||
<reference
|
<reference
|
||||||
|
@ -513,22 +531,12 @@
|
||||||
</reference>
|
</reference>
|
||||||
</visibleWhen>
|
</visibleWhen>
|
||||||
</command>
|
</command>
|
||||||
<command
|
|
||||||
commandId="com.raytheon.uf.viz.d2d.ui.actions.showPrintDialog"
|
|
||||||
icon="icons/print.gif"
|
|
||||||
label="Print">
|
|
||||||
<visibleWhen>
|
|
||||||
<reference
|
|
||||||
definitionId="com.raytheon.uf.viz.d2d.ui.inD2DActionSet">
|
|
||||||
</reference>
|
|
||||||
</visibleWhen>
|
|
||||||
</command>
|
|
||||||
<separator
|
<separator
|
||||||
name="tools.toolbar" visible="false">
|
name="tools.toolbar" visible="false">
|
||||||
</separator>
|
</separator>
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.uf.viz.d2d.ui.actions.changeD2DLayout"
|
commandId="com.raytheon.uf.viz.d2d.ui.actions.changeD2DLayout"
|
||||||
icon="icons/square.png"
|
icon="icons/stop.png"
|
||||||
label="Full Layout">
|
label="Full Layout">
|
||||||
<parameter
|
<parameter
|
||||||
name="sideViews"
|
name="sideViews"
|
||||||
|
@ -1285,6 +1293,10 @@
|
||||||
class="com.raytheon.uf.viz.d2d.ui.actions.OpenAWIPSProcedure"
|
class="com.raytheon.uf.viz.d2d.ui.actions.OpenAWIPSProcedure"
|
||||||
commandId="com.raytheon.viz.ui.openAWIPSProcedure">
|
commandId="com.raytheon.viz.ui.openAWIPSProcedure">
|
||||||
</handler>
|
</handler>
|
||||||
|
<handler
|
||||||
|
class="com.raytheon.uf.viz.d2d.ui.actions.SaveAWIPSProcedure"
|
||||||
|
commandId="com.raytheon.viz.ui.saveAWIPSProcedure">
|
||||||
|
</handler>
|
||||||
<handler
|
<handler
|
||||||
class="com.raytheon.uf.viz.d2d.ui.actions.DeleteAWIPSProcedure"
|
class="com.raytheon.uf.viz.d2d.ui.actions.DeleteAWIPSProcedure"
|
||||||
commandId="com.raytheon.viz.ui.deleteAWIPSProcedure">
|
commandId="com.raytheon.viz.ui.deleteAWIPSProcedure">
|
||||||
|
@ -1376,9 +1388,9 @@
|
||||||
</key>
|
</key>
|
||||||
<key
|
<key
|
||||||
contextId="com.raytheon.uf.viz.d2d.ui"
|
contextId="com.raytheon.uf.viz.d2d.ui"
|
||||||
commandId="com.raytheon.viz.ui.newAWIPSProcedure"
|
commandId="com.raytheon.viz.ui.saveAWIPSProcedure"
|
||||||
schemeId="com.raytheon.viz.ui.cave.scheme"
|
schemeId="com.raytheon.viz.ui.cave.scheme"
|
||||||
sequence="M1+N">
|
sequence="M1+S">
|
||||||
</key>
|
</key>
|
||||||
<key
|
<key
|
||||||
contextId="com.raytheon.uf.viz.d2d.ui"
|
contextId="com.raytheon.uf.viz.d2d.ui"
|
||||||
|
@ -1387,17 +1399,11 @@
|
||||||
sequence="M1+O">
|
sequence="M1+O">
|
||||||
</key>
|
</key>
|
||||||
<key
|
<key
|
||||||
contextId="com.raytheon.uf.viz.d2d.ui"
|
|
||||||
commandId="com.raytheon.viz.ui.deleteAWIPSProcedure"
|
commandId="com.raytheon.viz.ui.deleteAWIPSProcedure"
|
||||||
|
contextId="com.raytheon.uf.viz.d2d.ui"
|
||||||
schemeId="com.raytheon.viz.ui.cave.scheme"
|
schemeId="com.raytheon.viz.ui.cave.scheme"
|
||||||
sequence="M1+D">
|
sequence="M1+D">
|
||||||
</key>
|
</key>
|
||||||
<key
|
|
||||||
contextId="com.raytheon.uf.viz.d2d.ui"
|
|
||||||
commandId="com.raytheon.viz.ui.copyOutAWIPSProcedure"
|
|
||||||
schemeId="com.raytheon.viz.ui.cave.scheme"
|
|
||||||
sequence="M1+B">
|
|
||||||
</key>
|
|
||||||
<key
|
<key
|
||||||
contextId="com.raytheon.uf.viz.d2d.ui"
|
contextId="com.raytheon.uf.viz.d2d.ui"
|
||||||
commandId="com.raytheon.viz.ui.clear"
|
commandId="com.raytheon.viz.ui.clear"
|
||||||
|
@ -1652,12 +1658,6 @@
|
||||||
<parameter id="startIndex" value="2"></parameter>
|
<parameter id="startIndex" value="2"></parameter>
|
||||||
<parameter id="hideIndex" value="0"></parameter>
|
<parameter id="hideIndex" value="0"></parameter>
|
||||||
</key>
|
</key>
|
||||||
<key
|
|
||||||
contextId="com.raytheon.uf.viz.d2d.ui"
|
|
||||||
commandId="com.raytheon.uf.viz.d2d.ui.actions.dataScaleAction"
|
|
||||||
schemeId="com.raytheon.viz.ui.cave.scheme"
|
|
||||||
sequence="M1+S">
|
|
||||||
</key>
|
|
||||||
<key
|
<key
|
||||||
contextId="com.raytheon.uf.viz.d2d.ui"
|
contextId="com.raytheon.uf.viz.d2d.ui"
|
||||||
commandId="com.raytheon.uf.viz.d2d.ui.actions.imageCombination"
|
commandId="com.raytheon.uf.viz.d2d.ui.actions.imageCombination"
|
||||||
|
@ -1815,23 +1815,23 @@
|
||||||
description="Show the d2d history list"
|
description="Show the d2d history list"
|
||||||
name="Show History List">
|
name="Show History List">
|
||||||
</command>
|
</command>
|
||||||
<command
|
|
||||||
id="com.raytheon.viz.ui.newAWIPSProcedure"
|
|
||||||
categoryId="com.raytheon.uf.viz.d2d.ui"
|
|
||||||
description="Create a new procedure"
|
|
||||||
name="New AWIPS Procedure">
|
|
||||||
</command>
|
|
||||||
<command
|
<command
|
||||||
id="com.raytheon.viz.ui.openAWIPSProcedure"
|
id="com.raytheon.viz.ui.openAWIPSProcedure"
|
||||||
categoryId="com.raytheon.uf.viz.d2d.ui"
|
categoryId="com.raytheon.uf.viz.d2d.ui"
|
||||||
description="Open an existing procedure"
|
description="Open an existing bundle"
|
||||||
name="Open AWIPS Procedure">
|
name="Load Bundle">
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
id="com.raytheon.viz.ui.saveAWIPSProcedure"
|
||||||
|
categoryId="com.raytheon.uf.viz.d2d.ui"
|
||||||
|
description="Save current display to bundle"
|
||||||
|
name="Save Bundle">
|
||||||
</command>
|
</command>
|
||||||
<command
|
<command
|
||||||
id="com.raytheon.viz.ui.deleteAWIPSProcedure"
|
id="com.raytheon.viz.ui.deleteAWIPSProcedure"
|
||||||
categoryId="com.raytheon.uf.viz.d2d.ui"
|
categoryId="com.raytheon.uf.viz.d2d.ui"
|
||||||
description="Delete a procedure"
|
description="Delete a bundle"
|
||||||
name="Delete AWIPS Procedure">
|
name="Delete Bundle">
|
||||||
</command>
|
</command>
|
||||||
<command
|
<command
|
||||||
id="com.raytheon.viz.ui.copyOutAWIPSProcedure"
|
id="com.raytheon.viz.ui.copyOutAWIPSProcedure"
|
||||||
|
|
|
@ -30,6 +30,7 @@ import com.raytheon.uf.common.localization.LocalizationFile;
|
||||||
import com.raytheon.uf.common.localization.LocalizationUtil;
|
import com.raytheon.uf.common.localization.LocalizationUtil;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
import com.raytheon.uf.viz.core.procedures.Procedure;
|
import com.raytheon.uf.viz.core.procedures.Procedure;
|
||||||
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.OpenProcedureListDlg;
|
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.OpenProcedureListDlg;
|
||||||
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureDlg;
|
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureDlg;
|
||||||
|
@ -51,6 +52,9 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
* Oct 16, 2012 1229 rferrel Changes for non-blocking ProcedureListDlg.
|
* Oct 16, 2012 1229 rferrel Changes for non-blocking ProcedureListDlg.
|
||||||
* Jun 07, 2013 2074 mnash Don't open the dialog if no procedures are deserialized
|
* Jun 07, 2013 2074 mnash Don't open the dialog if no procedures are deserialized
|
||||||
* Aug 11, 2014 3480 bclement added logging
|
* Aug 11, 2014 3480 bclement added logging
|
||||||
|
* Apr 19, 2015 mjames Call loadProcedureToScreen instead of ProcedureDlg.displayDialog
|
||||||
|
* when procedure file selected, no longer using procedure element
|
||||||
|
* loader... too cumbersome for users.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author chammack
|
* @author chammack
|
||||||
|
@ -86,10 +90,12 @@ public class OpenAWIPSProcedure extends AbstractHandler {
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
log.info("Loading display file: "
|
log.info("Loading display file: "
|
||||||
+ f.getAbsolutePath());
|
+ f.getAbsolutePath());
|
||||||
ProcedureDlg.displayDialog(LocalizationUtil
|
try {
|
||||||
.extractName(selectedFile.getName()), p,
|
LoadSerializedXml.loadProcedureToScreen( p, false);
|
||||||
VizWorkbenchManager.getInstance()
|
} catch (VizException e) {
|
||||||
.getCurrentWindow().getShell());
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialog = null;
|
dialog = null;
|
||||||
|
|
|
@ -0,0 +1,218 @@
|
||||||
|
/**
|
||||||
|
* 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.uf.viz.d2d.ui.actions;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
|
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.handlers.HandlerUtil;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.localization.IPathManager;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationUtil;
|
||||||
|
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||||
|
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.util.FileUtil;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.core.procedures.Bundle;
|
||||||
|
import com.raytheon.uf.viz.core.procedures.Procedure;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.ResourceList;
|
||||||
|
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.OpenProcedureListDlg;
|
||||||
|
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureTree;
|
||||||
|
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.SaveProcedureListDlg;
|
||||||
|
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureDlg;
|
||||||
|
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureComm.BundlePair;
|
||||||
|
import com.raytheon.viz.ui.VizWorkbenchManager;
|
||||||
|
import com.raytheon.viz.ui.actions.LoadSerializedXml;
|
||||||
|
import com.raytheon.viz.ui.actions.SaveProcedure;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenAWIPSProcedure
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Apr 19, 2015 mjames Copied from OpenAWIPSProcedure
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author chammack
|
||||||
|
* @version 1
|
||||||
|
*/
|
||||||
|
public class SaveAWIPSProcedure extends AbstractHandler {
|
||||||
|
|
||||||
|
private final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(ProcedureDlg.class);
|
||||||
|
|
||||||
|
private java.util.List<BundlePair> bundles;
|
||||||
|
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
private Boolean frozen = false;
|
||||||
|
|
||||||
|
private SaveProcedureListDlg dialog;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
|
||||||
|
* .ExecutionEvent)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
|
Procedure procedure = SaveProcedure.getCurrentProcedure();
|
||||||
|
|
||||||
|
this.bundles = new ArrayList<BundlePair>();
|
||||||
|
frozen = false;
|
||||||
|
if (procedure != null && procedure.getBundles() != null) {
|
||||||
|
Bundle[] bund = procedure.getBundles();
|
||||||
|
for (Bundle b : bund) {
|
||||||
|
// remove any bad resource pairs from each display
|
||||||
|
for (AbstractRenderableDisplay display : b.getDisplays()) {
|
||||||
|
ResourceList rList = display.getDescriptor()
|
||||||
|
.getResourceList();
|
||||||
|
// modify the resource list so that we remove any null
|
||||||
|
// resource datas
|
||||||
|
for (ResourcePair rp : rList) {
|
||||||
|
if (rp.getResourceData() == null) {
|
||||||
|
rList.remove(rp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Check to see if frozen
|
||||||
|
for (AbstractRenderableDisplay display : b.getDisplays()) {
|
||||||
|
ResourceList rList = display.getDescriptor()
|
||||||
|
.getResourceList();
|
||||||
|
for (ResourcePair rp : rList) {
|
||||||
|
if (rp.getResourceData().isFrozen()) {
|
||||||
|
frozen = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (frozen) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BundlePair bp = new BundlePair();
|
||||||
|
try {
|
||||||
|
bp.xml = b.toXML();
|
||||||
|
} catch (VizException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
bp.name = (b.getName() != null ? b.getName() : " ");
|
||||||
|
this.bundles.add(bp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
|
||||||
|
dialog = new SaveProcedureListDlg(HandlerUtil.getActiveShell(event));
|
||||||
|
dialog.setCloseCallback(new ICloseCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dialogClosed(Object returnValue) {
|
||||||
|
String fn = dialog.getSelectedFileName();
|
||||||
|
if (fn != null) {
|
||||||
|
frozen = dialog.isFrozen();
|
||||||
|
fileName = fn;
|
||||||
|
saveProcedure(frozen,fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.open();
|
||||||
|
} else {
|
||||||
|
dialog.bringToTop();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveProcedure(boolean frozen, String fileName) {
|
||||||
|
try {
|
||||||
|
IPathManager pm = PathManagerFactory.getPathManager();
|
||||||
|
|
||||||
|
LocalizationContext context = pm.getContext(
|
||||||
|
LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
|
||||||
|
|
||||||
|
LocalizationFile localizationFile = pm.getLocalizationFile(context,
|
||||||
|
ProcedureDlg.PROCEDURES_DIR + File.separator + fileName);
|
||||||
|
|
||||||
|
Procedure procedure = SaveProcedure.getCurrentProcedure();
|
||||||
|
BundlePair[] bp = bundles.toArray(new BundlePair[bundles.size()]);
|
||||||
|
Bundle[] bundlesToSave = new Bundle[bp.length];
|
||||||
|
int i = 0;
|
||||||
|
for (BundlePair b : bp) {
|
||||||
|
Bundle bundle = Bundle.unmarshalBundle(b.xml, null);
|
||||||
|
|
||||||
|
if (!frozen) {
|
||||||
|
for (AbstractRenderableDisplay display : bundle
|
||||||
|
.getDisplays()) {
|
||||||
|
for (ResourcePair rp : display.getDescriptor()
|
||||||
|
.getResourceList()) {
|
||||||
|
if (rp.getResourceData() != null
|
||||||
|
&& rp.getResourceData() instanceof AbstractRequestableResourceData) {
|
||||||
|
((AbstractRequestableResourceData) rp
|
||||||
|
.getResourceData()).setFrozenTime(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bundlesToSave[i] = bundle;
|
||||||
|
bundlesToSave[i].setName(b.name);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
procedure.setBundles(bundlesToSave);
|
||||||
|
|
||||||
|
String procedureXML = procedure.toXML();
|
||||||
|
FileUtil.bytes2File(procedureXML.getBytes(),
|
||||||
|
localizationFile.getFile());
|
||||||
|
localizationFile.save();
|
||||||
|
|
||||||
|
//shell.setText("Procedure - " + fileName);
|
||||||
|
//saved = true;
|
||||||
|
//saveBtn.setEnabled(false);
|
||||||
|
|
||||||
|
dialog.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
final String errMsg = "Error occurred during procedure save.";
|
||||||
|
statusHandler.handle(Priority.PROBLEM, errMsg, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -63,7 +63,7 @@ public class OpenProcedureListDlg extends ProcedureListDlg {
|
||||||
* Parent shell.
|
* Parent shell.
|
||||||
*/
|
*/
|
||||||
public OpenProcedureListDlg(Shell parent) {
|
public OpenProcedureListDlg(Shell parent) {
|
||||||
super("Open Procedure", parent, Mode.OPEN);
|
super("Open Bundle", parent, Mode.OPEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
/**
|
||||||
|
* 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.uf.viz.d2d.ui.dialogs.procedures;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.raytheon.uf.common.localization.IPathManager;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||||
|
import com.raytheon.uf.common.localization.LocalizationUtil;
|
||||||
|
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
|
import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException;
|
||||||
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
|
import com.raytheon.uf.common.util.FileUtil;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay;
|
||||||
|
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||||
|
import com.raytheon.uf.viz.core.exception.VizException;
|
||||||
|
import com.raytheon.uf.viz.core.procedures.Bundle;
|
||||||
|
import com.raytheon.uf.viz.core.procedures.Procedure;
|
||||||
|
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
|
||||||
|
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureComm.BundlePair;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This dialog will allow users to open existing procedures.
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
*
|
||||||
|
* SOFTWARE HISTORY
|
||||||
|
*
|
||||||
|
* Date Ticket# Engineer Description
|
||||||
|
* ------------ ---------- ----------- --------------------------
|
||||||
|
* Apr 19, 2015 mjames Copied from OpenProcedureListDlg
|
||||||
|
*
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @author mschenke
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public class SaveProcedureListDlg extends ProcedureListDlg {
|
||||||
|
|
||||||
|
/** Flag indicating the data will only be at the root level. */
|
||||||
|
protected boolean oneLevel = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param parent
|
||||||
|
* Parent shell.
|
||||||
|
*/
|
||||||
|
public SaveProcedureListDlg(Shell parent) {
|
||||||
|
super("Save Bundle", parent, ProcedureListDlg.Mode.SAVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* populate the data list
|
||||||
|
*/
|
||||||
|
protected ProcedureTree populateDataList() {
|
||||||
|
ProcedureTree root = new ProcedureTree("root", null);
|
||||||
|
IPathManager mgr = PathManagerFactory.getPathManager();
|
||||||
|
LocalizationContext ctx = mgr.getContext(LocalizationType.CAVE_STATIC,
|
||||||
|
LocalizationLevel.USER);
|
||||||
|
LocalizationFile[] files = mgr.listFiles(ctx,
|
||||||
|
ProcedureDlg.PROCEDURES_DIR, null, true, true);
|
||||||
|
String[] strings = new String[files.length];
|
||||||
|
for (int i = 0; i < strings.length; i++) {
|
||||||
|
strings[i] = LocalizationUtil.extractName(files[i].getName());
|
||||||
|
root.addChild(strings[i], files[i]);
|
||||||
|
}
|
||||||
|
this.oneLevel = true;
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
}
|
|
@ -23,7 +23,7 @@
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.menus">
|
point="org.eclipse.ui.menus">
|
||||||
<menuContribution
|
<menuContribution
|
||||||
locationURI="menu:file.new">
|
locationURI="menu:tools">
|
||||||
<command
|
<command
|
||||||
commandId="com.raytheon.viz.textworkstation.opentextworkstation"
|
commandId="com.raytheon.viz.textworkstation.opentextworkstation"
|
||||||
label="Text Workstation"
|
label="Text Workstation"
|
||||||
|
|
Loading…
Add table
Reference in a new issue