public class ValidityModel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected ValidityManager |
validityManager |
static int |
WORK_FOR_ALL_SET_INPUT |
static int |
WORK_FOR_CLEAN_UP |
static int |
WORK_FOR_CREATE_MODEL |
Constructor and Description |
---|
ValidityModel(ValidityManager validityManager,
java.util.Collection<org.eclipse.emf.ecore.resource.Resource> newResources)
The Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.util.Set<ConstrainingURI> |
accumulateConstrainingURIs(java.util.Set<ConstrainingURI> constrainingURIs,
TypeURI typeURI) |
void |
addConstrainingFilter(IVisibilityFilter filter) |
void |
addFilteredSeverity(Severity severity) |
void |
addValidatableFilter(IVisibilityFilter filter) |
protected java.util.Set<org.eclipse.emf.ecore.EClass> |
analyzeResource(org.eclipse.emf.ecore.resource.Resource resource) |
protected java.util.Map<org.eclipse.emf.ecore.EPackage,java.util.Set<org.eclipse.emf.ecore.resource.Resource>> |
analyzeResources(java.util.Collection<org.eclipse.emf.ecore.resource.Resource> resources,
org.eclipse.emf.common.util.Monitor monitor,
int worked)
Looks for all EPackages in the source Resources.
|
protected java.util.Set<TypeURI> |
buildTypeClosure(org.eclipse.emf.ecore.EObject constrainingObject)
Return all types that may provide constraints to an instance of aType.
|
protected ConstrainingNode |
createConstrainingNode()
Creates a ConstrainingNode.
|
LeafConstrainingNode |
createLeafConstrainingNode()
creates a LeafConstrainingNode
|
protected Result |
createResult(org.eclipse.core.runtime.IProgressMonitor monitor)
Return a new Result object, or return null if the creation process is to be aborted.
|
protected ResultConstrainingNode |
createResultConstrainingNode()
Creates a ResultConstrainingNode.
|
protected void |
createResultNodes(java.util.Collection<org.eclipse.emf.ecore.resource.Resource> resources,
org.eclipse.emf.common.util.Monitor monitor,
int worked)
Create the ResultValidatableNode,ResultConstrainingNode cross-linkage for
all validateableObject,constraint pairs.
|
protected void |
createResultNodes(org.eclipse.emf.ecore.EObject constrainedObject,
ConstrainingURI constrainingURI)
Create the ResultValidatableNode,ResultConstrainingNode cross-linkage
between constrainedObject and each child constraint of constrainingType.
|
protected void |
createResultNodes(ValidatableNode validatable,
ConstrainingNode constrainingNode) |
protected boolean |
createResults(java.util.List<Result> results,
java.util.List<? extends ValidatableNode> validatableNodes,
org.eclipse.core.runtime.IProgressMonitor monitor)
Created Results of all validatableNodes.
|
protected ResultSet |
createResultSet()
Creates a ResultSet.
|
ResultSet |
createResultSet(org.eclipse.core.runtime.IProgressMonitor monitor)
Return a new ResultSet object containing an initial result for every
enabled combination of ValidatableNode and ConstrainingNode.
|
protected ResultValidatableNode |
createResultValidatableNode()
Creates a ResultValidatableNode
|
protected RootConstrainingNode |
createRootConstrainingNode() |
protected RootValidatableNode |
createRootValidatableNode() |
protected void |
createTypeConstrainingNodes(java.util.Map<org.eclipse.emf.ecore.EObject,java.util.List<LeafConstrainingNode>> allConstraints,
org.eclipse.emf.common.util.Monitor monitor)
Create the LeafConstrainingNode parents for each EModelElement that provides constraints
|
protected ValidatableNode |
createValidatableNode() |
java.lang.String |
getConstrainingLabel(org.eclipse.emf.ecore.EObject eObject)
Returns the eObject label
|
ConstrainingNode |
getConstrainingNode(org.eclipse.emf.ecore.EObject constrainingObject)
Return the ConstrainingNode node for EObject creating any parent
ConstrainingNodes that are required to ensure that the returned
ConstrainingNode is installed in the root.
|
protected java.lang.Iterable<ConstraintLocator> |
getConstraintLocators(java.lang.String nsURI) |
java.util.Collection<org.eclipse.emf.ecore.resource.Resource> |
getResources() |
java.lang.String |
getResultConstrainingLabel(ValidatableNode validatableNode) |
protected java.lang.StringBuilder |
getResultPath(java.lang.StringBuilder s,
AbstractNode abstractNode) |
java.lang.String |
getResultValidatableLabel(ConstrainingNode constrainingNode) |
RootNode |
getRootNode() |
protected ValidatableNode |
getValidatableNode(org.eclipse.emf.ecore.EObject eObject)
Return the ValidatableNode node for EObject creating any ValidatableNodes
that are required to ensure that the returned ValidatableNode is
installed in the root.
|
void |
init(org.eclipse.emf.common.util.Monitor monitor)
Initialize the ValidityModel
|
protected java.util.Map<org.eclipse.emf.ecore.EObject,java.util.List<LeafConstrainingNode>> |
locateConstraints(java.util.Map<org.eclipse.emf.ecore.EPackage,java.util.Set<org.eclipse.emf.ecore.resource.Resource>> ePackage2resources,
org.eclipse.emf.common.util.Monitor monitor,
int worked)
Find all constraints for each EClass
|
void |
refreshModel(java.util.List<AbstractNode> grayedValidatableNodes,
java.util.List<AbstractNode> grayedConstrainingNodes) |
void |
removeConstrainingFilter(IVisibilityFilter filter) |
void |
removeFilteredSeverity(Severity severity) |
void |
removeValidatableFilter(IVisibilityFilter filter) |
protected <T extends AbstractNode> |
sortEList(org.eclipse.emf.common.util.EList<T> nodes,
java.util.Comparator<AbstractNode> comparator)
Sorts the list.
|
protected <T extends AbstractNode> |
sortNodes(org.eclipse.emf.common.util.EList<T> nodes,
java.util.Comparator<AbstractNode> comparator)
Sorts the list.
|
public static final int WORK_FOR_CLEAN_UP
public static final int WORK_FOR_CREATE_MODEL
public static final int WORK_FOR_ALL_SET_INPUT
@NonNull protected final ValidityManager validityManager
public ValidityModel(@NonNull ValidityManager validityManager, @NonNull java.util.Collection<org.eclipse.emf.ecore.resource.Resource> newResources)
validityManager
- The ValidityManagernewResources
- All resources found in the resourceSet@Nullable public java.util.Set<ConstrainingURI> accumulateConstrainingURIs(@Nullable java.util.Set<ConstrainingURI> constrainingURIs, @NonNull TypeURI typeURI)
public void addConstrainingFilter(@NonNull IVisibilityFilter filter)
public void addFilteredSeverity(@NonNull Severity severity)
public void addValidatableFilter(@NonNull IVisibilityFilter filter)
@NonNull protected java.util.Map<org.eclipse.emf.ecore.EPackage,java.util.Set<org.eclipse.emf.ecore.resource.Resource>> analyzeResources(@NonNull java.util.Collection<org.eclipse.emf.ecore.resource.Resource> resources, @NonNull org.eclipse.emf.common.util.Monitor monitor, int worked)
resources
- the Collection of all resources in the resourceSet@NonNull protected java.util.Set<org.eclipse.emf.ecore.EClass> analyzeResource(org.eclipse.emf.ecore.resource.Resource resource)
@NonNull protected java.util.Set<TypeURI> buildTypeClosure(@NonNull org.eclipse.emf.ecore.EObject constrainingObject)
@NonNull protected ConstrainingNode createConstrainingNode()
@NonNull public LeafConstrainingNode createLeafConstrainingNode()
@Nullable protected Result createResult(@Nullable org.eclipse.core.runtime.IProgressMonitor monitor)
The default implementation always return an object. Derived implementations may cancel in response to a progress monitor request.
monitor
- the corresponding monitor@NonNull protected ResultConstrainingNode createResultConstrainingNode()
protected void createResultNodes(@NonNull java.util.Collection<org.eclipse.emf.ecore.resource.Resource> resources, @NonNull org.eclipse.emf.common.util.Monitor monitor, int worked)
resources
- the resourcesprotected void createResultNodes(@NonNull org.eclipse.emf.ecore.EObject constrainedObject, @NonNull ConstrainingURI constrainingURI)
constrainedObject
- the constraining objectconstrainingURI
- the uri of the constrainingNodeprotected void createResultNodes(@NonNull ValidatableNode validatable, @NonNull ConstrainingNode constrainingNode)
@NonNull protected ResultSet createResultSet()
@Nullable public ResultSet createResultSet(@Nullable org.eclipse.core.runtime.IProgressMonitor monitor)
monitor
- the corresponding monitor@NonNull protected ResultValidatableNode createResultValidatableNode()
protected boolean createResults(@NonNull java.util.List<Result> results, @NonNull java.util.List<? extends ValidatableNode> validatableNodes, @Nullable org.eclipse.core.runtime.IProgressMonitor monitor)
results
- the created resultsvalidatableNodes
- the validatableNodesmonitor
- the corresponding monitor@NonNull protected RootConstrainingNode createRootConstrainingNode()
@NonNull protected RootValidatableNode createRootValidatableNode()
protected void createTypeConstrainingNodes(@NonNull java.util.Map<org.eclipse.emf.ecore.EObject,java.util.List<LeafConstrainingNode>> allConstraints, @NonNull org.eclipse.emf.common.util.Monitor monitor)
allConstraints
- the map from each model element to the LeafConstrainingNode of each of its constraints@NonNull protected ValidatableNode createValidatableNode()
@NonNull public java.lang.String getConstrainingLabel(@NonNull org.eclipse.emf.ecore.EObject eObject)
eObject
- @NonNull public ConstrainingNode getConstrainingNode(@NonNull org.eclipse.emf.ecore.EObject constrainingObject)
@NonNull protected java.lang.Iterable<ConstraintLocator> getConstraintLocators(@NonNull java.lang.String nsURI)
@NonNull public java.util.Collection<org.eclipse.emf.ecore.resource.Resource> getResources()
@NonNull public java.lang.String getResultConstrainingLabel(@NonNull ValidatableNode validatableNode)
@NonNull protected java.lang.StringBuilder getResultPath(@NonNull java.lang.StringBuilder s, @Nullable AbstractNode abstractNode)
@NonNull public java.lang.String getResultValidatableLabel(@NonNull ConstrainingNode constrainingNode)
@NonNull public RootNode getRootNode()
@NonNull protected ValidatableNode getValidatableNode(@NonNull org.eclipse.emf.ecore.EObject eObject)
eObject
- the modelElementpublic void init(@NonNull org.eclipse.emf.common.util.Monitor monitor)
@Nullable protected java.util.Map<org.eclipse.emf.ecore.EObject,java.util.List<LeafConstrainingNode>> locateConstraints(@NonNull java.util.Map<org.eclipse.emf.ecore.EPackage,java.util.Set<org.eclipse.emf.ecore.resource.Resource>> ePackage2resources, @NonNull org.eclipse.emf.common.util.Monitor monitor, int worked)
ePackage2resources
- the map of all ePackages and their resourcespublic void refreshModel(@Nullable java.util.List<AbstractNode> grayedValidatableNodes, @Nullable java.util.List<AbstractNode> grayedConstrainingNodes)
public void removeConstrainingFilter(@NonNull IVisibilityFilter filter)
public void removeFilteredSeverity(@NonNull Severity severity)
public void removeValidatableFilter(@NonNull IVisibilityFilter filter)
protected <T extends AbstractNode> void sortEList(@NonNull org.eclipse.emf.common.util.EList<T> nodes, @NonNull java.util.Comparator<AbstractNode> comparator)
nodes
- the list of nodes needing to be sorted.protected <T extends AbstractNode> void sortNodes(@NonNull org.eclipse.emf.common.util.EList<T> nodes, @NonNull java.util.Comparator<AbstractNode> comparator)
nodes
- the list of nodes needing to be sorted.