Source:
protected List generateSnapPartsList(List exclusions) { if (!snapToAll) { List children = new ArrayList(container.getChildren()); Iterables.addAll(children, Iterables.filter(container.getParent().getChildren(), AbstractDiagramBorderNodeEditPart.class)); children.removeAll(exclusions); Iterable<Object> filteredChildren = Iterables.filter(children, Predicates.not(Predicates.instanceOf(IStyleEditPart.class))); List hiddenChildren = new ArrayList(); for (Iterator iter = filteredChildren.iterator(); iter.hasNext(); ) { GraphicalEditPart child = (GraphicalEditPart) iter.next(); if (!child.getFigure().isVisible()) { hiddenChildren.add(child); } } Iterables.removeAll(filteredChildren, hiddenChildren); return Lists.newArrayList(filteredChildren); } else { List<Class<?>> expectedClasses = Lists.newArrayList(); expectedClasses.add(AbstractBorderedDiagramElementEditPart.class); expectedClasses.add(AbstractDiagramBorderNodeEditPart.class); List<EditPart> snapPartsList = new ArrayList<EditPart>(new EditPartQuery(container.getRoot()).getAllChildren(false, expectedClasses)); List<EditPart> exclusionsWithChildren = new ArrayList<EditPart>(); for (Object editPart : exclusions) { if (editPart instanceof EditPart) { exclusionsWithChildren.add((EditPart) editPart); exclusionsWithChildren.addAll(new EditPartQuery((EditPart) editPart).getAllChildren(false, expectedClasses)); } } snapPartsList.removeAll(exclusionsWithChildren); for (Iterator<EditPart> iter = snapPartsList.iterator(); iter.hasNext(); ) { EditPart snapPart = iter.next(); if (snapPart instanceof IGraphicalEditPart && !new org.eclipse.sirius.diagram.ui.tools.internal.util.EditPartQuery((IGraphicalEditPart) snapPart).isVisibleOnViewport()) { iter.remove(); } } return snapPartsList; } }

Target:
protected List generateSnapPartsList(List exclusions) { if (!snapToAll) { List children = Lists.newArrayList(container.getChildren()); Iterables.addAll(children, Iterables.filter(container.getParent().getChildren(), AbstractDiagramBorderNodeEditPart.class)); children.removeAll(exclusions); Iterable<Object> filteredChildren = Iterables.filter(children, Predicates.not(Predicates.instanceOf(IStyleEditPart.class))); List hiddenChildren = Lists.newArrayList(); for (Iterator iter = filteredChildren.iterator(); iter.hasNext(); ) { GraphicalEditPart child = (GraphicalEditPart) iter.next(); if (!child.getFigure().isVisible()) { hiddenChildren.add(child); } } Iterables.removeAll(filteredChildren, hiddenChildren); return Lists.newArrayList(filteredChildren); } else { List<Class<?>> expectedClasses = Lists.newArrayList(); expectedClasses.add(AbstractBorderedDiagramElementEditPart.class); expectedClasses.add(AbstractDiagramBorderNodeEditPart.class); List<EditPart> snapPartsList = Lists.newArrayList(new EditPartQuery(container.getRoot()).getAllChildren(false, expectedClasses)); List<EditPart> exclusionsWithChildren = Lists.newArrayList(); for (Object editPart : exclusions) { if (editPart instanceof EditPart) { exclusionsWithChildren.add((EditPart) editPart); exclusionsWithChildren.addAll(new EditPartQuery((EditPart) editPart).getAllChildren(false, expectedClasses)); } } snapPartsList.removeAll(exclusionsWithChildren); for (Iterator<EditPart> iter = snapPartsList.iterator(); iter.hasNext(); ) { EditPart snapPart = iter.next(); if (snapPart instanceof IGraphicalEditPart && !new org.eclipse.sirius.diagram.ui.tools.internal.util.EditPartQuery((IGraphicalEditPart) snapPart).isVisibleOnViewport()) { iter.remove(); } } return snapPartsList; } }