Source:
private List<DRepresentationElement> extractSelectionFromUIState(DRepresentation currentRep, List<DRepresentationElement> notifiedElements) { List<DRepresentationElement> selectedElements = null; List<DRepresentationElement> dRepElements = Lists.newArrayList(); List<EObject> semanticElements = Lists.newArrayList(); UIState uiState = currentRep.getUiState(); if (uiState != null && uiState.isSetElementsToSelect()) { Collection<EObject> elementsToSelectFromUIState = uiState.getElementsToSelect(); boolean hasRepElement = false; boolean hasSemanticElement = false; boolean hasRepresentation = false; for (EObject currentElement : elementsToSelectFromUIState) { if (currentElement instanceof DRepresentationElement) { hasRepElement = true; dRepElements.add((DRepresentationElement) currentElement); } else if (currentElement instanceof DRepresentation) { hasRepresentation = true; break; } else { hasSemanticElement = true; semanticElements.add(currentElement); } } if (elementsToSelectFromUIState.isEmpty()) { selectedElements = Lists.newArrayList(); } else if (hasRepresentation && !hasRepElement && !hasSemanticElement) { selectedElements = Lists.newArrayList(); } else if (hasRepElement && (hasRepresentation || hasSemanticElement)) { selectedElements = null; } else if (hasSemanticElement) { selectedElements = Lists.newArrayList(); caseHasSemanticElement(selectedElements, notifiedElements, semanticElements, currentRep); } else if (hasRepElement) { if (uiState.isInverseSelectionOrder()) { Collections.reverse(dRepElements); } if (!notifiedElements.isEmpty()) { dRepElements.retainAll(notifiedElements); } selectedElements = Lists.newArrayList(dRepElements); } } return selectedElements; }

Target:
private List<DRepresentationElement> extractSelectionFromUIState(DRepresentation currentRep, List<DRepresentationElement> notifiedElements) { List<DRepresentationElement> selectedElements = null; List<DRepresentationElement> dRepElements = Lists.newArrayList(); List<EObject> semanticElements = Lists.newArrayList(); UIState uiState = currentRep.getUiState(); if (uiState != null && uiState.isSetElementsToSelect()) { Collection<EObject> elementsToSelectFromUIState = uiState.getElementsToSelect(); boolean hasRepElement = false; boolean hasSemanticElement = false; boolean hasRepresentation = false; for (EObject currentElement : elementsToSelectFromUIState) { if (currentElement instanceof DRepresentationElement) { hasRepElement = true; dRepElements.add((DRepresentationElement) currentElement); } else if (currentElement instanceof DRepresentation) { hasRepresentation = true; break; } else { hasSemanticElement = true; semanticElements.add(currentElement); } } if (elementsToSelectFromUIState.isEmpty()) { selectedElements = Lists.newArrayList(); } else if (hasRepresentation && !hasRepElement && !hasSemanticElement) { selectedElements = Lists.newArrayList(); } else if (hasRepElement && (hasRepresentation || hasSemanticElement)) { selectedElements = Lists.newArrayList(); } else if (hasSemanticElement) { selectedElements = Lists.newArrayList(); caseHasSemanticElement(selectedElements, notifiedElements, semanticElements, currentRep); } else if (hasRepElement) { if (uiState.isInverseSelectionOrder()) { Collections.reverse(dRepElements); } if (!notifiedElements.isEmpty()) { dRepElements.retainAll(notifiedElements); } selectedElements = Lists.newArrayList(dRepElements); } } return selectedElements; }