use of org.eclipse.sirius.business.api.session.SessionManagerListener in project InformationSystem by ObeoNetwork.
the class Activator method installAllDecoratorListeners.
/**
* Installs a Session listener to refresh decorators for objects with requirements on all sessions
*/
private void installAllDecoratorListeners() {
// it could happen depending on the plugin starting order
for (Session session : SessionManager.INSTANCE.getSessions()) {
installDecoratorListenerOnSession(session);
}
SessionManager.INSTANCE.addSessionsListener(new SessionManagerListener() {
public void notifyAddSession(Session newSession) {
installDecoratorListenerOnSession(newSession);
}
public void viewpointSelected(Viewpoint selectedSirius) {
// Do nothing
}
public void viewpointDeselected(Viewpoint deselectedSirius) {
// Do nothing
}
public void notifyRemoveSession(Session removedSession) {
// Do nothing
}
public void notify(Session updated, int notification) {
// Do nothing
}
});
IDecoratorManager decoratorManager = PlatformUI.getWorkbench().getDecoratorManager();
decoratorManager.addListener(new ILabelProviderListener() {
public void labelProviderChanged(LabelProviderChangedEvent event) {
boolean decoratorEnabled = ObjectWithRequirement.isDecoratorEnabled();
if (requirementsDecoratorEnabled != decoratorEnabled) {
// Value changed, we have to refresh diagrams
refreshDecorationsOnAllSessions();
requirementsDecoratorEnabled = decoratorEnabled;
}
}
});
}
Aggregations