Bug 549963 - GraphitiScrollingGraphicalViewer does not accept
non-EditPart setSelection references
Change-Id: I44e028cd6b144d0bba5adeb39218db15ff66822d
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 a27373f..8b94b41 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
@@ -11,6 +11,7 @@
* pjpaulin - Bug 352120 - Now uses IDiagramContainerUI interface
* fvelasco - Bug 323356 - Mouse-wheel support for scrolling and zooming
* Hubert Guerard, mwenz - Bug 543847 - Add capability to select several PictogramElement from a selection of PictogramElement
+* mwenz - Bug 549963 - GraphitiScrollingGraphicalViewer does not accept non-EditPart setSelection references
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
@@ -118,6 +119,14 @@
}
if (change) {
newSelection = new StructuredSelection(selectionList);
+ } else {
+ List<EditPart> filteredSelection = new ArrayList<>();
+ for (Object object : selectionList) {
+ if (object instanceof EditPart) {
+ filteredSelection.add((EditPart) object);
+ }
+ }
+ newSelection = new StructuredSelection(filteredSelection);
}
super.setSelection(newSelection);
}