diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/command/ViewDeleteCommand.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/command/ViewDeleteCommand.java index 36477e2da6..891b52364b 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/command/ViewDeleteCommand.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/command/ViewDeleteCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015, 2016 Obeo. + * Copyright (c) 2015, 2023 Obeo. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -12,6 +12,10 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.ui.business.internal.command; +import java.util.Collections; +import java.util.List; +import java.util.stream.Stream; + import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; @@ -21,9 +25,11 @@ import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand; import org.eclipse.gmf.runtime.diagram.core.util.ViewType; import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; - -import com.google.common.collect.Iterables; +import org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper; +import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; +import org.eclipse.sirius.diagram.ui.tools.internal.preferences.SiriusDiagramUiInternalPreferencesKeys; /** * Extends the GMF {@link DeleteCommand} to avoid creating @@ -61,13 +67,30 @@ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IA // Prevents GMF to install its CrossReferencerAdapter by not calling // ViewUtil.destroy(View) + boolean prefRemoveAttachedPGE = DiagramUIPlugin.getPlugin().getPreferenceStore() + .getBoolean(SiriusDiagramUiInternalPreferencesKeys.PREF_REMOVE_HIDE_NOTE_WHEN_ANNOTED_ELEMENT_HIDDEN_OR_REMOVE.name()); + // Remove incoming or outgoing NoteAttachment links - for (Edge edge : Iterables.filter(Iterables.concat(getView().getSourceEdges(), getView().getTargetEdges()), Edge.class)) { + List attachedEdge = GMFHelper.getAttachedEdgesRecursively(Collections.singleton(getView())); + + // Get PGE attached to all element that are about to be deleted + List attachedPGE = null; + if (prefRemoveAttachedPGE) { + attachedPGE = Stream.concat(GMFHelper.getAttachedPGE(getView()).stream(), GMFHelper.getAttachedPGE(attachedEdge).stream()).toList(); + } + // Delete all elements + for (Edge edge : attachedEdge) { if (ViewType.NOTEATTACHMENT.equals(edge.getType())) { EcoreUtil.remove(edge); } } EcoreUtil.remove(getView()); + + if (prefRemoveAttachedPGE) { + // attachedPGE can't be null here + GMFHelper.deleteDetachedPGE(attachedPGE); + } + return CommandResult.newOKCommandResult(); } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/CanonicalSynchronizerResult.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/CanonicalSynchronizerResult.java index 816da09282..3273b45606 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/CanonicalSynchronizerResult.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/CanonicalSynchronizerResult.java @@ -13,13 +13,11 @@ package org.eclipse.sirius.diagram.ui.internal.refresh; import java.util.ArrayList; -import java.util.Collection; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Optional; import java.util.Set; -import java.util.stream.Stream; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.util.EcoreUtil; @@ -431,85 +429,14 @@ public void deleteOrphanEdges() { * Compute all edges adjacent to the nodes to be deleted and adds them to the list. */ public void collectAttachedEdgeToNodes() { - collectAttachedEdges(orphanNodes); + this.addOrphanEdges(GMFHelper.getAttachedEdges(orphanNodes)); } /** * Compute all edges adjacent to the edges to be deleted and adds them to the list (and compute attached edge). */ public void collectAttachedEdgeToEdges() { - collectAttachedEdges(orphanEdges); - } - - /** - * Add all incoming and outgoing edges of all views to orphan edges list : - * - * - * @param - * type of collection (View, Edge or Node in general) - * @param views - * collection of views for which we want all incoming and outgoing edges - */ - private void collectAttachedEdges(Collection views) { - var removed = new HashSet(); - while (!views.isEmpty()) { - // Here we take view (take = remove from list), we put it aside (in removed). - // Then, if the view has not already been processed: - // we collect incoming and outgoing edges and we add these edges to the orphan edges list. - T view = views.stream().findAny().orElseThrow(); // get an element - if (removed.add(view)) { - // Before removing this view, we must identify incoming or outgoing - // edges of this view or of one of its children to delete them just - // after. Indeed, an Edge without source (or target) must not exist. - List edgesToDelete = getIncomingOutgoingEdges(view); - this.addOrphanEdges(edgesToDelete); - } - views.removeIf(v -> view == v); - } - views.addAll(removed); - } - - /** - * Get all incoming and outgoing edges of this view or of all of its children. - * - * @param view - * the concern view - * @return list of edges - */ - private List getIncomingOutgoingEdges(View view) { - List edgesToDelete = new ArrayList<>(); - edgesToDelete.addAll(view.getSourceEdges()); - edgesToDelete.addAll(view.getTargetEdges()); - - List children = view.getChildren(); - for (View child : children) { - edgesToDelete.addAll(getIncomingOutgoingEdges(child)); - } - return edgesToDelete; - } - - /** - * Collect all attached notes/texts/representation links (i.e. PGE: pure graphical elements). - */ - private void collectAttachedPGE(View view) { - // get all attached notes - List noteAttachments = getIncomingOutgoingEdges(view).stream() // - .filter(GMFNotationHelper::isNoteAttachment).toList(); - - noteAttachments.stream().flatMap(edge -> { - return Stream.of(edge.getSource(), edge.getTarget()); - }).filter(attachedView -> { // all nodes linked to note attachment: filter notes/texts - if (attachedView instanceof Node attachedNode) { - return GMFNotationHelper.isNote(attachedNode) || GMFNotationHelper.isTextNote(attachedNode); - } else { - return false; - } - }).map(Node.class::cast).forEach(attachedNote -> { // for each note - partialOrphanPGE.add(attachedNote); - }); + this.addOrphanEdges(GMFHelper.getAttachedEdgesRecursively(orphanEdges)); } /** @@ -530,7 +457,7 @@ public void collectDetachedPGEFromNode() { if (prefRemoveAttachedPGE) { // collect possibly detached PGE <=> collect PGE attached to orphan view for (View orphanNode : orphanNodes) { - collectAttachedPGE(orphanNode); + partialOrphanPGE.addAll(GMFHelper.getAttachedPGE(orphanNode)); } } } @@ -553,14 +480,17 @@ public void collectDetachedPGEFromEdge() { if (prefRemoveAttachedPGE) { // collect possibly detached PGE <=> collect PGE attached to orphan view for (Edge orphanEdge : orphanEdges) { - collectAttachedPGE(orphanEdge); + partialOrphanPGE.addAll(GMFHelper.getAttachedPGE(orphanEdge)); } } } /** - * Mark to remove all notes/texts/representation links (i.e. PGE: pure graphical elements) attached to nodes that - * will be removed. + * Remove all notes/texts/representation links (i.e. PGE: pure graphical elements) attached to removed nodes and + * without other attachment. + * + * The PGE is removed if all attached element are removed. The PGE is hidden if all visible attached element are + * removed. If the PGE has at least one remaining attached element, the PGE is not removed and note hidden. * * Before calling this function, you need to collect all PGE attached to view that will be removed (using method * collectDetachedPGEFromNode and collectDetachedPGEFromEdge) @@ -570,25 +500,7 @@ public void collectDetachedPGEFromEdge() { */ public void deleteDetachedPGE() { if (prefRemoveAttachedPGE) { - for (Node pureGraphicalElement : partialOrphanPGE) { - List sourceEdges = pureGraphicalElement.getSourceEdges(); - List targetEdges = pureGraphicalElement.getTargetEdges(); - - List validEdges = Stream.concat(sourceEdges.stream(), targetEdges.stream()) // - .filter(edge -> edge.eContainer() != null).toList(); - - // remove unattached notes/texts - if (validEdges.size() == 0) { - EcoreUtil.remove(pureGraphicalElement); - } else { - Stream visibleEdges = validEdges.stream().filter(edge -> edge.isVisible()); - - // hide notes/texts attached to invisible element - if (visibleEdges.count() == 0) { - pureGraphicalElement.setVisible(false); - } - } - } + GMFHelper.deleteDetachedPGE(partialOrphanPGE); partialOrphanPGE.clear(); } } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java index b20e9709ee..7287d9d61b 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/GMFHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2021 THALES GLOBAL SERVICES and others. + * Copyright (c) 2011, 2023 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -15,9 +15,11 @@ import java.io.File; import java.net.MalformedURLException; import java.util.ArrayList; +import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.stream.Stream; import org.eclipse.core.runtime.Path; import org.eclipse.draw2d.Connection; @@ -30,6 +32,7 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; import org.eclipse.gef.ConnectionEditPart; @@ -78,6 +81,7 @@ import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.provider.Messages; import org.eclipse.sirius.diagram.ui.tools.api.layout.LayoutUtils; +import org.eclipse.sirius.diagram.ui.tools.api.util.GMFNotationHelper; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.ext.gmf.runtime.gef.ui.figures.AlphaDropShadowBorder; @@ -986,4 +990,160 @@ private static Dimension getIconDimension(DSemanticDecorator dSemanticDecorator, Image icon = DiagramUIPlugin.getPlugin().getImage(descriptor); return new Dimension(icon.getBounds().width, icon.getBounds().height); } + + /** + * Get all incoming and outgoing edges of this view or of all of its children. + * + * @param view + * the concern view + * @return list of edges + */ + private static List getIncomingOutgoingEdges(View view) { + List edgesToDelete = new ArrayList<>(); + edgesToDelete.addAll(view.getSourceEdges()); + edgesToDelete.addAll(view.getTargetEdges()); + + List children = view.getChildren(); + for (View child : children) { + edgesToDelete.addAll(getIncomingOutgoingEdges(child)); + } + return edgesToDelete; + } + + /** + * Get all incoming and outgoing edges of all views or of all of their children. + * + * @param view + * the concern views + * @return list of edges + */ + public static List getAttachedEdges(Collection views) { + return views.stream().flatMap(view -> getIncomingOutgoingEdges(view).stream()).toList(); + } + + /** + * Return all incoming and outgoing edges of all edges recursively + * + * @param edges + * collection of edges for which we want all incoming and outgoing edges + * @return all incoming and outgoing edges of all edges recursively + */ + public static List getAttachedEdgesRecursively(Collection edges) { + var resursivlyAttachedEdges = new ArrayList(); + var remainingEdges = new ArrayList(edges); + while (!remainingEdges.isEmpty()) { + // Here we take view (take = remove from list), we put it aside (in removed). + // Then, if the view has not already been processed: + // we collect incoming and outgoing edges and we add these edges to the orphan edges list. + View view = remainingEdges.stream().findAny().orElseThrow(); // get an element + + // Before removing this view, we must identify incoming or outgoing + // edges of this view or of one of its children to delete them just + // after. Indeed, an Edge without source (or target) must not exist. + List attachedEdges = getIncomingOutgoingEdges(view); + // remove edges already present + attachedEdges.removeAll(resursivlyAttachedEdges); + attachedEdges.removeAll(remainingEdges); + + remainingEdges.addAll(attachedEdges); + resursivlyAttachedEdges.addAll(attachedEdges); + + remainingEdges.removeIf(v -> view == v); + } + return resursivlyAttachedEdges; + } + + /** + * Return all attached notes/texts/representation links (i.e. PGE: pure graphical elements) of a view. + * + * @return The list of attached PGE + */ + public static List getAttachedPGE(View view) { + // get all attached notes + List noteAttachments = getIncomingOutgoingEdges(view).stream() // + .filter(GMFNotationHelper::isNoteAttachment).toList(); + + return noteAttachments.stream().flatMap(edge -> { + return Stream.of(edge.getSource(), edge.getTarget()); + }).filter(attachedView -> { // all nodes linked to note attachment: filter notes/texts + if (attachedView instanceof Node attachedNode) { + return GMFNotationHelper.isNote(attachedNode) || GMFNotationHelper.isTextNote(attachedNode); + } else { + return false; + } + }).map(Node.class::cast).toList(); + } + + /** + * Return all attached notes/texts/representation links (i.e. PGE: pure graphical elements) of all views. + * + * @return The list of attached PGE + */ + public static List getAttachedPGE(Collection views) { + return views.stream().flatMap(view -> GMFHelper.getAttachedPGE(view).stream()).toList(); + } + + /** + * Remove all notes/texts/representation links (i.e. PGE: pure graphical elements) attached to removed nodes and + * without other attachment. + * + * The PGE is removed if all attached element are removed. The PGE is hidden if all visible attached element are + * removed. If the PGE has at least one remaining attached element, the PGE is not removed and note hidden. + * + * @param candidatesPGE + * Collection of all candidate PGE + */ + public static void deleteDetachedPGE(Collection candidatesPGE) { + for (Node pureGraphicalElement : candidatesPGE) { + List sourceEdges = pureGraphicalElement.getSourceEdges(); + List targetEdges = pureGraphicalElement.getTargetEdges(); + + List validEdges = Stream.concat(sourceEdges.stream(), targetEdges.stream()) // + .filter(edge -> edge.eContainer() != null).toList(); + + // remove unattached notes/texts + if (validEdges.size() == 0) { + EcoreUtil.remove(pureGraphicalElement); + } else { + Stream visibleEdges = validEdges.stream().filter(edge -> edge.isVisible()); + + // hide notes/texts attached to invisible element + if (visibleEdges.count() == 0) { + pureGraphicalElement.setVisible(false); + } + } + } + } + + /** + * Return the list of elements filtered by visible connection. + * + * This method take the collection of node elements and return a filtered list this collection. The + * condition to keep an element are as follows: + *
    + *
  • there are no edges attached to element,
  • + *
  • or all edges attached to element are hidden or blacklisted (in excludedEdges)
  • + *
+ * + * @param elements + * the initial collection to be filtered + * @param excludedEdges + * the black list for edges we want to exclude + * @return the filtered list + */ + public static List getElementWithoutVisibleConnection(Collection elements, Collection excludedEdges) { + return elements.stream().filter(element -> { + List sourceEdges = element.getSourceEdges(); + List targetEdges = element.getTargetEdges(); + + // All incoming and outgoing edges of element + Stream edges = Stream.concat(sourceEdges.stream(), targetEdges.stream()); + + // Filter on edges by visibility attribute and excluded edges + // Return node with none attached edges (except excluded edges or hidden edges) + return edges.noneMatch(edge -> { + return edge.isVisible() && !excludedEdges.contains(edge); + }); + }).toList(); + } } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/NotationVisibilityUpdater.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/NotationVisibilityUpdater.java index 870ae32d35..cc3ecce311 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/NotationVisibilityUpdater.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/internal/refresh/listeners/NotationVisibilityUpdater.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2021 THALES GLOBAL SERVICES and others. + * Copyright (c) 2012, 2023 THALES GLOBAL SERVICES and others. * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -21,6 +21,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Stream; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.notify.Notification; @@ -44,15 +45,13 @@ import org.eclipse.sirius.diagram.HideLabelFilter; import org.eclipse.sirius.diagram.business.api.query.EObjectQuery; import org.eclipse.sirius.diagram.ui.business.api.query.ViewQuery; +import org.eclipse.sirius.diagram.ui.internal.refresh.GMFHelper; import org.eclipse.sirius.diagram.ui.part.SiriusVisualIDRegistry; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.provider.Messages; import org.eclipse.sirius.diagram.ui.tools.api.util.GMFNotationHelper; import org.eclipse.sirius.diagram.ui.tools.internal.preferences.SiriusDiagramUiInternalPreferencesKeys; -import com.google.common.collect.Iterables; -import com.google.common.collect.Iterators; - /** * This class update the notation model views visibility attribute when it * receives a notification about a DDiagramElement visibility change. @@ -100,18 +99,32 @@ public Command transactionAboutToCommit(final ResourceSetChangeEvent event) thro View referencingView = getReferencingView(dDiagramElement); if (referencingView != null) { if (notification.getFeature() == DiagramPackage.eINSTANCE.getDDiagramElement_Visible()) { - viewsToUpdate.put(referencingView, Boolean.valueOf(notification.getNewBooleanValue())); + boolean isVisible = notification.getNewBooleanValue(); + + // hide incoming or outgoing NoteAttachment links + List attachedEdge = GMFHelper.getAttachedEdgesRecursively(Collections.singleton(referencingView)); + attachedEdge = attachedEdge.stream().filter(GMFNotationHelper::isNoteAttachment).toList(); + + viewsToUpdate.put(referencingView, isVisible); + for (Edge view : attachedEdge) { + viewsToUpdate.put(view, isVisible); + } + if (removeHideNote) { - Set allViewsToHide = new HashSet(); - allContentsViewsVisibilityScope(referencingView, allViewsToHide, viewsToUpdate); - Iterators.filter(referencingView.eAllContents(), View.class); - final Iterator allContents = Iterators.filter(referencingView.eAllContents(), View.class); - while (allContents.hasNext()) { - final Object next = allContents.next(); - allContentsViewsVisibilityScope((View) next, allViewsToHide, viewsToUpdate); + // PGE = Pure Graphical Element + // Get PGE attached to all element that are about to change visibility + List attachedPGE = Stream.concat(GMFHelper.getAttachedPGE(referencingView).stream(), GMFHelper.getAttachedPGE(attachedEdge).stream()).toList(); + List needChangePGE; + if (isVisible) { + // all attached PGE need to be visible + needChangePGE = attachedPGE; + } else { + // only PGE attached only to hidden elements must be hidden + needChangePGE = GMFHelper.getElementWithoutVisibleConnection(attachedPGE, attachedEdge); } - for (View view : allViewsToHide) { - viewsToUpdate.put(view, notification.getNewBooleanValue()); + + for (Node node : needChangePGE) { + viewsToUpdate.put(node, isVisible); } } } else if (notification.getFeature() == DiagramPackage.eINSTANCE.getDEdge_IsFold()) { @@ -166,100 +179,6 @@ private Set getHiddenViews(List views, HideLabelFilter hideLabelFilt return viewToHide; } - private Set getAllRelatedNotesVisibilityScope(View viewToDelete, Map viewsToUpdate) { - Set linkedViews = new HashSet<>(); - - for (Edge sourceEdge : Iterables.filter(viewToDelete.getSourceEdges(), Edge.class)) { - View target = sourceEdge.getTarget(); - if (GMFNotationHelper.isNoteAttachment(sourceEdge)) { - Set linked = new HashSet<>(); - linked.add(viewToDelete); - collectLinkedViews(target, linked, viewsToUpdate); - linked.remove(viewToDelete); - - linkedViews.addAll(getSafe(linked)); - - } - } - - for (Edge targetEdge : Iterables.filter(viewToDelete.getTargetEdges(), Edge.class)) { - View source = targetEdge.getSource(); - if (GMFNotationHelper.isNoteAttachment(targetEdge)) { - Set linked = new HashSet<>(); - linked.add(viewToDelete); - collectLinkedViews(source, linked, viewsToUpdate); - linked.remove(viewToDelete); - - linkedViews.addAll(getSafe(linked)); - - } - } - - return linkedViews; - - } - - /** - * Remove all contains set if the set contains an element that is not a note - * - * @param linked - * set of notes to delete. - * @return a collection of notes - */ - private Collection getSafe(Set linked) { - for (View linkedView : linked) { - if (!(linkedView instanceof Node && GMFNotationHelper.isNote((Node) linkedView))) { - return Collections.emptySet(); - } - } - - return linked; - } - - private void collectLinkedViews(final View v, Set linkedViews, Map viewsToUpdate) { - linkedViews.add(v); - for (Edge sourceEdge : Iterables.filter(v.getSourceEdges(), Edge.class)) { - View target = sourceEdge.getTarget(); - boolean sourceIsNotViewToUpdate = true; - if (viewsToUpdate.get(target) != null) { - sourceIsNotViewToUpdate = viewsToUpdate.get(target); - } - if (GMFNotationHelper.isNoteAttachment(sourceEdge)) { - if (!linkedViews.contains(target) && target instanceof Node && GMFNotationHelper.isNote((Node) target)) { - collectLinkedViews(target, linkedViews, viewsToUpdate); - } else if (target.isVisible() && sourceIsNotViewToUpdate) { - linkedViews.add(target); - } - } - } - - for (Edge targetEdge : Iterables.filter(v.getTargetEdges(), Edge.class)) { - View source = targetEdge.getSource(); - boolean sourceIsNotViewToUpdate = true; - if (viewsToUpdate.get(source) != null) { - sourceIsNotViewToUpdate = viewsToUpdate.get(source); - } - if (GMFNotationHelper.isNoteAttachment(targetEdge)) { - if (!linkedViews.contains(source) && source instanceof Node && GMFNotationHelper.isNote((Node) source)) { - collectLinkedViews(source, linkedViews, viewsToUpdate); - } else if (source.isVisible() && sourceIsNotViewToUpdate) { - linkedViews.add(source); - } - } - } - } - - @SuppressWarnings("unchecked") - private void allContentsViewsVisibilityScope(View viewToDelete, Set allViewsToDelete, Map viewsToUpdate) { - allViewsToDelete.addAll(getAllRelatedNotesVisibilityScope(viewToDelete, viewsToUpdate)); - - for (Edge edge : Iterables.filter(Iterables.concat(viewToDelete.getSourceEdges(), viewToDelete.getTargetEdges()), Edge.class)) { - if (GMFNotationHelper.isNoteAttachment(edge)) { - allViewsToDelete.add(edge); - } - } - } - private View getReferencingView(DDiagramElement dDiagramElement) { View referencingView = null; EObjectQuery eObjectQuery = new EObjectQuery(dDiagramElement); diff --git a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/NoteAttachmentTest.java b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/NoteAttachmentTest.java index 9c27482750..935a8c69f4 100644 --- a/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/NoteAttachmentTest.java +++ b/plugins/org.eclipse.sirius.tests.swtbot/src/org/eclipse/sirius/tests/swtbot/NoteAttachmentTest.java @@ -211,7 +211,8 @@ private List getTextEditParts(EditPart editPart) { } /** - * @return View type of all PGE (ViewType.NOTE or ViewType.TEXT) in given parameter `editPart` + * @return View type of all purely graphical elements (PGE: ViewType.NOTE or ViewType.TEXT) in given parameter + * `editPart` */ private List getPGETypes(EditPart editPart) { List elements = editPart.getChildren();