org.eclipse.emf.common.ui
Class MarkerHelper

java.lang.Object
  extended by org.eclipse.emf.common.ui.MarkerHelper
Direct Known Subclasses:
EditUIMarkerHelper

public class MarkerHelper
extends java.lang.Object

Provides methods to simplify the work with IMarkers. The main goal is to simplify the creation of markers using the information described in Diagnostics.

Since:
2.2.0

Constructor Summary
MarkerHelper()
           
 
Method Summary
protected  void adjustMarker(IMarker marker, Diagnostic diagnostic, Diagnostic parentDiagnostic)
          Clients should override this method to update the marker associated with the diagnostic.
protected  java.lang.String composeMessage(Diagnostic diagnostic, Diagnostic parentDiagnostic)
          Returns the message that will be used with the marker associated with the given diagnostic.
 void createMarkers(Diagnostic diagnostic)
          Creates a marker based on the information available in the specified diagnostic.
protected  void createMarkers(IResource resource, Diagnostic diagnostic, Diagnostic parentDiagnostic)
           
protected  void deleteMarkers(IResource resource, boolean includeSubtypes, int depth)
           
 void deleteMarkers(java.lang.Object object)
          Deletes a maker with id equals to the return of getMarkerID() from the IResource computed from the specified object.
 void deleteMarkers(java.lang.Object object, boolean includeSubtypes, int depth)
           
 IEditorInput getEditorInput(java.lang.Object object)
           
protected  IFile getFile(Diagnostic diagnostic)
           
protected  IFile getFile(java.lang.Object datum)
           
protected  IFile getFile(URI uri)
           
protected  java.lang.String getMarkerID()
           
 java.util.List<?> getTargetObjects(java.lang.Object object, IMarker marker)
           
protected  boolean hasMarkers(IResource resource, boolean includeSubtypes, int depth)
           
 boolean hasMarkers(java.lang.Object object)
          Returns whether the a maker with id equals to the return of getMarkerID() is available in the IResource computed from the specified object.
 boolean hasMarkers(java.lang.Object object, boolean includeSubtypes, int depth)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarkerHelper

public MarkerHelper()
Method Detail

getMarkerID

protected java.lang.String getMarkerID()

getFile

protected IFile getFile(java.lang.Object datum)

getFile

protected IFile getFile(Diagnostic diagnostic)

getFile

protected IFile getFile(URI uri)

createMarkers

public void createMarkers(Diagnostic diagnostic)
                   throws CoreException

Creates a marker based on the information available in the specified diagnostic. The marker's id is defined by getMarkerID().

The default implementation looks in the diagnostic's data array for objects that would allow an IFile to be computed

Parameters:
diagnostic -
Throws:
CoreException

createMarkers

protected void createMarkers(IResource resource,
                             Diagnostic diagnostic,
                             Diagnostic parentDiagnostic)
                      throws CoreException
Throws:
CoreException

adjustMarker

protected void adjustMarker(IMarker marker,
                            Diagnostic diagnostic,
                            Diagnostic parentDiagnostic)
                     throws CoreException
Clients should override this method to update the marker associated with the diagnostic.

Parameters:
marker - the marker to be updated.
diagnostic - the diagnostic associated with the marker.
parentDiagnostic - the parent of the diagnostic, if any.
Throws:
CoreException

composeMessage

protected java.lang.String composeMessage(Diagnostic diagnostic,
                                          Diagnostic parentDiagnostic)
Returns the message that will be used with the marker associated with the given diagnostic.

Parameters:
diagnostic - the diagnostic.
parentDiagnostic - the parent of the diagnostic, if any.
Returns:
the message that will be used with the marker associated with the given diagnostic.

hasMarkers

public boolean hasMarkers(java.lang.Object object)
Returns whether the a maker with id equals to the return of getMarkerID() is available in the IResource computed from the specified object.

Parameters:
object -
Returns:
boolean

hasMarkers

public boolean hasMarkers(java.lang.Object object,
                          boolean includeSubtypes,
                          int depth)

hasMarkers

protected boolean hasMarkers(IResource resource,
                             boolean includeSubtypes,
                             int depth)

deleteMarkers

public void deleteMarkers(java.lang.Object object)
Deletes a maker with id equals to the return of getMarkerID() from the IResource computed from the specified object.

Parameters:
object -

deleteMarkers

public void deleteMarkers(java.lang.Object object,
                          boolean includeSubtypes,
                          int depth)

deleteMarkers

protected void deleteMarkers(IResource resource,
                             boolean includeSubtypes,
                             int depth)

getEditorInput

public IEditorInput getEditorInput(java.lang.Object object)

getTargetObjects

public java.util.List<?> getTargetObjects(java.lang.Object object,
                                          IMarker marker)
Since:
2.3

Copyright 2001-2006 IBM Corporation and others.
All Rights Reserved.