Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » how to add listener to selectionmodel
how to add listener to selectionmodel [message #1818854] Mon, 30 December 2019 15:54 Go to next message
lian hongwu is currently offline lian hongwuFriend
Messages: 5
Registered: November 2017
Junior Member
how to add a listener to the IConentViewer, When a part is selected, I can be notified!
Re: how to add listener to selectionmodel [message #1819254 is a reply to message #1818854] Fri, 10 January 2020 14:22 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 230
Registered: March 2015
Senior Member
Hi Lian,

the SelectionModel is registered as an adapter at the individual viewers (if not configured differently). Therefore, you can access it as follows: contentViewer.getAdapter(SelectionModel.class)

The SelectionModel maintains an ObservableList of selected ContentParts: selectionModel.getSelection()

You can register a ChangeListener there. However, you might need to postpone handling of such changes using Platform.runLater() so that certain reactions are already finished when you process it (depends on use case).

The codebase contains an example, e.g. in SelectionBehavior (which constructs/destructs feedback and handle parts for the selection):

- Accessing the SelectionModel:
- Adding a listener:

Best regards,
Previous Topic:Looking for simple example
Next Topic:bug in mvc logo example
Goto Forum:

Current Time: Mon Feb 26 11:24:22 GMT 2024

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

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

Back to the top