/** * Test that no refresh command is returned by the {@link RefreshEditorsPrecommitListener} when it * receives a GMF notation model change notification. */ public void testNoRefreshOnGMFNodeChangeNotification() { // 1. Create a Notification for theRefreshEditorsPrecommitListener Bounds firstBounds = getFirstElement(sessionResource, Bounds.class); Notification dRepresentationElementChangeNotification = new ENotificationImpl( (InternalEObject) firstBounds, Notification.SET, NotationPackage.Literals.LOCATION__X, 0, firstBounds.getX()); ResourceSetChangeEvent event = new ResourceSetChangeEvent( domain, null, Collections.singletonList(dRepresentationElementChangeNotification)); // 2. Checks that the RefreshEditorsPrecommitListener doesn't refresh // the representation Option<Command> refreshPrecommitCmd = refreshEditorsPrecommitListener.localChangesAboutToCommit(event.getNotifications()); assertFalse( "On a DRepresentationElement change notification the RefreshPrecommitListener shouldn't do refresh", refreshPrecommitCmd.some()); }
/** * Test that no refresh command is returned by the {@link RefreshEditorsPrecommitListener} when it * receives a {@link DRepresentationElement} change notification. */ public void testNoRefreshOnDRepresentationElementChangeNotification() { // 1. Create a Notification for theRefreshEditorsPrecommitListener DNodeList firstDNodeList = getFirstElement(sessionResource, DNodeList.class); Notification dRepresentationElementChangeNotification = new ENotificationImpl( (InternalEObject) firstDNodeList, Notification.SET, DiagramPackage.Literals.DDIAGRAM_ELEMENT__VISIBLE, false, true); ResourceSetChangeEvent event = new ResourceSetChangeEvent( domain, null, Collections.singletonList(dRepresentationElementChangeNotification)); // 2. Checks that the RefreshEditorsPrecommitListener doesn't refresh // the representation Option<Command> refreshPrecommitCmd = refreshEditorsPrecommitListener.localChangesAboutToCommit(event.getNotifications()); assertFalse( "On a DRepresentationElement change notification the RefreshPrecommitListener shouldn't do refresh", refreshPrecommitCmd.some()); }
/** * Test that a refresh command is returned by the {@link RefreshEditorsPrecommitListener} when it * receives a semantic change notification. */ public void testRefreshOnSemanticChangeNotification() { // 1. Create a Notification for theRefreshEditorsPrecommitListener Resource semanticResource = resourceSet.getResource(semanticResourceURI, true); EClass firstEClass = getFirstElement(semanticResource, EClass.class); Notification dRepresentationElementChangeNotification = new ENotificationImpl( (InternalEObject) firstEClass, Notification.SET, EcorePackage.Literals.ECLASS__ABSTRACT, true, false); ResourceSetChangeEvent event = new ResourceSetChangeEvent( domain, null, Collections.singletonList(dRepresentationElementChangeNotification)); // 2. Checks that the RefreshEditorsPrecommitListener refresh // the representation Option<Command> refreshPrecommitCmd = refreshEditorsPrecommitListener.localChangesAboutToCommit(event.getNotifications()); assertTrue( "On a semantic change notification the RefreshPrecommitListener should do refresh", refreshPrecommitCmd.some()); }
@Override public void resourceSetChanged(ResourceSetChangeEvent event) { for (Notification notification : event.getNotifications()) { if (notification.getNotifier() instanceof EObject && notification.getEventType() != Notification.REMOVING_ADAPTER && notification.getEventType() != Notification.RESOLVE) { EObject eObject = (EObject) notification.getNotifier(); for (EClass eClass : eObject.eClass().getEAllSuperTypes()) { if (SGraphPackage.eINSTANCE == eClass.getEPackage()) { validationJob.cancel(); validationJob.schedule(DELAY); return; } } } } }
@Override public void resourceSetChanged(final ResourceSetChangeEvent event) { toRefreshInViewerWithUpdateLabels = Sets.newLinkedHashSet(); toUpdateInViewer = Sets.newLinkedHashSet(); dColumnsToUpdateDirectly = new LinkedHashSet<DColumn>(); dColumnsWidthToUpdate = new LinkedHashSet<DColumn>(); toCollapses = Sets.newLinkedHashSet(); toExpands = Sets.newLinkedHashSet(); dColumnsToRemove = new LinkedHashSet<DColumn>(); dColumnsToAdd = new LinkedHashMap<DColumn, Integer>(); dColumnsToVisibilityChanged = new LinkedHashMap<DColumn, Boolean>(); launchGlobalRefreshWithoutUpdateLabels = false; launchGlobalRefreshWithUpdateLabels = false; updateHeaderColumnWidth = false; analyseNotifications(event.getNotifications()); updateDTableTreeViewer(); }
/* (non-Javadoc) * @see com.hundsun.ares.studio.jres.metadata.ui.editors.MetadataListPage#isNeedValidate(org.eclipse.emf.transaction.ResourceSetChangeEvent) */ @Override protected boolean isNeedValidate(ResourceSetChangeEvent event) { for (Notification notification : event.getNotifications()) { Object obj = notification.getNotifier(); if (obj instanceof DynamicEObjectImpl) { return true; } if (notification.getFeature() == MetadataPackage.Literals.METADATA_CATEGORY__CHILDREN || notification.getFeature() == MetadataPackage.Literals.METADATA_RESOURCE_DATA__ITEMS || notification.getNotifier() instanceof MetadataItem || notification.getNotifier() instanceof MetadataCategory) { return true; } } return false; }
@Override public void resourceSetChanged(ResourceSetChangeEvent event) { Set<Object> contentForRefresh = new LinkedHashSet<Object>(); for (Notification notification : event.getNotifications()) { if (notification.getNotifier() instanceof Page) { continue; } boolean added = !EMFUtils.getAddedObjects(notification, EPlanElement.class).isEmpty(); boolean removed = !EMFUtils.getRemovedObjects(notification, EPlanElement.class).isEmpty(); if (added || removed) { contentForRefresh.add(GROUPING_ACTIVITIES); contentForRefresh.add(GROUPING_ACTIVITY_GROUPS); break; } } if (!contentForRefresh.isEmpty()) { refreshContents(contentForRefresh); } }
protected void handleResourceSetChangeEvent(ResourceSetChangeEvent event) { for (Notification next : event.getNotifications()) { notifyChanged(next); } }