/** * Creates a notification filter which filters notifications that may possibly affect the * notational model * * @generated */ protected NotificationFilter createFilter() { NotificationFilter filter = NotificationFilter.createFeatureFilter(MindmapPackage.eINSTANCE.getMap_RootTopics()); filter = filter.or( NotificationFilter.createFeatureFilter(MindmapPackage.eINSTANCE.getMap_Resources())); filter = filter.and(NotificationFilter.createNotifierFilter(getDiagram().getElement())); return filter; }
private static void addResourceTrackingModificationAdapter( TransactionalEditingDomain editingDomain) { EList<Adapter> adapters = editingDomain.getResourceSet().eAdapters(); Adapter adapter = EcoreUtil.getAdapter(adapters, SetTrackModificationAdapter.class); if (adapter == null) { final NotificationFilter diagramResourceModifiedFilter = NotificationFilter.createNotifierFilter(editingDomain.getResourceSet()) .and(NotificationFilter.createEventTypeFilter(Notification.ADD)) .and( NotificationFilter.createFeatureFilter( ResourceSet.class, ResourceSet.RESOURCE_SET__RESOURCES)); adapters.add(new SetTrackModificationAdapter(diagramResourceModifiedFilter)); } }
/** @generated */ private TransactionalEditingDomain createEditingDomain() { TransactionalEditingDomain editingDomain = DiagramEditingDomainFactory.getInstance().createEditingDomain(); editingDomain.setID("StateChartDesign.diagram.EditingDomain"); // $NON-NLS-1$ final NotificationFilter diagramResourceModifiedFilter = NotificationFilter.createNotifierFilter(editingDomain.getResourceSet()) .and(NotificationFilter.createEventTypeFilter(Notification.ADD)) .and( NotificationFilter.createFeatureFilter( ResourceSet.class, ResourceSet.RESOURCE_SET__RESOURCES)); editingDomain .getResourceSet() .eAdapters() .add( new Adapter() { private Notifier myTarger; public Notifier getTarget() { return myTarger; } public boolean isAdapterForType(Object type) { return false; } public void notifyChanged(Notification notification) { if (diagramResourceModifiedFilter.matches(notification)) { Object value = notification.getNewValue(); if (value instanceof Resource) { ((Resource) value).setTrackingModification(true); } } } public void setTarget(Notifier newTarget) { myTarger = newTarget; } }); return editingDomain; }