diff options
| author | Mickael LANOE | 2015-03-26 16:11:01 +0000 |
|---|---|---|
| committer | Maxime Porhel | 2015-04-01 07:32:12 +0000 |
| commit | e6869bbf5fdc489b0d26f01dd07fae709f86ae62 (patch) | |
| tree | 473eafde9ff4a8feb6bb0617cf341deb975161e0 | |
| parent | e4623a25a302066adf499793171e873f78cb5cd8 (diff) | |
| download | org.eclipse.sirius-e6869bbf5fdc489b0d26f01dd07fae709f86ae62.tar.gz org.eclipse.sirius-e6869bbf5fdc489b0d26f01dd07fae709f86ae62.tar.xz org.eclipse.sirius-e6869bbf5fdc489b0d26f01dd07fae709f86ae62.zip | |
[458822] Replace call to eAllContents() to retrieve diagram elements
Call DDiagramInternalQuery.getDiagramElements() instead of
eAllContents() to retrieve diagram elements because the query is
performing better.
Bug: 458822
Change-Id: Ic6229a04255d25b2fdeaf42a1908866b4392971b
Signed-off-by: Mickael LANOE <mickael.lanoe@obeo.fr>
| -rw-r--r-- | plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/helper/task/operations/CreateViewTask.java | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/helper/task/operations/CreateViewTask.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/helper/task/operations/CreateViewTask.java index 7332321bb0..36686630ca 100644 --- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/helper/task/operations/CreateViewTask.java +++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/helper/task/operations/CreateViewTask.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2014 THALES GLOBAL SERVICES and others. + * Copyright (c) 2008, 2015 THALES GLOBAL SERVICES and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,7 +15,6 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -45,6 +44,7 @@ import org.eclipse.sirius.diagram.business.api.helper.display.DisplayMode; import org.eclipse.sirius.diagram.business.api.helper.display.DisplayService; import org.eclipse.sirius.diagram.business.api.helper.display.DisplayServiceManager; import org.eclipse.sirius.diagram.business.api.helper.graphicalfilters.HideFilterHelper; +import org.eclipse.sirius.diagram.business.api.query.DDiagramQuery; import org.eclipse.sirius.diagram.business.api.query.DiagramElementMappingQuery; import org.eclipse.sirius.diagram.business.api.query.EObjectQuery; import org.eclipse.sirius.diagram.business.internal.experimental.sync.AbstractDNodeCandidate; @@ -72,8 +72,6 @@ import org.eclipse.sirius.viewpoint.DSemanticDecorator; import org.eclipse.sirius.viewpoint.description.SemanticBasedDecoration; import org.eclipse.sirius.viewpoint.description.tool.AbstractToolDescription; -import com.google.common.collect.Iterators; - /** * Create a view according to a specific CreateView model element. * @@ -100,23 +98,12 @@ public class CreateViewTask extends AbstractOperationTask { this.createViewOp = createViewOp; } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.business.api.helper.task.ICommandTask#getLabel() - */ + @Override public String getLabel() { return "create a view"; } - /** - * {@inheritDoc} - * - * @throws FeatureNotFoundException - * @throws MetaClassNotFoundException - * - * @see org.eclipse.sirius.business.api.helper.task.ICommandTask#execute() - */ + @Override public void execute() throws MetaClassNotFoundException, FeatureNotFoundException { DSemanticDecorator containerView = evaluateContainerViewExpression(); DSemanticDiagram parentDDiagram = getDSemanticDiagram(containerView); @@ -318,9 +305,7 @@ public class CreateViewTask extends AbstractOperationTask { private Collection<DDiagramElement> getNodes(final EObject semanticElement, final DSemanticDiagram dSemanticDiagram, final Collection<DiagramElementMapping> mappings) { Set<DDiagramElement> result = new HashSet<DDiagramElement>(); if (semanticElement != null) { - Iterator<DDiagramElement> dDiagramElements = Iterators.filter(dSemanticDiagram.eAllContents(), DDiagramElement.class); - while (dDiagramElements.hasNext()) { - DDiagramElement dDiagramElement = dDiagramElements.next(); + for (DDiagramElement dDiagramElement : new DDiagramQuery(dSemanticDiagram).getAllDiagramElements()) { if (mappings.contains(dDiagramElement.getMapping()) && semanticElement.equals(dDiagramElement.getTarget())) { result.add(dDiagramElement); } |
