Bug 546834 - Upgrade to Graphiti 0.16 makes it impossible to move UI
parts in specific cases
* Fix contribution for selection adaptation so that the select of an
object triggers a select for the first modified object and an apend only
for the remaining ones
Change-Id: I816393376682da9e7d4edaa7579ae8fbef9e8490
diff --git a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/GraphitiScrollingGraphicalViewer.java b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/GraphitiScrollingGraphicalViewer.java
index b15d6b3..a27373f 100644
--- a/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/GraphitiScrollingGraphicalViewer.java
+++ b/plugins/org.eclipse.graphiti.ui/src/org/eclipse/graphiti/ui/internal/editor/GraphitiScrollingGraphicalViewer.java
@@ -54,10 +54,20 @@
deselectAll();
PictogramElement[] newSelection = tbp.getSelections((PictogramElement) model);
if (newSelection != null) {
- for (PictogramElement selectionElement : newSelection) {
- EditPart editPart = (EditPart) getEditPartRegistry().get(selectionElement);
- if (editPart != null) {
- super.appendSelection(editPart);
+ List<EditPart> newEditPartSelections = new ArrayList<EditPart>();
+ for (PictogramElement newSelectionElement : newSelection) {
+ EditPart newEditPart = (EditPart) getEditPartRegistry().get(newSelectionElement);
+ if (newEditPart != null) {
+ newEditPartSelections.add(newEditPart);
+ }
+ }
+ boolean firstSelect = true;
+ for (EditPart newEditPart : newEditPartSelections) {
+ if (firstSelect) {
+ super.select(newEditPart);
+ firstSelect = false;
+ } else {
+ super.appendSelection(newEditPart);
}
}
}