|
|
|
|
|
|
|
Re: [EMFStore] disabling ceckout observer [message #1445294 is a reply to message #1444385] |
Wed, 15 October 2014 08:37 |
Edgar Mueller Messages: 89 Registered: March 2011 |
Member |
|
|
Hi Roza,
well, it's a bit clumsy, but it is possible to unregister observers with
the internal, even if you don't have an instance at hand.
I think it's best to illustrate this with an example:
@Test
public void testUnregisterViaNotify() {
final C observer = new C() {
public String fourtyTwo() {
return "42";
}
};
getObserverBus().register(observer);
C proxy = getObserverBus().notify(C.class);
proxy.fourtyTwo();
List<Result> observerCallResults =
((ObserverCall) proxy).getObserverCallResults();
// observer should have been notified
assertEquals(1, observerCallResults.size());
for (final Result result : observerCallResults) {
final ESObserver obs = result.getObserver();
getObserverBus().unregister(obs);
}
proxy = getObserverBus().notify(C.class);
proxy.fourtyTwo();
observerCallResults = ((ObserverCall) proxy).getObserverCallResults();
// no observers of type C left anymore
assertEquals(0, observerCallResults.size());
}
Hope this helps.
Cheers,
Edgar
> I see this can resolve the issue when we want to disable our own observer,
> but for instance I would like to disable the ECP observer, however, I
> don't have any access to the instance of the observer, hence I cannot
> remove the observer r access to instance of it.
>
> org.eclipse.emf.ecp.emfstore.internal.ui.observer.CheckoutObserver
>
>
--
Edgar Mueller
Get Professional Eclipse Support: http://eclipsesource.com/munich
|
|
|
|
Powered by
FUDForum. Page generated in 0.02750 seconds