Issue #2001 fix message handling

Change-Id: I17ee277950f9776e197b3c247aae34e33f53c55b

Former-commit-id: 2863f68dd5da6ca323c9cd84dfc06a589524e176
This commit is contained in:
Nate Jensen 2013-05-21 09:51:41 -05:00
parent 195cd5f210
commit 1ab118958f
2 changed files with 34 additions and 60 deletions

View file

@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.geotools.coverage.grid.GeneralGridEnvelope; import org.geotools.coverage.grid.GeneralGridEnvelope;
import org.geotools.coverage.grid.GridGeometry2D; import org.geotools.coverage.grid.GridGeometry2D;
@ -44,6 +43,8 @@ import com.raytheon.edex.plugin.redbook.common.blocks.RedbookBlockHeader;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.datastorage.records.ByteDataRecord; import com.raytheon.uf.common.datastorage.records.ByteDataRecord;
import com.raytheon.uf.common.geospatial.MapUtil; import com.raytheon.uf.common.geospatial.MapUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.DrawableString; import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.IExtent;
@ -53,7 +54,6 @@ import com.raytheon.uf.viz.core.IGraphicsTarget.TextStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment; import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.PixelCoverage; import com.raytheon.uf.viz.core.PixelCoverage;
import com.raytheon.uf.viz.core.PixelExtent; import com.raytheon.uf.viz.core.PixelExtent;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.drawables.IFont; import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IImage; import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.IRenderable; import com.raytheon.uf.viz.core.drawables.IRenderable;
@ -65,7 +65,6 @@ import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability; import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
import com.raytheon.viz.core.rsc.jts.JTSCompiler; import com.raytheon.viz.core.rsc.jts.JTSCompiler;
import com.raytheon.viz.redbook.Activator;
import com.raytheon.viz.redbook.RedbookWMOMap; import com.raytheon.viz.redbook.RedbookWMOMap;
import com.raytheon.viz.redbook.blocks.AbstractTextBlock; import com.raytheon.viz.redbook.blocks.AbstractTextBlock;
import com.raytheon.viz.redbook.blocks.AlphaNumBlock; import com.raytheon.viz.redbook.blocks.AlphaNumBlock;
@ -86,12 +85,13 @@ import com.vividsolutions.jts.geom.Coordinate;
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 29, 2008 #1162 chammack Initial creation * May 29, 2008 1162 chammack Initial creation
* Jan 28, 2010 #4224 M. Huang Added Line Style, Line Width * Jan 28, 2010 4224 M. Huang Added Line Style, Line Width
* menu choice * menu choice
* Apr 29, 2013 1958 bgonzale New class RedbookBlockHeader. * Apr 29, 2013 1958 bgonzale New class RedbookBlockHeader.
* May 21, 2013 2001 njensen Fixed error handling
* *
* </pre> * </pre>
* *
@ -100,6 +100,9 @@ import com.vividsolutions.jts.geom.Coordinate;
*/ */
public class RedbookFrame implements IRenderable { public class RedbookFrame implements IRenderable {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(RedbookFrame.class);
protected JTSCompiler compiler; protected JTSCompiler compiler;
protected IWireframeShape wireframeShape; protected IWireframeShape wireframeShape;
@ -184,14 +187,8 @@ public class RedbookFrame implements IRenderable {
try { try {
this.compiler.handle(vb.getGeometry()); this.compiler.handle(vb.getGeometry());
} catch (VizException e) { } catch (VizException e) {
Activator statusHandler.error(
.getDefault() "Error during rendering of redbook", e);
.getLog()
.log(new Status(
Status.ERROR,
Activator.PLUGIN_ID,
"Error during rendering of redbook",
e));
status.vectorRenderingWarning = true; status.vectorRenderingWarning = true;
} }
} else if (currBlock.equals("001_004")) { } else if (currBlock.equals("001_004")) {
@ -218,12 +215,8 @@ public class RedbookFrame implements IRenderable {
} }
} }
} catch (Exception e) { } catch (Exception e) {
VizApp.logAndAlert( statusHandler.error(
org.eclipse.core.runtime.Status.ERROR, "Error rendering redbook product", e);
e,
"Error rendering redbook product",
"The redbook product may not be rendered correctly due to an error determining the map projection.",
Activator.getDefault(), Activator.PLUGIN_ID);
} }
if (customProjection == null) { if (customProjection == null) {
@ -292,35 +285,23 @@ public class RedbookFrame implements IRenderable {
DefaultBlock block = new DefaultBlock(header, dataBuf); DefaultBlock block = new DefaultBlock(header, dataBuf);
if (!currBlock.equals("")) { if (!currBlock.equals("")) {
status.unhandledPackets = true; status.unhandledPackets = true;
statusHandler
Activator .warn("Unhandled redbook packet: (mode="
.getDefault() + block.getMode() + ", submode="
.getLog() + block.getSubMode() + ")");
.log(new Status(Status.WARNING,
Activator.PLUGIN_ID,
"Unhandled redbook packet: (mode="
+ block.getMode()
+ ", submode="
+ block.getSubMode() + ")"));
} }
} }
} }
} catch (TransformException e) { } catch (TransformException e) {
VizApp.logAndAlert( statusHandler
org.eclipse.core.runtime.Status.ERROR, .error("Error rendering redbook product due to an error setting up the map projection.",
e, e);
"Error rendering redbook product",
"The redbook product cannot be rendered due to an error setting up the map projection.",
Activator.getDefault(), Activator.PLUGIN_ID);
} catch (FactoryException e) { } catch (FactoryException e) {
VizApp.logAndAlert( statusHandler
org.eclipse.core.runtime.Status.ERROR, .error("Error rendering redbook product due to an error setting up the map projection.",
e, e);
"Error rendering redbook product",
"The redbook product cannot be rendered due to an error setting up the map projection.",
Activator.getDefault(), Activator.PLUGIN_ID);
} }
} }
@ -578,8 +559,8 @@ public class RedbookFrame implements IRenderable {
dstring.textStyle = TextStyle.BLANKED; dstring.textStyle = TextStyle.BLANKED;
} }
if (isLegend) { if (isLegend) {
target.getExtension(ICanvasRenderingExtension.class).drawStrings( target.getExtension(ICanvasRenderingExtension.class)
paintProps, dstring); .drawStrings(paintProps, dstring);
} else { } else {
target.drawStrings(dstring); target.drawStrings(dstring);

View file

@ -26,8 +26,6 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.crs.CoordinateReferenceSystem;
import com.raytheon.edex.plugin.redbook.common.RedbookRecord; import com.raytheon.edex.plugin.redbook.common.RedbookRecord;
@ -64,9 +62,10 @@ import com.raytheon.viz.redbook.rsc.RedbookFrame.RedbookStatus;
* *
* <pre> * <pre>
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* May 28, 2008 #1162 chammack Initial creation * May 28, 2008 1162 chammack Initial creation
* May 21, 2013 2001 njensen Fixed display of messages
* *
* </pre> * </pre>
* *
@ -261,17 +260,11 @@ public class RedbookResource extends
if (status != null) { if (status != null) {
if (status.unhandledPackets) { if (status.unhandledPackets) {
MessageDialog statusHandler
.openWarning( .info("Warning: Unrecognized redbook packets found. Rendering may not be complete.");
Display.getCurrent().getActiveShell(),
"Redbook Rendering Warning",
"Warning: Unrecognized redbook packets found, rendering may not be complete. Details have been logged.");
} else if (status.vectorRenderingWarning) { } else if (status.vectorRenderingWarning) {
MessageDialog statusHandler
.openWarning( .info("Warning: Some redbook vectors could not be rendered. Rendering may not be complete.");
Display.getCurrent().getActiveShell(),
"Redbook Rendering Warning",
"Warning: Some redbook vectors could not be rendered. Rendering may not be complete. Details have been logged.");
} }
} }
} }