Set selection programmatically [message #667239] |
Wed, 27 April 2011 11:10  |
Eclipse User |
|
|
|
Hello,
How do I programmatically set the selection of a Graphiti-based editor? (Scenario: The user double-clicks on an entry in the Problems view, that entry contains information about the business object and I would like to select the diagram element(s) that correspond to this BO.) I would have expected the editor to map between business objects or pictogram elements and the low-level GEF element, but that might have been a bit naive since all I'm getting is a CCE:
java.lang.ClassCastException: org.eclipse.graphiti.mm.pictograms.impl.ContainerShapeImpl cannot be cast to org.eclipse.gef.EditPart
at org.eclipse.gef.SelectionManager.setSelection(SelectionManager.java:253)
at org.eclipse.gef.ui.parts.AbstractEditPartViewer.setSelection(AbstractEditPartViewer.java:751)
at org.eclipse.graphiti.ui.internal.editor.GraphitiScrollingGraphicalViewer.setSelection(GraphitiScrollingGraphicalViewer.java:62)
...
Thanks
Volker
|
|
|
|
|
Re: Set selection programmatically [message #667378 is a reply to message #667372] |
Thu, 28 April 2011 08:16  |
Eclipse User |
|
|
|
Right, the editor API is something we still need to clean up. See
https://bugs.eclipse.org/bugs/show_bug.cgi?id=336488
Michael
"Volker Wegert" wrote in message news:ipbl15$87h$1@news.eclipse.org...
Michael,
thanks for the information.
Michael Wenz wrote on Thu, 28 April 2011 03:36
> you can call the method selectPictogramElements in the DiagramEditor, that
> will do it. Before you might have to get the pictogram element for your BO
> using the LinkService.
First of all, I get a warning when doing this:
Discouraged access: The type DiagramEditorInternal is not accessible due to
restriction on required project org.eclipse.graphiti.ui
And this feels strange - I've got a framework that is supposed to handle the
entire business object vs. graphical representation thingy, and I still have
to fiddle with this outside of the editor. I think that the editor should be
able to do this mapping by itself - or does that collide with some design
principle I overlooked?
Volker
|
|
|
Powered by
FUDForum. Page generated in 0.25036 seconds