diff --git a/cave/com.raytheon.uf.viz.core.maps/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/cave/com.raytheon.uf.viz.core.maps/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject index 6d018aeadb..afb7f3fb15 100644 --- a/cave/com.raytheon.uf.viz.core.maps/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ b/cave/com.raytheon.uf.viz.core.maps/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -3,4 +3,5 @@ com.raytheon.uf.viz.core.maps.rsc.DbMapResourceData com.raytheon.uf.viz.core.maps.rsc.DbPointMapResourceData com.raytheon.uf.viz.core.maps.MapStylePreferenceStore com.raytheon.uf.viz.core.maps.display.MapRenderableDisplay -com.raytheon.uf.viz.core.maps.display.PlainMapRenderableDisplay \ No newline at end of file +com.raytheon.uf.viz.core.maps.display.PlainMapRenderableDisplay +com.raytheon.uf.viz.core.maps.scales.MapScaleRenderableDisplay \ No newline at end of file diff --git a/cave/com.raytheon.uf.viz.core.maps/plugin.xml b/cave/com.raytheon.uf.viz.core.maps/plugin.xml index 912029cc41..3ee23e3ed6 100644 --- a/cave/com.raytheon.uf.viz.core.maps/plugin.xml +++ b/cave/com.raytheon.uf.viz.core.maps/plugin.xml @@ -56,6 +56,10 @@ class="com.raytheon.uf.viz.core.maps.actions.LoadMap" commandId="com.raytheon.uf.viz.core.maps.actions.LoadMap"> + + @@ -110,4 +114,14 @@ value="mapStyles"> + + + + + + diff --git a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/display/MapRenderableDisplay.java b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/display/MapRenderableDisplay.java index fef4f37c1d..cac074f7a5 100644 --- a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/display/MapRenderableDisplay.java +++ b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/display/MapRenderableDisplay.java @@ -39,6 +39,7 @@ import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay; import com.raytheon.uf.viz.core.drawables.PaintProperties; 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.map.MapDescriptor; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.AbstractVizResource.ResourceStatus; @@ -91,7 +92,7 @@ public class MapRenderableDisplay extends AbstractRenderableDisplay implements super(); } - public MapRenderableDisplay(MapDescriptor desc) { + public MapRenderableDisplay(IMapDescriptor desc) { this(); setDescriptor(desc); } diff --git a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/display/PlainMapRenderableDisplay.java b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/display/PlainMapRenderableDisplay.java index cb344317f5..edec1eb0aa 100644 --- a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/display/PlainMapRenderableDisplay.java +++ b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/display/PlainMapRenderableDisplay.java @@ -23,7 +23,7 @@ import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; -import com.raytheon.uf.viz.core.map.MapDescriptor; +import com.raytheon.uf.viz.core.map.IMapDescriptor; import com.raytheon.uf.viz.core.rsc.ResourceList; /** @@ -57,7 +57,7 @@ public class PlainMapRenderableDisplay extends MapRenderableDisplay { /** * @param desc */ - public PlainMapRenderableDisplay(MapDescriptor desc) { + public PlainMapRenderableDisplay(IMapDescriptor desc) { super(desc); } diff --git a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/IMapScaleDisplay.java b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/IMapScaleDisplay.java index 785108b90e..f56a798e11 100644 --- a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/IMapScaleDisplay.java +++ b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/IMapScaleDisplay.java @@ -19,6 +19,8 @@ **/ package com.raytheon.uf.viz.core.maps.scales; +import com.raytheon.uf.viz.core.maps.scales.MapScales.MapScale; + /** * Interface for display containing a scale * @@ -44,4 +46,10 @@ public interface IMapScaleDisplay { */ public String getScaleName(); + /** + * Changes the scale of the display + * + * @param scale + */ + public void changeScale(MapScale scale); } diff --git a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/MapScaleHandler.java b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/MapScaleHandler.java new file mode 100644 index 0000000000..5cda3a06b8 --- /dev/null +++ b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/MapScaleHandler.java @@ -0,0 +1,89 @@ +/** + * 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.core.maps.scales; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +import com.raytheon.uf.viz.core.IDisplayPane; +import com.raytheon.uf.viz.core.IDisplayPaneContainer; +import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; +import com.raytheon.uf.viz.core.globals.VizGlobalsManager; +import com.raytheon.uf.viz.core.maps.scales.MapScales.MapScale; + +/** + * Handler of setScale command that looks for a {@link MapScale} by name of + * attribute scale and sets on any {@link IMapScaleDisplay}s on the current + * editor + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 22, 2013            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ + +public class MapScaleHandler extends AbstractHandler { + + public static final String SET_SCALE_COMMAND_ID = "com.raytheon.viz.ui.setScale"; + + public static final String SCALE_NAME_ID = "scale"; + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands. + * ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + MapScale scale = MapScales.getInstance().getScaleByName( + event.getParameter(SCALE_NAME_ID)); + if (scale != null) { + IEditorPart part = HandlerUtil.getActiveEditor(event); + if (part instanceof IDisplayPaneContainer) { + IDisplayPaneContainer container = (IDisplayPaneContainer) part; + for (IDisplayPane pane : container.getDisplayPanes()) { + IRenderableDisplay display = pane.getRenderableDisplay(); + if (display instanceof IMapScaleDisplay) { + ((IMapScaleDisplay) display).changeScale(scale); + } + } + container.refresh(); + VizGlobalsManager.getInstance( + HandlerUtil.getActiveWorkbenchWindow(event)).updateUI( + container); + } + } + return null; + } + +} diff --git a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/MapScalePopulator.java b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/MapScalePopulator.java index 02caaadd17..4ed91e1a81 100644 --- a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/MapScalePopulator.java +++ b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/MapScalePopulator.java @@ -63,20 +63,19 @@ public class MapScalePopulator extends CompoundContributionItem { protected IContributionItem[] getContributionItems() { MenuManager menuMgr = new MenuManager("Scales", "mapControls"); IDisplayPaneContainer cont = EditorUtil.getActiveVizContainer(); - // Load scales if we have d2d map renderable display on editor or, there - // is no editor opened in the d2d perspective if ((cont != null && (cont.getActiveDisplayPane() .getRenderableDisplay() instanceof IMapScaleDisplay)) || EditorUtil.getActiveEditor() == null) { for (MapScale scale : MapScales.getInstance().getScales()) { Map parms = new HashMap(); - parms.put("scale", scale.getDisplayName()); + parms.put(MapScaleHandler.SCALE_NAME_ID, scale.getDisplayName()); CommandContributionItem item = new CommandContributionItem( new CommandContributionItemParameter( PlatformUI.getWorkbench(), null, - "com.raytheon.viz.ui.setScale", parms, null, - null, null, scale.getDisplayName(), null, null, - CommandContributionItem.STYLE_PUSH, null, true)); + MapScaleHandler.SET_SCALE_COMMAND_ID, parms, + null, null, null, scale.getDisplayName(), null, + null, CommandContributionItem.STYLE_PUSH, null, + true)); menuMgr.add(item); } } diff --git a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/MapScaleRenderableDisplay.java b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/MapScaleRenderableDisplay.java new file mode 100644 index 0000000000..af9f14d920 --- /dev/null +++ b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/scales/MapScaleRenderableDisplay.java @@ -0,0 +1,144 @@ +/** + * 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.core.maps.scales; + +import java.util.Map; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.viz.core.VizConstants; +import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay; +import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.globals.VizGlobalsManager; +import com.raytheon.uf.viz.core.map.IMapDescriptor; +import com.raytheon.uf.viz.core.maps.display.PlainMapRenderableDisplay; +import com.raytheon.uf.viz.core.maps.scales.MapScales.MapScale; +import com.raytheon.uf.viz.core.procedures.Bundle; +import com.raytheon.viz.ui.actions.LoadSerializedXml; + +/** + * MapRenderableDisplay associated with a {@link MapScale} + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 22, 2013            mschenke     Initial creation
+ * 
+ * 
+ * + * @author mschenke + * @version 1.0 + */ +@XmlAccessorType(XmlAccessType.NONE) +@XmlRootElement +public class MapScaleRenderableDisplay extends PlainMapRenderableDisplay + implements IMapScaleDisplay { + + @XmlAttribute + protected String scale = (String) VizGlobalsManager.getCurrentInstance() + .getPropery(VizConstants.SCALE_ID); + + public MapScaleRenderableDisplay() { + super(); + } + + public MapScaleRenderableDisplay(IMapDescriptor desc) { + super(desc); + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.maps.scales.IMapScaleDisplay#getScaleName() + */ + @Override + public String getScaleName() { + return scale; + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.maps.scales.IMapScaleDisplay#changeScale(com + * .raytheon.uf.viz.core.maps.scales.MapScales.MapScale) + */ + @Override + public void changeScale(MapScale scale) { + MapScale currentScale = MapScales.getInstance().getScaleByName( + getScaleName()); + Bundle bundle = (Bundle) LoadSerializedXml.deserialize(currentScale + .getFile()); + for (AbstractRenderableDisplay display : bundle.getDisplays()) { + descriptor.getResourceList().removeAll( + display.getDescriptor().getResourceList()); + } + loadScale(scale); + } + + @Override + public void clear() { + MapScale scale = MapScales.getInstance().getScaleByName(getScaleName()); + if (scale == null) { + scale = MapScales.getInstance().getScaleByName( + (String) VizGlobalsManager.getCurrentInstance().getPropery( + VizConstants.SCALE_ID)); + } + if (scale != null) { + descriptor.getResourceList().clear(); + loadScale(scale); + } + } + + protected void loadScale(MapScale scale) { + Bundle bundle = (Bundle) LoadSerializedXml.deserialize(scale.getFile()); + for (AbstractRenderableDisplay ard : bundle.getDisplays()) { + try { + descriptor.setGridGeometry(ard.getDescriptor() + .getGridGeometry()); + descriptor.getResourceList().addAll( + ard.getDescriptor().getResourceList()); + ard.getDescriptor().getResourceList().clear(); + break; + } catch (VizException e) { + statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), + e); + } + } + descriptor.getResourceList().instantiateResources(descriptor, true); + this.scale = scale.getDisplayName(); + scaleToClientArea(getBounds()); + } + + @Override + public Map getGlobalsMap() { + Map globals = super.getGlobalsMap(); + globals.put(VizConstants.SCALE_ID, getScaleName()); + return globals; + } + +} diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractRenderableDisplay.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractRenderableDisplay.java index 312afa1c3c..6e27dbf164 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractRenderableDisplay.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/drawables/AbstractRenderableDisplay.java @@ -74,7 +74,7 @@ import com.raytheon.uf.viz.core.rsc.ResourceList.RemoveListener; */ @XmlAccessorType(XmlAccessType.NONE) public abstract class AbstractRenderableDisplay implements IRenderableDisplay { - private static final transient IUFStatusHandler statusHandler = UFStatus + protected static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(AbstractRenderableDisplay.class); private static RGB BACKGROUND_COLOR = null; diff --git a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/map/D2DMapRenderableDisplay.java b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/map/D2DMapRenderableDisplay.java index ec375ae5ba..5df6c63188 100644 --- a/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/map/D2DMapRenderableDisplay.java +++ b/cave/com.raytheon.uf.viz.d2d.core/src/com/raytheon/uf/viz/d2d/core/map/D2DMapRenderableDisplay.java @@ -19,7 +19,6 @@ **/ package com.raytheon.uf.viz.d2d.core.map; -import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -32,7 +31,6 @@ import javax.xml.bind.annotation.XmlRootElement; import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.VizConstants; import com.raytheon.uf.viz.core.drawables.AbstractDescriptor; -import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay; import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.ResourcePair; @@ -40,10 +38,7 @@ import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.globals.VizGlobalsManager; import com.raytheon.uf.viz.core.map.IMapDescriptor; import com.raytheon.uf.viz.core.map.MapDescriptor; -import com.raytheon.uf.viz.core.maps.display.MapRenderableDisplay; -import com.raytheon.uf.viz.core.maps.scales.IMapScaleDisplay; -import com.raytheon.uf.viz.core.maps.scales.MapScales; -import com.raytheon.uf.viz.core.procedures.Bundle; +import com.raytheon.uf.viz.core.maps.scales.MapScaleRenderableDisplay; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; import com.raytheon.uf.viz.core.rsc.IResourceGroup; import com.raytheon.uf.viz.core.rsc.RenderingOrderFactory.ResourceOrder; @@ -56,7 +51,6 @@ import com.raytheon.uf.viz.d2d.core.ID2DRenderableDisplay; import com.raytheon.uf.viz.d2d.core.sampling.CloudHeightResourceData; import com.raytheon.uf.viz.d2d.core.time.D2DTimeMatcher; import com.raytheon.viz.core.imagery.ImageCombiner; -import com.raytheon.viz.ui.actions.LoadSerializedXml; /** * Implementation of a D2D-specific map renderable display @@ -68,6 +62,7 @@ import com.raytheon.viz.ui.actions.LoadSerializedXml; * ------------ ---------- ----------- -------------------------- * Feb 9, 2009 njensen Initial creation * Mar 21, 2013 1638 mschenke Made map scales not tied to d2d + * Mar 22, 2013 1638 mschenke Moved map scale code to MapScaleRenderableDisplay * * * @@ -76,8 +71,8 @@ import com.raytheon.viz.ui.actions.LoadSerializedXml; */ @XmlAccessorType(XmlAccessType.NONE) @XmlRootElement -public class D2DMapRenderableDisplay extends MapRenderableDisplay implements - ID2DRenderableDisplay, IMapScaleDisplay { +public class D2DMapRenderableDisplay extends MapScaleRenderableDisplay + implements ID2DRenderableDisplay { private static final CloudHeightResourceData cloudHeightData = new CloudHeightResourceData(); @@ -92,11 +87,6 @@ public class D2DMapRenderableDisplay extends MapRenderableDisplay implements protected double density = ((Double) VizGlobalsManager.getCurrentInstance() .getPropery(VizConstants.DENSITY_ID)).doubleValue(); - /** The current display scale */ - @XmlAttribute - protected String scale = (String) VizGlobalsManager.getCurrentInstance() - .getPropery(VizConstants.SCALE_ID); - protected DataScaleListener scaleListener = null; protected ImageCombiner combinerListener = null; @@ -264,28 +254,11 @@ public class D2DMapRenderableDisplay extends MapRenderableDisplay implements } } - @Override - public void clear() { - descriptor.getResourceList().clear(); - File scaleFile = MapScales.getInstance().getScaleByName(getScale()) - .getFile(); - Bundle bundle = (Bundle) LoadSerializedXml.deserialize(scaleFile); - for (AbstractRenderableDisplay ard : bundle.getDisplays()) { - descriptor.getResourceList().addAll( - ard.getDescriptor().getResourceList()); - ard.getDescriptor().getResourceList().clear(); - break; - } - descriptor.getResourceList().instantiateResources(descriptor, true); - scaleToClientArea(getBounds()); - } - @Override public Map getGlobalsMap() { Map globals = super.getGlobalsMap(); globals.put(VizConstants.FRAMES_ID, new Integer(getDescriptor() .getNumberOfFrames())); - globals.put(VizConstants.SCALE_ID, scale); globals.put(VizConstants.DENSITY_ID, new Double(density)); globals.put(VizConstants.MAGNIFICATION_ID, new Double(magnification)); globals.put(VizConstants.LOADMODE_ID, ((D2DTimeMatcher) getDescriptor() @@ -358,14 +331,4 @@ public class D2DMapRenderableDisplay extends MapRenderableDisplay implements return combinerListener; } - /* - * (non-Javadoc) - * - * @see com.raytheon.uf.viz.core.maps.scales.IMapScaleDisplay#getScaleName() - */ - @Override - public String getScaleName() { - return getScale(); - } - } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml b/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml index a6b87a2589..d1595b7a0d 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml +++ b/cave/com.raytheon.uf.viz.d2d.ui/plugin.xml @@ -1375,13 +1375,6 @@ id="com.raytheon.uf.viz.d2d.ui.densityPopulator"> - - - - @@ -1398,13 +1391,14 @@ class="com.raytheon.uf.viz.d2d.ui.map.actions.ClearAction" commandId="com.raytheon.viz.ui.clear"> - - + + + + + name="Update Scale Button" + defaultHandler="com.raytheon.viz.ui.actions.ScaleButtonHandler"> * @@ -164,13 +165,17 @@ public class BundleLoader extends Job { if (i == 0) { IRenderableDisplay loadFrom = items[i].loadFrom; IDisplayPane loadTo = items[i].loadTo; - AbstractTimeMatcher srcTimeMatcher = loadFrom + + AbstractTimeMatcher destTimeMatcher = loadTo .getDescriptor().getTimeMatcher(); - if (srcTimeMatcher != null) { - loadTo.getDescriptor().getTimeMatcher() - .copyFrom(srcTimeMatcher); + if (destTimeMatcher != null) { + AbstractTimeMatcher srcTimeMatcher = loadFrom + .getDescriptor().getTimeMatcher(); + if (srcTimeMatcher != null) { + destTimeMatcher.copyFrom(srcTimeMatcher); + } + destTimeMatcher.resetMultiload(); } - loadTo.getDescriptor().getTimeMatcher().resetMultiload(); t.run(); } else { t.start(); diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/actions/ScaleButtonHandler.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ScaleButtonHandler.java similarity index 93% rename from cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/actions/ScaleButtonHandler.java rename to cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ScaleButtonHandler.java index 50e981bbb0..2d86b43371 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/actions/ScaleButtonHandler.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ScaleButtonHandler.java @@ -20,7 +20,7 @@ /** * */ -package com.raytheon.uf.viz.d2d.ui.map.actions; +package com.raytheon.viz.ui.actions; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.commands.IElementUpdater; @@ -28,7 +28,6 @@ import org.eclipse.ui.menus.UIElement; import com.raytheon.uf.viz.core.VizConstants; import com.raytheon.uf.viz.core.globals.IGlobalChangedListener; -import com.raytheon.viz.ui.actions.AbstractGlobalsButtonHandler; /** * Updates the scale diff --git a/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/JAXBManager.java b/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/JAXBManager.java index 2e3c859a8e..7fda440889 100644 --- a/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/JAXBManager.java +++ b/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/JAXBManager.java @@ -20,10 +20,11 @@ package com.raytheon.uf.common.serialization; import java.io.File; +import java.io.FileOutputStream; import java.io.FileReader; -import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.io.StringReader; import java.io.StringWriter; import java.util.ArrayList; @@ -255,28 +256,45 @@ public class JAXBManager { */ public void jaxbMarshalToXmlFile(Object obj, String filePath) throws SerializationException { - FileWriter writer = null; + try { + jaxbMarshalToStream(obj, new FileOutputStream(new File(filePath))); + } catch (SerializationException e) { + throw e; + } catch (Exception e) { + throw new SerializationException(e); + } + + } + + /** + * Convert an instance of a class to an XML representation and write XML to + * output stream. Uses JAXB. + * + * @param obj + * @param out + * @throws SerializationException + */ + public void jaxbMarshalToStream(Object obj, OutputStream out) + throws SerializationException { Marshaller msh = null; try { msh = getMarshaller(); msh.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true)); - writer = new FileWriter(new File(filePath)); - msh.marshal(obj, writer); + msh.marshal(obj, out); } catch (Exception e) { throw new SerializationException(e); } finally { if (msh != null && marshallers.size() < QUEUE_SIZE) { marshallers.add(msh); } - if (writer != null) { + if (out != null) { try { - writer.close(); + out.close(); } catch (IOException e) { // ignore } } } - } /**