コード例 #1
0
 /**
  * Specific should be hidden method taking into account the selected filters.
  *
  * <p>Almost the same as {@link
  * org.eclipse.emf.compare.diff.metamodel.util.DiffAdapterFactory#shouldBeHidden(EObject)} but
  * call {@link #isHidden(DiffElement)}.
  *
  * @param element The element of which we need to check the "hidden" state.
  * @return <code>true</code> if the given element should be hidden, <code>false</code> otherwise.
  */
 private boolean shouldBeHidden(EObject element) {
   boolean result = false;
   if (element instanceof DiffElement) {
     final DiffElement diff = (DiffElement) element;
     final Iterator<AbstractDiffExtension> it = diff.getIsHiddenBy().iterator();
     while (it.hasNext()) {
       final AbstractDiffExtension extension = it.next();
       if (!extension.isIsCollapsed()) {
         result = true;
       }
     }
     result = result || isHiddenInMyContext((DiffElement) element);
   }
   if (element instanceof DiffGroup) {
     final DiffGroup group = (DiffGroup) element;
     if (filteredSubchanges(group) == 0) {
       result = true;
     }
   }
   return result;
 }
 public void testLastDiffElements(List<DiffElement> diffElements) {
   Assert.assertTrue(
       NLS.bind(
           "The number of DiffElement is not correct : we would like {0} DiffElement, and we found {1}",
           new Object[] {2, diffElements.size()}),
       diffElements.size() == 2);
   final DiffElement firstDiffElement = diffElements.get(0);
   final DiffElement secondDiffElement = diffElements.get(1);
   Assert.assertTrue(
       NLS.bind("The first DiffElement is not a {0}", ModelElementChangeLeftTarget.class),
       firstDiffElement instanceof ModelElementChangeLeftTarget);
   Assert.assertTrue(
       NLS.bind("The second DiffElement is not a {0}", UMLProfileApplicationAddition.class),
       secondDiffElement instanceof UMLProfileApplicationAddition);
   AbstractDiffExtension ext = (AbstractDiffExtension) secondDiffElement;
   Assert.assertTrue(
       NLS.bind("The {0} doesn't hide only one DiffElement", ext),
       ext.getHideElements().size() == 1);
   Assert.assertTrue(
       NLS.bind("The {0} doesn't hide the correct DiffElement", ext),
       ext.getHideElements().get(0) == firstDiffElement);
 }