/** * 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()); }