In my Eclipse e4 RCP application, I'm using annotations to get notified when a Part is activated, using the approach proposed here : http://www.vogella.com/tutorials/Eclipse4ModelEvents/article.html
@Inject
@Optional
public void subscribeTopicPartActivation(@UIEventTopic(UIEvents.UILifeCycle.ACTIVATE) Event event) {
Object element = event.getProperty(EventTags.ELEMENT);
if (!(element instanceof MPart)) {
return;
}
MPart part = (MPart) element;
System.out.println("Part activated: " + part.getLabel());
}
It works fine, but I've noticed that the activate event is triggered more than once for the same part in cases where we would expect a single activate event (i.e for exemple simple switch to the part...). The event message sent seems to be exactly the same (same target, same topic). Am I missing something ? Is it a normal behavior for the event framework ?