diff options
| author | Esteban Dugueperoux | 2016-02-08 09:18:05 +0000 |
|---|---|---|
| committer | Esteban Dugueperoux | 2016-02-08 09:20:03 +0000 |
| commit | 3fb910f89d0f60ebc3c61323ca5962ac86efe1e1 (patch) | |
| tree | e5b6e3ad1c434ce745e15fe7b25e3ed2de70f32c | |
| parent | 19be1eb390752299f5acca5d4419ab6807644693 (diff) | |
| download | org.eclipse.sirius-3fb910f89d0f60ebc3c61323ca5962ac86efe1e1.tar.gz org.eclipse.sirius-3fb910f89d0f60ebc3c61323ca5962ac86efe1e1.tar.xz org.eclipse.sirius-3fb910f89d0f60ebc3c61323ca5962ac86efe1e1.zip | |
[486330] Revert previous commit about representation refresh/creation
- Since some tests are badly written, i.e. they don't activate their
viewpoint before attempting to create/refresh a representation, there
are many failures.
- A cleanup commit will be done before committing again this commit.
Bug: 486330
This reverts commit 2baba6572dfa7a4b6614402373286ac29d51de65.
Change-Id: I01071cfdcfe208eb723b067d4e1bbcfd3cc06721
9 files changed, 20 insertions, 124 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/dialect/DiagramDialectUIServices.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/dialect/DiagramDialectUIServices.java index f0efdbb7d1..abfffd8b7d 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/dialect/DiagramDialectUIServices.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/business/internal/dialect/DiagramDialectUIServices.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES and others. + * Copyright (c) 2007, 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 @@ -55,7 +55,6 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.sirius.business.api.dialect.DialectManager; import org.eclipse.sirius.business.api.helper.SiriusResourceHelper; import org.eclipse.sirius.business.api.query.EObjectQuery; import org.eclipse.sirius.business.api.query.URIQuery; @@ -223,7 +222,14 @@ public class DiagramDialectUIServices implements DialectUIServices { } private Set<Viewpoint> activateNeededViewpoints(Session session, DDiagram dDiagram, IProgressMonitor monitor) { - Set<Viewpoint> neededViewpoints = DialectManager.INSTANCE.getRequiredViewpoints(dDiagram); + List<Layer> activatedLayers = dDiagram.getActivatedLayers(); + Set<Viewpoint> neededViewpoints = new LinkedHashSet<Viewpoint>(); + for (Layer activatedLayer : activatedLayers) { + if (!activatedLayer.eIsProxy() && activatedLayer.eContainer() != null) { + Viewpoint viewpoint = (Viewpoint) activatedLayer.eContainer().eContainer(); + neededViewpoints.add(viewpoint); + } + } Set<Viewpoint> selectedViewpoints = new LinkedHashSet<Viewpoint>(); for (Viewpoint viewpoint : session.getSelectedViewpoints(false)) { selectedViewpoints.add(SiriusResourceHelper.getCorrespondingViewpoint(session, viewpoint)); diff --git a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/dialect/DiagramDialectServices.java b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/dialect/DiagramDialectServices.java index bc6de95ae0..ff3d6636af 100644 --- a/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/dialect/DiagramDialectServices.java +++ b/plugins/org.eclipse.sirius.diagram/src-core/org/eclipse/sirius/diagram/business/internal/dialect/DiagramDialectServices.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2015 THALES GLOBAL SERVICES. * 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 @@ -12,8 +12,6 @@ package org.eclipse.sirius.diagram.business.internal.dialect; import java.text.MessageFormat; import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; import java.util.Map; import java.util.Set; @@ -122,7 +120,7 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService @Override public boolean canCreate(final EObject semantic, final RepresentationDescription desc) { boolean result = false; - if (semantic != null && isSupported(desc) && isRelatedViewpointSelected(new EObjectQuery(semantic).getSession(), desc)) { + if (semantic != null && isSupported(desc)) { DiagramDescription diagDesc = (DiagramDescription) desc; ModelAccessor accessor = SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(semantic); if (accessor != null) { @@ -175,7 +173,7 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService monitor.subTask(MessageFormat.format(Messages.DiagramDialectServices_createDiagramMsg, name)); diagram = createRepresentation(name, semantic, description, new SubProgressMonitor(monitor, 2)); if (diagram != null) { - DialectManager.INSTANCE.refresh(diagram, new SubProgressMonitor(monitor, 26)); + refresh(diagram, new SubProgressMonitor(monitor, 26)); if (DisplayMode.NORMAL.equals(DisplayServiceManager.INSTANCE.getMode())) { DisplayServiceManager.INSTANCE.getDisplayService().refreshAllElementsVisibility((DDiagram) diagram); monitor.worked(1); @@ -265,22 +263,6 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService } } - @Override - public Set<Viewpoint> getRequiredViewpoints(DRepresentation representation) { - Set<Viewpoint> requiredViewpoints = new LinkedHashSet<Viewpoint>(); - if (representation instanceof DDiagram) { - DDiagram dDiagram = (DDiagram) representation; - List<Layer> activatedLayers = dDiagram.getActivatedLayers(); - for (Layer activatedLayer : activatedLayers) { - if (!activatedLayer.eIsProxy() && activatedLayer.eContainer() != null) { - Viewpoint viewpoint = (Viewpoint) activatedLayer.eContainer().eContainer(); - requiredViewpoints.add(viewpoint); - } - } - } - return requiredViewpoints; - } - /** * {@inheritDoc} */ diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index deacec0505..b21e91e61c 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -134,17 +134,6 @@ <li><span class="label label-success">Added</span> <code>org.eclipse.sirius.tools.api.command.ui.NoUICallback.askForTypedVariable(List<TypedVariable>, List<String>)</code> has been created. </li> - <li><span class="label label-success">Added</span> - <code>org.eclipse.sirius.business.api.dialect.DialectServices.getRequiredViewpoints(DRepresentation)</code> has been added to have mean to get required viewpoints to use a representation. - </li> - <li><span class="label label-success">Added</span> - <code>org.eclipse.sirius.business.api.dialect.AbstractRepresentationDialectServices.getRequiredViewpoints(DRepresentation)</code> has been added to have a default implementation of - <code>DialectServices.getRequiredViewpoints(DRepresentation)</code> method. - </li> - <li><span class="label label-success">Added</span> - <code>org.eclipse.sirius.business.api.dialect.AbstractRepresentationDialectServices.isRelatedViewpointSelected(Session, RepresentationDescription)</code> protected method has been added to check if a - <code>RepresentationDescription</code> is usable in the context of the specified session. - </li> <li><span class="label label-info">Modified</span> <code>org.eclipse.sirius.viewpoint.description.tool.SelectModelElementVariable</code> now implements <code>org.eclipse.sirius.viewpoint.description.InteractiveVariableDescription</code>. diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index 7491fc46aa..a08924b392 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -30,9 +30,6 @@ h4. Changes in @org.eclipse.sirius@ * <span class="label label-success">Added</span> @org.eclipse.sirius.viewpoint.description.InteractiveVariableDescription@ has been created as tag interface for variables that require user interaction to be valued. * <span class="label label-success">Added</span> @org.eclipse.sirius.tools.api.command.ui.UICallBack.askForTypedVariable(List<TypedVariable>, List<String>)@ has been created. * <span class="label label-success">Added</span> @org.eclipse.sirius.tools.api.command.ui.NoUICallback.askForTypedVariable(List<TypedVariable>, List<String>)@ has been created. -* <span class="label label-success">Added</span> @org.eclipse.sirius.business.api.dialect.DialectServices.getRequiredViewpoints(DRepresentation)@ has been added to have mean to get required viewpoints to use a representation. -* <span class="label label-success">Added</span> @org.eclipse.sirius.business.api.dialect.AbstractRepresentationDialectServices.getRequiredViewpoints(DRepresentation)@ has been added to have a default implementation of @DialectServices.getRequiredViewpoints(DRepresentation)@ method. -* <span class="label label-success">Added</span> @org.eclipse.sirius.business.api.dialect.AbstractRepresentationDialectServices.isRelatedViewpointSelected(Session, RepresentationDescription)@ protected method has been added to check if a @RepresentationDescription@ is usable in the context of the specified session. * <span class="label label-info">Modified</span> @org.eclipse.sirius.viewpoint.description.tool.SelectModelElementVariable@ now implements @org.eclipse.sirius.viewpoint.description.InteractiveVariableDescription@. * <span class="label label-info">Modified</span> @org.eclipse.sirius.viewpoint.description.tool.AbstractVariable@ has been moved to @org.eclipse.sirius.viewpoint.description.AbstractVariable@. * <span class="label label-info">Modified</span> @org.eclipse.sirius.viewpoint.description.tool.SubVariable@ has been moved to @org.eclipse.sirius.viewpoint.description.SubVariable@. diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableDialectServices.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableDialectServices.java index 83c558adb8..5c3c021470 100644 --- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableDialectServices.java +++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableDialectServices.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES and others. + * Copyright (c) 2007, 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 @@ -29,7 +29,6 @@ import org.eclipse.emf.transaction.util.TransactionUtil; import org.eclipse.sirius.business.api.dialect.AbstractRepresentationDialectServices; import org.eclipse.sirius.business.api.dialect.description.IInterpretedExpressionQuery; import org.eclipse.sirius.business.api.query.DRepresentationElementQuery; -import org.eclipse.sirius.business.api.query.EObjectQuery; import org.eclipse.sirius.business.api.query.IdentifiedElementQuery; import org.eclipse.sirius.business.api.session.CustomDataConstants; import org.eclipse.sirius.business.api.session.Session; @@ -112,7 +111,7 @@ public class TableDialectServices extends AbstractRepresentationDialectServices @Override public boolean canCreate(final EObject semantic, final RepresentationDescription desc) { boolean result = false; - if (semantic != null && isSupported(desc) && isRelatedViewpointSelected(new EObjectQuery(semantic).getSession(), desc)) { + if (semantic != null && isSupported(desc)) { TableDescription tableDesc = (TableDescription) desc; ModelAccessor accessor = SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(semantic); if (accessor != null) { diff --git a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/TreeDialectServices.java b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/TreeDialectServices.java index 7c863b9a58..f5d3340b15 100644 --- a/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/TreeDialectServices.java +++ b/plugins/org.eclipse.sirius.tree/src/org/eclipse/sirius/tree/business/internal/dialect/TreeDialectServices.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2016 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 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 @@ -215,7 +215,7 @@ public class TreeDialectServices extends AbstractRepresentationDialectServices { @Override public boolean canCreate(EObject semantic, RepresentationDescription desc) { boolean result = false; - if (semantic != null && isSupported(desc) && isRelatedViewpointSelected(new EObjectQuery(semantic).getSession(), desc)) { + if (semantic != null && isSupported(desc)) { TreeDescription treeDesc = (TreeDescription) desc; ModelAccessor accessor = SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(semantic); if (accessor != null) { diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/AbstractRepresentationDialectServices.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/AbstractRepresentationDialectServices.java index e6d4678654..e603fedb9b 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/AbstractRepresentationDialectServices.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/AbstractRepresentationDialectServices.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2016 THALES GLOBAL SERVICES and others. + * Copyright (c) 2009, 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 @@ -14,7 +14,6 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; -import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; @@ -28,8 +27,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.sirius.business.api.dialect.identifier.RepresentationElementIdentifier; import org.eclipse.sirius.business.api.helper.SiriusUtil; import org.eclipse.sirius.business.api.helper.task.AbstractCommandTask; -import org.eclipse.sirius.business.api.query.EObjectQuery; -import org.eclipse.sirius.business.api.query.RepresentationDescriptionQuery; import org.eclipse.sirius.business.api.query.ViewpointQuery; import org.eclipse.sirius.business.api.session.CustomDataConstants; import org.eclipse.sirius.business.api.session.Session; @@ -179,53 +176,7 @@ public abstract class AbstractRepresentationDialectServices implements DialectSe */ @Override public boolean canRefresh(DRepresentation representation) { - return isSupported(representation) && areRequiredViewpointsSelected(representation); - } - - private boolean areRequiredViewpointsSelected(DRepresentation representation) { - boolean areRequiredViewpointsSelected = false; - if (representation != null) { - Collection<Viewpoint> requiredViewpoints = getRequiredViewpoints(representation); - if (!requiredViewpoints.isEmpty()) { - Session session = new EObjectQuery(representation).getSession(); - if (session != null) { - areRequiredViewpointsSelected = session.getSelectedViewpoints(false).containsAll(requiredViewpoints); - } - } - } - return areRequiredViewpointsSelected; - } - - /** - * Tell if the {@link Viewpoint} owner of the - * {@link RepresentationDescription} is enabled on {@link Session}. - * - * @param session - * the {@link Session} - * @param representationDescription - * a {@link RepresentationDescription} in the context of the - * {@link Session} - * @return true if the {@link Viewpoint} owner of the - * {@link RepresentationDescription} is enabled on {@link Session} - */ - protected boolean isRelatedViewpointSelected(Session session, RepresentationDescription representationDescription) { - boolean isRelatedViewpointSelected = false; - Viewpoint parentViewpoint = new RepresentationDescriptionQuery(representationDescription).getParentViewpoint(); - isRelatedViewpointSelected = session != null && parentViewpoint != null && session.getSelectedViewpoints(false).contains(parentViewpoint); - return isRelatedViewpointSelected; - } - - @Override - public Set<Viewpoint> getRequiredViewpoints(DRepresentation representation) { - Set<Viewpoint> requiredViewpoints = new LinkedHashSet<Viewpoint>(); - RepresentationDescription representationDescription = getDescription(representation); - if (representationDescription != null) { - Viewpoint parentViewpoint = new RepresentationDescriptionQuery(representationDescription).getParentViewpoint(); - if (parentViewpoint != null) { - requiredViewpoints.add(parentViewpoint); - } - } - return requiredViewpoints; + return isSupported(representation); } /** diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/DialectServices.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/DialectServices.java index 05d7a51441..f527947fea 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/DialectServices.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/dialect/DialectServices.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2014 THALES GLOBAL SERVICES. * 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 @@ -12,7 +12,6 @@ package org.eclipse.sirius.business.api.dialect; import java.util.Collection; import java.util.Map; -import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.common.notify.Notification; @@ -355,18 +354,4 @@ public interface DialectServices { * @since 1.0.0 M6 */ boolean allowsEStructuralFeatureCustomization(EObject element); - - /** - * Tell which {@link Viewpoint viewpoints} are required to do a refresh of - * the specified <code>representation</code>. - * - * NOTE: only available viewpoints are returned. In some cases, the - * Viewpoint of a selected layer might not be available: for example if it - * is not installed. - * - * @param representation - * the specified {@link DRepresentation} - * @return the collection of required {@link Viewpoint viewpoints} - */ - Set<Viewpoint> getRequiredViewpoints(DRepresentation representation); } diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/dialect/DialectManagerImpl.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/dialect/DialectManagerImpl.java index d2121dbb9d..f8fbb32703 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/dialect/DialectManagerImpl.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/dialect/DialectManagerImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES and others. + * Copyright (c) 2007, 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 @@ -17,7 +17,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; @@ -593,16 +592,4 @@ public class DialectManagerImpl implements DialectManager { } return customizationAllowed; } - - @Override - public Set<Viewpoint> getRequiredViewpoints(DRepresentation representation) { - Set<Viewpoint> requiredViewpoints = null; - for (Dialect dialect : dialects.values()) { - if (dialect.getServices().handles(getDescription(representation))) { - requiredViewpoints = dialect.getServices().getRequiredViewpoints(representation); - break; - } - } - return requiredViewpoints; - } } |
