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 rule
DiagramValidator, but narrows the scope down only to currently opened diagrams.
When creating annotations, the diagrams in scope should be retrieved by using DiagramValidator.getDiagrams() method.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanacceptDiagram(DiagramPresentationElement diagram) voiddiagramsChanged(Collection<AbstractDiagramPresentationElement> opened, Collection<AbstractDiagramPresentationElement> 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
-
Constructor Details
-
OpenedDiagramValidator
public OpenedDiagramValidator()
-
-
Method Details
-
acceptDiagram
- Overrides:
acceptDiagramin classDiagramValidator- Returns:
- true if the diagram in scope should be returned by
DiagramValidator.getDiagrams()method
-
init
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(Collection<AbstractDiagramPresentationElement> opened, Collection<AbstractDiagramPresentationElement> closed) Called when opened diagrams changes. Should not be called manually.- Specified by:
diagramsChangedin interfacecom.nomagic.magicdraw.core.diagram.DiagramsChangeListener- Parameters:
opened- newly opened diagrams including inner diagrams displayed within them.closed- newly closed diagrams including inner diagrams, if the diagrams are no longer open in any other tab.
-
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
-