org.eclipse.graphiti.ui.editor
Class DefaultMarkerBehavior

java.lang.Object
  extended by org.eclipse.graphiti.ui.editor.DefaultMarkerBehavior

public class DefaultMarkerBehavior
extends java.lang.Object

The default implementation for the DiagramEditor behavior extension that controls how markers are handled in the editor. Clients may subclass to change the marker behavior; use DiagramEditor.createMarkerBehavior() to return the instance that shall be used.
Note that there is always a 1:1 relation with a DiagramEditor.

Since:
0.9

Field Summary
protected  DiagramEditor diagramEditor
          The associated DiagramEditor
private  MarkerHelper markerHelper
          The marker helper instance is responsible for creating workspace resource markers presented in Eclipse's Problems View.
private  EContentAdapter problemIndicationAdapter
          Adapter used to update the problem indication when resources are demanded loaded.
private  java.util.Map<Resource,Diagnostic> resourceToDiagnosticMap
          Map to store the diagnostic associated with a resource.
private  boolean updateProblemIndication
          Controls whether the problem indication should be updated.
 
Constructor Summary
DefaultMarkerBehavior(DiagramEditor diagramEditor)
          Creates a new instance of DefaultMarkerBehavior that is associated with the given DiagramEditor.
 
Method Summary
 Diagnostic analyzeResourceProblems(Resource resource, java.lang.Exception exception)
          Returns a diagnostic describing the errors and warnings listed in the resource and the specified exception (if any).
 void disableProblemIndicationUpdate()
          Can be called to (temporarily) disable the marker update adapter, so that mass changes do not result in a bunch of notifications and cause performance penalties.
 void dispose()
          Called to dispose this instance when the editor is closed.
 void enableProblemIndicationUpdate()
          Can be called to enable the marker update adapter again after it has been disabled with disableProblemIndicationUpdate().
 EContentAdapter getProblemIndicationAdapter()
          Returns the adapter that is installed for updating the markers.
 void initialize()
          Initializes this marker behavior extension.
(package private)  void updateProblemIndication()
          Updates the problems indication markers in the editor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

diagramEditor

protected DiagramEditor diagramEditor
The associated DiagramEditor


markerHelper

private MarkerHelper markerHelper
The marker helper instance is responsible for creating workspace resource markers presented in Eclipse's Problems View.


resourceToDiagnosticMap

private java.util.Map<Resource,Diagnostic> resourceToDiagnosticMap
Map to store the diagnostic associated with a resource.


updateProblemIndication

private boolean updateProblemIndication
Controls whether the problem indication should be updated.


problemIndicationAdapter

private EContentAdapter problemIndicationAdapter
Adapter used to update the problem indication when resources are demanded loaded.

Constructor Detail

DefaultMarkerBehavior

public DefaultMarkerBehavior(DiagramEditor diagramEditor)
Creates a new instance of DefaultMarkerBehavior that is associated with the given DiagramEditor.

Parameters:
diagramEditor - the associated DiagramEditor
Method Detail

initialize

public void initialize()
Initializes this marker behavior extension. The default implementation simply registers an adapter that updates the markers when EMF objects change.


getProblemIndicationAdapter

public EContentAdapter getProblemIndicationAdapter()
Returns the adapter that is installed for updating the markers.

Returns:
the problemIndicationAdapter

disableProblemIndicationUpdate

public void disableProblemIndicationUpdate()
Can be called to (temporarily) disable the marker update adapter, so that mass changes do not result in a bunch of notifications and cause performance penalties.

See Also:
enableProblemIndicationUpdate()

enableProblemIndicationUpdate

public void enableProblemIndicationUpdate()
Can be called to enable the marker update adapter again after it has been disabled with disableProblemIndicationUpdate(). The default implementation also triggers an update of the markers.


updateProblemIndication

void updateProblemIndication()
Updates the problems indication markers in the editor. The default implementation used an EMF BasicDiagnostic to do the checks and EditUIMarkerHelper to check and set markers for EObjects.


analyzeResourceProblems

public Diagnostic analyzeResourceProblems(Resource resource,
                                          java.lang.Exception exception)
Returns a diagnostic describing the errors and warnings listed in the resource and the specified exception (if any).

Parameters:
resource - the resource to analyze
exception - forwarded as data object to the BasicDiagnostic
Returns:
a new Diagnostic for the given resource

dispose

public void dispose()
Called to dispose this instance when the editor is closed. The default implementation simply disables the marker update adapter and removes it from the resource set and clears its member variables.



Copyright (c) SAP AG 2005, 2012.