Package ptolemy.vergil
Class VergilErrorHandler
- java.lang.Object
-
- ptolemy.vergil.VergilErrorHandler
-
- All Implemented Interfaces:
ErrorHandler
public class VergilErrorHandler extends java.lang.Object implements ErrorHandler
This error handler attempts to replace any failed MoML elements with generic versions so that the parsing of the MoML can continue. The generic versions, where appropriate, have icons that indicate failure.- Since:
- Ptolemy II 2.0
- Version:
- $Id$
- Author:
- Edward A. Lee
- Pt.AcceptedRating:
- Red (reviewmoderator)
- Pt.ProposedRating:
- Red (eal)
-
-
Field Summary
-
Fields inherited from interface ptolemy.moml.ErrorHandler
CANCEL, CONTINUE, RETHROW
-
-
Constructor Summary
Constructors Constructor Description VergilErrorHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
enableErrorSkipping(boolean enable)
Enable or disable skipping of errors.int
handleError(java.lang.String element, NamedObj context, java.lang.Throwable exception)
Handle an error.
-
-
-
Method Detail
-
enableErrorSkipping
public void enableErrorSkipping(boolean enable)
Enable or disable skipping of errors. If this method is called with a true argument, then do not report subsequent errors when handleError() is called, and instead return CONTINUE. If it is called with a false argument, then report all subsequent errors.This method is intended to be used when an operation may trigger a large number of errors, and the user interface wishes to offer the user the option of ignoring them. This method should be called with a true argument before the operation begins, and then called with a false argument after the operation ends.
- Specified by:
enableErrorSkipping
in interfaceErrorHandler
- Parameters:
enable
- True to enable skipping, false to disable.
-
handleError
public int handleError(java.lang.String element, NamedObj context, java.lang.Throwable exception)
Handle an error.- Specified by:
handleError
in interfaceErrorHandler
- Parameters:
element
- The XML element that triggered the error.context
- The container object for the element.exception
- The exception that was thrown.- Returns:
- CONTINUE to skip this element, CANCEL to abort processing of the XML, IGNORE to continue to process the XML as if nothing had happened, or RETHROW to request that the exception be rethrown.
-
-