Skip to main content


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 12:56 Go to next message
markizik maa is currently offline markizik maaFriend
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 22:25 Go to previous messageGo to next message
Marcel Boerner is currently offline Marcel BoernerFriend
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 12:22 Go to previous message
Eclipse UserFriend
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: Tue Mar 19 11:24:22 GMT 2024

Powered by FUDForum. Page generated in 0.02050 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top