|
Re: Refreshing in Common Navigator (SOLVED) [message #439949 is a reply to message #420292] |
Fri, 31 July 2009 07:08 |
Javier Messages: 57 Registered: July 2009 |
Member |
|
|
Somehow I fixed the problem.
I couldn't make notifyChanged() of the AdapterFactory to get all
notifications, so I tried to improve the workaround of making the
wrapper listens to its EObject element. There, when I get the
notification I'm not getting in the Factory, I refresh the
CommonNavigator viewer. I was doing it by viewer.refresh(true) and this
is what was making EMF model to multiply the notifications: for first
change in the model it was just one notification, for second change it
sent 2 notifications, for third change it sent 4 and so on... So instead
of refreshing like that, I'm using this method:
NotifyChangedToViewerRefresh.handleNotifyChanged
(final Viewer viewer,
final Object object,
final int eventType,
final Object feature,
final Object oldValue,
final Object newValue,
final int index)
Javier escribió:
> Hello.
>
> I've already been some time working with a CommonNavigator for my
> application and I got stuck several times with the way it handles the
> refreshing of its elements in the Viewer.
>
> My content provider don't list the real EMF elements, but some wrappers
> that contains them (this is this way cauase I need some extra
> information for each one in the navigator). My ContentProvider extends
> the class AdapterFactoryContentProvider. My Navigator is synchronized
> with the diagram, they both share the same EditingDomain so changes in
> model elements should automatically appear in the Navigator. In the
> AdapterConentProvider there is a method notifyChanged(Notification)
> which receives notifications when changes are performed in the model,
> but I noticed it is not getting the same notifications as if it were
> added directly in mdoel elements as a listener (like EditParts do). What
> I mean by this is the following: For some elememts, if I modify them
> (for examle I change the name) the navigator is not getting any
> notification and hence it is not refreshing it contents.
>
> So I dont know how it is getting the notifications. I tried the
> following: make my wrappers implements Adapter interface and make them
> listen to its model object. Then they get all notifications, and I can
> call the navigator.refresh(). The problem then is that for every change,
> the number of notifications (all being the same) gets multiplied! I
> don't know what the refresh method is doing exactly as to get that many
> notifications involved.
>
> Any idea on how to make this work properly??
>
> Thank u guys
>
|
|
|
Powered by
FUDForum. Page generated in 0.01733 seconds