org.eclipse.emf.validation.marker
Class MarkerUtil

java.lang.Object
  extended by org.eclipse.emf.validation.marker.MarkerUtil

public final class MarkerUtil
extends Object

This class provides utility methods that aid in the creation of IResource markers (IMarker). Markers created by this utility will have the ValidationMarkerResolution registered as a resolution that simply disables the constraint unless they are using a marker subtype. In that case they will have to explicitly register the ValidationMarkerResolution against their marker type.


Field Summary
static String RULE_ATTRIBUTE
           
static String VALIDATION_MARKER_TYPE
           
 
Constructor Summary
MarkerUtil()
           
 
Method Summary
static void createMarkers(IStatus validationStatus)
           Creates markers with default validation marker type for all resources that had validation failures or warnings.
static void createMarkers(IStatus validationStatus, int severityMask)
           Creates markers with default validation marker type for all resources that had validation failures or warnings.
static void createMarkers(IStatus validationStatus, int severityMask, String markerType, IMarkerConfigurator configurator)
           Creates markers with the provided marker type for all resources that had validation failures or warnings.
static void createMarkers(IStatus validationStatus, String markerType, IMarkerConfigurator configurator)
           Creates markers with the provided marker type for all resources that had validation failures or warnings.
static void updateMarkers(IStatus validationStatus)
           Creates or updates markers with default validation marker type for all resources that had validation failures or warnings.
static void updateMarkers(IStatus validationStatus, int severityMask)
           Creates markers with default validation marker type for all resources that had validation failures or warnings.
static void updateMarkers(IStatus validationStatus, int severityMask, String markerType, IMarkerConfigurator configurator)
           Creates markers with the provided marker type for all resources that had validation failures or warnings.
static void updateMarkers(IStatus validationStatus, String markerType, IMarkerConfigurator configurator)
           Creates markers with the provided marker type for all resources that had validation failures or warnings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALIDATION_MARKER_TYPE

public static final String VALIDATION_MARKER_TYPE
See Also:
Constant Field Values

RULE_ATTRIBUTE

public static final String RULE_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

MarkerUtil

public MarkerUtil()
Method Detail

createMarkers

public static void createMarkers(IStatus validationStatus)
                          throws CoreException

Creates markers with default validation marker type for all resources that had validation failures or warnings. The status provided is the status returned by one of the IValidator.validate(Object) methods.

To update the markers on a resource that already has markers, use the updateMarkers(IStatus) method.

Parameters:
validationStatus - A status object returned by a validator's validate method.
Throws:
CoreException - A core exception is thrown if there were any problems interacting with the workspace to attach/delete markers on resources.
See Also:
updateMarkers(IStatus)

createMarkers

public static void createMarkers(IStatus validationStatus,
                                 int severityMask)
                          throws CoreException

Creates markers with default validation marker type for all resources that had validation failures or warnings. The status provided is the status returned by one of the IValidator.validate(Object) methods.

To update the markers on a resource that already has markers, use the updateMarkers(IStatus, int) method.

Parameters:
validationStatus - A status object returned by a validator's validate method.
severityMask - mask selecting which severities to create markers for
Throws:
CoreException - A core exception is thrown if there were any problems interacting with the workspace to attach/delete markers on resources.
Since:
1.2
See Also:
updateMarkers(IStatus, int)

createMarkers

public static void createMarkers(IStatus validationStatus,
                                 String markerType,
                                 IMarkerConfigurator configurator)
                          throws CoreException

Creates markers with the provided marker type for all resources that had validation failures or warnings. An options marker configurator is provided in order to populate the marker with additional information.

To update the markers on a resource that already has markers, use the updateMarkers(IStatus, String, IMarkerConfigurator) method.

Parameters:
validationStatus - A status object returned by a validator's validate method.
markerType - A marker type that is a subtype of the validationProblem marker type.
configurator - An optional configurator to populate marker subtype specific attributes.
Throws:
CoreException - A core exception is thrown if there were any problems interacting with the workspace to attach/delete markers on resources.
See Also:
IValidator.validate(Object), IValidator.validate(java.util.Collection), IMarkerConfigurator, updateMarkers(IStatus, String, IMarkerConfigurator)

createMarkers

public static void createMarkers(IStatus validationStatus,
                                 int severityMask,
                                 String markerType,
                                 IMarkerConfigurator configurator)
                          throws CoreException

Creates markers with the provided marker type for all resources that had validation failures or warnings. An options marker configurator is provided in order to populate the marker with additional information.

To update the markers on a resource that already has markers, use the updateMarkers(IStatus, int, String, IMarkerConfigurator) method.

Parameters:
validationStatus - A status object returned by a validator's validate method.
severityMask - mask selecting which severities to create markers for
markerType - A marker type that is a subtype of the validationProblem marker type.
configurator - An optional configurator to populate marker subtype specific attributes.
Throws:
CoreException - A core exception is thrown if there were any problems interacting with the workspace to attach/delete markers on resources.
Since:
1.2
See Also:
IValidator.validate(Object), IValidator.validate(java.util.Collection), IMarkerConfigurator, updateMarkers(IStatus, int, String, IMarkerConfigurator)

updateMarkers

public static void updateMarkers(IStatus validationStatus)
                          throws CoreException

Creates or updates markers with default validation marker type for all resources that had validation failures or warnings. If there is no failed validation on a given resource, its previously attached markers are deleted. If a resource has validation failures or warnings, its previously attached markers are deleted and new ones are created. The status provided is the status returned by one of the IValidator.validate(Object) methods.

Note that, in order to correctly update the markers for resources that reported no problems, the validation operation must have been performed with the IBatchValidator.OPTION_TRACK_RESOURCES option enabled.

Parameters:
validationStatus - A status object returned by a validator's validate method.
Throws:
CoreException - A core exception is thrown if there were any problems interacting with the workspace to attach/delete markers on resources.
Since:
1.3

updateMarkers

public static void updateMarkers(IStatus validationStatus,
                                 int severityMask)
                          throws CoreException

Creates markers with default validation marker type for all resources that had validation failures or warnings. If there is no failed validation on a given resource, its previously attached markers are deleted. If a resource has validation failures or warnings, its previously attached markers are deleted and new ones are created. The status provided is the status returned by one of the IValidator.validate(Object) methods.

Note that, in order to correctly update the markers for resources that reported no problems, the validation operation must have been performed with the IBatchValidator.OPTION_TRACK_RESOURCES option enabled.

Parameters:
validationStatus - A status object returned by a validator's validate method.
severityMask - mask selecting which severities to create markers for
Throws:
CoreException - A core exception is thrown if there were any problems interacting with the workspace to attach/delete markers on resources.
Since:
1.3

updateMarkers

public static void updateMarkers(IStatus validationStatus,
                                 String markerType,
                                 IMarkerConfigurator configurator)
                          throws CoreException

Creates markers with the provided marker type for all resources that had validation failures or warnings. If there is no failed validation on a given resource, its previously attached markers are deleted. If a resource has validation failures or warnings, its previously attached markers are deleted and new ones are created. An optional marker configurator is provided in order to populate the marker with additional information.

that reported no problems, the validation operation must have been performed with the IBatchValidator.OPTION_TRACK_RESOURCES option enabled.

Parameters:
validationStatus - A status object returned by a validator's validate method.
markerType - A marker type that is a subtype of the validationProblem marker type.
configurator - An optional configurator to populate marker subtype specific attributes.
Throws:
CoreException - A core exception is thrown if there were any problems interacting with the workspace to attach/delete markers on resources.
Since:
1.3
See Also:
IValidator.validate(Object), IValidator.validate(java.util.Collection), IMarkerConfigurator

updateMarkers

public static void updateMarkers(IStatus validationStatus,
                                 int severityMask,
                                 String markerType,
                                 IMarkerConfigurator configurator)
                          throws CoreException

Creates markers with the provided marker type for all resources that had validation failures or warnings. If there is no failed validation on a given resource, its previously attached markers are deleted. If a resource has validation failures or warnings, its previously attached markers are deleted and new ones are created. An optional marker configurator is provided in order to populate the marker with additional

Note that, in order to correctly update the markers for resources that reported no problems, the validation operation must have been performed with the IBatchValidator.OPTION_TRACK_RESOURCES option enabled.

information.

Parameters:
validationStatus - A status object returned by a validator's validate method.
severityMask - mask selecting which severities to create markers for
markerType - A marker type that is a subtype of the validationProblem marker type.
configurator - An optional configurator to populate marker subtype specific attributes.
Throws:
CoreException - A core exception is thrown if there were any problems interacting with the workspace to attach/delete markers on resources.
Since:
1.3
See Also:
IValidator.validate(Object), IValidator.validate(java.util.Collection), IMarkerConfigurator

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.