Best way to listen to eclipse Notification [message #1115593] |
Tue, 24 September 2013 05:58  |
Eclipse User |
|
|
|
I'd like to observe org.eclipse.emf.common.notify.Notification's in my (business domain) plugin, ie. I have to listen to
objects of type org.eclipse.emf.common.notify.impl.NotificationImpl.
What is the best way/technique to implement / register an appropriate
org.eclipse.emf.common.notify.Adapter?
Do I need an org.eclipse.emf.common.notify.AdapterFactory?
I don't want tight coupling by adding technical imports in the corresponding classes...
Can anyone provide links or code templates?
best regards
Juergen
|
|
|
|
|
|
|
Re: Best way to listen to eclipse Notification [message #1118273 is a reply to message #1118236] |
Fri, 27 September 2013 04:30   |
Eclipse User |
|
|
|
Jürgen,
Comments below.
On 27/09/2013 9:40 AM, Jürgen rey wrote:
> Hi Ed,
>
> yes, I want to listen to model state changes for a UI element!
Is the UI element an EMF model?
>
> .. and yes: the state change should immediately propagated to a
> preferences store, where all kinds of prefs are collected at first.
> (the preference manager is responsible for further handling)
>
> The panel is normally part of an editor or a view, it is currently NOT
> part of any modal dialog, but it could be in the future. (which
> implications does this have?)
It's a question of how often you want such things saved. If the user
doesn't save the editor, do they still want this preference state to be
saved?
>
> It would be very nice, if my preference manager only had imports of
> the Notification(Impl) class. This way I wouldn't have any
> dependencies to custom (presentation) model classes!
But it sounds like the preference manager is also responsible for
reading the state and making it available via the state of a model...
>
> Can I do this via extension points, which establish corresponding
> adapters?
It's not so clear exactly what you're doing. There is no EMF extension
point for adding adapters. There's an extension point contributing an
item provider adapter factory for your package, but it sounds unrelated
to what you're describing.
> In Java code or per xml declarations?
>
> Sorry for these detailed questions, but I didn't find appropriate
> documentations or eclipse recipes for (Notification) handling.
I'm not sure if you aren't confusing EMF's notification with other
flavors of notification provided by Eclipse.
>
> best regards
>
>
>
>
>
>
|
|
|
Re: Best way to listen to eclipse Notification [message #1118296 is a reply to message #1117620] |
Fri, 27 September 2013 05:04  |
Eclipse User |
|
|
|
On 26-09-13 18:35, Jürgen rey wrote:
> A user toggles the state (by clicking an small triangle), which upon a
> NotificationImpl event is fired.
This sounds like an e4 workbench model, which fires with UI interaction.
What would be the relation between the state of the workbench (Saved as
workbench.xmi in the workspace) and an adaptation to the Preference
Store, if your Panel is based on the e4 programming model?
BTW, with e3, you can bind your UI state with an EMF model, but this EMF
model would need to be defined first.
See this: http://www.vogella.com/articles/EclipseDataBindingEMF/article.html
The way I do it in NetXStudio is by simply writing SWT/JFace UI state to
an IMemento, but that's not very "modern" .
Cheers / Christophe
|
|
|
Powered by
FUDForum. Page generated in 0.04782 seconds