use of org.eclipse.ui.IDecoratorManager in project InformationSystem by ObeoNetwork.
the class RequirementLinkerPlugin method installDecoratorListenerOnSession.
private void installDecoratorListenerOnSession(Session session) {
TransactionalEditingDomain ted = session.getTransactionalEditingDomain();
if (ted != null) {
NotificationFilter notificationFilter = NotificationFilter.createFeatureFilter(RequirementPackage.Literals.REQUIREMENT__REFERENCED_OBJECT);
ted.addResourceSetListener(new ResourceSetListenerImpl(notificationFilter) {
@Override
public boolean isPostcommitOnly() {
return true;
}
@Override
public void resourceSetChanged(ResourceSetChangeEvent event) {
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
IDecoratorManager decoratorManager = PlatformUI.getWorkbench().getDecoratorManager();
decoratorManager.update(ObjectWithRequirement.DECORATOR_ID);
}
});
}
});
}
}
use of org.eclipse.ui.IDecoratorManager 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