public class RevalidateAction
extends org.eclipse.emf.edit.ui.action.ValidateAction
There are Diagnostic objects maintained as errors and warnings of an EMF resource, and IMarker objects managed by IResources and stored persistently in the
workspace, representing validation errors. MarkerHelper and its subclasses can turn Diagnostic objects into
IMarkers which form the basis for the problem view display. A MarkerHelper is used to create markers from Diagnostic objects. Specializations of MarkerHelper can annotate the markers with additional
information stored, e.g., in Diagnostic.getData() and storing them in attributes
of the marker. By default, this process is triggered in the updateProblemIndication method of a generated EMF
sample editor, where first all markers for the entire ResourceSet (this seems too broad a scope) are deleted and then
created again based on the Diagnostics returned from Resource.getErrors() and Resource.getWarnings()
for the resources contained by the editing domain's resource set.
EMF resources, upon loading, don't perform any constraint validation. Therefore, their errors and warnings list turns out empty
by default. Filling those has to happen by explicitly performing a ValidateAction on selected resources or individual
elements. Only then will a Diagnostician be used to fetch the EValidator from the validator registry with which
a validation is performed on a single EObject. Such a validation run will produce Diagnostic objects which the
ValidateAction then converts into IMarkers again. Note that these Diagnostic objects are not
entered into the errors/warnings of the Resource on which the validation happened.
When a change Notification triggers this revalidation action, the constraint is re-evaluated on the context objects
determined by the OCL Impact Analysis. For any constraint which now evaluates to true, any
existing Diagnostic needs to be removed. FOr any constraint evaluating to false a Diagnostic
object needs to be created, and an IMarker needs to be created and displayed in the problem view.
During re-validation, the resources of other objects on which to evaluate the constraint may be loaded into the surrounding
editing domain's resource set. Markers are managed by a MarkerManager which persistently stores markers in the
workspace, keyed by the resources to which they belong.
| Constructor and Description |
|---|
RevalidateAction(java.lang.String constraintName,
java.util.Collection<org.eclipse.emf.ecore.EObject> contextObjects,
OCLExpression invariant,
OCLFactory oclFactory,
OppositeEndFinder oppositeEndFinder) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
composeMessage(org.eclipse.emf.common.util.Diagnostic diagnostic,
org.eclipse.emf.common.util.Diagnostic parentDiagnostic) |
protected void |
createMarkers(org.eclipse.core.resources.IResource resource,
org.eclipse.emf.common.util.Diagnostic diagnostic,
org.eclipse.emf.common.util.Diagnostic parentDiagnostic) |
void |
run() |
createDiagnostician, handleDiagnostic, selectionChanged, setActiveWorkbenchPart, updateSelection, validateconvertAccelerator, convertAccelerator, findKeyCode, findKeyString, findModifier, findModifierString, getAccelerator, getActionDefinitionId, getDescription, getDisabledImageDescriptor, getHelpListener, getHoverImageDescriptor, getId, getImageDescriptor, getMenuCreator, getStyle, getText, getToolTipText, isChecked, isEnabled, isHandled, notifyResult, removeAcceleratorText, removeMnemonics, runWithEvent, setAccelerator, setActionDefinitionId, setChecked, setDescription, setDisabledImageDescriptor, setEnabled, setHelpListener, setHoverImageDescriptor, setId, setImageDescriptor, setMenuCreator, setText, setToolTipTextaddPropertyChangeListener, firePropertyChange, firePropertyChange, removePropertyChangeListeneraddListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectpublic RevalidateAction(java.lang.String constraintName,
java.util.Collection<org.eclipse.emf.ecore.EObject> contextObjects,
OCLExpression invariant,
OCLFactory oclFactory,
OppositeEndFinder oppositeEndFinder)
public void run()
run in interface org.eclipse.jface.action.IActionrun in class org.eclipse.emf.edit.ui.action.ValidateActionprotected java.lang.String composeMessage(org.eclipse.emf.common.util.Diagnostic diagnostic,
org.eclipse.emf.common.util.Diagnostic parentDiagnostic)
protected void createMarkers(org.eclipse.core.resources.IResource resource,
org.eclipse.emf.common.util.Diagnostic diagnostic,
org.eclipse.emf.common.util.Diagnostic parentDiagnostic)
throws org.eclipse.core.runtime.CoreException
org.eclipse.core.runtime.CoreException