de.cau.cs.kieler.core.model.util
Class ModelErrorHandler

java.lang.Object
  extended by de.cau.cs.kieler.core.model.util.ModelErrorHandler
All Implemented Interfaces:
GenericErrorHandler.StatusListener, IStartup

public class ModelErrorHandler
extends Object
implements GenericErrorHandler.StatusListener, IStartup

A StatusHandler that displays error messages for KielerModelException Status causes at the corresponding Diagram object as a problem marker. Other exceptions and styles (BLOCK, LOG) are handled like the default Status handler.

Rating proposed yellow
(2010-06-11) soh

Field Summary
 
Fields inherited from interface de.cau.cs.kieler.core.ui.errorhandler.GenericErrorHandler.StatusListener
DONT_CARE
 
Constructor Summary
ModelErrorHandler()
           
 
Method Summary
static void addMarker(String msg, EObject target)
          Add a problem marker to a given EObject to indicate problems graphically in the diagram.
static void clearMarker(EObject target)
          Remove all custom problem markers from a given EObject to indicate problems graphically in the diagram.
static void disable()
          Disable the error handler.
 void earlyStartup()
          
static void enable()
          Enable the error handler.
static boolean isEnabled()
          Check whether the error handler is enabled.
 int reroute(StatusAdapter statusAdapter, int style)
          Reroute the exception to the given listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelErrorHandler

public ModelErrorHandler()
Method Detail

enable

public static void enable()
Enable the error handler.


disable

public static void disable()
Disable the error handler.


isEnabled

public static boolean isEnabled()
Check whether the error handler is enabled.

Returns:
true if it is

reroute

public int reroute(StatusAdapter statusAdapter,
                   int style)
Reroute the exception to the given listener. If the listener wants to modify the style it should return the style that it wants the exception to have. If the component doesn't care about that particular exception it should return the GenericErrorHandler.StatusListener.DONT_CARE style.

Specified by:
reroute in interface GenericErrorHandler.StatusListener
Parameters:
statusAdapter - the status adapter
style - the style
Returns:
the style that the status should have

addMarker

public static void addMarker(String msg,
                             EObject target)
Add a problem marker to a given EObject to indicate problems graphically in the diagram. Will silently fail at any errors, e.g. if there is no graphical editor open corresponding to the object.

Parameters:
msg - String message of the marker
target - target object

clearMarker

public static void clearMarker(EObject target)
Remove all custom problem markers from a given EObject to indicate problems graphically in the diagram. Will silently fail at any errors, e.g. if there is no graphical editor open corresponding to the object.

Parameters:
target - target object

earlyStartup

public void earlyStartup()

Specified by:
earlyStartup in interface IStartup