private DRepresentation getRepresentation(String name) { for (final DView dView : session.getOwnedViews()) { for (final Iterator<DRepresentation> iterator = new DViewQuery(dView).getLoadedRepresentations().iterator(); iterator.hasNext(); ) { final DRepresentation rep = iterator.next(); if (name.equals(rep.getName())) { return rep; } } } return null; }
private String getName(final DRepresentation representation) { if (representations.size() == 1) { return newName; } else { return newName + " " + representation.getName(); // $NON-NLS-1$ } }
private List<DRepresentationElement> getRepresentationElements( final DRepresentation representation, final List<?> selection) { List<DRepresentationElement> result = Lists.newArrayList(); if (representation != null) { for (final DRepresentationElement element : representation.getRepresentationElements()) { if (selection != null && selection.contains(element.getTarget())) result.add(element); } } return result; }
/** * Get, or create if there is none, a migration annotation for a group. * * @param source the source of the annotation * @param representation the DRepresentation * @param eObject the data of the annotation * @return the annotation entry */ public static AnnotationEntry getOrCreateAnnotation( final String source, final DRepresentation representation, final EObject eObject) { AnnotationEntry annotation = new DRepresentationQuery(representation).getAnnotation(source, eObject).get(); if (annotation == null && eObject != null) { annotation = DescriptionFactory.eINSTANCE.createAnnotationEntry(); annotation.setSource(source); annotation.setData(eObject); representation.getOwnedAnnotationEntries().add(annotation); } return annotation; }