[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Updating custom label text

Mike,

Yes, please take a whack at the recipe. I'll try to follow up by looking closely at the example and thinking about any improvements I could make to it...


Mike Gering wrote:
Thanks, Ed and Ron, for the excellent advice. I think I have a working solution based
on the following implementation of an inner class to AItemProvider:


class ChangeListener implements INotifyChangedListener {
public void notifyChanged(Notification notification) {
if(notification.getNotifier() == ((A) getTarget()).getB()) {
((IChangeNotifier) getAdapterFactory()).removeListener(this);
fireNotifyChanged(new ViewerNotification(notification, getTarget(), false, true));
((IChangeNotifier) getAdapterFactory()).addListener(this);
}
}
}


Note that I'm adding/removing the listener around the fireNotifyChanged() call.
If I don't do this, the listener gets called in an infinite recursion loop.


Also, I expected AItemProvider.notifyChanged() to get called. I'm guessing
the reason is that the new ViewerNotification reuses the notification which
references the B instance. I don't know how I could create a valid notification
with A as the notifier -- there is no feature in A corresponding to the change.


Do you want me to take a whack at creating a recipe?

Thanks,
Mike