@OpenApiAll public class AnnotationManager extends com.nomagic.magicdraw.core.project.service.AbstractProjectService implements ProjectProvider
Modifier and Type | Method and Description |
---|---|
boolean |
add(Annotation annotation)
Add single annotation.
|
boolean |
add(Annotation annotation,
AnnotationCategory category)
Add single annotation.
|
static void |
addAnnotationParentTargetProvider(AnnotationTargetParentProvider provider) |
void |
addListener(AnnotationManagerListener listener) |
void |
disposeService() |
java.util.Collection<BaseElement> |
getAnnotatedElements()
Returns a collection of annotated elements
|
java.util.Collection<BaseElement> |
getAnnotatedElements(AnnotationSubset subset)
Returns a collection of annotated elements
|
java.util.Set<java.lang.Object> |
getAnnotatedTargets(AnnotationSubset subset)
Returns targets of the registered annotations.
|
java.util.List<Annotation> |
getAnnotations(BaseElement element)
Get all annotations for particular element.
|
java.util.List<Annotation> |
getAnnotations(BaseElement element,
AnnotationSubset subset) |
java.util.List<Annotation> |
getAnnotations(java.lang.Object target) |
java.util.List<Annotation> |
getAnnotations(java.lang.Object target,
AnnotationSubset subset) |
java.util.List<Annotation> |
getAnnotationsOfChildren(BaseElement element) |
java.util.List<Annotation> |
getAnnotationsOfChildren(BaseElement element,
AnnotationSubset subset)
Get all annotations of children of given element.
|
java.util.List<Annotation> |
getAnnotationsOfHiddenChildren(PresentationElement view)
Get all annotations of closest hidden children(recursively) of given symbol.
|
java.util.List<Annotation> |
getAnnotationsOfHiddenChildren(PresentationElement view,
AnnotationSubset subset)
Get all annotations of closest hidden children(recursively) of given symbol.
|
static AnnotationManager |
getInstance(BaseElement element) |
static AnnotationManager |
getInstance(Project project) |
java.util.Iterator<BaseElement> |
getIteratorOfAnnotatedElements(BaseElement owner)
Returns a collection of annotated elements
|
java.util.Iterator<Annotation> |
getIteratorOfAnnotationsOfChildren(BaseElement element) |
java.util.Iterator<Annotation> |
getIteratorOfAnnotationsOfChildren(BaseElement element,
AnnotationSubset subset) |
Project |
getProject() |
static Project |
getProject(java.lang.Object annotationTarget)
Used to retrieve project from element or parent target providers if given object is not element.
|
boolean |
hasAnnotatedChildren(BaseElement element)
Test if given element has children (recursively) with some annotations.
|
boolean |
hasAnnotatedChildren(BaseElement element,
AnnotationSubset subset)
Test if given element has children (recursively) with some annotations.
|
boolean |
hasAnnotations() |
boolean |
hasAnnotations(BaseElement element,
AnnotationSubset subset) |
boolean |
hasAnnotations(java.lang.Object target,
AnnotationSubset subset) |
(package private) static boolean |
isAncestor(BaseElement ancestor,
BaseElement child) |
void |
registerSubset(AnnotationSubset subset)
Register subset (part) of annotations.
|
boolean |
remove(Annotation annotation)
Remove single annotation.
|
static void |
removeAnnotationParentTargetProvider(AnnotationTargetParentProvider provider) |
void |
removeListener(AnnotationManagerListener listener) |
void |
unregisterSubset(AnnotationSubset subset) |
void |
update()
Repaint only opened diagrams for project
|
void |
update(java.util.Collection<? extends Annotation> removed,
java.util.Collection<Annotation> added)
Updates annotation manager using specified data.
|
void |
update(java.util.Collection<? extends Annotation> removed,
java.util.Collection<Annotation> added,
AnnotationCategory category)
Updates annotation manager using specified data.
|
public static void addAnnotationParentTargetProvider(AnnotationTargetParentProvider provider)
public static void removeAnnotationParentTargetProvider(AnnotationTargetParentProvider provider)
public static AnnotationManager getInstance(BaseElement element)
public static AnnotationManager getInstance(Project project)
public boolean add(Annotation annotation)
update()
method has been called.annotation
- annotation to addpublic boolean add(Annotation annotation, AnnotationCategory category)
update()
method has been called.annotation
- annotation to addcategory
- category to which this annotation belongs. Each category can be part of various AnnotationSubsetspublic boolean remove(Annotation annotation)
update()
method has been called.annotation
- annotation to removepublic boolean hasAnnotatedChildren(@CheckForNull BaseElement element)
element
- given elementpublic boolean hasAnnotatedChildren(@CheckForNull BaseElement element, AnnotationSubset subset)
element
- given elementsubset
- subset (part) of all currently registered annotations to check.public java.util.List<Annotation> getAnnotationsOfChildren(BaseElement element)
public java.util.List<Annotation> getAnnotationsOfChildren(BaseElement element, AnnotationSubset subset)
element
- given elementsubset
- subset (part) of all currently registered children annotations to retrievepublic java.util.List<Annotation> getAnnotationsOfHiddenChildren(PresentationElement view)
view
- symbol of starting PE. dedicated to find closest hidden elements for diagrams.public java.util.List<Annotation> getAnnotationsOfHiddenChildren(PresentationElement view, AnnotationSubset subset)
view
- symbol of starting PE. dedicated to find closest hidden elements for diagrams.subset
- subset (part) of all currently registered hidden children annotations to check.public java.util.List<Annotation> getAnnotations(BaseElement element)
element
- element to get annotations forpublic java.util.List<Annotation> getAnnotations(BaseElement element, AnnotationSubset subset)
element
- element to get annotations forsubset
- subset (part) of all currently registered annotations to retrieve.public java.util.List<Annotation> getAnnotations(java.lang.Object target)
public java.util.List<Annotation> getAnnotations(java.lang.Object target, AnnotationSubset subset)
public boolean hasAnnotations(BaseElement element, AnnotationSubset subset)
public boolean hasAnnotations(java.lang.Object target, AnnotationSubset subset)
public void update()
public void disposeService()
disposeService
in interface com.nomagic.magicdraw.core.project.service.DisposableService
disposeService
in class com.nomagic.magicdraw.core.project.service.AbstractProjectService
public static Project getProject(java.lang.Object annotationTarget)
annotationTarget
- annotation targetpublic java.util.Collection<BaseElement> getAnnotatedElements()
public java.util.Collection<BaseElement> getAnnotatedElements(AnnotationSubset subset)
subset
- subset (part) of all currently registered annotations to take into account.public java.util.Set<java.lang.Object> getAnnotatedTargets(AnnotationSubset subset)
subset
- subset (part) of all currently registered annotations to take into account.public java.util.Iterator<BaseElement> getIteratorOfAnnotatedElements(@CheckForNull BaseElement owner)
public void update(java.util.Collection<? extends Annotation> removed, java.util.Collection<Annotation> added)
removed
- collection of removed annotations.added
- collection of added annotations.public void update(java.util.Collection<? extends Annotation> removed, java.util.Collection<Annotation> added, AnnotationCategory category)
removed
- collection of removed annotations.added
- collection of added annotations.category
- category to which annotations belongspublic void addListener(AnnotationManagerListener listener)
public void removeListener(AnnotationManagerListener listener)
public boolean hasAnnotations()
public java.util.Iterator<Annotation> getIteratorOfAnnotationsOfChildren(BaseElement element)
public java.util.Iterator<Annotation> getIteratorOfAnnotationsOfChildren(BaseElement element, AnnotationSubset subset)
public void registerSubset(AnnotationSubset subset)
public void unregisterSubset(AnnotationSubset subset)
static boolean isAncestor(BaseElement ancestor, BaseElement child)
public Project getProject()
getProject
in interface ProjectProvider