Search in sources :

Example 1 with NotificationFilter

use of org.eclipse.emf.transaction.NotificationFilter 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);
                    }
                });
            }
        });
    }
}
Also used : TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) ResourceSetChangeEvent(org.eclipse.emf.transaction.ResourceSetChangeEvent) ResourceSetListenerImpl(org.eclipse.emf.transaction.ResourceSetListenerImpl) IDecoratorManager(org.eclipse.ui.IDecoratorManager) NotificationFilter(org.eclipse.emf.transaction.NotificationFilter)

Example 2 with NotificationFilter

use of org.eclipse.emf.transaction.NotificationFilter in project InformationSystem by ObeoNetwork.

the class Activator method installDecoratorListenerOnSession.

private void installDecoratorListenerOnSession(final 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() {
                        refreshDecorationsOnSession(session, false);
                    }
                });
            }
        });
    }
}
Also used : TransactionalEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain) ResourceSetChangeEvent(org.eclipse.emf.transaction.ResourceSetChangeEvent) ResourceSetListenerImpl(org.eclipse.emf.transaction.ResourceSetListenerImpl) NotificationFilter(org.eclipse.emf.transaction.NotificationFilter)

Aggregations

NotificationFilter (org.eclipse.emf.transaction.NotificationFilter)2 ResourceSetChangeEvent (org.eclipse.emf.transaction.ResourceSetChangeEvent)2 ResourceSetListenerImpl (org.eclipse.emf.transaction.ResourceSetListenerImpl)2 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)2 IDecoratorManager (org.eclipse.ui.IDecoratorManager)1