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 booleanacceptDiagram(DiagramPresentationElement diagram)voiddiagramsChanged(java.util.Collection<DiagramPresentationElement> opened, java.util.Collection<DiagramPresentationElement> closed)Called when opened diagrams changes.voiddispose()Unregisters all listeners that were registered and releases other resources.voidinit(Project project, Constraint constraint)This is the first method that is invoked on the implementation of theValidationRuleinterface.-
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:
acceptDiagramin 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:ValidationRuleThis is the first method that is invoked on the implementation of theValidationRuleinterface. Implementation can initialize internal state if required.- Specified by:
initin interfaceValidationRule- Overrides:
initin 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:
diagramsChangedin interfacecom.nomagic.magicdraw.core.diagram.DiagramsChangeListener
-
dispose
public void dispose()
Description copied from class:DiagramValidatorUnregisters all listeners that were registered and releases other resources.- Specified by:
disposein interfaceValidationRule- Overrides:
disposein classDiagramValidator
-
-