Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » SelectionListener for GraphicalEditor
SelectionListener for GraphicalEditor [message #778337] Thu, 12 January 2012 07:56 Go to next message
markizik maa is currently offline markizik maa
Messages: 2
Registered: January 2012
Junior Member
Hi,

Is there a way to add SelectionListener for GraphicalEditor (GraphicalEditorWithFlyoutPalette)?

I have a jface viewer, when user selects a node in treeview i want to select matched object in GraphicalEditor.
Foe this I need listener...

What should I do?
Re: SelectionListener for GraphicalEditor [message #790159 is a reply to message #778337] Fri, 03 February 2012 17:25 Go to previous messageGo to next message
Marcel Boerner is currently offline Marcel Boerner
Messages: 1
Registered: February 2012
Junior Member
What are you trying to do?
Why do you want to add a SelectionListener to a GraphicalEditor if you want to select something in a treeview?
-> That does not seem to make sense.

If i understand right, you want to select an object in a treeview, and the EditPart (or better the Figure) in the GraphicalEditor which belongs to this object, should be selected then. If I'm right the answer depends on the layout of your Editor
So, how is the layout of your Editor?
e.g.
-------------------------------
|TreeViewer| Editor with Parts |
-------------------------------

If that is the case then you have to do the following steps.
Make a subclass of the GraphicalEditorWithFlyoutPalette and let it implement a SelectionChangedListener Interface. Then register the subclassed GraphicalEditor as Listener in your TreeViewer. When the Selection changes you can react in your GraphicalEditor. Since GraphicalEditor knows its EditPartViewer, and the EditPartViewer has a Methode to the EditPart Registry, you can use your Modelartefact to get the EditPart belonging to the artefact from the EditPart Registry. When you have the EditPart, just use the setSelection Methode of the EditPartViewer.
Re: SelectionListener for GraphicalEditor [message #792799 is a reply to message #778337] Tue, 07 February 2012 07:22 Go to previous message
Eclipse User
On 12.01.2012 13:56, markizik maa wrote:
> Hi,
>
> Is there a way to add SelectionListener for GraphicalEditor
> (GraphicalEditorWithFlyoutPalette)?
>
> I have a jface viewer, when user selects a node in treeview i want to
> select matched object in GraphicalEditor.
> Foe this I need listener...
>
> What should I do?

Hi, in addition to Marcel's hint, I recommend you to take a look at the
class org.eclipse.gef.ui.parts.SelectionSynchronizer, which is a
generically implementats ISelectionChangedListener. Probably, you can
directly use this class for your Viewer.

Cheers,

Tony
Previous Topic:Display a form on a property label
Next Topic:ZEST: Disable manual movement of some, but not all nodes in a graph?
Goto Forum:
  


Current Time: Wed Apr 23 17:45:47 EDT 2014

Powered by FUDForum. Page generated in 0.02598 seconds