Package com.nomagic.magicdraw.validation
Class OpenedDiagramValidator
- java.lang.Object
-
- com.nomagic.magicdraw.validation.DiagramValidator
-
- com.nomagic.magicdraw.validation.OpenedDiagramValidator
-
- All Implemented Interfaces:
com.nomagic.magicdraw.core.diagram.DiagramsChangeListener
,ValidationRule
@OpenApiAll public abstract class OpenedDiagramValidator extends DiagramValidator implements com.nomagic.magicdraw.core.diagram.DiagramsChangeListener
Works the same as the base ruleDiagramValidator
, but narrows the scope down only to currently opened diagrams. When creating annotations, the diagrams in scope should be retrieved by usingDiagramValidator.getDiagrams()
method.
-
-
Constructor Summary
Constructors Constructor Description OpenedDiagramValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
acceptDiagram(DiagramPresentationElement diagram)
void
diagramsChanged(java.util.Collection<DiagramPresentationElement> opened, java.util.Collection<DiagramPresentationElement> closed)
Called when opened diagrams changes.void
dispose()
Unregisters all listeners that were registered and releases other resources.void
init(Project project, Constraint constraint)
This is the first method that is invoked on the implementation of theValidationRule
interface.-
Methods inherited from class com.nomagic.magicdraw.validation.DiagramValidator
getAnnotations, getDiagrams, getDiagramsStream, getPresentationElements, getPresentationElements, getProject, isElementInScope, needsRun, needsRun, run, setNeedsRun
-
-
-
-
Method Detail
-
acceptDiagram
protected boolean acceptDiagram(DiagramPresentationElement diagram)
- Overrides:
acceptDiagram
in classDiagramValidator
- Returns:
- true if the diagram in scope should be returned by
DiagramValidator.getDiagrams()
method
-
init
public void init(Project project, Constraint constraint)
Description copied from interface:ValidationRule
This is the first method that is invoked on the implementation of theValidationRule
interface. Implementation can initialize internal state if required.- Specified by:
init
in interfaceValidationRule
- Overrides:
init
in classDiagramValidator
- Parameters:
project
- a project of the constraintconstraint
- a constraint object
-
diagramsChanged
public void diagramsChanged(java.util.Collection<DiagramPresentationElement> opened, java.util.Collection<DiagramPresentationElement> closed)
Called when opened diagrams changes. Should not be called manually.- Specified by:
diagramsChanged
in interfacecom.nomagic.magicdraw.core.diagram.DiagramsChangeListener
-
dispose
public void dispose()
Description copied from class:DiagramValidator
Unregisters all listeners that were registered and releases other resources.- Specified by:
dispose
in interfaceValidationRule
- Overrides:
dispose
in classDiagramValidator
-
-