/** * Get the {@link ComputedStyleDescriptionRegistry} of the specified {@link DDiagram}. * * @param createIfNotExists true if we want to create a {@link ComputedStyleDescriptionRegistry} * for the specified {@link DDiagram} if there is not one, false otherwise * @return the {@link ComputedStyleDescriptionRegistry} of the {@link DDiagram} or null if this * last has not one */ public ComputedStyleDescriptionRegistry getComputedStyleDescriptionRegistry( boolean createIfNotExists) { ComputedStyleDescriptionRegistry computedStyleDescriptionRegistry = null; AnnotationEntry annotationEntry = null; Collection<AnnotationEntry> annotationEntries = new DRepresentationQuery(dDiagram) .getAnnotation(BestStyleDescriptionRegistry.DANNOTATION_CUSTOMIZATION_KEY); if (annotationEntries == null || annotationEntries.isEmpty()) { annotationEntry = DescriptionFactory.eINSTANCE.createAnnotationEntry(); annotationEntry.setSource(BestStyleDescriptionRegistry.DANNOTATION_CUSTOMIZATION_KEY); dDiagram.getOwnedAnnotationEntries().add(annotationEntry); } else { annotationEntry = annotationEntries.iterator().next(); } if (annotationEntry.getData() == null || !(annotationEntry.getData() instanceof ComputedStyleDescriptionRegistry)) { computedStyleDescriptionRegistry = DiagramFactory.eINSTANCE.createComputedStyleDescriptionRegistry(); annotationEntry.setData(computedStyleDescriptionRegistry); } else { computedStyleDescriptionRegistry = (ComputedStyleDescriptionRegistry) annotationEntry.getData(); } return computedStyleDescriptionRegistry; }