diff options
| author | Pierre-Charles David | 2018-01-18 16:15:26 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2018-02-08 09:00:17 +0000 |
| commit | c07b653ced6294685d7f570a80d50bddb0b915d5 (patch) | |
| tree | ac3e9c364b4378f429790bd64f8719404fd661ba | |
| parent | ef16312c969af98ae720a3767e59e1321fc41a80 (diff) | |
| download | org.eclipse.sirius-c07b653ced6294685d7f570a80d50bddb0b915d5.tar.gz org.eclipse.sirius-c07b653ced6294685d7f570a80d50bddb0b915d5.tar.xz org.eclipse.sirius-c07b653ced6294685d7f570a80d50bddb0b915d5.zip | |
[462311] Remove all Movida-related code
Bug: 462311
Change-Id: I2ffb07cd20cedba1a5df10d5e7580fa5720a1820
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
150 files changed, 113 insertions, 17816 deletions
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 cbbe41ba26..1bd10713fd 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, 2017 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2018 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 @@ -92,14 +92,11 @@ import com.google.common.collect.Iterables; /** * Services for diagram. - * + * * @author cbrun */ public class DiagramDialectServices extends AbstractRepresentationDialectServices { - /** - * {@inheritDoc} - */ @Override protected boolean isSupported(DRepresentation representation) { return representation instanceof DDiagram; @@ -110,9 +107,6 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService return representationDescriptor.getDescription() instanceof DiagramDescription; } - /** - * {@inheritDoc} - */ @Override protected boolean isSupported(RepresentationDescription description) { return description instanceof DiagramDescription; @@ -151,9 +145,6 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService return result; } - /** - * {@inheritDoc} - */ @Override public DRepresentation createRepresentation(final String name, final EObject semantic, final RepresentationDescription description, final IProgressMonitor monitor) { // TODO ensure that the given description is contained in the same @@ -167,9 +158,6 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService return sync.getDiagram(); } - /** - * {@inheritDoc} - */ @Override public DRepresentation createRepresentation(final String name, final EObject semantic, final RepresentationDescription description, final Session session, final IProgressMonitor monitor) { DRepresentation diagram = null; @@ -205,7 +193,7 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService /** * Create and store a gmf diagram from a Sirius one. - * + * * @param session * the session * @param diagram @@ -225,9 +213,6 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService return gmfDiag; } - /** - * {@inheritDoc} - */ @Override public DRepresentation copyRepresentation(final DRepresentation representation, final String name, final Session session, final IProgressMonitor monitor) { @@ -241,7 +226,7 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService /** * The <code>fullRefresh</code> is not taken into account for diagram dialect. - * + * * {@inheritDoc} */ @Override @@ -298,17 +283,11 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService super.initRepresentations(semantic, vp, DiagramDescription.class); } - /** - * {@inheritDoc} - */ @Override public void initRepresentations(final Viewpoint vp, final EObject semantic, IProgressMonitor monitor) { super.initRepresentations(semantic, vp, DiagramDescription.class, monitor); } - /** - * {@inheritDoc} - */ @Override protected <T extends RepresentationDescription> void initRepresentationForElement(T representationDescription, EObject semanticElement, IProgressMonitor monitor) { if (representationDescription instanceof DiagramDescription) { @@ -332,10 +311,7 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService } } } - - /** - * {@inheritDoc} - */ + @Override public void updateRepresentationsExtendedBy(final Session session, final Viewpoint viewpoint, final boolean activated) { final EList<RepresentationExtensionDescription> extensions = viewpoint.getOwnedRepresentationExtensions(); @@ -381,49 +357,26 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService } } - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.business.api.dialect.DialectServices#createInterpretedExpressionQuery(org.eclipse.emf.ecore.EObject, - * org.eclipse.emf.ecore.EStructuralFeature) - */ @Override public IInterpretedExpressionQuery createInterpretedExpressionQuery(EObject target, EStructuralFeature feature) { return new DiagramInterpretedExpressionQuery(target, feature); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.business.api.dialect.DialectServices#handles(org.eclipse.sirius.viewpoint.description.RepresentationDescription) - */ @Override public boolean handles(RepresentationDescription representationDescription) { return (representationDescription instanceof DiagramDescription) || (representationDescription instanceof DiagramImportDescription); } - /** - * {@inheritDoc} - * - * @see org.eclipse.sirius.business.api.dialect.DialectServices#handles(org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription) - */ @Override public boolean handles(RepresentationExtensionDescription representationExtensionDescription) { return representationExtensionDescription instanceof DiagramExtensionDescription; } - /** - * {@inheritDoc} - */ @Override public void invalidateMappingCache() { DiagramDescriptionMappingsRegistry.INSTANCE.computeMappings(); } - /** - * {@inheritDoc} - */ @Override public Option<? extends AbstractCommandTask> createTask(CommandContext context, ModelAccessor extPackage, ModelOperation op, Session session, UICallBack uiCallback) { Option<? extends AbstractCommandTask> task = Options.newNone(); @@ -439,7 +392,7 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService /** * {@inheritDoc} - * + * * The diagram dialect allows the feature customizations on style descriptions. */ @Override @@ -548,7 +501,7 @@ public class DiagramDialectServices extends AbstractRepresentationDialectService private Set<DDiagramElement> getDiagramElementsToRefresh(EObject notifier, DSemanticDiagram diagram, ECrossReferenceAdapter xref) { Set<DDiagramElement> diagramElementsToRefresh = new HashSet<>(); - Collection<EObject> inverseReferencers = new EObjectQuery(notifier, xref).getInverseReferences(REPRESENTATION_ELEMENTS_INVERSE_REFERENCES); + Collection<EObject> inverseReferencers = new EObjectQuery(notifier, xref).getInverseReferences(AbstractRepresentationDialectServices.REPRESENTATION_ELEMENTS_INVERSE_REFERENCES); for (EObject inverseReferencer : inverseReferencers) { if (inverseReferencer instanceof DDiagramElement) { DDiagramElement diagramElement = (DDiagramElement) inverseReferencer; diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index bc83d6de5d..c4e758be84 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -177,6 +177,34 @@ <code>org.eclipse.sirius.business.api.componentization.ViewpointRegistryImpl()</code> has been moved to <code>org.eclipse.sirius.business.internal.componentization</code> package. </li> + <li><span class="label label-danger">Removed</span> The whole + <code>contribution</code> metamodel, which lived in package + <code>org.eclipse.sirius.description.contribution</code>, has been removed. It corresponded to an experimental feature which has been abandonned long ago. + </li> + <li><span class="label label-danger">Removed</span> The + <code>org.eclipse.sirius.viewpointSpecificationModel</code> extension point has been removed. It was part of the same experimental feauture and not actually used in practice. + </li> + <li><span class="label label-danger">Removed</span> In + <code>org.eclipse.sirius.business.api.session.danalysis.DAnalysisSessionHelper</code>, the method + <code>getViewpointSelection()</code> has been removed. It used an internal type as argument which has also been removed. + </li> + <li><span class="label label-danger">Removed</span> In + <code>org.eclipse.sirius.business.api.helper.SiriusResourceHelper</code>, the method + <code>getCorrespondingViewpoint(Session session, URI, boolean)</code> has been removed. It was not used anywhere, the real one is + <code>getCorrespondingViewpoint(Session, Viewpoint)</code> in the same class. + </li> + <li><span class="label label-danger">Removed</span> In + <code>org.eclipse.sirius.business.api.dialect.DialectServices</code> (and all its implementations), the method + <code>refreshEffectiveRepresentationDescription(DRepresentation, IProgressMonitor)</code> has been removed. It corresponded to an experimental feature which has been abandonned long ago. + </li> + </ul> + <h4 id="Changesinorg.eclipse.sirius.ui">Changes in + <code>org.eclipse.sirius.ui</code> + </h4> + <ul> + <li><span class="label label-danger">Removed</span> The class + <code>org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelectionDialog</code> has been removed. + </li> </ul> <h4 id="Migrations">Migrations</h4> <h4 id="TranslationKeysChanges">Translation Keys Changes</h4> @@ -243,7 +271,7 @@ <pre>SiriusEditPlugin.getPlugin().getPreferenceStore().setDefault(SiriusUIPreferencesKeys.PREF_SCALE_LEVEL_DIAGRAMS_ON_EXPORT.name(),0); </pre> - <h4 id="Changesinorg.eclipse.sirius.ui">Changes in + <h4 id="Changesinorg.eclipse.sirius.ui2">Changes in <code>org.eclipse.sirius.ui</code> </h4> <ul> @@ -514,7 +542,7 @@ <a href="./specifier/general/Writing_Queries.html#service_methods">specifier documentation</a>, it is recommended to use List or Set instead of Collection in java services signature. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.ui2">Changes in + <h4 id="Changesinorg.eclipse.sirius.ui3">Changes in <code>org.eclipse.sirius.ui</code> </h4> <ul> @@ -826,7 +854,7 @@ <code>RepresentationElementIdentifier</code>) have been removed. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.ui3">Changes in + <h4 id="Changesinorg.eclipse.sirius.ui4">Changes in <code>org.eclipse.sirius.ui</code> </h4> <ul> @@ -1500,7 +1528,7 @@ SWTBotUtils.waitAllUiEvents(); <code>updateModelsReferences(DAnalysis, Iterator<DSemanticDecorator>)</code> because it is more suited to the client needs. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.ui4">Changes in + <h4 id="Changesinorg.eclipse.sirius.ui5">Changes in <code>org.eclipse.sirius.ui</code> </h4> <ul> @@ -1994,7 +2022,7 @@ SWTBotUtils.waitAllUiEvents(); <code>org.eclipse.sirius.diagram.description.filter.impl.VariableFilterImpl.resetVariables()</code>. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.ui5">Changes in + <h4 id="Changesinorg.eclipse.sirius.ui6">Changes in <code>org.eclipse.sirius.ui</code> </h4> <ul> @@ -2142,7 +2170,7 @@ SWTBotUtils.waitAllUiEvents(); <code>org.eclipse.sirius.ext.gmf.runtime.diagram.ui.tools.MoveInDiagramDragTracker</code> has been added to declare states used by all DragTrackers which manage move in diagram using mouse middle click. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.ui6">Changes in + <h4 id="Changesinorg.eclipse.sirius.ui7">Changes in <code>org.eclipse.sirius.ui</code> </h4> <ul> diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index b1ab02938c..4f8eceefe5 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -28,6 +28,15 @@ h4. Changes in @org.eclipse.sirius@ * <span class="label label-success">Added</span> The method @org.eclipse.sirius.business.api.componentization.ViewpointRegistry.reloadAllFromPlugins()@ has been added to reload, from the runtime, all the VSMs of installed plug-ins and have the effect dynamically in the runtime. * <span class="label label-info">Modified</span> The class @org.eclipse.sirius.business.api.componentization.ViewpointRegistryImpl()@ has been moved to @org.eclipse.sirius.business.internal.componentization@ package. +* <span class="label label-danger">Removed</span> The whole @contribution@ metamodel, which lived in package @org.eclipse.sirius.description.contribution@, has been removed. It corresponded to an experimental feature which has been abandonned long ago. +* <span class="label label-danger">Removed</span> The @org.eclipse.sirius.viewpointSpecificationModel@ extension point has been removed. It was part of the same experimental feauture and not actually used in practice. +* <span class="label label-danger">Removed</span> In @org.eclipse.sirius.business.api.session.danalysis.DAnalysisSessionHelper@, the method @getViewpointSelection()@ has been removed. It used an internal type as argument which has also been removed. +* <span class="label label-danger">Removed</span> In @org.eclipse.sirius.business.api.helper.SiriusResourceHelper@, the method @getCorrespondingViewpoint(Session session, URI, boolean)@ has been removed. It was not used anywhere, the real one is @getCorrespondingViewpoint(Session, Viewpoint)@ in the same class. +* <span class="label label-danger">Removed</span> In @org.eclipse.sirius.business.api.dialect.DialectServices@ (and all its implementations), the method @refreshEffectiveRepresentationDescription(DRepresentation, IProgressMonitor)@ has been removed. It corresponded to an experimental feature which has been abandonned long ago. + +h4. Changes in @org.eclipse.sirius.ui@ + +* <span class="label label-danger">Removed</span> The class @org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelectionDialog@ has been removed. h4. Migrations diff --git a/plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF index 871dba130d..87df640568 100644 --- a/plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.editor/META-INF/MANIFEST.MF @@ -33,11 +33,6 @@ Export-Package: org.eclipse.sirius.editor;version="6.0.0", org.eclipse.sirius.editor.properties;version="2.0.4", org.eclipse.sirius.editor.properties.filters.audit.templateinformationsection;version="2.0.4", org.eclipse.sirius.editor.properties.filters.common;version="2.0.4", - org.eclipse.sirius.editor.properties.filters.contribution.computedeobjectreference;version="2.0.4", - org.eclipse.sirius.editor.properties.filters.contribution.contribution;version="2.0.4", - org.eclipse.sirius.editor.properties.filters.contribution.contributionpoint;version="2.0.4", - org.eclipse.sirius.editor.properties.filters.contribution.directeobjectreference;version="2.0.4", - org.eclipse.sirius.editor.properties.filters.contribution.featurecontribution;version="2.0.4", org.eclipse.sirius.editor.properties.filters.description.abstractmappingimport;version="2.0.4", org.eclipse.sirius.editor.properties.filters.description.abstractvariable;version="2.0.4", org.eclipse.sirius.editor.properties.filters.description.annotationentry;version="2.0.4", @@ -113,11 +108,6 @@ Export-Package: org.eclipse.sirius.editor;version="6.0.0", org.eclipse.sirius.editor.properties.filters.validation.viewvalidationrule;version="2.0.4", org.eclipse.sirius.editor.properties.sections.audit.templateinformationsection;version="2.0.4", org.eclipse.sirius.editor.properties.sections.common;version="2.1.0", - org.eclipse.sirius.editor.properties.sections.contribution.computedeobjectreference;version="2.0.4", - org.eclipse.sirius.editor.properties.sections.contribution.contribution;version="2.0.4", - org.eclipse.sirius.editor.properties.sections.contribution.contributionpoint;version="2.0.4", - org.eclipse.sirius.editor.properties.sections.contribution.directeobjectreference;version="2.0.4", - org.eclipse.sirius.editor.properties.sections.contribution.featurecontribution;version="2.0.4", org.eclipse.sirius.editor.properties.sections.description.abstractmappingimport;version="2.0.4", org.eclipse.sirius.editor.properties.sections.description.abstractvariable;version="2.0.4", org.eclipse.sirius.editor.properties.sections.description.annotationentry;version="2.0.4", diff --git a/plugins/org.eclipse.sirius.editor/plugin.xml b/plugins/org.eclipse.sirius.editor/plugin.xml index 61843889c0..12e7aa9a3c 100644 --- a/plugins/org.eclipse.sirius.editor/plugin.xml +++ b/plugins/org.eclipse.sirius.editor/plugin.xml @@ -1180,47 +1180,6 @@ </propertySection> </propertySections> </extension> - - <extension point="org.eclipse.ui.views.properties.tabbed.propertySections"> - <propertySections contributorId="org.eclipse.sirius.editor.editorPlugin.ViewpointEditorContributor"> - <propertySection - class="org.eclipse.sirius.editor.properties.sections.contribution.computedeobjectreference.ComputedEObjectReferenceValueExpressionPropertySection" - filter="org.eclipse.sirius.editor.properties.filters.contribution.computedeobjectreference.ComputedEObjectReferenceValueExpressionFilter" - id="contribution.section.computedEObjectReference.ValueExpression" - tab="viewpoint.tab.general"> - <input type="org.eclipse.sirius.description.contribution.ComputedEObjectReference"/> - </propertySection> - <propertySection - class="org.eclipse.sirius.editor.properties.sections.contribution.directeobjectreference.DirectEObjectReferenceValuePropertySection" - filter="org.eclipse.sirius.editor.properties.filters.contribution.directeobjectreference.DirectEObjectReferenceValueFilter" - id="contribution.section.directEObjectReference.Value" - tab="viewpoint.tab.general"> - <input type="org.eclipse.sirius.description.contribution.DirectEObjectReference"/> - </propertySection> - <propertySection - class="org.eclipse.sirius.editor.properties.sections.contribution.featurecontribution.FeatureContributionTargetFeaturePropertySection" - filter="org.eclipse.sirius.editor.properties.filters.contribution.featurecontribution.FeatureContributionTargetFeatureFilter" - id="contribution.section.featureContribution.TargetFeature" - afterSection="contribution.section.featureContribution.SourceFeature" - tab="viewpoint.tab.general"> - <input type="org.eclipse.sirius.description.contribution.FeatureContribution"/> - </propertySection> - <propertySection - class="org.eclipse.sirius.editor.properties.sections.contribution.featurecontribution.FeatureContributionSourceFeaturePropertySection" - filter="org.eclipse.sirius.editor.properties.filters.contribution.featurecontribution.FeatureContributionSourceFeatureFilter" - id="contribution.section.featureContribution.SourceFeature" - tab="viewpoint.tab.general"> - <input type="org.eclipse.sirius.description.contribution.FeatureContribution"/> - </propertySection> - <propertySection - class="org.eclipse.sirius.editor.properties.sections.contribution.contribution.ContributionDescriptionPropertySection" - id="contribution.section.contribution.Description" - filter="org.eclipse.sirius.editor.properties.filters.contribution.contribution.ContributionDescriptionFilter" - tab="viewpoint.tab.general"> - <input type="org.eclipse.sirius.description.contribution.Contribution"/> - </propertySection> - </propertySections> - </extension> <!-- Start of user code plugin.xml end specifics --> diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/computedeobjectreference/ComputedEObjectReferenceValueExpressionFilter.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/computedeobjectreference/ComputedEObjectReferenceValueExpressionFilter.java deleted file mode 100644 index 009f4800a1..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/computedeobjectreference/ComputedEObjectReferenceValueExpressionFilter.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.filters.contribution.computedeobjectreference; - -// Start of user code specific imports - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.properties.filters.common.ContributionPropertyFilter; - -// End of user code specific imports - -/** - * A filter for the valueExpression property section. - */ -public class ComputedEObjectReferenceValueExpressionFilter extends ContributionPropertyFilter { - - /** - * {@inheritDoc} - */ - protected EStructuralFeature getFeature() { - return ContributionPackage.eINSTANCE.getComputedEObjectReference_ValueExpression(); - } - - /** - * {@inheritDoc} - */ - protected boolean isRightInputType(Object arg0) { - return arg0 instanceof org.eclipse.sirius.description.contribution.ComputedEObjectReference; - } - - // Start of user code user methods - - // End of user code user methods - -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/contribution/ContributionDescriptionFilter.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/contribution/ContributionDescriptionFilter.java deleted file mode 100644 index cf670fc7a9..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/contribution/ContributionDescriptionFilter.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.filters.contribution.contribution; - -// Start of user code specific imports - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.properties.filters.common.ContributionPropertyFilter; - -// End of user code specific imports - -/** - * A filter for the description property section. - */ -public class ContributionDescriptionFilter extends ContributionPropertyFilter { - - /** - * {@inheritDoc} - */ - protected EStructuralFeature getFeature() { - return ContributionPackage.eINSTANCE.getContribution_Description(); - } - - /** - * {@inheritDoc} - */ - protected boolean isRightInputType(Object arg0) { - return arg0 instanceof org.eclipse.sirius.description.contribution.Contribution; - } - - // Start of user code user methods - - // End of user code user methods - -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/contributionpoint/ContributionPointContributedFilter.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/contributionpoint/ContributionPointContributedFilter.java deleted file mode 100644 index abd7939c0d..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/contributionpoint/ContributionPointContributedFilter.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.filters.contribution.contributionpoint; - -// Start of user code specific imports - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.properties.filters.common.ContributionPropertyFilter; - -// End of user code specific imports - -/** - * A filter for the contributed property section. - */ -public class ContributionPointContributedFilter extends ContributionPropertyFilter { - - /** - * {@inheritDoc} - */ - protected EStructuralFeature getFeature() { - return ContributionPackage.eINSTANCE.getContributionPoint_Contributed(); - } - - /** - * {@inheritDoc} - */ - protected boolean isRightInputType(Object arg0) { - return arg0 instanceof org.eclipse.sirius.description.contribution.ContributionPoint; - } - - // Start of user code user methods - - // End of user code user methods - -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/contributionpoint/ContributionPointOriginFilter.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/contributionpoint/ContributionPointOriginFilter.java deleted file mode 100644 index 258684dd47..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/contributionpoint/ContributionPointOriginFilter.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.filters.contribution.contributionpoint; - -// Start of user code specific imports - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.properties.filters.common.ContributionPropertyFilter; - -// End of user code specific imports - -/** - * A filter for the origin property section. - */ -public class ContributionPointOriginFilter extends ContributionPropertyFilter { - - /** - * {@inheritDoc} - */ - protected EStructuralFeature getFeature() { - return ContributionPackage.eINSTANCE.getContributionPoint_Origin(); - } - - /** - * {@inheritDoc} - */ - protected boolean isRightInputType(Object arg0) { - return arg0 instanceof org.eclipse.sirius.description.contribution.ContributionPoint; - } - - // Start of user code user methods - - // End of user code user methods - -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/directeobjectreference/DirectEObjectReferenceValueFilter.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/directeobjectreference/DirectEObjectReferenceValueFilter.java deleted file mode 100644 index e579b7b245..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/directeobjectreference/DirectEObjectReferenceValueFilter.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.filters.contribution.directeobjectreference; - -// Start of user code specific imports - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.properties.filters.common.ContributionPropertyFilter; - -// End of user code specific imports - -/** - * A filter for the value property section. - */ -public class DirectEObjectReferenceValueFilter extends ContributionPropertyFilter { - - /** - * {@inheritDoc} - */ - protected EStructuralFeature getFeature() { - return ContributionPackage.eINSTANCE.getDirectEObjectReference_Value(); - } - - /** - * {@inheritDoc} - */ - protected boolean isRightInputType(Object arg0) { - return arg0 instanceof org.eclipse.sirius.description.contribution.DirectEObjectReference; - } - - // Start of user code user methods - - // End of user code user methods - -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/featurecontribution/FeatureContributionSourceFeatureFilter.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/featurecontribution/FeatureContributionSourceFeatureFilter.java deleted file mode 100644 index 8934dd7e67..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/featurecontribution/FeatureContributionSourceFeatureFilter.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.filters.contribution.featurecontribution; - -// Start of user code specific imports - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.properties.filters.common.ContributionPropertyFilter; - -// End of user code specific imports - -/** - * A filter for the sourceFeature property section. - */ -public class FeatureContributionSourceFeatureFilter extends ContributionPropertyFilter { - - /** - * {@inheritDoc} - */ - protected EStructuralFeature getFeature() { - return ContributionPackage.eINSTANCE.getFeatureContribution_SourceFeature(); - } - - /** - * {@inheritDoc} - */ - protected boolean isRightInputType(Object arg0) { - return arg0 instanceof org.eclipse.sirius.description.contribution.FeatureContribution; - } - - // Start of user code user methods - - // End of user code user methods - -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/featurecontribution/FeatureContributionTargetFeatureFilter.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/featurecontribution/FeatureContributionTargetFeatureFilter.java deleted file mode 100644 index dc30258b6a..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/filters/contribution/featurecontribution/FeatureContributionTargetFeatureFilter.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.filters.contribution.featurecontribution; - -// Start of user code specific imports - -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.properties.filters.common.ContributionPropertyFilter; - -// End of user code specific imports - -/** - * A filter for the targetFeature property section. - */ -public class FeatureContributionTargetFeatureFilter extends ContributionPropertyFilter { - - /** - * {@inheritDoc} - */ - protected EStructuralFeature getFeature() { - return ContributionPackage.eINSTANCE.getFeatureContribution_TargetFeature(); - } - - /** - * {@inheritDoc} - */ - protected boolean isRightInputType(Object arg0) { - return arg0 instanceof org.eclipse.sirius.description.contribution.FeatureContribution; - } - - // Start of user code user methods - - // End of user code user methods - -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/computedeobjectreference/ComputedEObjectReferenceValueExpressionPropertySection.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/computedeobjectreference/ComputedEObjectReferenceValueExpressionPropertySection.java deleted file mode 100644 index 5c74a29dee..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/computedeobjectreference/ComputedEObjectReferenceValueExpressionPropertySection.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.sections.contribution.computedeobjectreference; - -// Start of user code imports - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.editorPlugin.SiriusEditor; -import org.eclipse.sirius.editor.properties.sections.common.AbstractTextPropertySection; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; - -// End of user code imports - -/** - * A section for the valueExpression property of a ComputedEObjectReference object. - */ -public class ComputedEObjectReferenceValueExpressionPropertySection extends AbstractTextPropertySection { - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getDefaultLabelText() - */ - protected String getDefaultLabelText() { - return "ValueExpression"; //$NON-NLS-1$ - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getLabelText() - */ - protected String getLabelText() { - String labelText; - labelText = super.getLabelText() + "*:"; //$NON-NLS-1$ - // Start of user code get label text - - // End of user code get label text - return labelText; - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getFeature() - */ - public EAttribute getFeature() { - return ContributionPackage.eINSTANCE.getComputedEObjectReference_ValueExpression(); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getFeatureValue(String) - */ - protected Object getFeatureValue(String newText) { - return newText; - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#isEqual(String) - */ - protected boolean isEqual(String newText) { - return getFeatureAsText().equals(newText); - } - - /** - * {@inheritDoc} - */ - public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { - super.createControls(parent, tabbedPropertySheetPage); - - nameLabel.setFont(SiriusEditor.getFontRegistry().get("required")); - - // Start of user code create controls - - // End of user code create controls - - } - - /** - * {@inheritDoc} - */ - protected String getPropertyDescription() { - return ""; - } - - // Start of user code user operations - - // End of user code user operations -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/contribution/ContributionDescriptionPropertySection.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/contribution/ContributionDescriptionPropertySection.java deleted file mode 100644 index 986bf061d0..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/contribution/ContributionDescriptionPropertySection.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.sections.contribution.contribution; - -// Start of user code imports - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.properties.sections.common.AbstractTextPropertySection; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; - -// End of user code imports - -/** - * A section for the description property of a Contribution object. - */ -public class ContributionDescriptionPropertySection extends AbstractTextPropertySection { - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getDefaultLabelText() - */ - protected String getDefaultLabelText() { - return "Description"; //$NON-NLS-1$ - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getLabelText() - */ - protected String getLabelText() { - String labelText; - labelText = super.getLabelText() + ":"; //$NON-NLS-1$ - // Start of user code get label text - - // End of user code get label text - return labelText; - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getFeature() - */ - public EAttribute getFeature() { - return ContributionPackage.eINSTANCE.getContribution_Description(); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getFeatureValue(String) - */ - protected Object getFeatureValue(String newText) { - return newText; - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#isEqual(String) - */ - protected boolean isEqual(String newText) { - return getFeatureAsText().equals(newText); - } - - /** - * {@inheritDoc} - */ - public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { - super.createControls(parent, tabbedPropertySheetPage); - - // Start of user code create controls - - // End of user code create controls - - } - - /** - * {@inheritDoc} - */ - protected String getPropertyDescription() { - return ""; - } - - // Start of user code user operations - - // End of user code user operations -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/contributionpoint/ContributionPointContributedPropertySection.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/contributionpoint/ContributionPointContributedPropertySection.java deleted file mode 100644 index d06e665bda..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/contributionpoint/ContributionPointContributedPropertySection.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.sections.contribution.contributionpoint; - -// Start of user code imports - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.editorPlugin.SiriusEditor; -import org.eclipse.sirius.editor.properties.sections.common.AbstractComboPropertySection; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; - -// End of user code imports - -/** - * A section for the contributed property of a ContributionPoint object. - */ -public class ContributionPointContributedPropertySection extends AbstractComboPropertySection { - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getDefaultLabelText() - */ - protected String getDefaultLabelText() { - return "Contributed"; //$NON-NLS-1$ - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getLabelText() - */ - protected String getLabelText() { - String labelText; - labelText = super.getLabelText() + "*:"; //$NON-NLS-1$ - // Start of user code get label text - - // End of user code get label text - return labelText; - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getFeature() - */ - protected EReference getFeature() { - return ContributionPackage.eINSTANCE.getContributionPoint_Contributed(); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getFeatureValue(int) - */ - protected Object getFeatureValue(int index) { - return getFeatureValueAt(index); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#isEqual(int) - */ - protected boolean isEqual(int index) { - boolean isEqual = false; - if (getFeatureValueAt(index) == null) - isEqual = eObject.eGet(getFeature()) == null; - else - isEqual = getFeatureValueAt(index).equals(eObject.eGet(getFeature())); - return isEqual; - } - - /** - * Returns the value at the specified index in the choice of values for the feature. - * - * @param index - * Index of the value. - * @return the value at the specified index in the choice of values. - */ - protected Object getFeatureValueAt(int index) { - List<?> values = getChoiceOfValues(); - if (values.size() < index || values.size() == 0 || index == -1) { - return null; - } - return values.get(index); - } - - /** - * Fetches the list of available values for the feature. - * - * @return The list of available values for the feature. - */ - protected List<?> getChoiceOfValues() { - List<?> values = Collections.emptyList(); - List<IItemPropertyDescriptor> propertyDescriptors = getDescriptors(); - for (Iterator<IItemPropertyDescriptor> iterator = propertyDescriptors.iterator(); iterator.hasNext();) { - IItemPropertyDescriptor propertyDescriptor = iterator.next(); - if (((EStructuralFeature) propertyDescriptor.getFeature(eObject)) == getFeature()) - values = new ArrayList<Object>(propertyDescriptor.getChoiceOfValues(eObject)); - } - - // Start of user code choice of values - // End of user code choice of values - return values; - } - - /** - * {@inheritDoc} - */ - public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { - super.createControls(parent, tabbedPropertySheetPage); - nameLabel.setFont(SiriusEditor.getFontRegistry().get("required")); - // Start of user code create controls - - // End of user code create controls - } - // Start of user code user operations - - // End of user code user operations -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/contributionpoint/ContributionPointOriginPropertySection.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/contributionpoint/ContributionPointOriginPropertySection.java deleted file mode 100644 index 54887aebbe..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/contributionpoint/ContributionPointOriginPropertySection.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.sections.contribution.contributionpoint; - -// Start of user code imports - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.editorPlugin.SiriusEditor; -import org.eclipse.sirius.editor.properties.sections.common.AbstractTextPropertySection; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; - -// End of user code imports - -/** - * A section for the origin property of a ContributionPoint object. - */ -public class ContributionPointOriginPropertySection extends AbstractTextPropertySection { - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getDefaultLabelText() - */ - protected String getDefaultLabelText() { - return "Origin"; //$NON-NLS-1$ - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getLabelText() - */ - protected String getLabelText() { - String labelText; - labelText = super.getLabelText() + "*:"; //$NON-NLS-1$ - // Start of user code get label text - - // End of user code get label text - return labelText; - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getFeature() - */ - public EAttribute getFeature() { - return ContributionPackage.eINSTANCE.getContributionPoint_Origin(); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#getFeatureValue(String) - */ - protected Object getFeatureValue(String newText) { - return newText; - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractTextPropertySection#isEqual(String) - */ - protected boolean isEqual(String newText) { - return getFeatureAsText().equals(newText); - } - - /** - * {@inheritDoc} - */ - public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { - super.createControls(parent, tabbedPropertySheetPage); - - nameLabel.setFont(SiriusEditor.getFontRegistry().get("required")); - - // Start of user code create controls - - // End of user code create controls - - } - - /** - * {@inheritDoc} - */ - protected String getPropertyDescription() { - return ""; - } - - // Start of user code user operations - - // End of user code user operations -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/directeobjectreference/DirectEObjectReferenceValuePropertySection.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/directeobjectreference/DirectEObjectReferenceValuePropertySection.java deleted file mode 100644 index e96d713556..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/directeobjectreference/DirectEObjectReferenceValuePropertySection.java +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.sections.contribution.directeobjectreference; - -// Start of user code imports - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.edit.command.SetCommand; -import org.eclipse.emf.edit.domain.EditingDomain; -import org.eclipse.emf.edit.domain.IEditingDomainProvider; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.sirius.business.api.componentization.ViewpointRegistry; -import org.eclipse.sirius.business.api.componentization.ViewpointResourceHandler; -import org.eclipse.sirius.business.api.query.EObjectQuery; -import org.eclipse.sirius.business.internal.movida.Movida; -import org.eclipse.sirius.common.tools.api.util.TreeItemWrapper; -import org.eclipse.sirius.common.ui.tools.api.selection.EObjectSelectionWizard; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.editor.editorPlugin.SiriusEditor; -import org.eclipse.sirius.editor.properties.sections.common.AbstractComboPropertySection; -import org.eclipse.sirius.ext.emf.AllContents; -import org.eclipse.sirius.viewpoint.description.Viewpoint; -import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; - -import com.google.common.collect.Iterables; - -// End of user code imports - -/** - * A section for the value property of a DirectEObjectReference object. - */ -public class DirectEObjectReferenceValuePropertySection extends AbstractComboPropertySection { - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getDefaultLabelText() - */ - protected String getDefaultLabelText() { - return "Value"; //$NON-NLS-1$ - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getLabelText() - */ - protected String getLabelText() { - String labelText; - labelText = super.getLabelText() + "*:"; //$NON-NLS-1$ - // Start of user code get label text - - // End of user code get label text - return labelText; - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getFeature() - */ - protected EReference getFeature() { - return ContributionPackage.eINSTANCE.getDirectEObjectReference_Value(); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getFeatureValue(int) - */ - protected Object getFeatureValue(int index) { - return getFeatureValueAt(index); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#isEqual(int) - */ - protected boolean isEqual(int index) { - boolean isEqual = false; - if (getFeatureValueAt(index) == null) - isEqual = eObject.eGet(getFeature()) == null; - else - isEqual = getFeatureValueAt(index).equals(eObject.eGet(getFeature())); - return isEqual; - } - - /** - * Returns the value at the specified index in the choice of values for the feature. - * - * @param index - * Index of the value. - * @return the value at the specified index in the choice of values. - */ - protected Object getFeatureValueAt(int index) { - List<?> values = getChoiceOfValues(); - if (values.size() < index || values.size() == 0 || index == -1) { - return null; - } - return values.get(index); - } - - /** - * Fetches the list of available values for the feature. - * - * @return The list of available values for the feature. - */ - protected List<?> getChoiceOfValues() { - List<?> values = Collections.emptyList(); - List<IItemPropertyDescriptor> propertyDescriptors = getDescriptors(); - for (Iterator<IItemPropertyDescriptor> iterator = propertyDescriptors.iterator(); iterator.hasNext();) { - IItemPropertyDescriptor propertyDescriptor = iterator.next(); - if (((EStructuralFeature) propertyDescriptor.getFeature(eObject)) == getFeature()) - values = new ArrayList<Object>(propertyDescriptor.getChoiceOfValues(eObject)); - } - - // Start of user code choice of values - if (Movida.isEnabled()) { - List<EObject> elementsInScope = new ArrayList<>(); - ViewpointResourceHandler vrh = ((org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry) ViewpointRegistry.getInstance()).getSiriusResourceHandler(); - ResourceSet rs = eObject.eResource().getResourceSet(); - for (Resource res : rs.getResources()) { - if (vrh.handles(res.getURI())) { - for (Viewpoint vp : vrh.collectViewpointDefinitions(res)) { - Iterables.addAll(elementsInScope, AllContents.of(vp, true)); - } - } - } - values = elementsInScope; - } - // End of user code choice of values - return values; - } - - /** - * {@inheritDoc} - */ - public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { - super.createControls(parent, tabbedPropertySheetPage); - nameLabel.setFont(SiriusEditor.getFontRegistry().get("required")); - // Start of user code create controls - /* - * We want to add a "Select" button on the right of the text field, but the layout data - */ - FormData data = new FormData(); - data.left = new FormAttachment(0, LABEL_WIDTH); - data.right = new FormAttachment(90, 0); - data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE); - combo.setLayoutData(data); - // Force users to use the dialog box instead of directly editing the - // text file - combo.setEnabled(false); - - data = new FormData(); - data.left = new FormAttachment(0, 0); - data.right = new FormAttachment(combo, -ITabbedPropertyConstants.HSPACE - 20); - data.top = new FormAttachment(combo, 0, SWT.CENTER); - nameLabel.setLayoutData(data); - - Button selectionButton = getWidgetFactory().createButton(composite, "Select", SWT.PUSH); - data = new FormData(); - data.left = new FormAttachment(90, ITabbedPropertyConstants.HSPACE); - data.right = new FormAttachment(100, 0); - data.top = new FormAttachment(combo, 0, SWT.CENTER); - selectionButton.setLayoutData(data); - selectionButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - if (eObject instanceof DirectEObjectReference) { - List<EObject> roots = new ArrayList<>(); - roots.addAll(new EObjectQuery(eObject).getAvailableViewpointsInResourceSet()); - AdapterFactory af = SiriusEditPlugin.getPlugin().getItemProvidersAdapterFactory(); - TreeItemWrapper wrapper = buildWrapper(roots); - EObjectSelectionWizard wizard = new EObjectSelectionWizard("Selection", "Please select an object to reference", null, wrapper, af); - wizard.setMany(Boolean.FALSE); - WizardDialog dlg = new WizardDialog(composite.getShell(), wizard); - if (dlg.open() == Window.OK) { - EObject value = wizard.getSelectedEObject(); - EditingDomain editingDomain = ((IEditingDomainProvider) getPart()).getEditingDomain(); - editingDomain.getCommandStack().execute(SetCommand.create(editingDomain, eObject, getFeature(), value)); - } - } - } - - private TreeItemWrapper buildWrapper(List<EObject> roots) { - TreeItemWrapper result = new TreeItemWrapper(null, null); - for (EObject root : roots) { - addElementsAndChildren(result, root); - } - return result; - } - - private void addElementsAndChildren(TreeItemWrapper parent, EObject element) { - TreeItemWrapper elementWrapper = new TreeItemWrapper(element, parent); - parent.getChildren().add(elementWrapper); - for (EObject child : element.eContents()) { - addElementsAndChildren(elementWrapper, child); - } - } - }); - // End of user code create controls - } - // Start of user code user operations - - // End of user code user operations -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/featurecontribution/FeatureContributionSourceFeaturePropertySection.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/featurecontribution/FeatureContributionSourceFeaturePropertySection.java deleted file mode 100644 index ef1b0a8247..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/featurecontribution/FeatureContributionSourceFeaturePropertySection.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.sections.contribution.featurecontribution; - -// Start of user code imports - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.editor.editorPlugin.SiriusEditor; -import org.eclipse.sirius.editor.properties.sections.common.AbstractComboPropertySection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; - -import com.google.common.collect.Lists; - -// End of user code imports - -/** - * A section for the sourceFeature property of a FeatureContribution object. - */ -public class FeatureContributionSourceFeaturePropertySection extends AbstractComboPropertySection { - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getDefaultLabelText() - */ - protected String getDefaultLabelText() { - return "SourceFeature"; //$NON-NLS-1$ - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getLabelText() - */ - protected String getLabelText() { - String labelText; - labelText = super.getLabelText() + "*:"; //$NON-NLS-1$ - // Start of user code get label text - - // End of user code get label text - return labelText; - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getFeature() - */ - protected EReference getFeature() { - return ContributionPackage.eINSTANCE.getFeatureContribution_SourceFeature(); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getFeatureValue(int) - */ - protected Object getFeatureValue(int index) { - return getFeatureValueAt(index); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#isEqual(int) - */ - protected boolean isEqual(int index) { - boolean isEqual = false; - if (getFeatureValueAt(index) == null) - isEqual = eObject.eGet(getFeature()) == null; - else - isEqual = getFeatureValueAt(index).equals(eObject.eGet(getFeature())); - return isEqual; - } - - /** - * Returns the value at the specified index in the choice of values for the feature. - * - * @param index - * Index of the value. - * @return the value at the specified index in the choice of values. - */ - protected Object getFeatureValueAt(int index) { - List<?> values = getChoiceOfValues(); - if (values.size() < index || values.size() == 0 || index == -1) { - return null; - } - return values.get(index); - } - - /** - * Fetches the list of available values for the feature. - * - * @return The list of available values for the feature. - */ - protected List<?> getChoiceOfValues() { - List<?> values = Collections.emptyList(); - List<IItemPropertyDescriptor> propertyDescriptors = getDescriptors(); - for (Iterator<IItemPropertyDescriptor> iterator = propertyDescriptors.iterator(); iterator.hasNext();) { - IItemPropertyDescriptor propertyDescriptor = iterator.next(); - if (((EStructuralFeature) propertyDescriptor.getFeature(eObject)) == getFeature()) - values = new ArrayList<Object>(propertyDescriptor.getChoiceOfValues(eObject)); - } - - // Start of user code choice of values - if (eObject.eContainer() instanceof Contribution) { - Contribution contrib = (Contribution) eObject.eContainer(); - if (contrib.getSource() instanceof DirectEObjectReference) { - EObject actualSource = ((DirectEObjectReference) contrib.getSource()).getValue(); - if (actualSource != null) { - EClass sourceType = actualSource.eClass(); - values = Lists.newArrayList(sourceType.getEAllStructuralFeatures()); - } - } - } - // End of user code choice of values - return values; - } - - /** - * {@inheritDoc} - */ - public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { - super.createControls(parent, tabbedPropertySheetPage); - combo.setToolTipText("The feature in the source object from which the contribution values are obtained."); - - CLabel help = getWidgetFactory().createCLabel(composite, ""); - FormData data = new FormData(); - data.top = new FormAttachment(combo, 0, SWT.TOP); - data.left = new FormAttachment(nameLabel); - help.setLayoutData(data); - help.setImage(getHelpIcon()); - help.setToolTipText("The feature in the source object from which the contribution values are obtained."); - nameLabel.setFont(SiriusEditor.getFontRegistry().get("required")); - // Start of user code create controls - - // End of user code create controls - } - // Start of user code user operations - - // End of user code user operations -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/featurecontribution/FeatureContributionTargetFeaturePropertySection.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/featurecontribution/FeatureContributionTargetFeaturePropertySection.java deleted file mode 100644 index 992052ae59..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/properties/sections/contribution/featurecontribution/FeatureContributionTargetFeaturePropertySection.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.properties.sections.contribution.featurecontribution; - -// Start of user code imports - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.editor.editorPlugin.SiriusEditor; -import org.eclipse.sirius.editor.properties.sections.common.AbstractComboPropertySection; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; - -import com.google.common.collect.Lists; - -// End of user code imports - -/** - * A section for the targetFeature property of a FeatureContribution object. - */ -public class FeatureContributionTargetFeaturePropertySection extends AbstractComboPropertySection { - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getDefaultLabelText() - */ - protected String getDefaultLabelText() { - return "TargetFeature"; //$NON-NLS-1$ - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getLabelText() - */ - protected String getLabelText() { - String labelText; - labelText = super.getLabelText() + "*:"; //$NON-NLS-1$ - // Start of user code get label text - - // End of user code get label text - return labelText; - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getFeature() - */ - protected EReference getFeature() { - return ContributionPackage.eINSTANCE.getFeatureContribution_TargetFeature(); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#getFeatureValue(int) - */ - protected Object getFeatureValue(int index) { - return getFeatureValueAt(index); - } - - /** - * @see org.eclipse.sirius.editor.properties.sections.AbstractComboPropertySection#isEqual(int) - */ - protected boolean isEqual(int index) { - boolean isEqual = false; - if (getFeatureValueAt(index) == null) - isEqual = eObject.eGet(getFeature()) == null; - else - isEqual = getFeatureValueAt(index).equals(eObject.eGet(getFeature())); - return isEqual; - } - - /** - * Returns the value at the specified index in the choice of values for the feature. - * - * @param index - * Index of the value. - * @return the value at the specified index in the choice of values. - */ - protected Object getFeatureValueAt(int index) { - List<?> values = getChoiceOfValues(); - if (values.size() < index || values.size() == 0 || index == -1) { - return null; - } - return values.get(index); - } - - /** - * Fetches the list of available values for the feature. - * - * @return The list of available values for the feature. - */ - protected List<?> getChoiceOfValues() { - List<?> values = Collections.emptyList(); - List<IItemPropertyDescriptor> propertyDescriptors = getDescriptors(); - for (Iterator<IItemPropertyDescriptor> iterator = propertyDescriptors.iterator(); iterator.hasNext();) { - IItemPropertyDescriptor propertyDescriptor = iterator.next(); - if (((EStructuralFeature) propertyDescriptor.getFeature(eObject)) == getFeature()) - values = new ArrayList<Object>(propertyDescriptor.getChoiceOfValues(eObject)); - } - - // Start of user code choice of values - if (eObject.eContainer() instanceof Contribution) { - Contribution contrib = (Contribution) eObject.eContainer(); - if (contrib.getTarget() instanceof DirectEObjectReference) { - EObject actualTarget = ((DirectEObjectReference) contrib.getTarget()).getValue(); - if (actualTarget != null) { - EClass targetType = actualTarget.eClass(); - values = Lists.newArrayList(targetType.getEAllStructuralFeatures()); - } - } - } - // End of user code choice of values - return values; - } - - /** - * {@inheritDoc} - */ - public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { - super.createControls(parent, tabbedPropertySheetPage); - combo.setToolTipText("The feature in the target object to which the contribution values are applied."); - - CLabel help = getWidgetFactory().createCLabel(composite, ""); - FormData data = new FormData(); - data.top = new FormAttachment(combo, 0, SWT.TOP); - data.left = new FormAttachment(nameLabel); - help.setLayoutData(data); - help.setImage(getHelpIcon()); - help.setToolTipText("The feature in the target object to which the contribution values are applied."); - nameLabel.setFont(SiriusEditor.getFontRegistry().get("required")); - // Start of user code create controls - - // End of user code create controls - } - // Start of user code user operations - - // End of user code user operations -} diff --git a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/wizards/ContributionModelWizard.java b/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/wizards/ContributionModelWizard.java deleted file mode 100644 index da43012794..0000000000 --- a/plugins/org.eclipse.sirius.editor/src-gen/org/eclipse/sirius/editor/wizards/ContributionModelWizard.java +++ /dev/null @@ -1,470 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007-2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.wizards; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.MissingResourceException; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EClassifier; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.sirius.description.contribution.ContributionFactory; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.editor.editorPlugin.SiriusEditorPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.part.ISetSelectionTarget; - -/** - * This is a simple wizard for creating a new model file. - */ -public class ContributionModelWizard extends Wizard implements INewWizard { - /** - * This caches an instance of the model package. - */ - protected ContributionPackage contributionPackage = ContributionPackage.eINSTANCE; - - /** - * This caches an instance of the model factory. - */ - protected ContributionFactory contributionFactory = contributionPackage.getContributionFactory(); - - /** - * This is the file creation page. - */ - protected ContributionModelWizardNewFileCreationPage newFileCreationPage; - - /** - * This is the initial object creation page. - */ - protected ContributionModelWizardInitialObjectCreationPage initialObjectCreationPage; - - /** - * Remember the selection during initialization for populating the default container. - */ - protected IStructuredSelection selection; - - /** - * Remember the workbench during initialization. - */ - protected IWorkbench workbench; - - /** - * Caches the names of the types that can be created as the root object. - */ - protected List<String> initialObjectNames; - - /** - * This just records the information. - */ - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - this.selection = selection; - setWindowTitle(SiriusEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); - setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(SiriusEditorPlugin.INSTANCE.getImage("full/wizban/NewModel"))); - } - - /** - * Returns the names of the types that can be created as the root object. - */ - protected Collection<String> getInitialObjectNames() { - if (initialObjectNames == null) { - initialObjectNames = new ArrayList<String>(); - for (Iterator<EClassifier> classifiers = contributionPackage.getEClassifiers().iterator(); classifiers.hasNext();) { - EClassifier eClassifier = classifiers.next(); - if (eClassifier instanceof EClass) { - EClass eClass = (EClass) eClassifier; - if (!eClass.isAbstract()) { - initialObjectNames.add(eClass.getName()); - } - } - } - Collections.sort(initialObjectNames, java.text.Collator.getInstance()); - } - - // Start of user code getInitialObjectNames - - // End of user code getInitialObjectNames - return initialObjectNames; - } - - /** - * Create a new model. - */ - protected EObject createInitialModel() { - EClass eClass = (EClass) contributionPackage.getEClassifier(initialObjectCreationPage.getInitialObjectName()); - EObject rootObject = contributionFactory.create(eClass); - return rootObject; - } - - /** - * Do the work after everything is specified. - */ - public boolean performFinish() { - try { - // Remember the file. - // - final IFile modelFile = getModelFile(); - - // Do the work within an operation. - // - WorkspaceModifyOperation operation = new WorkspaceModifyOperation() { - protected void execute(IProgressMonitor progressMonitor) { - try { - // Create a resource set - // - ResourceSet resourceSet = new ResourceSetImpl(); - - // Get the URI of the model file. - // - URI fileURI = URI.createPlatformResourceURI(modelFile.getFullPath().toString(), true); - - // Create a resource for this file. - // - Resource resource = resourceSet.createResource(fileURI); - - // Add the initial model object to the contents. - // - EObject rootObject = createInitialModel(); - if (rootObject != null) { - resource.getContents().add(rootObject); - } - - // Save the contents of the resource to the file system. - // - Map<Object, Object> options = new HashMap<Object, Object>(); - options.put(XMLResource.OPTION_ENCODING, initialObjectCreationPage.getEncoding()); - resource.save(options); - } catch (Exception exception) { - SiriusEditorPlugin.INSTANCE.log(exception); - } finally { - progressMonitor.done(); - } - } - }; - - getContainer().run(false, false, operation); - - // Select the new file resource in the current view. - // - IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); - IWorkbenchPage page = workbenchWindow.getActivePage(); - final IWorkbenchPart activePart = page.getActivePart(); - if (activePart instanceof ISetSelectionTarget) { - final ISelection targetSelection = new StructuredSelection(modelFile); - getShell().getDisplay().asyncExec(new Runnable() { - public void run() { - ((ISetSelectionTarget) activePart).selectReveal(targetSelection); - } - }); - } - - // Open an editor on the new file. - // - try { - page.openEditor(new FileEditorInput(modelFile), workbench.getEditorRegistry().getDefaultEditor(modelFile.getFullPath().toString()).getId()); - } catch (PartInitException exception) { - MessageDialog.openError(workbenchWindow.getShell(), SiriusEditorPlugin.INSTANCE.getString("_UI_OpenEditorError_label"), exception.getMessage()); - return false; - } - - return true; - } catch (Exception exception) { - SiriusEditorPlugin.INSTANCE.log(exception); - return false; - } - } - - /** - * This is the one page of the wizard. - */ - public class ContributionModelWizardNewFileCreationPage extends WizardNewFileCreationPage { - /** - * Pass in the selection. - */ - public ContributionModelWizardNewFileCreationPage(String pageId, IStructuredSelection selection) { - super(pageId, selection); - } - - /** - * The framework calls this to see if the file is correct. - */ - protected boolean validatePage() { - if (super.validatePage()) { - // Make sure the file ends in ".contribution". - // - String requiredExt = SiriusEditorPlugin.INSTANCE.getString("_UI_SiriusEditorFilenameExtension"); - String enteredExt = new Path(getFileName()).getFileExtension(); - if (enteredExt == null || !enteredExt.equals(requiredExt)) { - setErrorMessage(SiriusEditorPlugin.INSTANCE.getString("_WARN_FilenameExtension", new Object[] { requiredExt })); - return false; - } else { - return true; - } - } else { - return false; - } - } - - public IFile getModelFile() { - return ResourcesPlugin.getWorkspace().getRoot().getFile(getContainerFullPath().append(getFileName())); - } - } - - /** - * This is the page where the type of object to create is selected. - */ - public class ContributionModelWizardInitialObjectCreationPage extends WizardPage { - protected Combo initialObjectField; - - protected List<String> encodings; - - protected Combo encodingField; - - /** - * Pass in the selection. - */ - public ContributionModelWizardInitialObjectCreationPage(String pageId) { - super(pageId); - } - - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); - { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.verticalSpacing = 12; - composite.setLayout(layout); - - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.grabExcessVerticalSpace = true; - data.horizontalAlignment = GridData.FILL; - composite.setLayoutData(data); - } - - Label containerLabel = new Label(composite, SWT.LEFT); - { - containerLabel.setText(SiriusEditorPlugin.INSTANCE.getString("_UI_ModelObject")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - containerLabel.setLayoutData(data); - } - - initialObjectField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - initialObjectField.setLayoutData(data); - } - - for (Iterator<String> i = getInitialObjectNames().iterator(); i.hasNext();) { - initialObjectField.add(getLabel(i.next())); - } - - if (initialObjectField.getItemCount() == 1) { - initialObjectField.select(0); - } - initialObjectField.addModifyListener(validator); - - Label encodingLabel = new Label(composite, SWT.LEFT); - { - encodingLabel.setText(SiriusEditorPlugin.INSTANCE.getString("_UI_XMLEncoding")); - - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - encodingLabel.setLayoutData(data); - } - encodingField = new Combo(composite, SWT.BORDER); - { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = true; - encodingField.setLayoutData(data); - } - - for (Iterator<String> i = getEncodings().iterator(); i.hasNext();) { - encodingField.add(i.next()); - } - - encodingField.select(0); - encodingField.addModifyListener(validator); - - setPageComplete(validatePage()); - setControl(composite); - } - - protected ModifyListener validator = new ModifyListener() { - public void modifyText(ModifyEvent e) { - setPageComplete(validatePage()); - } - }; - - protected boolean validatePage() { - return getInitialObjectName() != null && getEncodings().contains(encodingField.getText()); - } - - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - if (initialObjectField.getItemCount() == 1) { - initialObjectField.clearSelection(); - encodingField.setFocus(); - } else { - encodingField.clearSelection(); - initialObjectField.setFocus(); - } - } - } - - public String getInitialObjectName() { - String label = initialObjectField.getText(); - - for (Iterator<String> i = getInitialObjectNames().iterator(); i.hasNext();) { - String name = i.next(); - if (getLabel(name).equals(label)) { - return name; - } - } - return null; - } - - public String getEncoding() { - return encodingField.getText(); - } - - /** - * Returns the label for the specified type name. - */ - protected String getLabel(String typeName) { - try { - return org.eclipse.sirius.editor.editorPlugin.SiriusEditorPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); - } catch (MissingResourceException mre) { - SiriusEditorPlugin.INSTANCE.log(mre); - } - return typeName; - } - - protected Collection<String> getEncodings() { - if (encodings == null) { - encodings = new ArrayList<String>(); - for (StringTokenizer stringTokenizer = new StringTokenizer(SiriusEditorPlugin.INSTANCE.getString("_UI_XMLEncodingChoices")); stringTokenizer.hasMoreTokens();) { - encodings.add(stringTokenizer.nextToken()); - } - } - return encodings; - } - } - - /** - * The framework calls this to create the contents of the wizard. - */ - public void addPages() { - // Create a page, set the title, and the initial model file name. - // - newFileCreationPage = new ContributionModelWizardNewFileCreationPage("Whatever", selection); - newFileCreationPage.setTitle(SiriusEditorPlugin.INSTANCE.getString("_UI_ContributionModelWizard_label")); - newFileCreationPage.setDescription(SiriusEditorPlugin.INSTANCE.getString("_UI_ContributionModelWizard_description")); - newFileCreationPage - .setFileName(SiriusEditorPlugin.INSTANCE.getString("_UI_SiriusEditorFilenameDefaultBase") + "." + SiriusEditorPlugin.INSTANCE.getString("_UI_SiriusEditorFilenameExtension")); - addPage(newFileCreationPage); - - // Try and get the resource selection to determine a current directory - // for the file dialog. - // - if (selection != null && !selection.isEmpty()) { - // Get the resource... - // - Object selectedElement = selection.iterator().next(); - if (selectedElement instanceof IResource) { - // Get the resource parent, if it's a file. - // - IResource selectedResource = (IResource) selectedElement; - if (selectedResource.getType() == IResource.FILE) { - selectedResource = selectedResource.getParent(); - } - - // This gives us a directory... - // - if (selectedResource instanceof IFolder || selectedResource instanceof IProject) { - // Set this for the container. - // - newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); - - // Make up a unique new name here. - // - String defaultModelBaseFilename = SiriusEditorPlugin.INSTANCE.getString("_UI_SiriusEditorFilenameDefaultBase"); - String defaultModelFilenameExtension = SiriusEditorPlugin.INSTANCE.getString("_UI_SiriusEditorFilenameExtension"); - String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; - for (int i = 1; ((IContainer) selectedResource).findMember(modelFilename) != null; ++i) { - modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; - } - newFileCreationPage.setFileName(modelFilename); - } - } - } - initialObjectCreationPage = new ContributionModelWizardInitialObjectCreationPage("Whatever2"); - initialObjectCreationPage.setTitle(SiriusEditorPlugin.INSTANCE.getString("_UI_ContributionModelWizard_label")); - initialObjectCreationPage.setDescription(SiriusEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description")); - addPage(initialObjectCreationPage); - } - - /** - * Get the file from the page. - */ - public IFile getModelFile() { - return newFileCreationPage.getModelFile(); - } -} diff --git a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/CustomSiriusActionBarContributor.java b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/CustomSiriusActionBarContributor.java index 84683b26f6..fd506cf5d9 100644 --- a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/CustomSiriusActionBarContributor.java +++ b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/CustomSiriusActionBarContributor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2009, 2018 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 @@ -43,7 +43,6 @@ import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.Viewer; -import org.eclipse.sirius.business.internal.movida.Movida; import org.eclipse.sirius.editor.editorPlugin.SiriusEditorPlugin; import org.eclipse.sirius.editor.tools.api.menu.AbstractMenuBuilder; import org.eclipse.sirius.editor.tools.api.menu.CompositeMenuBuilder; @@ -184,9 +183,7 @@ public class CustomSiriusActionBarContributor extends EditingDomainActionBarCont */ public CustomSiriusActionBarContributor() { super(ADDITIONS_LAST_STYLE); - if (!Movida.isEnabled()) { - loadResourceAction = new LoadResourceAction(); - } + loadResourceAction = new LoadResourceAction(); validateAction = new ValidateAction(); controlAction = new ControlAction(); diff --git a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/CustomSiriusEditor.java b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/CustomSiriusEditor.java index 5aed259f28..395bbc7808 100644 --- a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/CustomSiriusEditor.java +++ b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/CustomSiriusEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 THALES GLOBAL SERVICES and others. + * Copyright (c) 2009, 2018 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 @@ -10,15 +10,11 @@ *******************************************************************************/ package org.eclipse.sirius.editor.tools.internal.presentation; -import java.util.ArrayList; import java.util.Collections; import java.util.EventObject; import java.util.HashMap; -import java.util.HashSet; -import java.util.List; import java.util.Map; import java.util.Optional; -import java.util.Set; import java.util.stream.Stream; import org.eclipse.core.resources.IMarker; @@ -36,13 +32,12 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.ECrossReferenceAdapter; import org.eclipse.emf.ecore.xmi.XMLResource; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; +import org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.ToolBarManager; -import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.AbstractTreeViewer; @@ -51,31 +46,22 @@ import org.eclipse.jface.viewers.DoubleClickEvent; import org.eclipse.jface.viewers.IDoubleClickListener; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.sirius.business.api.helper.SiriusUtil; import org.eclipse.sirius.business.api.logger.MarkerRuntimeLogger; -import org.eclipse.sirius.business.api.query.ViewpointQuery; import org.eclipse.sirius.business.internal.migration.description.VSMExtendedMetaData; import org.eclipse.sirius.business.internal.migration.description.VSMMigrationService; import org.eclipse.sirius.business.internal.migration.description.VSMResourceHandler; import org.eclipse.sirius.business.internal.migration.description.VSMVersionSAXParser; -import org.eclipse.sirius.business.internal.movida.DynamicVSMLoader; -import org.eclipse.sirius.business.internal.movida.Movida; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointURIConverter; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointURIHandler; import org.eclipse.sirius.common.ui.tools.api.editor.IEObjectNavigable; import org.eclipse.sirius.editor.editorPlugin.SiriusEditor; import org.eclipse.sirius.editor.editorPlugin.SiriusEditorPlugin; import org.eclipse.sirius.editor.properties.validation.SiriusInterpreterErrorDecorator; import org.eclipse.sirius.editor.tools.internal.actions.ValidateAction; -import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.ui.business.api.template.RepresentationTemplateEditManager; import org.eclipse.sirius.viewpoint.description.DAnnotation; import org.eclipse.sirius.viewpoint.description.Group; -import org.eclipse.sirius.viewpoint.description.Viewpoint; import org.eclipse.sirius.viewpoint.description.util.DescriptionResourceImpl; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IEditorInput; @@ -88,14 +74,35 @@ import org.eclipse.ui.contexts.IContextService; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.Version; -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; +import com.google.common.base.Preconditions; /** * The advanced Viewpoint Specification Model (*.odesign) Editor, base on the standard EMF-generated editor, but with * Sirius-specific customizations. */ public class CustomSiriusEditor extends SiriusEditor implements IEObjectNavigable { + private static class ViewpointURIHandler extends URIHandlerImpl.PlatformSchemeAware { + private final ResourceSet resourceSet; + + /** + * Constructor. + * + * @param resourceSet + * the resource set to use for the conversion of physical URIs to + * logical <code>viewpoint:/</code> URIs on save.. + */ + ViewpointURIHandler(ResourceSet resourceSet) { + this.resourceSet = Preconditions.checkNotNull(resourceSet); + } + + @Override + public URI deresolve(URI uri) { + if (!baseURI.isPlatform() && "viewpoint".equals(baseURI.scheme())) { //$NON-NLS-1$ + baseURI = resourceSet.getURIConverter().normalize(baseURI); + } + return super.deresolve(uri); + } + } /** * ID of the context. @@ -131,10 +138,6 @@ public class CustomSiriusEditor extends SiriusEditor implements IEObjectNavigabl private ValidationDecoration validationDecorator; - private DynamicVSMLoader loader; - - private VSMRequirementChangeAdapter tracker; - /** * Constructor. */ @@ -143,24 +146,6 @@ public class CustomSiriusEditor extends SiriusEditor implements IEObjectNavigabl editingDomain.getResourceSet().eAdapters().add(new ECrossReferenceAdapter()); editingDomain.getResourceSet().eAdapters().add(new ModificationTrackingEnabler(editingDomain.getResourceSet())); vsmURIHandler = new ViewpointURIHandler(editingDomain.getResourceSet()); - if (Movida.isEnabled()) { - ViewpointRegistry registry = (ViewpointRegistry) org.eclipse.sirius.business.api.componentization.ViewpointRegistry.getInstance(); - editingDomain.getResourceSet().setURIConverter(new ViewpointURIConverter(registry)); - loader = new DynamicVSMLoader(editingDomain.getResourceSet(), registry); - loader.setErrorHandler(new Runnable() { - @Override - public void run() { - getSite().getShell().getDisplay().asyncExec(new Runnable() { - @Override - public void run() { - MessageDialog.openError(getSite().getShell(), "Error", "The editor will be closed."); - getSite().getPage().closeEditor(CustomSiriusEditor.this, false); - CustomSiriusEditor.this.dispose(); - } - }); - } - }); - } } public Control getControl() { @@ -228,38 +213,9 @@ public class CustomSiriusEditor extends SiriusEditor implements IEObjectNavigabl } }); validationDecorator = new ValidationDecoration(); - if (Movida.isEnabled()) { - /* - * Customize the label provider to add the URI of the corresponding resource for Viewpoints loaded by - * dependency. - */ - decoratingLabelProvider = new GeneratedElementsLabelProvider((IStyledLabelProvider) selectionViewer.getLabelProvider(), validationDecorator) { - @Override - protected StyledString getStyledText(Object element) { - StyledString result = super.getStyledText(element); - if (element instanceof Viewpoint) { - Viewpoint viewpoint = (Viewpoint) element; - Resource resource = viewpoint.eResource(); - if (resource != null) { - // CHECKSTYLE:OFF - if (resource.getResourceSet().getResources().indexOf(resource) != 0) { - result.append(result + " (" + resource.getURI() + ")"); - } - // CHECKSTYLE:ON - } - } - return result; - } - }; - } else { - decoratingLabelProvider = new GeneratedElementsLabelProvider((IStyledLabelProvider) selectionViewer.getLabelProvider(), validationDecorator); - } + decoratingLabelProvider = new GeneratedElementsLabelProvider((IStyledLabelProvider) selectionViewer.getLabelProvider(), validationDecorator); decoratingLabelProvider.setLabelDecorator(new SiriusInterpreterErrorDecorator(this.getURIFromInput(getEditorInput()))); - if (Movida.isEnabled()) { - customizeContentProvider(); - } - selectionViewer.setLabelProvider(decoratingLabelProvider); selectionViewer.addDoubleClickListener(new IDoubleClickListener() { @@ -382,52 +338,6 @@ public class CustomSiriusEditor extends SiriusEditor implements IEObjectNavigabl return Optional.empty(); } - /** - * Customize the content provider not to show the whole resources loaded by dependency, but only the Viewpoints - * (inside these resources) which the main VSM depend on. - */ - private void customizeContentProvider() { - final ViewpointRegistry registry = (ViewpointRegistry) org.eclipse.sirius.business.api.componentization.ViewpointRegistry.getInstance(); - selectionViewer.setContentProvider(new AdapterFactoryContentProvider(adapterFactory) { - @Override - public Object[] getElements(Object object) { - if (object instanceof ResourceSet) { - Set<EObject> viewpoints = getRequiredViewpoints(registry, (ResourceSet) object); - List<Object> elements = new ArrayList<>(); - Resource mainResource = ((ResourceSet) object).getResources().get(0); - elements.add(mainResource); - for (Viewpoint additionalVP : Iterables.filter(viewpoints, Viewpoint.class)) { - Resource resource = additionalVP.eResource(); - if (resource != null && resource != mainResource) { - elements.add(additionalVP); - } - } - return elements.toArray(); - } else { - return super.getElements(object); - } - } - - private Set<EObject> getRequiredViewpoints(final ViewpointRegistry registry, ResourceSet resourceSet) { - Set<EObject> viewpoints = new HashSet<>(); - for (final URI uri : loader.getRequiredViewpoints()) { - Option<URI> provider = registry.getProvider(uri); - if (provider.some()) { - Resource res = resourceSet.getResource(provider.get(), true); - viewpoints.add(Iterables.find(registry.getSiriusResourceHandler().collectViewpointDefinitions(res), new Predicate<Viewpoint>() { - @Override - public boolean apply(Viewpoint input) { - Option<URI> inputURI = new ViewpointQuery(input).getViewpointURI(); - return inputURI.some() && inputURI.get().equals(uri); - } - })); - } - } - return viewpoints; - } - }); - } - private ToolBarManager getToolBarManager() { return currentViewerPane.getToolBarManager(); } @@ -464,12 +374,6 @@ public class CustomSiriusEditor extends SiriusEditor implements IEObjectNavigabl resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception)); } editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter); - - if (Movida.isEnabled()) { - loader.protect(resource.getURI()); - tracker = new VSMRequirementChangeAdapter(resource, loader); - tracker.install(); - } } private URI getURIFromInput(IEditorInput input) { @@ -500,11 +404,6 @@ public class CustomSiriusEditor extends SiriusEditor implements IEObjectNavigabl if (decoratingLabelProvider != null) { decoratingLabelProvider.dispose(); } - - if (Movida.isEnabled()) { - loader.dispose(); - tracker.uninstall(); - } } /** diff --git a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/VSMRequirementChangeAdapter.java b/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/VSMRequirementChangeAdapter.java deleted file mode 100644 index a055e8b32b..0000000000 --- a/plugins/org.eclipse.sirius.editor/src/org/eclipse/sirius/editor/tools/internal/presentation/VSMRequirementChangeAdapter.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2016 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.editor.tools.internal.presentation; - -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.util.EContentAdapter; -import org.eclipse.sirius.business.api.componentization.ViewpointResourceHandler; -import org.eclipse.sirius.business.api.query.ViewpointQuery; -import org.eclipse.sirius.business.internal.movida.DynamicVSMLoader; -import org.eclipse.sirius.ext.base.relations.Relation; -import org.eclipse.sirius.viewpoint.description.DescriptionPackage; -import org.eclipse.sirius.viewpoint.description.Group; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.collect.HashMultimap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Multimap; - -/** - * A content adapter for a whole VSM, which detects when the requirements - * declared by the Viewpoints it contain change. - * - * @author pierre-charles.david@obeo.fr - */ -class VSMRequirementChangeAdapter extends EContentAdapter { - private final Resource resource; - - private final DynamicVSMLoader loader; - - /** - * For each Sirius URI directly required, the set of Viewpoints which - * require it. - */ - private final Multimap<URI, Viewpoint> requirements = HashMultimap.create(); - - VSMRequirementChangeAdapter(Resource res, DynamicVSMLoader loader) { - this.resource = res; - this.loader = loader; - } - - public void install() { - Relation<URI> requires = loader.getRegistry().getRelations().getRequires(); - ViewpointResourceHandler handler = loader.getRegistry().getSiriusResourceHandler(); - for (Viewpoint vp : handler.collectViewpointDefinitions(resource)) { - for (URI required : requires.apply(new ViewpointQuery(vp).getViewpointURI().get())) { - addRequirement(required, vp); - } - } - resource.eAdapters().add(this); - } - - public void uninstall() { - resource.eAdapters().remove(this); - } - - @Override - public void notifyChanged(Notification notification) { - super.notifyChanged(notification); - Object feature = notification.getFeature(); - if (notification.getNotifier() instanceof Viewpoint && feature == DescriptionPackage.eINSTANCE.getViewpoint_Customizes() || feature == DescriptionPackage.eINSTANCE.getViewpoint_Reuses()) { - switch (notification.getEventType()) { - case Notification.ADD: - case Notification.ADD_MANY: - Object added = notification.getNewValue(); - if (added instanceof List<?>) { - handleRequirementsAdded((Viewpoint) notification.getNotifier(), Iterables.filter((List<?>) added, URI.class)); - } else if (added instanceof URI) { - handleRequirementsAdded((Viewpoint) notification.getNotifier(), Collections.singleton((URI) added)); - } - break; - case Notification.REMOVE: - case Notification.REMOVE_MANY: - Object removed = notification.getOldValue(); - if (removed instanceof List<?>) { - handleRequirementsRemoved((Viewpoint) notification.getNotifier(), Iterables.filter((List<?>) removed, URI.class)); - } else if (removed instanceof URI) { - handleRequirementsRemoved((Viewpoint) notification.getNotifier(), Collections.singleton((URI) removed)); - } - break; - default: - break; - } - } else if (notification.getNotifier() instanceof Group && feature == DescriptionPackage.eINSTANCE.getGroup_OwnedViewpoints()) { - switch (notification.getEventType()) { - case Notification.ADD: - case Notification.ADD_MANY: - Object added = notification.getNewValue(); - if (added instanceof List<?>) { - handleViewpointsAdded(Iterables.filter((List<?>) added, Viewpoint.class)); - } else if (added instanceof Viewpoint) { - handleViewpointsAdded(Collections.singleton((Viewpoint) added)); - } - break; - case Notification.REMOVE: - case Notification.REMOVE_MANY: - Object removed = notification.getOldValue(); - if (removed instanceof List<?>) { - handleViewpointsRemoved(Iterables.filter((List<?>) removed, Viewpoint.class)); - } else if (removed instanceof Viewpoint) { - handleViewpointsRemoved(Collections.singleton((Viewpoint) removed)); - } - break; - default: - break; - } - } - } - - private void addRequirement(URI required, Viewpoint vp) { - boolean wasNotRequired = requirements.get(required).isEmpty(); - requirements.put(required, vp); - if (wasNotRequired) { - loader.require(required); - } - } - - private void removeRequirement(URI required, Viewpoint vp) { - boolean removed = requirements.remove(required, vp); - if (removed && requirements.get(required).isEmpty()) { - loader.unrequire(required); - } - } - - private void handleRequirementsAdded(Viewpoint vp, Iterable<URI> added) { - for (URI uri : added) { - addRequirement(uri, vp); - } - } - - private void handleRequirementsRemoved(Viewpoint vp, Iterable<URI> removed) { - for (URI uri : removed) { - removeRequirement(uri, vp); - } - } - - private void handleViewpointsAdded(Iterable<Viewpoint> added) { - Relation<URI> requires = loader.getRegistry().getRelations().getRequires(); - for (Viewpoint viewpoint : added) { - for (URI uri : requires.apply(new ViewpointQuery(viewpoint).getViewpointURI().get())) { - addRequirement(uri, viewpoint); - } - } - } - - private void handleViewpointsRemoved(Iterable<Viewpoint> removed) { - for (Viewpoint viewpoint : removed) { - for (URI uri : requirements.keySet()) { - removeRequirement(uri, viewpoint); - } - } - } -} diff --git a/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/EditionTableDescriptionItemProvider.java b/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/EditionTableDescriptionItemProvider.java index 229f1496a2..59a5781b48 100644 --- a/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/EditionTableDescriptionItemProvider.java +++ b/plugins/org.eclipse.sirius.table.ui/src-gen/org/eclipse/sirius/table/metamodel/table/description/provider/EditionTableDescriptionItemProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007-2015 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2018 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 @@ -19,9 +19,6 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.emf.edit.provider.ViewerNotification; import org.eclipse.sirius.business.api.query.IdentifiedElementQuery; -import org.eclipse.sirius.business.internal.movida.Movida; -import org.eclipse.sirius.description.contribution.ContributionFactory; -import org.eclipse.sirius.description.contribution.ContributionPackage; import org.eclipse.sirius.table.metamodel.table.description.DescriptionFactory; import org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage; import org.eclipse.sirius.table.metamodel.table.description.EditionTableDescription; @@ -137,11 +134,6 @@ public class EditionTableDescriptionItemProvider extends TableDescriptionItemPro @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); - - if (Movida.isEnabled()) { - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION_PROVIDER__CONTRIBUTIONS, ContributionFactory.eINSTANCE.createContribution())); - } - newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.EDITION_TABLE_DESCRIPTION__OWNED_COLUMN_MAPPINGS, DescriptionFactory.eINSTANCE.createFeatureColumnMapping())); } diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/ContributionTrakingIdentifier.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/ContributionTrakingIdentifier.java deleted file mode 100644 index 45882a693e..0000000000 --- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/ContributionTrakingIdentifier.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.table.business.internal.dialect; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.sirius.description.contribution.ContributionPoint; -import org.eclipse.sirius.table.tools.internal.Messages; - -import com.google.common.base.Function; -import com.google.common.base.Preconditions; -import com.google.common.base.Supplier; - -/** - * A function which identifies elements from a representation's effective - * description according to the VSM origin of the elements, as recorded in the - * table's contribution points. - * - * @author pierre-charles.david@obeo.fr - */ -public class ContributionTrakingIdentifier implements Function<EObject, Object> { - private final Function<EObject, String> pathFunction; - - private Supplier<EObject> edSupplier; - - private Supplier<Iterable<ContributionPoint>> cpSupplier; - - /** - * Constructor. - * - * @param edSupplier - * a supplier for the effective representations description to - * use. - * @param cpSupplier - * a supplier for the contribution points to use. - * - * @param pathFunction - * the function to use to get the intrinsic identifiers of the - * elements. - */ - public ContributionTrakingIdentifier(Supplier<EObject> edSupplier, Supplier<Iterable<ContributionPoint>> cpSupplier, Function<EObject, String> pathFunction) { - this.edSupplier = Preconditions.checkNotNull(edSupplier); - this.cpSupplier = Preconditions.checkNotNull(cpSupplier); - this.pathFunction = Preconditions.checkNotNull(pathFunction); - } - - /** - * {@inheritDoc} - */ - @Override - public Object apply(EObject from) { - String currentURI = pathFunction.apply(from); - if (isInContributionScope(from)) { - ContributionPoint cp = findMostSpecificContributionPoint(from, edSupplier.get(), cpSupplier.get()); - if (cp != null) { - String parentURI = pathFunction.apply(cp.getContributed()); - String relativeURI = currentURI.replace(parentURI, ""); //$NON-NLS-1$ - return cp.getOrigin() + relativeURI; - } else { - throw new RuntimeException(Messages.ContributionTrakingIdentifier_ElementWithoutMatchingData); - } - } else { - return currentURI; - } - } - - private boolean isInContributionScope(EObject from) { - EObject scopeRoot = edSupplier.get(); - return scopeRoot != null && (from == scopeRoot || EcoreUtil.isAncestor(scopeRoot, from)); - } - - private ContributionPoint findMostSpecificContributionPoint(EObject obj, EObject root, Iterable<ContributionPoint> points) { - EObject current = obj; - while (current != root.eContainer()) { - ContributionPoint cp = findContributionPoint(current, points); - if (cp != null) { - return cp; - } - current = current.eContainer(); - } - return null; - } - - private ContributionPoint findContributionPoint(EObject from, Iterable<ContributionPoint> contributionPoints) { - // TODO Replace this search by a lookup in an index re-created from - // findMostSpecificContributionPoint(). - for (ContributionPoint cp : contributionPoints) { - if (cp.getContributed() == from) { - return cp; - } - } - return null; - } -} diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableContributionsFinder.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableContributionsFinder.java deleted file mode 100644 index 456beecaa5..0000000000 --- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableContributionsFinder.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.table.business.internal.dialect; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.business.api.query.EObjectQuery; -import org.eclipse.sirius.business.api.query.ViewpointQuery; -import org.eclipse.sirius.business.internal.contribution.ReuseHelper; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.emf.AllContents; -import org.eclipse.sirius.table.metamodel.table.description.TableDescription; -import org.eclipse.sirius.viewpoint.description.DescriptionPackage; -import org.eclipse.sirius.viewpoint.description.RepresentationDescription; -import org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Function; -import com.google.common.base.Objects; -import com.google.common.base.Predicates; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; - -/** - * Helper to find all the contributions which should be applied to produce the - * effective version of a representation description, in the order they should - * be applied. - * - * @author pierre-charles.david@obeo.fr - */ -public class TableContributionsFinder implements Function<Iterable<EObject>, Iterable<Contribution>> { - private final TableDescription mainDescription; - - /** - * Constructor. - * - * @param mainDescription - * the main description for which we want to produce an effective - * version. - */ - public TableContributionsFinder(TableDescription mainDescription) { - this.mainDescription = mainDescription; - } - - /** - * {@inheritDoc} - */ - public Iterable<Contribution> apply(Iterable<EObject> from) { - LinkedHashSet<EObject> sortedRepresentations = getRelevantRepresentations(getAllRepresentations(from)); - ArrayList<EObject> reversed = Lists.newArrayList(sortedRepresentations); - Collections.reverse(reversed); - - List<Contribution> result = new ArrayList<>(); - for (EObject root : reversed) { - Iterables.addAll(result, Iterables.filter(AllContents.of(root, ContributionPackage.eINSTANCE.getContribution(), true), Contribution.class)); - } - return result; - } - - private LinkedHashSet<EObject> getRelevantRepresentations(Set<EObject> allRepresentations) { - LinkedHashSet<EObject> result = new LinkedHashSet<>(); - boolean changed = result.add(mainDescription); - while (changed) { - changed = false; - // Add all the Representations we reuse. - for (RepresentationDescription r1 : Iterables.filter(Lists.newArrayList(result), RepresentationDescription.class)) { - for (RepresentationDescription r2 : Iterables.filter(allRepresentations, RepresentationDescription.class)) { - if (r1 != r2 && reuses(r1, r2)) { - changed = changed || result.add(r2); - } - } - } - // Add all the RepresentationExtensions which extend any of us. - for (RepresentationExtensionDescription ext : Iterables.filter(allRepresentations, RepresentationExtensionDescription.class)) { - for (RepresentationDescription r : Iterables.filter(Lists.newArrayList(result), RepresentationDescription.class)) { - if (isExtending(ext, r)) { - changed = changed || result.add(ext); - } - } - } - } - return result; - } - - private boolean reuses(RepresentationDescription user, RepresentationDescription used) { - return new ReuseHelper().reuses(user, used); - } - - private boolean isExtending(RepresentationExtensionDescription extension, RepresentationDescription extended) { - String targetSiriusURI = getTargetSiriusURI(extended); - String targetRepresentationName = extended.getName(); - return Objects.equal(extension.getViewpointURI(), targetSiriusURI) && Objects.equal(extension.getRepresentationName(), targetRepresentationName); - } - - private String getTargetSiriusURI(RepresentationDescription target) { - Option<EObject> parentVp = new EObjectQuery(target).getFirstAncestorOfType(DescriptionPackage.eINSTANCE.getViewpoint()); - if (parentVp.some()) { - Viewpoint vp = (Viewpoint) parentVp.get(); - String uri = getSiriusURI(vp); - if (uri != null) { - return uri; - } - } - return null; - } - - /** - * Returns the viewpoint URI associated to the given Sirius. - * - * @param vp - * the viewpoint to get the URI from - * @return the viewpoint URI associated to the given Sirius - */ - protected String getSiriusURI(Viewpoint vp) { - Option<URI> uri = new ViewpointQuery(vp).getViewpointURI(); - if (uri.some()) { - return uri.get().toString(); - } else { - return null; - } - } - - private Set<EObject> getAllRepresentations(Iterable<EObject> from) { - Set<EObject> result = new HashSet<>(); - for (EObject eObject : from) { - Iterables.addAll( - result, - Iterables.filter(AllContents.of(eObject, true), - Predicates.or(Predicates.instanceOf(RepresentationDescription.class), Predicates.instanceOf(RepresentationExtensionDescription.class)))); - } - return result; - } -} 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 0d73e63799..3787ccc3f8 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, 2017 THALES GLOBAL SERVICES and others. + * Copyright (c) 2007, 2018 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 @@ -11,19 +11,13 @@ package org.eclipse.sirius.table.business.internal.dialect; import java.text.MessageFormat; -import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; -import java.util.List; -import java.util.Map; import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.util.ECrossReferenceAdapter; @@ -32,25 +26,14 @@ 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.DViewQuery; 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; -import org.eclipse.sirius.business.api.session.SessionManager; -import org.eclipse.sirius.business.internal.contribution.ContributionPointHelper; -import org.eclipse.sirius.business.internal.contribution.IncrementalModelContributor; -import org.eclipse.sirius.business.internal.contribution.IntrinsicPathIdentifier; -import org.eclipse.sirius.business.internal.contribution.ModelContributorAdapter; -import org.eclipse.sirius.business.internal.contribution.RepresentationExtensionsFinder; -import org.eclipse.sirius.business.internal.contribution.SiriusReferenceResolver; -import org.eclipse.sirius.business.internal.movida.Movida; import org.eclipse.sirius.common.tools.api.interpreter.EvaluationException; import org.eclipse.sirius.common.tools.api.interpreter.IInterpreter; import org.eclipse.sirius.common.tools.api.util.StringUtil; -import org.eclipse.sirius.description.contribution.ContributionPoint; import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor; -import org.eclipse.sirius.ext.emf.AllContents; import org.eclipse.sirius.table.business.api.refresh.DTableSynchronizer; import org.eclipse.sirius.table.business.internal.dialect.description.TableInterpretedExpressionQuery; import org.eclipse.sirius.table.business.internal.refresh.DTableElementSynchronizer; @@ -61,7 +44,6 @@ import org.eclipse.sirius.table.metamodel.table.DLine; import org.eclipse.sirius.table.metamodel.table.DTable; import org.eclipse.sirius.table.metamodel.table.DTableElement; import org.eclipse.sirius.table.metamodel.table.TableFactory; -import org.eclipse.sirius.table.metamodel.table.description.EditionTableDescription; import org.eclipse.sirius.table.metamodel.table.description.TableDescription; import org.eclipse.sirius.table.tools.internal.Messages; import org.eclipse.sirius.table.tools.internal.command.TableCommandFactory; @@ -70,15 +52,11 @@ import org.eclipse.sirius.tools.api.interpreter.InterpreterUtil; import org.eclipse.sirius.viewpoint.DRepresentation; import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; import org.eclipse.sirius.viewpoint.DSemanticDecorator; -import org.eclipse.sirius.viewpoint.DView; import org.eclipse.sirius.viewpoint.SiriusPlugin; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; import org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; -import com.google.common.base.Function; -import com.google.common.base.Supplier; - /** * Services for the table dialect. * @@ -86,19 +64,6 @@ import com.google.common.base.Supplier; */ public class TableDialectServices extends AbstractRepresentationDialectServices { - /** - * Tests whether a representation should be handled by the Movida-specific code which handles contributions and - * effective representation descriptions. - * - * @param representation - * the representation to test. - * @return <code>true</code> if it should be handled by Movida-specific logic. - * - */ - public static boolean isHandledByMovida(DRepresentation representation) { - return Movida.isEnabled() && (representation instanceof DTable) && (((DTable) representation).getDescription() instanceof EditionTableDescription); - } - @Override protected boolean isSupported(DRepresentation representation) { return representation instanceof DTable; @@ -143,9 +108,6 @@ public class TableDialectServices extends AbstractRepresentationDialectServices table.setName(name); table.setTarget(semantic); table.setDescription((TableDescription) description); - if (isHandledByMovida(table)) { - refreshEffectiveRepresentationDescription(table, monitor); - } monitor.worked(1); refresh(table, new SubProgressMonitor(monitor, 10)); @@ -155,96 +117,6 @@ public class TableDialectServices extends AbstractRepresentationDialectServices return table; } - @Override - public void updateRepresentationsExtendedBy(Session session, Viewpoint viewpoint, boolean activated) { - if (Movida.isEnabled()) { - IProgressMonitor monitor = new NullProgressMonitor(); - for (DView view : session.getOwnedViews()) { - for (DRepresentation representation : new DViewQuery(view).getLoadedRepresentations()) { - if (isHandledByMovida(representation)) { - RepresentationExtensionsFinder ref = new RepresentationExtensionsFinder(((DTable) representation).getDescription()); - if (ref.isAffectedBy(viewpoint)) { - refreshEffectiveRepresentationDescription(representation, monitor); - refresh(representation, monitor); - } - } - } - } - } - } - - @Override - public void refreshEffectiveRepresentationDescription(DRepresentation representation, IProgressMonitor monitor) { - if (!(isHandledByMovida(representation))) { - return; - } - DTable table = (DTable) representation; - Session session = SessionManager.INSTANCE.getSession(table.getTarget()); - IncrementalModelContributor imc = getModelContributor(session, table); - imc.apply(table.getDescription(), new RepresentationExtensionsFinder(table.getDescription()).findAllRelevantViewpoints(session)); - - Supplier<EObject> efSupplier = new Supplier<EObject>() { - @Override - public EObject get() { - return null; - } - }; - Supplier<EList<ContributionPoint>> cpSupplier = new Supplier<EList<ContributionPoint>>() { - @Override - public EList<ContributionPoint> get() { - return null; - } - }; - updateContributionPoints(table, efSupplier, cpSupplier, imc); - } - - private IncrementalModelContributor getModelContributor(Session session, DTable table) { - ModelContributorAdapter mca = ModelContributorAdapter.find(table); - if (mca == null) { - mca = ModelContributorAdapter.attach(table, createModelContributor(session, table)); - } - return mca.getModelContributor(); - } - - private IncrementalModelContributor createModelContributor(Session session, final DTable table) { - Supplier<EObject> efSupplier = new Supplier<EObject>() { - @Override - public EObject get() { - return null; - } - }; - Supplier<Iterable<ContributionPoint>> cpSupplier = new Supplier<Iterable<ContributionPoint>>() { - @Override - public Iterable<ContributionPoint> get() { - return null; - } - }; - SiriusReferenceResolver resolver = new SiriusReferenceResolver(session.getInterpreter()); - Function<EObject, Object> idFunction = new ContributionTrakingIdentifier(efSupplier, cpSupplier, new IntrinsicPathIdentifier()); - IncrementalModelContributor imc = new TableModelContributor(new TableContributionsFinder(table.getDescription()), resolver, idFunction); - if (efSupplier.get() != null) { - Map<EObject, Object> restoredIdentifiers = new HashMap<>(); - for (EObject obj : AllContents.of(efSupplier.get(), true)) { - restoredIdentifiers.put(obj, idFunction.apply(obj)); - } - imc.resetState(efSupplier.get(), restoredIdentifiers); - } - return imc; - } - - private void updateContributionPoints(DTable table, Supplier<EObject> efSupplier, Supplier<EList<ContributionPoint>> cpSupplier, IncrementalModelContributor imc) { - List<ContributionPoint> newPoints = new ArrayList<>(); - newPoints.add(ContributionPointHelper.make(efSupplier.get(), new IntrinsicPathIdentifier().apply(table.getDescription()))); - Map<EObject, Object> cps = imc.getContributionPoints(); - for (Map.Entry<EObject, Object> entry : cps.entrySet()) { - newPoints.add(ContributionPointHelper.make(entry.getKey(), (String) entry.getValue())); - } - for (EObject imported : ((TableDescription) efSupplier.get()).getImportedElements()) { - newPoints.add(ContributionPointHelper.make(imported, (String) imc.getIdentifier(imported))); - } - ContributionPointHelper.updateIfNeeded(cpSupplier.get(), newPoints); - } - /** * The <code>fullRefresh</code> is not taken into account for table dialect. * @@ -257,20 +129,7 @@ public class TableDialectServices extends AbstractRepresentationDialectServices DTable table = (DTable) representation; IInterpreter interpreter = SiriusPlugin.getDefault().getInterpreterRegistry().getInterpreter(table.getTarget()); ModelAccessor accessor = SiriusPlugin.getDefault().getModelAccessorRegistry().getModelAccessor(representation); - - Supplier<EObject> efSupplier = new Supplier<EObject>() { - @Override - public EObject get() { - // return table.getEffectiveDescription(); - return null; - } - }; - - if (isHandledByMovida(table) && efSupplier.get() == null) { - refreshEffectiveRepresentationDescription(representation, monitor); - monitor.worked(1); - } - TableDescription description = isHandledByMovida(table) ? (TableDescription) efSupplier.get() : table.getDescription(); + TableDescription description = table.getDescription(); DTableSynchronizer sync = new DTableSynchronizerImpl(description, accessor, interpreter); sync.setTable(table); sync.refresh(new SubProgressMonitor(monitor, 1)); @@ -351,9 +210,6 @@ public class TableDialectServices extends AbstractRepresentationDialectServices return table == new DRepresentationElementQuery(tableElement).getParentRepresentation(); } - /** - * {@inheritDoc} - */ @Override public RepresentationDescription getDescription(DRepresentation representation) { if (isSupported(representation)) { diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableModelContributor.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableModelContributor.java deleted file mode 100644 index 831e511f85..0000000000 --- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/dialect/TableModelContributor.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.table.business.internal.dialect; - -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.sirius.business.api.query.EObjectQuery; -import org.eclipse.sirius.business.internal.contribution.IncrementalModelContributor; -import org.eclipse.sirius.business.internal.contribution.ReferenceResolver; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionProvider; -import org.eclipse.sirius.ext.emf.AllContents; -import org.eclipse.sirius.table.metamodel.table.description.TableDescription; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Function; - -/** - * Customization of the generic IncrementalModelContributor for computing - * effective EditionTableDescriptions. - * - * @author pierre-charles.david@obeo.fr - */ -public final class TableModelContributor extends IncrementalModelContributor { - /** - * Constructor. - * - * @param contributionFinder - * the function to use to find all the potentially applicable - * contributions from a source model - * @param resolver - * the resolver to use on the contributions to locate their - * actual source and target elements - * @param idFunction - * the function used to obtain logical identifiers for model - * elements, required to perform the incremental update - */ - public TableModelContributor(Function<Iterable<EObject>, Iterable<Contribution>> contributionFinder, ReferenceResolver resolver, Function<EObject, Object> idFunction) { - super(contributionFinder, resolver, idFunction); - } - - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.business.internal.contribution.IncrementalModelContributor#findAllContributions(org.eclipse.emf.ecore.EObject, - * java.lang.Iterable) - */ - @Override - protected List<Contribution> findAllContributions(EObject targetModel, Iterable<EObject> sources) { - this.contributionFinder = new TableContributionsFinder((TableDescription) targetModel) { - @Override - protected String getSiriusURI(Viewpoint vp) { - return TableModelContributor.this.getSiriusURI(vp); - } - }; - return super.findAllContributions(targetModel, sources); - } - - /** - * - * {@inheritDoc} - * - * @see org.eclipse.sirius.business.internal.contribution.IncrementalModelContributor#postProcess(org.eclipse.emf.ecore.EObject) - */ - @Override - protected void postProcess(EObject result) { - incorporateAllReusedElements((TableDescription) result); - removeContributions(result); - } - - private void incorporateAllReusedElements(TableDescription result) { - EList<EObject> imported = result.getImportedElements(); - for (EObject obj : AllContents.of(result, true)) { - for (EReference re : obj.eClass().getEAllReferences()) { - if (isReuseReference(re)) { - for (EObject o : new EObjectQuery(obj).getValues(re)) { - if (!EcoreUtil.isAncestor(result, o)) { - imported.add(o); - } - } - } - } - } - } - - private boolean isReuseReference(EReference re) { - return !re.isContainment() && re.getName().startsWith("reused"); //$NON-NLS-1$ - } - - private void removeContributions(EObject obj) { - if (obj instanceof ContributionProvider) { - ((ContributionProvider) obj).getContributions().clear(); - } - for (EObject child : obj.eContents()) { - removeContributions(child); - } - } -} diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java index 625ca97939..c3664554dd 100644 --- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java +++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableSynchronizerImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 THALES GLOBAL SERVICES and others. + * Copyright (c) 2007, 2018 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 @@ -40,7 +40,6 @@ import org.eclipse.sirius.ext.base.collect.SetIntersection; import org.eclipse.sirius.table.business.api.helper.TableHelper; import org.eclipse.sirius.table.business.api.query.DTableQuery; import org.eclipse.sirius.table.business.api.refresh.DTableSynchronizer; -import org.eclipse.sirius.table.business.internal.dialect.TableDialectServices; import org.eclipse.sirius.table.metamodel.table.DCell; import org.eclipse.sirius.table.metamodel.table.DColumn; import org.eclipse.sirius.table.metamodel.table.DFeatureColumn; @@ -475,7 +474,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer { * let's analyze the existing columns. */ for (final DColumn column : table.getColumns()) { - boolean mappingIsObsolete = TableDialectServices.isHandledByMovida(table) ? false : (column.getOriginMapping().eResource() == null || column.getOriginMapping().eIsProxy()); + boolean mappingIsObsolete = column.getOriginMapping().eResource() == null || column.getOriginMapping().eIsProxy(); if (mappingIsObsolete || (column.getOriginMapping() == mapping && column instanceof DFeatureColumn)) { columnsWithoutTarget.add(column); } @@ -576,7 +575,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer { * let's analyse the existing columns. */ for (final DColumn column : table.getColumns()) { - boolean mappingIsObsolete = TableDialectServices.isHandledByMovida(table) ? false : (column.getOriginMapping().eResource() == null || column.getOriginMapping().eIsProxy()); + boolean mappingIsObsolete = column.getOriginMapping().eResource() == null || column.getOriginMapping().eIsProxy(); if (mappingIsObsolete || (column.getOriginMapping() == mapping && column instanceof DFeatureColumn)) { status.addInOld(new DFeatureColumnCandidate((DFeatureColumn) column, this.ids)); } @@ -703,7 +702,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer { // to the old values. for (final DCell cell : new DTableQuery(table).getCells()) { IntersectionMapping intersectionMapping = cell.getIntersectionMapping(); - boolean mappingIsObsolete = TableDialectServices.isHandledByMovida(table) ? false : (intersectionMapping == null || intersectionMapping.eResource() == null); + boolean mappingIsObsolete = intersectionMapping == null || intersectionMapping.eResource() == null; if (iMapping.equals(intersectionMapping) || mappingIsObsolete) { status.addInOld(new DCellCandidate(cell, this.ids)); } @@ -863,7 +862,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer { // to the old values. for (final DCell cell : new DTableQuery(table).getCells()) { IntersectionMapping intersectionMapping = cell.getIntersectionMapping(); - boolean mappingIsObsolete = TableDialectServices.isHandledByMovida(table) ? false : (intersectionMapping == null || intersectionMapping.eResource() == null); + boolean mappingIsObsolete = intersectionMapping == null || intersectionMapping.eResource() == null; if (iMapping.equals(intersectionMapping) || mappingIsObsolete) { status.addInOld(new DCellCandidate(cell, this.ids)); } @@ -1064,8 +1063,7 @@ public class DTableSynchronizerImpl implements DTableSynchronizer { } for (final DLine line : container.getLines()) { LineMapping originMapping = line.getOriginMapping(); - boolean mappingIsObsolete = TableDialectServices.isHandledByMovida(table) ? false : (originMapping.eResource() == null); - if (originMapping == mapping || mappingIsObsolete) { + if (originMapping == mapping || originMapping.eResource() == null) { status.addInOld(new DLineCandidate(line, this.ids)); } } @@ -1101,20 +1099,12 @@ public class DTableSynchronizerImpl implements DTableSynchronizer { return status; } - /** - * - * {@inheritDoc} - */ @Override public void setTable(final DTable newTable) { this.table = newTable; this.ids = RefreshIdsHolder.getOrCreateHolder(table); } - /** - * - * {@inheritDoc} - */ @Override public DTable getTable() { return table; diff --git a/plugins/org.eclipse.sirius.tests.junit/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.tests.junit/META-INF/MANIFEST.MF index 50be79a2d8..fbcc90a8f1 100644 --- a/plugins/org.eclipse.sirius.tests.junit/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.tests.junit/META-INF/MANIFEST.MF @@ -140,7 +140,6 @@ Export-Package: org.eclipse.sirius.tests, org.eclipse.sirius.tests.unit.common.logger, org.eclipse.sirius.tests.unit.common.migration, org.eclipse.sirius.tests.unit.common.mock, - org.eclipse.sirius.tests.unit.contribution, org.eclipse.sirius.tests.unit.diagram, org.eclipse.sirius.tests.unit.diagram.action, org.eclipse.sirius.tests.unit.diagram.benchmark, diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/common/AllCommonStandaloneTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/common/AllCommonStandaloneTests.java index 021a172c20..ce043987f1 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/common/AllCommonStandaloneTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/suite/common/AllCommonStandaloneTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2015 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2018 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.sirius.tests.unit.common.LabelProviderProviderServiceTests; import org.eclipse.sirius.tests.unit.common.SessionLabelTest; import org.eclipse.sirius.tests.unit.common.VisualBindingManagerTestCase; import org.eclipse.sirius.tests.unit.common.logger.MarkerRuntimeLoggerTest; -import org.eclipse.sirius.tests.unit.contribution.SiriusURIQueryTest; import junit.framework.JUnit4TestAdapter; import junit.framework.Test; @@ -68,7 +67,6 @@ public class AllCommonStandaloneTests extends TestCase { suite.addTestSuite(VisualBindingManagerTestCase.class); suite.addTest(new JUnit4TestAdapter(FileUtilTest.class)); suite.addTestSuite(ContentHelperTests.class); - suite.addTest(new JUnit4TestAdapter(SiriusURIQueryTest.class)); // suite.addTest(new JUnit4TestAdapter(AllContributionTests.class)); suite.addTestSuite(DragAndDropNodeTest.class); suite.addTestSuite(TypeAssistantTests.class); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SiriusComparatorTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SiriusComparatorTests.java index 1bee898fae..296ff2a659 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SiriusComparatorTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SiriusComparatorTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2018 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 @@ -16,7 +16,6 @@ import java.util.Set; import org.eclipse.emf.common.util.URI; import org.eclipse.sirius.business.api.componentization.ViewpointRegistry; import org.eclipse.sirius.business.api.componentization.ViewpointRegistry.ViewpointComparator; -import org.eclipse.sirius.business.internal.movida.Movida; import org.eclipse.sirius.tests.SiriusTestsPlugin; import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper; import org.eclipse.sirius.viewpoint.description.Viewpoint; @@ -50,9 +49,6 @@ public class SiriusComparatorTests extends TestCase { private Set<Viewpoint> registeredInTest = null; public void testIdentity() { - if (Movida.isEnabled()) { - return; - } assertEquals(0, comp.compare(vp1_P1_resource, vp1_P1_resource)); assertEquals(0, comp.compare(vp2_P1_resource, vp2_P1_resource)); assertEquals(0, comp.compare(vp2_P2_resource, vp2_P2_resource)); @@ -62,9 +58,6 @@ public class SiriusComparatorTests extends TestCase { } public void testSameLabelDifferentProjects() { - if (Movida.isEnabled()) { - return; - } int comp1 = comp.compare(vp1_P1_resource, vp2_P2_resource); int comp2 = comp.compare(vp2_P2_resource, vp1_P1_resource); @@ -74,9 +67,6 @@ public class SiriusComparatorTests extends TestCase { } public void testSameLabelDifferentResourceNameAndProjects() { - if (Movida.isEnabled()) { - return; - } int comp1 = comp.compare(vp2_P1_resource, vp2_P2_resource); int comp2 = comp.compare(vp2_P2_resource, vp2_P1_resource); @@ -86,9 +76,6 @@ public class SiriusComparatorTests extends TestCase { } public void testSameLabelSameProject() { - if (Movida.isEnabled()) { - return; - } int comp1 = comp.compare(vp1_P1_resource, vp2_P1_resource); int comp2 = comp.compare(vp2_P1_resource, vp1_P1_resource); @@ -98,9 +85,6 @@ public class SiriusComparatorTests extends TestCase { } public void testSameLabelSamePlugin() { - if (Movida.isEnabled()) { - return; - } int comp1 = comp.compare(vp1_plugin, vp2_plugin); int comp2 = comp.compare(vp2_plugin, vp1_plugin); @@ -110,9 +94,6 @@ public class SiriusComparatorTests extends TestCase { } public void testSameLabelDifferentLocation() { - if (Movida.isEnabled()) { - return; - } int comp1 = comp.compare(vp1_P1_resource, vp1_plugin); int comp2 = comp.compare(vp1_plugin, vp1_P1_resource); @@ -126,9 +107,6 @@ public class SiriusComparatorTests extends TestCase { super.setUp(); comp = new ViewpointRegistry.ViewpointComparator(); - if (Movida.isEnabled()) { - return; - } registeredInTest = new HashSet<>(); initProject1(); @@ -195,9 +173,6 @@ public class SiriusComparatorTests extends TestCase { @Override protected void tearDown() throws Exception { super.tearDown(); - if (Movida.isEnabled()) { - return; - } vp1_P1_resource = null; vp2_P1_resource = null; diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SiriusRegistryTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SiriusRegistryTests.java index 36a70cef97..b9caa8d619 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SiriusRegistryTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/SiriusRegistryTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2018 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 @@ -12,7 +12,6 @@ package org.eclipse.sirius.tests.unit.api.session; import org.eclipse.sirius.business.api.componentization.ViewpointRegistry; import org.eclipse.sirius.business.api.componentization.ViewpointRegistryFilter; -import org.eclipse.sirius.business.internal.movida.Movida; import org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; @@ -23,9 +22,6 @@ public class SiriusRegistryTests extends TestCase { private static final String BASIC_FILTER = "basicFilter"; public void testFilters() { - if (Movida.isEnabled()) { - return; - } final int numberOfSiriuss = ViewpointRegistry.getInstance().getViewpoints().size(); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/ViewpointSelectionTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/ViewpointSelectionTests.java index ffd7749441..c87c9f6c6e 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/ViewpointSelectionTests.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/session/ViewpointSelectionTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2018 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2018 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.util.HashSet; import java.util.Set; import org.eclipse.sirius.business.api.componentization.ViewpointRegistry; -import org.eclipse.sirius.business.internal.movida.Movida; import org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelection; import org.eclipse.sirius.viewpoint.description.DescriptionFactory; import org.eclipse.sirius.viewpoint.description.Viewpoint; @@ -36,11 +35,6 @@ public class ViewpointSelectionTests extends TestCase { } public void testFileExtensionWithoutPattern() { - if (Movida.isEnabled()) { - // The new Movida registry does not implement the - // registerFromWorkspace() API. - return; - } Set<Viewpoint> createdViewpoints = new HashSet<Viewpoint>(); createdViewpoints.add(createViewpoint("lolita")); @@ -51,11 +45,6 @@ public class ViewpointSelectionTests extends TestCase { } public void testMultipleFileExtension() { - if (Movida.isEnabled()) { - // The new Movida registry does not implement the - // registerFromWorkspace() API. - return; - } Set<Viewpoint> createdViewpoints = new HashSet<Viewpoint>(); createdViewpoints.add(createViewpoint("lolita tatata tutu")); @@ -80,11 +69,6 @@ public class ViewpointSelectionTests extends TestCase { } public void testFileExtensionWithPattern() { - if (Movida.isEnabled()) { - // The new Movida registry does not implement the - // registerFromWorkspace() API. - return; - } Set<Viewpoint> createdViewpoints = new HashSet<Viewpoint>(); createdViewpoints.add(createViewpoint("*.treztattaaaazzz")); @@ -95,11 +79,6 @@ public class ViewpointSelectionTests extends TestCase { } public void testMultipleFileExtensionWithPattern() { - if (Movida.isEnabled()) { - // The new Movida registry does not implement the - // registerFromWorkspace() API. - return; - } Set<Viewpoint> createdViewpoints = new HashSet<Viewpoint>(); createdViewpoints.add(createViewpoint("*.treztattaaaazzz toto *.tutu tata ")); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/vsm/edit/SiriusAdapterFactoryRegistryTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/vsm/edit/SiriusAdapterFactoryRegistryTest.java index 637a1d5ac4..430b495aee 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/vsm/edit/SiriusAdapterFactoryRegistryTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/api/vsm/edit/SiriusAdapterFactoryRegistryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2018 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.Collections; import java.util.List; import org.eclipse.emf.ecore.EPackage; -import org.eclipse.sirius.description.contribution.ContributionPackage; import org.eclipse.sirius.diagram.DiagramPackage; import org.eclipse.sirius.diagram.description.concern.ConcernPackage; import org.eclipse.sirius.diagram.description.filter.FilterPackage; @@ -44,7 +43,6 @@ public class SiriusAdapterFactoryRegistryTest extends AbstractItemProviderAdapte exposedPackages.add(ToolPackage.eINSTANCE); exposedPackages.add(StylePackage.eINSTANCE); exposedPackages.add(AuditPackage.eINSTANCE); - exposedPackages.add(ContributionPackage.eINSTANCE); exposedPackages.add(DiagramPackage.eINSTANCE); exposedPackages.add(org.eclipse.sirius.diagram.description.DescriptionPackage.eINSTANCE); exposedPackages.add(org.eclipse.sirius.diagram.description.style.StylePackage.eINSTANCE); diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/AcceleoPackageRegistryTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/AcceleoPackageRegistryTest.java index da58cffe5c..c8c198b97c 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/AcceleoPackageRegistryTest.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/AcceleoPackageRegistryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2018 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 @@ -24,7 +24,6 @@ import org.eclipse.sirius.ecore.extender.business.api.accessor.EcoreMetamodelDes import org.eclipse.sirius.ecore.extender.business.api.accessor.MetamodelDescriptor; import org.eclipse.sirius.ext.emf.AllContents; import org.eclipse.sirius.tests.support.api.EclipseTestsSupportHelper; -import org.eclipse.sirius.tests.unit.contribution.Freezer; import junit.framework.TestCase; diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/Freezer.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/Freezer.java index 881e6a2b22..ccb56f110f 100644 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/Freezer.java +++ b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/common/interpreter/acceleo/mtl/Freezer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2014 THALES GLOBAL SERVICES. + * Copyright (c) 2010, 2018 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 @@ -8,7 +8,7 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -package org.eclipse.sirius.tests.unit.contribution; +package org.eclipse.sirius.tests.unit.common.interpreter.acceleo.mtl; import static org.junit.Assert.fail; diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/AllContributionTests.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/AllContributionTests.java deleted file mode 100644 index 8fa078bc26..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/AllContributionTests.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.tests.unit.contribution; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * Unit tests for the model contribution mechanism, used for reuse and - * customization of VSM elements. - * - * @author pierre-charles.david@obeo.fr - */ -@RunWith(Suite.class) -@Suite.SuiteClasses({ FeatureContributionTest.class, ReferenceResolverTest.class, ModelContributionTest.class, TableContributionTest.class, UpdaterTest.class, SiriusURIQueryTest.class, IncrementalModelContributionTest.class }) -public class AllContributionTests { - -} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/FeatureContributionTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/FeatureContributionTest.java deleted file mode 100644 index 838a533043..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/FeatureContributionTest.java +++ /dev/null @@ -1,219 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.tests.unit.contribution; - -import org.eclipse.emf.common.EMFPlugin; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl; -import org.eclipse.sirius.business.internal.contribution.FeatureContributor; -import org.eclipse.sirius.description.contribution.ContributionFactory; -import org.eclipse.sirius.description.contribution.FeatureContribution; -import org.junit.Assert; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.google.common.base.Objects; - -/** - * Unit tests for the application of feature contributions. We use Ecore models - * built in memory for convenience. This test can run in standalone (outside - * Eclipse). - * - * @author pierre-charles.david@obeo.fr - */ -public class FeatureContributionTest { - private EClass targetClass; - - private EClass sourceClass; - - private EAttribute nameFeature; - - private EReference supertypesFeature; - - private ContributionFactory factory = ContributionFactory.eINSTANCE; - - /** - * Make sure EMF is properly initialized when we are run outside of Eclipse. - */ - @BeforeClass - public static void initializeEMF() { - if (!EMFPlugin.IS_ECLIPSE_RUNNING) { - @SuppressWarnings("unused") - EPackage ecore = EcorePackage.eINSTANCE; - Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl()); - } - } - - @Before - public void setup() { - targetClass = EcoreFactory.eINSTANCE.createEClass(); - targetClass.setName("base"); - sourceClass = EcoreFactory.eINSTANCE.createEClass(); - sourceClass.setName("contrib"); - Freezer.freeze(sourceClass); // Forbid change by default. - nameFeature = EcorePackage.eINSTANCE.getENamedElement_Name(); - supertypesFeature = EcorePackage.eINSTANCE.getEClass_ESuperTypes(); - } - - @Test - public void ignore_does_not_change_target() { - String nameBefore = targetClass.getName(); - FeatureContribution fc = factory.createIgnoreFeatureContribution(); - fc.setSourceFeature(nameFeature); - fc.setTargetFeature(nameFeature); - new FeatureContributor(fc).apply(targetClass, sourceClass); - - Assert.assertEquals(nameBefore, targetClass.getName()); - } - - @Test(expected = IllegalArgumentException.class) - public void ignore_fails_if_source_feature_missing() { - FeatureContribution fc = factory.createIgnoreFeatureContribution(); - fc.setTargetFeature(nameFeature); - new FeatureContributor(fc).apply(targetClass, sourceClass); - } - - @Test(expected = IllegalArgumentException.class) - public void ignore_fails_if_target_feature_missing() { - FeatureContribution fc = factory.createIgnoreFeatureContribution(); - fc.setTargetFeature(nameFeature); - new FeatureContributor(fc).apply(targetClass, sourceClass); - } - - @Test(expected = NullPointerException.class) - public void ignore_fails_if_source_missing() { - FeatureContribution fc = factory.createIgnoreFeatureContribution(); - fc.setSourceFeature(nameFeature); - fc.setTargetFeature(nameFeature); - new FeatureContributor(fc).apply(targetClass, null); - } - - @Test(expected = NullPointerException.class) - public void ignore_fails_if_target_missing() { - FeatureContribution fc = factory.createIgnoreFeatureContribution(); - fc.setSourceFeature(nameFeature); - fc.setTargetFeature(nameFeature); - new FeatureContributor(fc).apply(null, sourceClass); - } - - @Test(expected = IllegalArgumentException.class) - public void ignore_fails_if_features_not_compatible() { - FeatureContribution fc = factory.createIgnoreFeatureContribution(); - fc.setSourceFeature(nameFeature); - fc.setTargetFeature(EcorePackage.eINSTANCE.getEClass_Abstract()); - new FeatureContributor(fc).apply(targetClass, sourceClass); - } - - @Test - public void set_string_attribute() { - Assert.assertFalse(Objects.equal(targetClass.getName(), sourceClass.getName())); - - FeatureContribution fc = factory.createSetFeatureContribution(); - fc.setSourceFeature(nameFeature); - fc.setTargetFeature(nameFeature); - new FeatureContributor(fc).apply(targetClass, sourceClass); - - Assert.assertEquals(sourceClass.getName(), targetClass.getName()); - } - - @Test - public void set_boolean_attribute() { - Freezer.thaw(sourceClass); - sourceClass.setAbstract(true); - Freezer.freeze(sourceClass); - - FeatureContribution fc = factory.createSetFeatureContribution(); - EStructuralFeature abstractFeature = EcorePackage.eINSTANCE.getEClass_Abstract(); - fc.setSourceFeature(abstractFeature); - fc.setTargetFeature(abstractFeature); - - Assert.assertFalse(sourceClass.isAbstract() == targetClass.isAbstract()); - new FeatureContributor(fc).apply(targetClass, sourceClass); - Assert.assertEquals(sourceClass.isAbstract(), targetClass.isAbstract()); - } - - @Test - public void add_to_many_valued_reference() { - Freezer.thaw(sourceClass); - EClass c = EcoreFactory.eINSTANCE.createEClass(); - c.setName("Super"); - sourceClass.getESuperTypes().add(c); - Freezer.freeze(sourceClass); - Assert.assertTrue(targetClass.getESuperTypes().isEmpty()); - - FeatureContribution fc = factory.createAddFeatureContribution(); - fc.setSourceFeature(supertypesFeature); - fc.setTargetFeature(supertypesFeature); - new FeatureContributor(fc).apply(targetClass, sourceClass); - - Assert.assertEquals(1, targetClass.getESuperTypes().size()); - Assert.assertSame(c, targetClass.getESuperTypes().get(0)); - } - - @Test - public void remove_from_many_valued_references() { - Freezer.thaw(sourceClass); - EClass c = EcoreFactory.eINSTANCE.createEClass(); - c.setName("Super"); - targetClass.getESuperTypes().add(c); - sourceClass.getESuperTypes().add(c); - Freezer.freeze(sourceClass); - Assert.assertEquals(1, targetClass.getESuperTypes().size()); - - FeatureContribution fc = factory.createRemoveFeatureContribution(); - fc.setSourceFeature(supertypesFeature); - fc.setTargetFeature(supertypesFeature); - new FeatureContributor(fc).apply(targetClass, sourceClass); - - Assert.assertTrue(targetClass.getESuperTypes().isEmpty()); - } - - @Test - public void clear_many_valued_reference() { - EClass c = EcoreFactory.eINSTANCE.createEClass(); - c.setName("Super1"); - targetClass.getESuperTypes().add(c); - c = EcoreFactory.eINSTANCE.createEClass(); - c.setName("Super2"); - targetClass.getESuperTypes().add(c); - Assert.assertEquals(2, targetClass.getESuperTypes().size()); - - FeatureContribution fc = factory.createClearFeatureContribution(); - fc.setSourceFeature(supertypesFeature); - fc.setTargetFeature(supertypesFeature); - new FeatureContributor(fc).apply(targetClass, sourceClass); - - Assert.assertTrue(targetClass.getESuperTypes().isEmpty()); - } - - @Test - public void reset_attribute_to_default() { - EAttribute abstractFeature = EcorePackage.eINSTANCE.getEClass_Abstract(); - boolean defaultValue = ((Boolean) abstractFeature.getDefaultValue()).booleanValue(); - targetClass.setAbstract(!defaultValue); - - FeatureContribution fc = factory.createResetFeatureContribution(); - fc.setSourceFeature(abstractFeature); - fc.setTargetFeature(abstractFeature); - new FeatureContributor(fc).apply(targetClass, sourceClass); - - Assert.assertEquals(defaultValue, targetClass.isAbstract()); - } - -} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/IncrementalModelContributionTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/IncrementalModelContributionTest.java deleted file mode 100644 index a1418bf3b9..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/IncrementalModelContributionTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.tests.unit.contribution; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.EMFPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; -import org.eclipse.sirius.business.internal.contribution.ContributionBuilder; -import org.eclipse.sirius.business.internal.contribution.ContributionFinder; -import org.eclipse.sirius.business.internal.contribution.IncrementalModelContributor; -import org.eclipse.sirius.business.internal.contribution.SiriusReferenceResolver; -import org.eclipse.sirius.common.tools.api.interpreter.CompoundInterpreter; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.diagram.description.DiagramDescription; -import org.eclipse.sirius.ext.emf.AllContents; -import org.eclipse.sirius.tests.SiriusTestsPlugin; -import org.eclipse.sirius.viewpoint.description.DescriptionPackage; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.google.common.base.Function; -import com.google.common.base.Predicates; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; - -/** - * Unit tests for the application of full contributions on models. - * - * @author pierre-charles.david@obeo.fr - */ -public class IncrementalModelContributionTest { - private ResourceSetImpl rs; - - private EObject root; - - private SiriusReferenceResolver resolver; - - private Resource contribsResource; - - private Function<EObject, Object> uriFragmentId; - - /** - * Make sure EMF is properly initialized when we are run outside of Eclipse. - */ - @BeforeClass - @SuppressWarnings("unused") - public static void initializeEMF() { - if (!EMFPlugin.IS_ECLIPSE_RUNNING) { - EPackage vsm = DescriptionPackage.eINSTANCE; - EPackage tables = org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage.eINSTANCE; - EPackage sequence = org.eclipse.sirius.diagram.sequence.description.DescriptionPackage.eINSTANCE; - Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("odesign", new XMIResourceFactoryImpl()); - } - } - - @Before - public void setup() { - uriFragmentId = new Function<EObject, Object>() { - public Object apply(EObject from) { - return from.eResource().getURIFragment(from); - } - }; - resolver = new SiriusReferenceResolver(CompoundInterpreter.INSTANCE); - rs = new ResourceSetImpl(); - if (EMFPlugin.IS_ECLIPSE_RUNNING) { - root = rs.getResource(URI.createPlatformPluginURI("/" + SiriusTestsPlugin.PLUGIN_ID + "/data/unit/movida/contribution_tests.odesign", true), true).getContents().get(0); - contribsResource = rs.createResource(URI.createPlatformPluginURI("/" + SiriusTestsPlugin.PLUGIN_ID + "/data/unit/movida/contributions.odesign", true)); - } else { - root = rs.getResource(URI.createFileURI("data/unit/movida/contribution_tests.odesign"), true).getContents().get(0); - contribsResource = rs.createResource(URI.createFileURI("data/unit/movida/contributions.odesign")); - } - Freezer.freeze(AllContents.of(root, true)); - } - - @After - public void tearDown() { - Freezer.thaw(AllContents.of(root, true)); - uriFragmentId = null; - resolver = null; - root = null; - rs = null; - } - - @Test - public void incremental_contribution() { - final List<Contribution> firstContribs = createFirstTestContributions(root); - contribsResource.getContents().addAll(firstContribs); - - IncrementalModelContributor imc = new IncrementalModelContributor(ContributionFinder.intrinsic(), resolver, uriFragmentId); - ArrayList<EObject> allSources = Lists.<EObject>newArrayList(firstContribs); - allSources.add(root); - EObject result = imc.apply(root, allSources); - - assertNotNull(result); - assertFalse(root == result); - - List<EObject> newDiagrams = Lists.newArrayList(Iterables.filter(AllContents.of(result), Predicates.instanceOf(DiagramDescription.class))); - DiagramDescription newDDiag = (DiagramDescription) Iterables.get(newDiagrams, 0); - assertEquals(3, newDDiag.getDefaultLayer().getNodeMappings().size()); - - final List<Contribution> secondContribs = createSecondTestContributions(root); - contribsResource.getContents().clear(); - contribsResource.getContents().addAll(secondContribs); - allSources.clear(); - allSources.add(root); - allSources.addAll(secondContribs); - EObject secondResult = imc.apply(root, allSources); - - assertNotNull(secondResult); - assertFalse(root == secondResult); - assertSame(result, secondResult); - assertEquals(2, newDDiag.getDefaultLayer().getNodeMappings().size()); - assertEquals(1, newDDiag.getDefaultLayer().getEdgeMappings().size()); - } - - private List<Contribution> createFirstTestContributions(EObject root) { - ArrayList<EObject> diagrams = Lists.newArrayList(Iterables.filter(AllContents.of(root), Predicates.instanceOf(DiagramDescription.class))); - DiagramDescription dDiag = (DiagramDescription) Iterables.get(diagrams, 0); - DiagramDescription dextDiag = (DiagramDescription) Iterables.get(diagrams, 1); - - Contribution contrib = new ContributionBuilder().from(dextDiag.getDefaultLayer()).to(dDiag.getDefaultLayer()).add("nodeMappings").build(); - return Collections.singletonList(contrib); - } - - private List<Contribution> createSecondTestContributions(EObject root) { - ArrayList<EObject> diagrams = Lists.newArrayList(Iterables.filter(AllContents.of(root), Predicates.instanceOf(DiagramDescription.class))); - DiagramDescription dDiag = (DiagramDescription) Iterables.get(diagrams, 0); - DiagramDescription dextDiag = (DiagramDescription) Iterables.get(diagrams, 1); - - Contribution contrib = new ContributionBuilder().from(dextDiag.getDefaultLayer()).to(dDiag.getDefaultLayer()).add("edgeMappings").build(); - return Collections.singletonList(contrib); - } -} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ModelContributionTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ModelContributionTest.java deleted file mode 100644 index 67c632467d..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ModelContributionTest.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.tests.unit.contribution; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; - -import java.util.Arrays; - -import org.eclipse.emf.common.EMFPlugin; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl; -import org.eclipse.sirius.business.internal.contribution.ContributionBuilder; -import org.eclipse.sirius.business.internal.contribution.ContributionFinder; -import org.eclipse.sirius.business.internal.contribution.ModelContributor; -import org.eclipse.sirius.business.internal.contribution.SiriusReferenceResolver; -import org.eclipse.sirius.common.tools.api.interpreter.CompoundInterpreter; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.diagram.description.DescriptionFactory; -import org.eclipse.sirius.diagram.description.DiagramDescription; -import org.eclipse.sirius.diagram.description.Layer; -import org.eclipse.sirius.diagram.description.NodeMapping; -import org.eclipse.sirius.ext.emf.AllContents; -import org.eclipse.sirius.viewpoint.ViewpointPackage; -import org.eclipse.sirius.viewpoint.description.Viewpoint; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.google.common.base.Predicates; -import com.google.common.collect.Iterables; - -/** - * Unit tests for the application of full contributions on models. - * - * @author pierre-charles.david@obeo.fr - */ -public class ModelContributionTest { - - private SiriusReferenceResolver resolver; - - /** - * Make sure EMF is properly initialized when we are run outside of Eclipse. - */ - @BeforeClass - public static void initializeEMF() { - if (!EMFPlugin.IS_ECLIPSE_RUNNING) { - @SuppressWarnings("unused") - EPackage viewpoint = ViewpointPackage.eINSTANCE; - Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("odesign", new XMIResourceFactoryImpl()); - } - } - - @Before - public void setup() { - resolver = new SiriusReferenceResolver(CompoundInterpreter.INSTANCE); - } - - @After - public void tearDown() { - resolver = null; - } - - @Test - public void reuse_semanticCandidateExpression() { - Viewpoint vTarget = createSampleSirius("target"); - Viewpoint vSource = createSampleSirius("source"); - NodeMapping targetNode = (NodeMapping) Iterables.find(AllContents.of(vTarget), Predicates.instanceOf(NodeMapping.class)); - NodeMapping sourceNode = (NodeMapping) Iterables.find(AllContents.of(vSource), Predicates.instanceOf(NodeMapping.class)); - String expression = "aql:aComplicatedExpressionThatMakesSenseToReuse"; - sourceNode.setSemanticCandidatesExpression(expression); - - Contribution contrib = new ContributionBuilder().from(sourceNode).to(targetNode).set("semanticCandidatesExpression").build(); - ModelContributor mc = new ModelContributor(ContributionFinder.providing(contrib), resolver); - - assertNull(targetNode.getSemanticCandidatesExpression()); - mc.apply(vTarget, Arrays.asList((EObject) vSource)); - assertEquals(expression, targetNode.getSemanticCandidatesExpression()); - assertEquals(expression, sourceNode.getSemanticCandidatesExpression()); - } - - @Test - public void reuse_borderedNodeMapping() { - Viewpoint vTarget = createSampleSirius("target"); - Viewpoint vSource = createSampleSirius("source"); - NodeMapping targetNode = (NodeMapping) Iterables.find(AllContents.of(vTarget), Predicates.instanceOf(NodeMapping.class)); - NodeMapping sourceNode = (NodeMapping) Iterables.find(AllContents.of(vSource), Predicates.instanceOf(NodeMapping.class)); - NodeMapping border = DescriptionFactory.eINSTANCE.createNodeMapping(); - border.setName("Bordered node"); - sourceNode.getBorderedNodeMappings().add(border); - - Contribution contrib = new ContributionBuilder().from(sourceNode).to(targetNode).add("reusedBorderedNodeMappings", "borderedNodeMappings").build(); - ModelContributor mc = new ModelContributor(ContributionFinder.providing(contrib), resolver); - - assertEquals(1, sourceNode.getBorderedNodeMappings().size()); - assertSame(border, sourceNode.getBorderedNodeMappings().get(0)); - assertEquals(0, targetNode.getReusedBorderedNodeMappings().size()); - Freezer.freeze(sourceNode); - Freezer.freeze(border); - mc.apply(vTarget, Arrays.asList((EObject) vSource)); - assertEquals(1, sourceNode.getBorderedNodeMappings().size()); - assertSame(border, sourceNode.getBorderedNodeMappings().get(0)); - assertEquals(1, targetNode.getReusedBorderedNodeMappings().size()); - assertSame(border, targetNode.getReusedBorderedNodeMappings().get(0)); - } - - public Viewpoint createSampleSirius(String suffix) { - Viewpoint v = org.eclipse.sirius.viewpoint.description.DescriptionFactory.eINSTANCE.createViewpoint(); - v.setName("Sirius_" + suffix); - - DiagramDescription diag = DescriptionFactory.eINSTANCE.createDiagramDescription(); - diag.setName("Diagram_" + suffix); - diag.setDomainClass("EPackage"); - v.getOwnedRepresentations().add(diag); - - Layer layer = DescriptionFactory.eINSTANCE.createLayer(); - layer.setName("Default"); - diag.setDefaultLayer(layer); - - NodeMapping nm = DescriptionFactory.eINSTANCE.createNodeMapping(); - nm.setName("Node_" + suffix); - nm.setDomainClass("EClass"); - layer.getNodeMappings().add(nm); - - return v; - } -} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/OptionAssert.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/OptionAssert.java deleted file mode 100644 index 5bafe7ba12..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/OptionAssert.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.tests.unit.contribution; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - -import org.eclipse.sirius.ext.base.Option; - -/** - * JUnit assertions for testing {@link Option}. - * - * @author pierre-charles.david@obeo.fr - */ -public class OptionAssert { - public static <T> void assertHasNoValue(Option<T> opt) { - assertNotNull("Option object should not be null.", opt); - assertFalse("Option object should represent no value", opt.some()); - } - - public static <T> void assertHasSomeValue(Option<T> opt) { - assertNotNull("Option object should not be null.", opt); - assertTrue("Option object should represent a value", opt.some()); - } - - public static <T> void assertHasSomeNonNullValue(Option<T> opt) { - assertHasSomeNonNullValue(opt); - assertNotNull(opt.get()); - } - - public static <T> void assertHasExactValue(T expectedValue, Option<T> actualOption) { - assertHasSomeValue(actualOption); - assertSame(expectedValue, actualOption.get()); - } -} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ReferenceResolverTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ReferenceResolverTest.java deleted file mode 100644 index 7af11d7b3a..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/ReferenceResolverTest.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.tests.unit.contribution; - -import static org.eclipse.sirius.tests.unit.contribution.OptionAssert.assertHasExactValue; -import static org.eclipse.sirius.tests.unit.contribution.OptionAssert.assertHasNoValue; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.sirius.business.internal.contribution.ReferenceResolver; -import org.eclipse.sirius.business.internal.contribution.SiriusReferenceResolver; -import org.eclipse.sirius.common.tools.api.interpreter.CompoundInterpreter; -import org.eclipse.sirius.common.tools.api.interpreter.IInterpreter; -import org.eclipse.sirius.description.contribution.ComputedEObjectReference; -import org.eclipse.sirius.description.contribution.ContributionFactory; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.description.contribution.EObjectReference; -import org.eclipse.sirius.ext.base.Option; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -/** - * Tests for {@link SiriusReferenceResolver}. - * - * @author pierre-charles.david@obeo.fr - */ -public class ReferenceResolverTest { - private static final Map<String, Object> NO_CONTEXT = new HashMap<>(); - - private static ContributionFactory factory; - - private IInterpreter interpreter; - - private ReferenceResolver resolver; - - @BeforeClass - public static void init() { - factory = ContributionFactory.eINSTANCE; - } - - @Before - public void setUp() { - this.interpreter = CompoundInterpreter.INSTANCE; - this.resolver = new SiriusReferenceResolver(interpreter); - } - - @Test - public void direct_reference_with_null_value_resolves_to_empty_option() { - EObjectReference ref = factory.createDirectEObjectReference(); - Option<EObject> result = resolver.resolve(ref, NO_CONTEXT); - assertHasNoValue(result); - } - - @Test - public void direct_reference_with_value_resolves_to_value() { - EObject value = EcoreFactory.eINSTANCE.createEObject(); - DirectEObjectReference ref = factory.createDirectEObjectReference(); - ref.setValue(value); - Option<EObject> result = resolver.resolve(ref, NO_CONTEXT); - assertHasExactValue(value, result); - } - - @Test - public void computed_reference_with_no_expression_resolves_to_empty_option() { - ComputedEObjectReference ref = factory.createComputedEObjectReference(); - Option<EObject> result = resolver.resolve(ref, NO_CONTEXT); - assertHasNoValue(result); - } - - @Test - public void computed_reference_with_invalid_expression_resolves_to_empty_option() { - ComputedEObjectReference ref = factory.createComputedEObjectReference(); - ref.setValueExpression("not a valid expression"); - Option<EObject> result = resolver.resolve(ref, NO_CONTEXT); - assertHasNoValue(result); - } - - @Test - public void computed_reference_with_valid_expression_but_not_context_resolves_to_empty_option() { - ComputedEObjectReference ref = factory.createComputedEObjectReference(); - ref.setValueExpression("aql:self"); - Option<EObject> result = resolver.resolve(ref, NO_CONTEXT); - assertHasNoValue(result); - } - - @Test - public void computed_reference_with_self_expression_resolves_to_context() { - EObject self = EcoreFactory.eINSTANCE.createEObject(); - ComputedEObjectReference ref = factory.createComputedEObjectReference(); - ref.setValueExpression("aql:self"); - Map<String, Object> context = new HashMap<>(); - context.put("self", self); - Option<EObject> result = resolver.resolve(ref, context); - assertHasExactValue(self, result); - } -} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/SiriusURIQueryTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/SiriusURIQueryTest.java deleted file mode 100644 index aef36b9e7f..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/SiriusURIQueryTest.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.tests.unit.contribution; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.sirius.business.api.query.ViewpointURIQuery; -import org.junit.Assert; -import org.junit.Test; - -/** - * Unit tests for {@link ViewpointURIQuery}. - * - * @author pierre-charles.david@obeo.fr - */ -public class SiriusURIQueryTest { - - @Test - public void null_uri_is_invalid() { - Assert.assertFalse(ViewpointURIQuery.isValidViewpointURI(null)); - } - - @Test - public void blank_uri_is_invalid() { - Assert.assertFalse(ViewpointURIQuery.isValidViewpointURI(URI.createURI(""))); - Assert.assertFalse(ViewpointURIQuery.isValidViewpointURI(URI.createURI(" "))); - } - - @Test - public void http_uri_is_invalid() { - Assert.assertFalse(ViewpointURIQuery.isValidViewpointURI(URI.createURI("htttp://www.eclipse.org/"))); - Assert.assertFalse(ViewpointURIQuery.isValidViewpointURI(URI.createURI("htttp://www.eclipse.org/sirius"))); - } - - @Test - public void basic_viewpoint_query_is_valid() { - URI uri = URI.createURI("viewpoint:/myPlugin/MySirius"); - Assert.assertTrue(ViewpointURIQuery.isValidViewpointURI(uri)); - ViewpointURIQuery q = new ViewpointURIQuery(uri); - Assert.assertNotNull(q); - Assert.assertEquals("myPlugin", q.getPluginId()); - Assert.assertEquals("MySirius", q.getViewpointName()); - } - - @Test - public void plugin_id_can_have_dots() { - URI uri = URI.createURI("viewpoint:/org.eclipse.sirius.tests.something/MySirius"); - Assert.assertTrue(ViewpointURIQuery.isValidViewpointURI(uri)); - ViewpointURIQuery q = new ViewpointURIQuery(uri); - Assert.assertNotNull(q); - Assert.assertEquals("org.eclipse.sirius.tests.something", q.getPluginId()); - Assert.assertEquals("MySirius", q.getViewpointName()); - } - - @Test - public void viewpoint_name_can_have_spaces() { - URI uri = URI.createURI("viewpoint:/org.eclipse.sirius.tests.something/My Viewpoint"); - Assert.assertTrue(ViewpointURIQuery.isValidViewpointURI(uri)); - ViewpointURIQuery q = new ViewpointURIQuery(uri); - Assert.assertNotNull(q); - Assert.assertEquals("org.eclipse.sirius.tests.something", q.getPluginId()); - Assert.assertEquals("My Viewpoint", q.getViewpointName()); - } - -} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/TableContributionTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/TableContributionTest.java deleted file mode 100644 index 1c79117e88..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/TableContributionTest.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.tests.unit.contribution; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.Collections; - -import org.eclipse.emf.common.EMFPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.sirius.business.internal.contribution.ContributionFinder; -import org.eclipse.sirius.business.internal.contribution.ModelContributor; -import org.eclipse.sirius.business.internal.contribution.SiriusReferenceResolver; -import org.eclipse.sirius.common.tools.api.interpreter.CompoundInterpreter; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.ext.emf.AllContents; -import org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage; -import org.eclipse.sirius.table.metamodel.table.description.EditionTableDescription; -import org.eclipse.sirius.table.metamodel.table.description.LineMapping; -import org.eclipse.sirius.tests.SiriusTestsPlugin; -import org.eclipse.sirius.viewpoint.description.Group; -import org.eclipse.sirius.viewpoint.description.Viewpoint; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import com.google.common.base.Objects; -import com.google.common.base.Predicates; -import com.google.common.collect.Iterables; - -/** - * Unit tests for the use of the contribution mechanism on table descriptions. - * - * @author pierre-charles.david@obeo.fr - */ -public class TableContributionTest { - private Resource vsm; - - private SiriusReferenceResolver resolver; - - @BeforeClass - public static void initializeEMF() { - ModelContributionTest.initializeEMF(); - @SuppressWarnings("unused") - EPackage tables = DescriptionPackage.eINSTANCE; - } - - @Before - public void setUp() { - ResourceSet rs = new ResourceSetImpl(); - if (EMFPlugin.IS_ECLIPSE_RUNNING) { - vsm = rs.getResource(URI.createPlatformPluginURI("/" + SiriusTestsPlugin.PLUGIN_ID + "/data/unit/movida/tables.odesign", true), true); - } else { - vsm = rs.getResource(URI.createFileURI("data/unit/movida/tables.odesign"), true); - } - resolver = new SiriusReferenceResolver(CompoundInterpreter.INSTANCE); - } - - @Test - public void vsm_loaded_properly() { - assertNotNull(vsm); - assertEquals(1, vsm.getContents().size()); - assertTrue(vsm.getContents().get(0) instanceof Group); - } - - @Test - public void simple_semantic_candidate_expression_customization() { - Group group = (Group) vsm.getContents().get(0); - - Viewpoint vp1 = group.getOwnedViewpoints().get(0); - EditionTableDescription targetTable = (EditionTableDescription) vp1.getOwnedRepresentations().get(0); - LineMapping targetMapping = targetTable.getAllLineMappings().get(0); - - Viewpoint vp2 = group.getOwnedViewpoints().get(1); - EditionTableDescription sourceTable = (EditionTableDescription) vp2.getOwnedRepresentationExtensions().get(0); - LineMapping sourceMapping = sourceTable.getOwnedLineMappings().get(0); - - Contribution contrib = findFirst(vp2, Contribution.class); - EStructuralFeature feature = DescriptionPackage.eINSTANCE.getLineMapping_SemanticCandidatesExpression(); - contrib.getFeatureMask().get(0).setSourceFeature(feature); - contrib.getFeatureMask().get(0).setTargetFeature(feature); - - assertFalse(Objects.equal(sourceMapping.getSemanticCandidatesExpression(), targetMapping.getSemanticCandidatesExpression())); - ModelContributor mc = new ModelContributor(ContributionFinder.intrinsic(), resolver); - Freezer.freeze(AllContents.of(vp2)); - - mc.apply(vp1, Collections.singletonList((EObject) vp2)); - assertTrue(Objects.equal(sourceMapping.getSemanticCandidatesExpression(), targetMapping.getSemanticCandidatesExpression())); - Freezer.thaw(AllContents.of(vp2)); - } - - private <T> T findFirst(EObject root, Class<T> klass) { - return klass.cast(Iterables.find(AllContents.of(root), Predicates.instanceOf(klass))); - } -} diff --git a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/UpdaterTest.java b/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/UpdaterTest.java deleted file mode 100644 index 791c19b4f3..0000000000 --- a/plugins/org.eclipse.sirius.tests.junit/src/org/eclipse/sirius/tests/unit/contribution/UpdaterTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.tests.unit.contribution; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertSame; - -import java.io.IOException; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.common.EMFPlugin; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.EcoreUtil.Copier; -import org.eclipse.sirius.business.internal.contribution.IdentifierBasedMatcher; -import org.eclipse.sirius.business.internal.contribution.Updater; -import org.eclipse.sirius.ecore.extender.tool.api.ModelUtils; -import org.eclipse.sirius.ext.emf.AllContents; -import org.eclipse.sirius.tests.SiriusTestsPlugin; -import org.eclipse.sirius.viewpoint.description.DescriptionPackage; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -import com.google.common.base.Function; - -/** - * Unit tests for the in-place model {@link Updater}. - * - * @author pierre-charles.david@obeo.fr - */ -@RunWith(value = Parameterized.class) -public class UpdaterTest { - - @Parameters - public static Collection<Object[]> data() { - Object[][] data = new Object[][] { { "original", "add_edge_mapping" }, { "original", "various_changes" }, { "original", "add_layer" }, { "original", "change_attributes" }, - { "original", "reorder_mappings" }, { "interaction", "interaction_modified" }, { "original", "original" }, { "add_layer", "add_layer" }, { "interaction", "interaction" } }; - return Arrays.asList(data); - } - - /** - * Make sure EMF is properly initialized when we are run outside of Eclipse. - */ - @BeforeClass - @SuppressWarnings("unused") - public static void initializeEMF() { - if (!EMFPlugin.IS_ECLIPSE_RUNNING) { - EPackage vsm = DescriptionPackage.eINSTANCE; - EPackage tables = org.eclipse.sirius.table.metamodel.table.description.DescriptionPackage.eINSTANCE; - EPackage sequence = org.eclipse.sirius.diagram.sequence.description.DescriptionPackage.eINSTANCE; - // Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap().put("odesign", - // new XMIResourceFactoryImpl()); - } - } - - private String beforeName; - - private String afterName; - - private EObject v0; - - private EObject v1; - - private ResourceSetImpl rs; - - public UpdaterTest(String beforeName, String afterName) { - this.beforeName = beforeName; - this.afterName = afterName; - } - - @Before - public void setUp() { - rs = new ResourceSetImpl(); - if (EMFPlugin.IS_ECLIPSE_RUNNING) { - v0 = rs.getResource(URI.createPlatformPluginURI("/" + SiriusTestsPlugin.PLUGIN_ID + "/data/unit/movida/" + beforeName + ".odesign", true), true).getContents().get(0); - v1 = rs.getResource(URI.createPlatformPluginURI("/" + SiriusTestsPlugin.PLUGIN_ID + "/data/unit/movida/" + afterName + ".odesign", true), true).getContents().get(0); - } else { - v0 = rs.getResource(URI.createFileURI("data/unit/movida/" + beforeName + ".odesign"), true).getContents().get(0); - v1 = rs.getResource(URI.createFileURI("data/unit/movida/" + afterName + ".odesign"), true).getContents().get(0); - } - EcoreUtil.resolveAll(rs); - } - - @After - public void tearDown() { - v0 = null; - v1 = null; - rs = null; - } - - @Test - public void update_whole_model() throws IOException { - Copier copier = new EcoreUtil.Copier(); - EObject v1Copy = copier.copy(v1); - copier.copyReferences(); - final Map<EObject, Object> inputIds = new HashMap<>(); - addIntrinsicIds(v0, inputIds); - for (EObject obj : AllContents.of(v1, true)) { - inputIds.put(copier.get(obj), getIntrinsicId(obj)); - } - - IdentifierBasedMatcher matcher = new IdentifierBasedMatcher(new Function<EObject, Object>() { - public Object apply(EObject from) { - if (inputIds.containsKey(from)) { - return inputIds.get(from); - } else { - return EcoreUtil.getURI(from); - } - } - }); - if (beforeName.equals(afterName)) { - Freezer.freeze(AllContents.of(v0, true)); - Freezer.freeze(AllContents.of(v1Copy, true)); - } - Updater updater = new Updater(matcher, v0, v1Copy); - EObject result = updater.update(); - - assertSame(result, v0); - String v1Text = ModelUtils.serialize(v1); - String v0Text = ModelUtils.serialize(v0); - assertEquals(v1Text, v0Text); - - if (beforeName.equals(afterName)) { - Freezer.thaw(AllContents.of(v0, true)); - Freezer.thaw(AllContents.of(v1Copy, true)); - } - } - - public void addIntrinsicIds(EObject root, Map<EObject, Object> map) { - for (EObject obj : AllContents.of(root, true)) { - map.put(obj, getIntrinsicId(obj)); - } - } - - private Object getIntrinsicId(EObject obj) { - return obj.eResource().getURIFragment(obj); - } -} diff --git a/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java b/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java index e30c252a82..0d686e771d 100644 --- a/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java +++ b/plugins/org.eclipse.sirius.ui.debug/src/org/eclipse/sirius/ui/debug/SiriusDebugView.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 THALES GLOBAL SERVICES and others. + * Copyright (c) 2010, 2018 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 @@ -79,14 +79,10 @@ import org.eclipse.gmf.runtime.notation.RelativeBendpoints; import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.window.Window; import org.eclipse.sirius.business.api.query.EObjectQuery; import org.eclipse.sirius.business.api.query.SiriusReferenceFinder; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.SessionManager; -import org.eclipse.sirius.business.internal.movida.ViewpointSelection; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistryListener; import org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl; import org.eclipse.sirius.diagram.AbsoluteBoundsFilter; import org.eclipse.sirius.diagram.DDiagramElement; @@ -129,7 +125,6 @@ import org.eclipse.sirius.ext.emf.AllContents; import org.eclipse.sirius.tests.sample.component.Component; import org.eclipse.sirius.tests.sample.component.util.PayloadMarkerAdapter; import org.eclipse.sirius.tests.sample.component.util.PayloadMarkerAdapter.FeatureAccess; -import org.eclipse.sirius.ui.business.api.viewpoint.ViewpointSelectionDialog; import org.eclipse.sirius.ui.debug.ResourceSetTopologyAnalyzer.Reference; import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; import org.eclipse.sirius.viewpoint.DRepresentationElement; @@ -166,8 +161,6 @@ public class SiriusDebugView extends AbstractDebugView { */ protected Map<EObject, Integer> storedPositions; - protected ViewpointRegistry registry; - /** * Returns the text to show in the main text area for the specified object. */ @@ -470,8 +463,6 @@ public class SiriusDebugView extends AbstractDebugView { // addExpandAction(); // addRefreshCoverageAction(); // addRefreshDiagramAction(); - // addStartMovidaRegistryAction(); - // addShowMovidaRegistryStatusAction(); // addSelectReusedSiriussAction(); // addShowCommandStackAction(); // addSiriusSelectionAction(); @@ -933,24 +924,6 @@ public class SiriusDebugView extends AbstractDebugView { }); } - private ViewpointSelection currentSelection = null; - - private void addSiriusSelectionAction() { - addAction("Sirius Selection", new Runnable() { - @Override - public void run() { - ViewpointRegistry reg = (ViewpointRegistry) org.eclipse.sirius.business.api.componentization.ViewpointRegistry.getInstance(); - if (currentSelection == null) { - currentSelection = new ViewpointSelection(reg); - } - ViewpointSelectionDialog dlg = new ViewpointSelectionDialog(getSite().getShell(), reg, currentSelection, null); - if (dlg.open() == Window.OK) { - // Do nothing here. - } - } - }); - } - private void addShowCommandStackAction() { addAction("Show CommandStack", new Runnable() { @Override @@ -1017,50 +990,6 @@ public class SiriusDebugView extends AbstractDebugView { }); } - private void addShowMovidaRegistryStatusAction() { - addAction("Show Registry Status", new Runnable() { - @Override - public void run() { - if (registry != null) { - StringBuilder status = new StringBuilder(); - registry.dumpStatus(status); - setText(status.toString()); - } - } - }); - } - - private void addStartMovidaRegistryAction() { - addAction("Start Registry", new Runnable() { - @Override - public void run() { - if (registry != null) { - registry.stop(); - } - registry = new ViewpointRegistry(); - registry.addListener(new ViewpointRegistryListener() { - @Override - public void registryChanged(ViewpointRegistry registry, Set<URI> removed, Set<URI> added, Set<URI> changed) { - System.out.println(); - System.out.println("Added:"); - for (URI a : added) { - System.out.println(" - " + a); - } - System.out.println("Removed:"); - for (URI r : removed) { - System.out.println(" - " + r); - } - System.out.println("Changed:"); - for (URI c : changed) { - System.out.println(" - " + c); - } - } - }); - registry.start(); - } - }); - } - private void addRefreshDiagramAction() { addAction("Refresh diagram", new Runnable() { @Override diff --git a/plugins/org.eclipse.sirius.ui.ext/plugin.xml b/plugins/org.eclipse.sirius.ui.ext/plugin.xml index 2bb3224172..ac71c3e61c 100644 --- a/plugins/org.eclipse.sirius.ui.ext/plugin.xml +++ b/plugins/org.eclipse.sirius.ui.ext/plugin.xml @@ -109,31 +109,6 @@ </modelExplorerTabExtension> </extension> --> - <!-- - <extension - point="org.eclipse.ui.popupMenus"> - <objectContribution - id="org.eclipse.sirius.ui.business.internal.migration.logicalUriMigration" - nameFilter="*.odesign" - objectClass="org.eclipse.core.resources.IFile"> - <menu - id="org.eclipse.sirius.ui.movida.menu" - label="Movida" - path="additions"> - <separator - name="group"> - </separator> - </menu> - <action - class="org.eclipse.sirius.ui.business.internal.migration.MigrateToLogicalURIsAction" - enablesFor="+" - label="Migrate to Logical URIs" - menubarPath="org.eclipse.sirius.ui.movida.menu/group"> - </action> - </objectContribution> - </extension> - --> - <extension point="org.eclipse.ui.menus"> <menuContribution diff --git a/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF index 4aa0a88b08..5ade50375c 100644 --- a/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF @@ -7,8 +7,7 @@ Bundle-ClassPath: . Bundle-Activator: org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin$Implementation Bundle-Vendor: %providerName Bundle-Localization: plugin -Export-Package: org.eclipse.sirius.description.contribution.provider;version="2.0.4", - org.eclipse.sirius.ui.business.api.action;version="2.0.4", +Export-Package: org.eclipse.sirius.ui.business.api.action;version="2.0.4", org.eclipse.sirius.ui.business.api.delete;version="2.0.4", org.eclipse.sirius.ui.business.api.descriptor;version="2.0.4", org.eclipse.sirius.ui.business.api.dialect;version="3.1.0", diff --git a/plugins/org.eclipse.sirius.ui/plugin.xml b/plugins/org.eclipse.sirius.ui/plugin.xml index 59b487ff7e..8a37746ad7 100644 --- a/plugins/org.eclipse.sirius.ui/plugin.xml +++ b/plugins/org.eclipse.sirius.ui/plugin.xml @@ -582,30 +582,6 @@ </modelExplorerTabExtension> </extension> --> - <!-- - <extension - point="org.eclipse.ui.popupMenus"> - <objectContribution - id="org.eclipse.sirius.ui.business.internal.migration.logicalUriMigration" - nameFilter="*.odesign" - objectClass="org.eclipse.core.resources.IFile"> - <menu - id="org.eclipse.sirius.ui.movida.menu" - label="Movida" - path="additions"> - <separator - name="group"> - </separator> - </menu> - <action - class="org.eclipse.sirius.ui.business.internal.migration.MigrateToLogicalURIsAction" - enablesFor="+" - label="Migrate to Logical URIs" - menubarPath="org.eclipse.sirius.ui.movida.menu/group"> - </action> - </objectContribution> - </extension> - --> <extension point="org.eclipse.ui.commands"> diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/AddFeatureContributionItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/AddFeatureContributionItemProvider.java deleted file mode 100644 index 8eb4dc2096..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/AddFeatureContributionItemProvider.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.sirius.description.contribution.AddFeatureContribution; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.AddFeatureContribution} - * object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class AddFeatureContributionItemProvider extends FeatureContributionItemProvider { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public AddFeatureContributionItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This returns AddFeatureContribution.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/AddFeatureContribution")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @not-generated - */ - @Override - public String getText(Object object) { - String result = getString("_UI_AddFeatureContribution_type"); //$NON-NLS-1$ - if (object instanceof AddFeatureContribution) { - AddFeatureContribution afc = (AddFeatureContribution) object; - result += " target." + featureString(afc.getTargetFeature()) + " += source." + featureString(afc.getSourceFeature()); //$NON-NLS-1$ //$NON-NLS-2$ - } - return result; - } - - private String featureString(EStructuralFeature feature) { - if (feature != null) { - return feature.getName(); - } else { - return "[unset]"; //$NON-NLS-1$ - } - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ClearFeatureContributionItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ClearFeatureContributionItemProvider.java deleted file mode 100644 index 1f18ce927f..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ClearFeatureContributionItemProvider.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.sirius.description.contribution.ClearFeatureContribution; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.ClearFeatureContribution} - * object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class ClearFeatureContributionItemProvider extends FeatureContributionItemProvider { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ClearFeatureContributionItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This returns ClearFeatureContribution.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/ClearFeatureContribution")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @not-generated - */ - @Override - public String getText(Object object) { - String result = getString("_UI_ClearFeatureContribution_type"); //$NON-NLS-1$ - if (object instanceof ClearFeatureContribution) { - ClearFeatureContribution cfc = (ClearFeatureContribution) object; - result += " target." + featureString(cfc.getTargetFeature()); //$NON-NLS-1$ - } - return result; - } - - private String featureString(EStructuralFeature feature) { - if (feature != null) { - return feature.getName(); - } else { - return "[unset]"; //$NON-NLS-1$ - } - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ComputedEObjectReferenceItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ComputedEObjectReferenceItemProvider.java deleted file mode 100644 index e41e89be6b..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ComputedEObjectReferenceItemProvider.java +++ /dev/null @@ -1,152 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.sirius.common.tools.api.util.StringUtil; -import org.eclipse.sirius.description.contribution.ComputedEObjectReference; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.ComputedEObjectReference} - * object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class ComputedEObjectReferenceItemProvider extends ItemProviderAdapter - implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ComputedEObjectReferenceItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addValueExpressionPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Value Expression feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected void addValueExpressionPropertyDescriptor(Object object) { - itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), - getString("_UI_ComputedEObjectReference_valueExpression_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ComputedEObjectReference_valueExpression_feature", "_UI_ComputedEObjectReference_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ContributionPackage.Literals.COMPUTED_EOBJECT_REFERENCE__VALUE_EXPRESSION, true, false, true, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString("_UI_GeneralPropertyCategory"), //$NON-NLS-1$ - null)); - } - - /** - * This returns ComputedEObjectReference.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/ComputedEObjectReference")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @not-generated - */ - @Override - public String getText(Object object) { - String result = getString("_UI_ComputedEObjectReference_type"); //$NON-NLS-1$ - if (object instanceof ComputedEObjectReference) { - ComputedEObjectReference ref = (ComputedEObjectReference) object; - if (ref.eContainer() != null && ref.eContainingFeature() == ContributionPackage.eINSTANCE.getContribution_Source()) { - result = "Source " + result; //$NON-NLS-1$ - } else if (ref.eContainer() != null && ref.eContainingFeature() == ContributionPackage.eINSTANCE.getContribution_Target()) { - result = "Target " + result; //$NON-NLS-1$ - } - if (!StringUtil.isEmpty(ref.getValueExpression())) { - result = result + " to: " + ref.getValueExpression(); //$NON-NLS-1$ - } - } - return result; - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(ComputedEObjectReference.class)) { - case ContributionPackage.COMPUTED_EOBJECT_REFERENCE__VALUE_EXPRESSION: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ResourceLocator getResourceLocator() { - return SiriusEditPlugin.INSTANCE; - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionItemProvider.java deleted file mode 100644 index 71bb907264..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionItemProvider.java +++ /dev/null @@ -1,219 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionFactory; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.Contribution} object. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class ContributionItemProvider extends ItemProviderAdapter - implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ContributionItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addDescriptionPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Description feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected void addDescriptionPropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Contribution_description_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_Contribution_description_feature", "_UI_Contribution_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ContributionPackage.Literals.CONTRIBUTION__DESCRIPTION, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/Contribution")); //$NON-NLS-1$ - } - - /** - * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an - * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or - * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - @Override - public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { - if (childrenFeatures == null) { - super.getChildrenFeatures(object); - childrenFeatures.add(ContributionPackage.Literals.CONTRIBUTION__SOURCE); - childrenFeatures.add(ContributionPackage.Literals.CONTRIBUTION__TARGET); - childrenFeatures.add(ContributionPackage.Literals.CONTRIBUTION__FEATURE_MASK); - childrenFeatures.add(ContributionPackage.Literals.CONTRIBUTION__SUB_CONTRIBUTIONS); - } - return childrenFeatures; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EStructuralFeature getChildFeature(Object object, Object child) { - // Check the type of the specified child object and return the proper - // feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildFeature(object, child); - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String getText(Object object) { - String label = ((Contribution) object).getDescription(); - return label == null || label.length() == 0 ? getString("_UI_Contribution_type") : //$NON-NLS-1$ - getString("_UI_Contribution_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(Contribution.class)) { - case ContributionPackage.CONTRIBUTION__DESCRIPTION: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - case ContributionPackage.CONTRIBUTION__SOURCE: - case ContributionPackage.CONTRIBUTION__TARGET: - case ContributionPackage.CONTRIBUTION__FEATURE_MASK: - case ContributionPackage.CONTRIBUTION__SUB_CONTRIBUTIONS: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__SOURCE, ContributionFactory.eINSTANCE.createDirectEObjectReference())); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__SOURCE, ContributionFactory.eINSTANCE.createComputedEObjectReference())); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__TARGET, ContributionFactory.eINSTANCE.createDirectEObjectReference())); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__TARGET, ContributionFactory.eINSTANCE.createComputedEObjectReference())); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__FEATURE_MASK, ContributionFactory.eINSTANCE.createIgnoreFeatureContribution())); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__FEATURE_MASK, ContributionFactory.eINSTANCE.createSetFeatureContribution())); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__FEATURE_MASK, ContributionFactory.eINSTANCE.createAddFeatureContribution())); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__FEATURE_MASK, ContributionFactory.eINSTANCE.createRemoveFeatureContribution())); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__FEATURE_MASK, ContributionFactory.eINSTANCE.createClearFeatureContribution())); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__FEATURE_MASK, ContributionFactory.eINSTANCE.createResetFeatureContribution())); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION__SUB_CONTRIBUTIONS, ContributionFactory.eINSTANCE.createContribution())); - } - - /** - * This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - @Override - public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { - Object childFeature = feature; - Object childObject = child; - - boolean qualify = childFeature == ContributionPackage.Literals.CONTRIBUTION__SOURCE || childFeature == ContributionPackage.Literals.CONTRIBUTION__TARGET; - - if (qualify) { - return getString("_UI_CreateChild_text2", //$NON-NLS-1$ - new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); - } - return super.getCreateChildText(owner, feature, child, selection); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ResourceLocator getResourceLocator() { - return SiriusEditPlugin.INSTANCE; - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionItemProviderAdapterFactory.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionItemProviderAdapterFactory.java deleted file mode 100644 index bbe9a4e0f4..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionItemProviderAdapterFactory.java +++ /dev/null @@ -1,450 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.ArrayList; -import java.util.Collection; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.edit.provider.ChangeNotifier; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.ComposedAdapterFactory; -import org.eclipse.emf.edit.provider.IChangeNotifier; -import org.eclipse.emf.edit.provider.IDisposable; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.INotifyChangedListener; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.sirius.description.contribution.util.ContributionAdapterFactory; - -/** - * This is the factory that is used to provide the interfaces needed to support Viewers. The adapters generated by this - * factory convert EMF adapter notifications into calls to {@link #fireNotifyChanged fireNotifyChanged}. The adapters - * also support Eclipse property sheets. Note that most of the adapters are shared among multiple instances. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class ContributionItemProviderAdapterFactory extends ContributionAdapterFactory implements ComposeableAdapterFactory, IChangeNotifier, IDisposable { - /** - * This keeps track of the root adapter factory that delegates to this adapter factory. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected ComposedAdapterFactory parentAdapterFactory; - - /** - * This is used to implement {@link org.eclipse.emf.edit.provider.IChangeNotifier}. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected IChangeNotifier changeNotifier = new ChangeNotifier(); - - /** - * This keeps track of all the supported types checked by {@link #isFactoryForType isFactoryForType}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected Collection<Object> supportedTypes = new ArrayList<Object>(); - - /** - * This constructs an instance. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ContributionItemProviderAdapterFactory() { - supportedTypes.add(IEditingDomainItemProvider.class); - supportedTypes.add(IStructuredItemContentProvider.class); - supportedTypes.add(ITreeItemContentProvider.class); - supportedTypes.add(IItemLabelProvider.class); - supportedTypes.add(IItemPropertySource.class); - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.description.contribution.IgnoreFeatureContribution} instances. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected IgnoreFeatureContributionItemProvider ignoreFeatureContributionItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.sirius.description.contribution.IgnoreFeatureContribution} . - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Adapter createIgnoreFeatureContributionAdapter() { - if (ignoreFeatureContributionItemProvider == null) { - ignoreFeatureContributionItemProvider = new IgnoreFeatureContributionItemProvider(this); - } - - return ignoreFeatureContributionItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.description.contribution.SetFeatureContribution} instances. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected SetFeatureContributionItemProvider setFeatureContributionItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.sirius.description.contribution.SetFeatureContribution} . <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Adapter createSetFeatureContributionAdapter() { - if (setFeatureContributionItemProvider == null) { - setFeatureContributionItemProvider = new SetFeatureContributionItemProvider(this); - } - - return setFeatureContributionItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.description.contribution.AddFeatureContribution} instances. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected AddFeatureContributionItemProvider addFeatureContributionItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.sirius.description.contribution.AddFeatureContribution} . <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Adapter createAddFeatureContributionAdapter() { - if (addFeatureContributionItemProvider == null) { - addFeatureContributionItemProvider = new AddFeatureContributionItemProvider(this); - } - - return addFeatureContributionItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.description.contribution.RemoveFeatureContribution} instances. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected RemoveFeatureContributionItemProvider removeFeatureContributionItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.sirius.description.contribution.RemoveFeatureContribution} . - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Adapter createRemoveFeatureContributionAdapter() { - if (removeFeatureContributionItemProvider == null) { - removeFeatureContributionItemProvider = new RemoveFeatureContributionItemProvider(this); - } - - return removeFeatureContributionItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.description.contribution.ClearFeatureContribution} instances. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected ClearFeatureContributionItemProvider clearFeatureContributionItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.sirius.description.contribution.ClearFeatureContribution} . <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Adapter createClearFeatureContributionAdapter() { - if (clearFeatureContributionItemProvider == null) { - clearFeatureContributionItemProvider = new ClearFeatureContributionItemProvider(this); - } - - return clearFeatureContributionItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.description.contribution.ResetFeatureContribution} instances. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected ResetFeatureContributionItemProvider resetFeatureContributionItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.sirius.description.contribution.ResetFeatureContribution} . <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Adapter createResetFeatureContributionAdapter() { - if (resetFeatureContributionItemProvider == null) { - resetFeatureContributionItemProvider = new ResetFeatureContributionItemProvider(this); - } - - return resetFeatureContributionItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.description.contribution.DirectEObjectReference} instances. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected DirectEObjectReferenceItemProvider directEObjectReferenceItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.sirius.description.contribution.DirectEObjectReference} . <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Adapter createDirectEObjectReferenceAdapter() { - if (directEObjectReferenceItemProvider == null) { - directEObjectReferenceItemProvider = new DirectEObjectReferenceItemProvider(this); - } - - return directEObjectReferenceItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.description.contribution.ComputedEObjectReference} instances. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - protected ComputedEObjectReferenceItemProvider computedEObjectReferenceItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.sirius.description.contribution.ComputedEObjectReference} . <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Adapter createComputedEObjectReferenceAdapter() { - if (computedEObjectReferenceItemProvider == null) { - computedEObjectReferenceItemProvider = new ComputedEObjectReferenceItemProvider(this); - } - - return computedEObjectReferenceItemProvider; - } - - /** - * This keeps track of the one adapter used for all {@link org.eclipse.sirius.description.contribution.Contribution} - * instances. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ContributionItemProvider contributionItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.sirius.description.contribution.Contribution}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Adapter createContributionAdapter() { - if (contributionItemProvider == null) { - contributionItemProvider = new ContributionItemProvider(this); - } - - return contributionItemProvider; - } - - /** - * This keeps track of the one adapter used for all - * {@link org.eclipse.sirius.description.contribution.ContributionPoint} instances. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - protected ContributionPointItemProvider contributionPointItemProvider; - - /** - * This creates an adapter for a {@link org.eclipse.sirius.description.contribution.ContributionPoint}. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Adapter createContributionPointAdapter() { - if (contributionPointItemProvider == null) { - contributionPointItemProvider = new ContributionPointItemProvider(this); - } - - return contributionPointItemProvider; - } - - /** - * This returns the root adapter factory that contains this factory. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ComposeableAdapterFactory getRootAdapterFactory() { - return parentAdapterFactory == null ? this : parentAdapterFactory.getRootAdapterFactory(); - } - - /** - * This sets the composed adapter factory that contains this factory. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) { - this.parentAdapterFactory = parentAdapterFactory; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean isFactoryForType(Object type) { - return supportedTypes.contains(type) || super.isFactoryForType(type); - } - - /** - * This implementation substitutes the factory itself as the key for the adapter. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - @Override - public Adapter adapt(Notifier notifier, Object type) { - return super.adapt(notifier, this); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object adapt(Object object, Object type) { - if (isFactoryForType(type)) { - Object adapter = super.adapt(object, type); - if (!(type instanceof Class<?>) || (((Class<?>) type).isInstance(adapter))) { - return adapter; - } - } - - return null; - } - - /** - * This adds a listener. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void addListener(INotifyChangedListener notifyChangedListener) { - changeNotifier.addListener(notifyChangedListener); - } - - /** - * This removes a listener. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void removeListener(INotifyChangedListener notifyChangedListener) { - changeNotifier.removeListener(notifyChangedListener); - } - - /** - * This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - @Override - public void fireNotifyChanged(Notification notification) { - changeNotifier.fireNotifyChanged(notification); - - if (parentAdapterFactory != null) { - parentAdapterFactory.fireNotifyChanged(notification); - } - } - - /** - * This disposes all of the item providers created by this factory. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void dispose() { - if (ignoreFeatureContributionItemProvider != null) { - ignoreFeatureContributionItemProvider.dispose(); - } - if (setFeatureContributionItemProvider != null) { - setFeatureContributionItemProvider.dispose(); - } - if (addFeatureContributionItemProvider != null) { - addFeatureContributionItemProvider.dispose(); - } - if (removeFeatureContributionItemProvider != null) { - removeFeatureContributionItemProvider.dispose(); - } - if (clearFeatureContributionItemProvider != null) { - clearFeatureContributionItemProvider.dispose(); - } - if (resetFeatureContributionItemProvider != null) { - resetFeatureContributionItemProvider.dispose(); - } - if (directEObjectReferenceItemProvider != null) { - directEObjectReferenceItemProvider.dispose(); - } - if (computedEObjectReferenceItemProvider != null) { - computedEObjectReferenceItemProvider.dispose(); - } - if (contributionItemProvider != null) { - contributionItemProvider.dispose(); - } - if (contributionPointItemProvider != null) { - contributionPointItemProvider.dispose(); - } - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionPointItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionPointItemProvider.java deleted file mode 100644 index 7027c5373f..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionPointItemProvider.java +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.ContributionPoint; -import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.ContributionPoint} object. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class ContributionPointItemProvider extends ItemProviderAdapter - implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ContributionPointItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addOriginPropertyDescriptor(object); - addContributedPropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Origin feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected void addOriginPropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_ContributionPoint_origin_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ContributionPoint_origin_feature", "_UI_ContributionPoint_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ContributionPackage.Literals.CONTRIBUTION_POINT__ORIGIN, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); - } - - /** - * This adds a property descriptor for the Contributed feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected void addContributedPropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_ContributionPoint_contributed_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_ContributionPoint_contributed_feature", "_UI_ContributionPoint_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ContributionPackage.Literals.CONTRIBUTION_POINT__CONTRIBUTED, true, false, true, null, null, null)); - } - - /** - * This returns ContributionPoint.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/ContributionPoint")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String getText(Object object) { - String label = ((ContributionPoint) object).getOrigin(); - return label == null || label.length() == 0 ? getString("_UI_ContributionPoint_type") : //$NON-NLS-1$ - getString("_UI_ContributionPoint_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(ContributionPoint.class)) { - case ContributionPackage.CONTRIBUTION_POINT__ORIGIN: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ResourceLocator getResourceLocator() { - return SiriusEditPlugin.INSTANCE; - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionProviderItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionProviderItemProvider.java deleted file mode 100644 index 9a8c514223..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ContributionProviderItemProvider.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.sirius.description.contribution.ContributionFactory; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.ContributionProvider; -import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.ContributionProvider} - * object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class ContributionProviderItemProvider extends ItemProviderAdapter - implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ContributionProviderItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an - * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or - * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - @Override - public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { - if (childrenFeatures == null) { - super.getChildrenFeatures(object); - childrenFeatures.add(ContributionPackage.Literals.CONTRIBUTION_PROVIDER__CONTRIBUTIONS); - } - return childrenFeatures; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EStructuralFeature getChildFeature(Object object, Object child) { - // Check the type of the specified child object and return the proper - // feature to use for - // adding (see {@link AddCommand}) it as a child. - - return super.getChildFeature(object, child); - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String getText(Object object) { - return getString("_UI_ContributionProvider_type"); //$NON-NLS-1$ - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(ContributionProvider.class)) { - case ContributionPackage.CONTRIBUTION_PROVIDER__CONTRIBUTIONS: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - - newChildDescriptors.add(createChildParameter(ContributionPackage.Literals.CONTRIBUTION_PROVIDER__CONTRIBUTIONS, ContributionFactory.eINSTANCE.createContribution())); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ResourceLocator getResourceLocator() { - return SiriusEditPlugin.INSTANCE; - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/DirectEObjectReferenceItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/DirectEObjectReferenceItemProvider.java deleted file mode 100644 index 0faf064d2b..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/DirectEObjectReferenceItemProvider.java +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.DirectEObjectReference} - * object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class DirectEObjectReferenceItemProvider extends ItemProviderAdapter - implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public DirectEObjectReferenceItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addValuePropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Value feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected void addValuePropertyDescriptor(Object object) { - itemPropertyDescriptors - .add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_DirectEObjectReference_value_feature"), //$NON-NLS-1$ - getString("_UI_PropertyDescriptor_description", "_UI_DirectEObjectReference_value_feature", "_UI_DirectEObjectReference_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - ContributionPackage.Literals.DIRECT_EOBJECT_REFERENCE__VALUE, true, false, true, null, getString("_UI_GeneralPropertyCategory"), //$NON-NLS-1$ - null)); - } - - /** - * This returns DirectEObjectReference.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/DirectEObjectReference")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @not-generated - */ - @Override - public String getText(Object object) { - String result = getString("_UI_DirectEObjectReference_type"); //$NON-NLS-1$ - if (object instanceof DirectEObjectReference) { - DirectEObjectReference ref = (DirectEObjectReference) object; - if (ref.eContainer() != null && ref.eContainingFeature() == ContributionPackage.eINSTANCE.getContribution_Source()) { - result = "Source " + result; //$NON-NLS-1$ - } else if (ref.eContainer() != null && ref.eContainingFeature() == ContributionPackage.eINSTANCE.getContribution_Target()) { - result = "Target " + result; //$NON-NLS-1$ - } - if (ref.getValue() == null) { - result += " [unset]"; //$NON-NLS-1$ - } else { - AdapterFactory ipaf = SiriusEditPlugin.getPlugin().getItemProvidersAdapterFactory(); - result += " to: " + ((IItemLabelProvider) ipaf.adapt(ref.getValue(), IItemLabelProvider.class)).getText(ref.getValue()); //$NON-NLS-1$ - result += " (" + ref.getValue().eClass().getName() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - return result; - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(DirectEObjectReference.class)) { - case ContributionPackage.DIRECT_EOBJECT_REFERENCE__VALUE: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ResourceLocator getResourceLocator() { - return SiriusEditPlugin.INSTANCE; - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/FeatureContributionItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/FeatureContributionItemProvider.java deleted file mode 100644 index d6cc017625..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/FeatureContributionItemProvider.java +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.util.ResourceLocator; -import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; -import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; -import org.eclipse.emf.edit.provider.IItemLabelProvider; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.emf.edit.provider.IItemPropertySource; -import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; -import org.eclipse.emf.edit.provider.ITreeItemContentProvider; -import org.eclipse.emf.edit.provider.ItemProviderAdapter; -import org.eclipse.emf.edit.provider.ViewerNotification; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.FeatureContribution; -import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.FeatureContribution} - * object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class FeatureContributionItemProvider extends ItemProviderAdapter - implements IEditingDomainItemProvider, IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public FeatureContributionItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - addSourceFeaturePropertyDescriptor(object); - addTargetFeaturePropertyDescriptor(object); - } - return itemPropertyDescriptors; - } - - /** - * This adds a property descriptor for the Source Feature feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected void addSourceFeaturePropertyDescriptor(Object object) { - itemPropertyDescriptors.add( - createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_FeatureContribution_sourceFeature_feature"), //$NON-NLS-1$ - getString("_UI_FeatureContribution_sourceFeature_description"), //$NON-NLS-1$ - ContributionPackage.Literals.FEATURE_CONTRIBUTION__SOURCE_FEATURE, true, false, true, null, getString("_UI_GeneralPropertyCategory"), //$NON-NLS-1$ - null)); - } - - /** - * This adds a property descriptor for the Target Feature feature. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected void addTargetFeaturePropertyDescriptor(Object object) { - itemPropertyDescriptors.add( - createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_FeatureContribution_targetFeature_feature"), //$NON-NLS-1$ - getString("_UI_FeatureContribution_targetFeature_description"), //$NON-NLS-1$ - ContributionPackage.Literals.FEATURE_CONTRIBUTION__TARGET_FEATURE, true, false, true, null, getString("_UI_GeneralPropertyCategory"), //$NON-NLS-1$ - null)); - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String getText(Object object) { - return getString("_UI_FeatureContribution_type"); //$NON-NLS-1$ - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - - switch (notification.getFeatureID(FeatureContribution.class)) { - case ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE: - case ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE: - fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); - return; - } - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - - /** - * Return the resource locator for this item provider's resources. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ResourceLocator getResourceLocator() { - return SiriusEditPlugin.INSTANCE; - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/IgnoreFeatureContributionItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/IgnoreFeatureContributionItemProvider.java deleted file mode 100644 index 0079abb8b4..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/IgnoreFeatureContributionItemProvider.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.sirius.description.contribution.IgnoreFeatureContribution; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.IgnoreFeatureContribution} - * object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class IgnoreFeatureContributionItemProvider extends FeatureContributionItemProvider { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public IgnoreFeatureContributionItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This returns IgnoreFeatureContribution.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/IgnoreFeatureContribution")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @not-generated - */ - @Override - public String getText(Object object) { - String result = getString("_UI_IgnoreFeatureContribution_type"); //$NON-NLS-1$ - if (object instanceof IgnoreFeatureContribution) { - IgnoreFeatureContribution ifc = (IgnoreFeatureContribution) object; - result += " " + featureString(ifc.getTargetFeature()); //$NON-NLS-1$ - } - return result; - } - - private String featureString(EStructuralFeature feature) { - if (feature != null) { - return feature.getName(); - } else { - return "[unset]"; //$NON-NLS-1$ - } - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/RemoveFeatureContributionItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/RemoveFeatureContributionItemProvider.java deleted file mode 100644 index 51b3e9c265..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/RemoveFeatureContributionItemProvider.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.sirius.description.contribution.RemoveFeatureContribution; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.RemoveFeatureContribution} - * object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class RemoveFeatureContributionItemProvider extends FeatureContributionItemProvider { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public RemoveFeatureContributionItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This returns RemoveFeatureContribution.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/RemoveFeatureContribution")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @not-generated - */ - @Override - public String getText(Object object) { - String result = getString("_UI_RemoveFeatureContribution_type"); //$NON-NLS-1$ - if (object instanceof RemoveFeatureContribution) { - RemoveFeatureContribution rfc = (RemoveFeatureContribution) object; - result += " target." + featureString(rfc.getTargetFeature()) + " -= source." + featureString(rfc.getSourceFeature()); //$NON-NLS-1$ //$NON-NLS-2$ - } - return result; - } - - private String featureString(EStructuralFeature feature) { - if (feature != null) { - return feature.getName(); - } else { - return "[unset]"; //$NON-NLS-1$ - } - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ResetFeatureContributionItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ResetFeatureContributionItemProvider.java deleted file mode 100644 index 9a9b0d2876..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/ResetFeatureContributionItemProvider.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.sirius.description.contribution.ResetFeatureContribution; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.ResetFeatureContribution} - * object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class ResetFeatureContributionItemProvider extends FeatureContributionItemProvider { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ResetFeatureContributionItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This returns ResetFeatureContribution.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/ResetFeatureContribution")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @not-generated - */ - @Override - public String getText(Object object) { - String result = getString("_UI_ResetFeatureContribution_type"); //$NON-NLS-1$ - if (object instanceof ResetFeatureContribution) { - ResetFeatureContribution rfc = (ResetFeatureContribution) object; - result += " target." + featureString(rfc.getTargetFeature()); //$NON-NLS-1$ - } - return result; - } - - private String featureString(EStructuralFeature feature) { - if (feature != null) { - return feature.getName(); - } else { - return "[unset]"; //$NON-NLS-1$ - } - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/SetFeatureContributionItemProvider.java b/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/SetFeatureContributionItemProvider.java deleted file mode 100644 index 87cae1d2a1..0000000000 --- a/plugins/org.eclipse.sirius.ui/src-gen/org/eclipse/sirius/description/contribution/provider/SetFeatureContributionItemProvider.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.provider; - -import java.util.Collection; -import java.util.List; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; -import org.eclipse.sirius.description.contribution.SetFeatureContribution; - -/** - * This is the item provider adapter for a {@link org.eclipse.sirius.description.contribution.SetFeatureContribution} - * object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ -public class SetFeatureContributionItemProvider extends FeatureContributionItemProvider { - /** - * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public SetFeatureContributionItemProvider(AdapterFactory adapterFactory) { - super(adapterFactory); - } - - /** - * This returns the property descriptors for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { - if (itemPropertyDescriptors == null) { - super.getPropertyDescriptors(object); - - } - return itemPropertyDescriptors; - } - - /** - * This returns SetFeatureContribution.gif. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object getImage(Object object) { - return overlayImage(object, getResourceLocator().getImage("full/obj16/SetFeatureContribution")); //$NON-NLS-1$ - } - - /** - * This returns the label text for the adapted class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @not-generated - */ - @Override - public String getText(Object object) { - String result = getString("_UI_SetFeatureContribution_type"); //$NON-NLS-1$ - if (object instanceof SetFeatureContribution) { - SetFeatureContribution sfc = (SetFeatureContribution) object; - result += " target." + featureString(sfc.getTargetFeature()) + " = source." + featureString(sfc.getSourceFeature()); //$NON-NLS-1$ //$NON-NLS-2$ - } - return result; - } - - private String featureString(EStructuralFeature feature) { - if (feature != null) { - return feature.getName(); - } else { - return "[unset]"; //$NON-NLS-1$ - } - } - - /** - * This handles model notifications by calling {@link #updateChildren} to update any cached children and by creating - * a viewer notification, which it passes to {@link #fireNotifyChanged}. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - */ - @Override - public void notifyChanged(Notification notification) { - updateChildren(notification); - super.notifyChanged(notification); - } - - /** - * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children that can be created - * under this object. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { - super.collectNewChildDescriptors(newChildDescriptors, object); - } - -} diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelection.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelection.java index 698658e617..b7fd9f77cd 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelection.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 THALES GLOBAL SERVICES and others. + * Copyright (c) 2008, 2018 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 @@ -27,13 +27,8 @@ import java.util.regex.Pattern; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.CheckboxCellEditor; @@ -52,18 +47,13 @@ import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.IWizardContainer; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.sirius.business.api.componentization.ViewpointRegistry; -import org.eclipse.sirius.business.api.helper.SiriusResourceHelper; import org.eclipse.sirius.business.api.query.IdentifiedElementQuery; import org.eclipse.sirius.business.api.query.ViewpointQuery; import org.eclipse.sirius.business.api.session.Session; -import org.eclipse.sirius.business.api.session.danalysis.DAnalysisSession; -import org.eclipse.sirius.business.api.session.danalysis.DAnalysisSessionHelper; -import org.eclipse.sirius.business.internal.movida.Movida; import org.eclipse.sirius.common.tools.api.util.EqualityHelper; import org.eclipse.sirius.common.tools.api.util.StringUtil; import org.eclipse.sirius.common.ui.tools.api.util.SWTUtil; import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ui.business.internal.commands.ChangeViewpointSelectionCommand; import org.eclipse.sirius.ui.tools.internal.viewpoint.ViewpointHelper; import org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; @@ -76,7 +66,6 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Item; -import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.ui.PlatformUI; @@ -285,24 +274,12 @@ public final class ViewpointSelection { * at true for selected {@link Viewpoint}. */ public static void openViewpointsSelectionDialog(final Session session, boolean createNewRepresentations) { - if (Movida.isEnabled()) { - session.getSemanticCrossReferencer(); - org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry registry = (org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry) ViewpointRegistry.getInstance(); - org.eclipse.sirius.business.internal.movida.ViewpointSelection selection = DAnalysisSessionHelper.getViewpointSelection(registry, (DAnalysisSession) session); - Set<URI> selectedBefore = selection.getSelected(); - ViewpointSelectionDialog vsd = new ViewpointSelectionDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), registry, selection, - ViewpointSelection.getSemanticFileExtensions(session)); - if (vsd.open() == Window.OK) { - ViewpointSelection.applyViewpointSelectionChange(session, selection, selectedBefore); - } - } else { - session.getSemanticCrossReferencer(); - final SortedMap<Viewpoint, Boolean> viewpointsMap = ViewpointSelection.getViewpointsWithMonitor(session); - org.eclipse.sirius.ui.business.internal.viewpoint.ViewpointSelectionDialog vsd = new org.eclipse.sirius.ui.business.internal.viewpoint.ViewpointSelectionDialog( - PlatformUI.getWorkbench().getDisplay().getActiveShell(), viewpointsMap); - if (vsd.open() == Window.OK) { - ViewpointHelper.applyNewViewpointSelection(viewpointsMap, vsd.getSelection(), session, createNewRepresentations, new ViewpointSelectionCallbackWithConfimation()); - } + session.getSemanticCrossReferencer(); + final SortedMap<Viewpoint, Boolean> viewpointsMap = ViewpointSelection.getViewpointsWithMonitor(session); + org.eclipse.sirius.ui.business.internal.viewpoint.ViewpointSelectionDialog vsd = new org.eclipse.sirius.ui.business.internal.viewpoint.ViewpointSelectionDialog( + PlatformUI.getWorkbench().getDisplay().getActiveShell(), viewpointsMap); + if (vsd.open() == Window.OK) { + ViewpointHelper.applyNewViewpointSelection(viewpointsMap, vsd.getSelection(), session, createNewRepresentations, new ViewpointSelectionCallbackWithConfimation()); } } @@ -331,56 +308,6 @@ public final class ViewpointSelection { return sb.toString(); } - private static void applyViewpointSelectionChange(final Session session, org.eclipse.sirius.business.internal.movida.ViewpointSelection selection, Set<URI> selectedBefore) { - Set<URI> selectedAfter = selection.getSelected(); - Set<URI> newSelected = Sets.difference(selectedAfter, selectedBefore); - Set<URI> newDeselected = Sets.difference(selectedBefore, selectedAfter); - final ViewpointSelection.Callback callback = new ViewpointSelectionCallbackWithConfimation(); - final Set<Viewpoint> newSelectedViewpoints = Sets.newHashSet(Iterables.transform(newSelected, new Function<URI, Viewpoint>() { - @Override - public Viewpoint apply(URI from) { - return SiriusResourceHelper.getCorrespondingViewpoint(session, from, true).get(); - } - })); - final Set<Viewpoint> newDeselectedViewpoints = Sets.newHashSet(Iterables.transform(newDeselected, new Function<URI, Viewpoint>() { - @Override - public Viewpoint apply(URI from) { - return SiriusResourceHelper.getCorrespondingViewpoint(session, from, true).get(); - } - })); - // Only if there is something to do - if (!newSelected.isEmpty() || !newDeselected.isEmpty()) { - - try { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); - IRunnableContext context = new ProgressMonitorDialog(shell); - IRunnableWithProgress runnable = new IRunnableWithProgress() { - @Override - public void run(final IProgressMonitor monitor) { - try { - monitor.beginTask(Messages.ViewpointSelection_applySelectionTask, 1); - SubMonitor subMonitor = SubMonitor.convert(monitor, 1); - Command command = new ChangeViewpointSelectionCommand(session, callback, newSelectedViewpoints, newDeselectedViewpoints, subMonitor); - TransactionalEditingDomain domain = session.getTransactionalEditingDomain(); - domain.getCommandStack().execute(command); - } finally { - monitor.done(); - } - } - - }; - PlatformUI.getWorkbench().getProgressService().runInUI(context, runnable, null); - } catch (final InvocationTargetException e) { - if (e.getCause() instanceof RuntimeException) { - throw (RuntimeException) e.getCause(); - } - throw new RuntimeException(e); - } catch (final InterruptedException e) { - throw new RuntimeException(e); - } - } - } - /** * Compute the missing viewpoint dependencies (if any) for all the viewpoints enabled by the user. * diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionDialog.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionDialog.java deleted file mode 100644 index 8a941f173a..0000000000 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/business/api/viewpoint/ViewpointSelectionDialog.java +++ /dev/null @@ -1,445 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.ui.business.api.viewpoint; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.viewers.CellLabelProvider; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTreeViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerCell; -import org.eclipse.sirius.business.api.query.IdentifiedElementQuery; -import org.eclipse.sirius.business.api.query.ViewpointQuery; -import org.eclipse.sirius.business.internal.movida.ViewpointDependenciesTracker; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; -import org.eclipse.sirius.viewpoint.description.Viewpoint; -import org.eclipse.sirius.viewpoint.provider.Messages; -import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.ScrolledComposite; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -import com.google.common.base.Function; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Multimap; -import com.google.common.collect.Ordering; - -/** - * A dialog box which allow end-users to select which viewpoints are enabled - * inside a session. - * - * @author pierre-charles.david@obeo.fr - */ -public class ViewpointSelectionDialog extends TitleAreaDialog { - /** - * The possible states for an item in the selection dialog. - */ - enum State { - /** - * The item is checked, meaning the corresponding viewpoints and all the - * item's parent are part of the selection. - */ - CHECKED, - /** - * The item is checked, but grayed out, meaning the corresponding - * viewpoint is part of the selection, but the item's parent is not. - * This is possible if a viewpoint appears as a sub-item of several - * other viewpoints. - */ - GRAY_CHECKED, - /** - * The item is unchecked, meaning the corresponding viewpoints is not - * part of the selection. - */ - UNCHECKED, - } - - // CHECKSTYLE:OFF - private class Item { - public final Viewpoint viewpoint; - - public final Item parent; - - public final List<Item> descendants = new ArrayList<>(); - - public Item(Item parent, Viewpoint vp) { - this.parent = parent; - this.viewpoint = vp; - index.put(viewpoint, this); - } - - public String getLabel() { - return new IdentifiedElementQuery(viewpoint).getLabel(); - } - - public URI getViewpointURI() { - return new ViewpointQuery(this.viewpoint).getViewpointURI().get(); - } - - private void addToSelection() { - selection.select(getViewpointURI()); - } - - private void removeFromSelection() { - selection.deselect(getViewpointURI()); - } - - private boolean isInSelection() { - return selection.getSelected().contains(getViewpointURI()); - } - - /** - * Select the viewpoint corresponding to this element and all the item's - * parents' viewpoints. - */ - public void onChecked() { - for (Item current = this; current != null; current = current.parent) { - current.addToSelection(); - } - } - - /** - * Deselect the viewpoint. - */ - public void onUnchecked() { - onUnchecked(this); - } - - private void onUnchecked(Item unchecked) { - if (unchecked == this) { - removeFromSelection(); - } else if (isInSelection()) { - if (Iterables.all(Iterables.filter(index.get(this.viewpoint), Predicates.not(Predicates.equalTo(this))), new Predicate<Item>() { - public boolean apply(Item input) { - return input.parent != null && !input.parent.isInSelection(); - } - })) { - removeFromSelection(); - } - } - for (Item child : descendants) { - child.onUnchecked(unchecked); - } - } - - public void setInitialUiStateRecursive(State parentState) { - if (isInSelection()) { - if (parentState == State.CHECKED) { - setUiState(State.CHECKED); - } else { - setUiState(State.GRAY_CHECKED); - } - } else { - setUiState(State.UNCHECKED); - } - for (Item child : descendants) { - child.setInitialUiStateRecursive(getUiState()); - } - } - - protected State getUiState() { - if (tree.getGrayed(this)) { - return State.GRAY_CHECKED; - } else if (tree.getChecked(this)) { - return State.CHECKED; - } else { - return State.UNCHECKED; - } - } - - protected void setUiState(State s) { - switch (s) { - case CHECKED: - tree.setChecked(this, true); - tree.setGrayed(this, false); - break; - case GRAY_CHECKED: - tree.setGrayChecked(this, true); - break; - case UNCHECKED: - tree.setChecked(this, false); - break; - } - } - - public void fillDescendants() { - URI uri = getViewpointURI(); - for (URI childURI : customizeTracker.getReverseDependencies(uri)) { - Item child = new Item(this, registry.getViewpoint(childURI)); - descendants.add(child); - child.fillDescendants(); - } - Collections.sort(descendants, Ordering.natural().onResultOf(new Function<Item, String>() { - public String apply(Item from) { - return from.viewpoint.getName(); - } - })); - } - - @Override - public String toString() { - if (parent != null) { - return parent.toString() + " > " + this.getLabel(); //$NON-NLS-1$ - } else { - return this.getLabel(); - } - } - } - - // CHECKSTYLE:ON - - /** - * The content provider for the tree of viewpoints. - */ - private final class ViewpointSelectionContentProvider implements ITreeContentProvider { - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // Ignore. - } - - public void dispose() { - // Ignore. - } - - public Object[] getElements(Object inputElement) { - if (inputElement instanceof List<?> && Iterables.all((List<?>) inputElement, Predicates.instanceOf(Item.class))) { - @SuppressWarnings("unchecked") - List<Item> topItems = (List<Item>) inputElement; - return topItems.toArray(); - } else { - return null; - } - } - - public boolean hasChildren(Object element) { - if (element instanceof Item) { - return !((Item) element).descendants.isEmpty(); - } else { - return false; - } - } - - public Object getParent(Object element) { - if (element instanceof Item) { - return ((Item) element).parent; - } else { - return null; - } - } - - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof Item) { - return ((Item) parentElement).descendants.toArray(); - } else { - return null; - } - } - } - - private CheckboxTreeViewer tree; - - private Label description; - - private final ViewpointRegistry registry; - - private final org.eclipse.sirius.business.internal.movida.ViewpointSelection selection; - - private final ViewpointDependenciesTracker customizeTracker; - - private final List<Item> input; - - private Multimap<Viewpoint, Item> index = ArrayListMultimap.create(); - - /** - * Constructor. - * - * @param parentShell - * the parent shell for the dialog box. - * @param regsitry - * the registry in which to look for available viewpoints. - * @param selection - * the selection of viewpoints to edit. - * @param fileExtensions - * the extensions of the semantic resources in the session to - * configure; used to restrict the set of viewpoints displayed. - */ - public ViewpointSelectionDialog(Shell parentShell, ViewpointRegistry regsitry, org.eclipse.sirius.business.internal.movida.ViewpointSelection selection, Collection<String> fileExtensions) { - super(parentShell); - // CHECKSTYLE:OFF really, checkstyle? - setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE); - // CHECKSTYLE:ON - this.registry = Preconditions.checkNotNull(regsitry); - this.selection = Preconditions.checkNotNull(selection); - this.customizeTracker = this.registry.createTrackerFor(this.registry.getRelations().getCustomize()); - this.input = computeItemHierarchy(fileExtensions); - } - - private List<Item> computeItemHierarchy(final Collection<String> fileExtensions) { - final Predicate<Viewpoint> isTopLevel = new Predicate<Viewpoint>() { - public boolean apply(final Viewpoint vp) { - boolean top = vp != null && vp.getCustomizes().isEmpty(); - boolean matchesSemancitModel = Iterables.any(fileExtensions, new Predicate<String>() { - public boolean apply(String ext) { - return new ViewpointQuery(vp).handlesSemanticModelExtension(ext); - } - }); - return top && matchesSemancitModel; - } - }; - - List<Item> roots = Lists.newArrayList(Iterables.transform(Iterables.filter(this.registry.getViewpoints(), isTopLevel), new Function<Viewpoint, Item>() { - public Item apply(Viewpoint from) { - return new Item(null, from); - } - })); - for (Item item : roots) { - item.fillDescendants(); - } - Collections.sort(roots, Ordering.natural().onResultOf(new Function<Item, String>() { - public String apply(Item from) { - return from.viewpoint.getName(); - } - })); - return roots; - } - - @Override - protected Control createContents(Composite parent) { - Control contents = super.createContents(parent); - setTitle(Messages.ViewpointSelectionDialog_title); - setMessage(Messages.ViewpointSelectionDialog_message); - Shell shell = parent.getShell(); - shell.setText(Messages.ViewpointSelectionDialog_text); - shell.pack(); - shell.setSize(shell.getSize().x, 500); - return contents; - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - composite.setLayout(new GridLayout(1, false)); - - tree = new CheckboxTreeViewer(composite); - tree.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); - configureTreeViewer(); - - Group group = new Group(composite, SWT.SHADOW_IN); - group.setText(Messages.ViewpointSelectionDialog_description); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - FillLayout layout = new FillLayout(SWT.HORIZONTAL); - layout.marginHeight = 5; - layout.marginWidth = 5; - group.setLayout(layout); - - ScrolledComposite scrolledComposite = new ScrolledComposite(group, SWT.H_SCROLL | SWT.V_SCROLL); - scrolledComposite.setExpandHorizontal(true); - scrolledComposite.setExpandVertical(true); - - description = new Label(scrolledComposite, SWT.WRAP); - scrolledComposite.setContent(description); - return composite; - } - - private void configureTreeViewer() { - tree.setContentProvider(new ViewpointSelectionContentProvider()); - tree.setLabelProvider(new CellLabelProvider() { - @Override - public void update(ViewerCell cell) { - Item item = (Item) cell.getElement(); - cell.setText(item.getLabel()); - cell.setImage(SiriusEditPlugin.getPlugin().getBundledImage("icons/full/obj16/Viewpoint.gif")); //$NON-NLS-1$ - } - - @Override - public String getToolTipText(Object element) { - Item item = (Item) element; - return item.getViewpointURI().toString(); - } - }); - tree.addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - if (event.getElement() instanceof Item) { - Item item = (Item) event.getElement(); - if (event.getChecked()) { - item.onChecked(); - } else if (item.getUiState() == State.GRAY_CHECKED) { - item.onChecked(); - } else { - item.onUnchecked(); - } - for (Item root : input) { - root.setInitialUiStateRecursive(State.CHECKED); - } - selection.validate(); - if (!selection.isValid()) { - setErrorMessage(selection.getErrorMessage()); - } else { - setErrorMessage(null); - } - getButton(IDialogConstants.OK_ID).setEnabled(selection.isValid()); - } - } - }); - tree.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - ISelection sel = event.getSelection(); - if (sel instanceof IStructuredSelection) { - Item item = (Item) ((IStructuredSelection) sel).getFirstElement(); - if (item != null && item.viewpoint != null) { - description.setText(item.viewpoint.getEndUserDocumentation()); - } else { - description.setText(""); //$NON-NLS-1$ - } - } else { - description.setText(""); //$NON-NLS-1$ - } - } - }); - tree.setInput(input); - for (Item root : input) { - root.setInitialUiStateRecursive(State.CHECKED); - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean close() { - this.customizeTracker.dispose(); - return super.close(); - } -} diff --git a/plugins/org.eclipse.sirius/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius/META-INF/MANIFEST.MF index 9653e0d50b..0cd0ba4c12 100644 --- a/plugins/org.eclipse.sirius/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius/META-INF/MANIFEST.MF @@ -38,7 +38,6 @@ Export-Package: org.eclipse.sirius.business.api.action;version="2.0.4", org.eclipse.sirius.business.internal.color;version="2.0.4";x-internal:=true, org.eclipse.sirius.business.internal.command.control;version="2.0.4";x-internal:=true, org.eclipse.sirius.business.internal.componentization;x-internal:=true, - org.eclipse.sirius.business.internal.contribution;version="2.0.4";x-internal:=true, org.eclipse.sirius.business.internal.dialect;version="3.0.0";x-internal:=true, org.eclipse.sirius.business.internal.dialect.command;version="2.0.4";x-internal:=true, org.eclipse.sirius.business.internal.dialect.description;version="3.0.0";x-internal:=true, @@ -63,9 +62,6 @@ Export-Package: org.eclipse.sirius.business.api.action;version="2.0.4", org.eclipse.sirius.business.internal.migration.resource.session.commands;version="2.0.4";x-internal:=true, org.eclipse.sirius.business.internal.modelingproject.manager;version="2.0.5";x-internal:=true, org.eclipse.sirius.business.internal.modelingproject.marker;version="2.0.4";x-internal:=true, - org.eclipse.sirius.business.internal.movida;version="2.0.4";x-internal:=true, - org.eclipse.sirius.business.internal.movida.registry;version="2.0.4";x-internal:=true, - org.eclipse.sirius.business.internal.movida.registry.monitoring;version="2.0.4";x-internal:=true, org.eclipse.sirius.business.internal.query;version="3.0.1";x-internal:=true, org.eclipse.sirius.business.internal.repair.commands;version="3.0.0";x-internal:=true, org.eclipse.sirius.business.internal.representation;version="5.0.0", @@ -76,9 +72,6 @@ Export-Package: org.eclipse.sirius.business.api.action;version="2.0.4", org.eclipse.sirius.business.internal.session.danalysis;version="3.0.0";x-internal:=true, org.eclipse.sirius.business.internal.session.factory;version="2.0.4";x-internal:=true, org.eclipse.sirius.business.internal.session.parser;version="2.0.4";x-internal:=true, - org.eclipse.sirius.description.contribution;version="2.0.4", - org.eclipse.sirius.description.contribution.impl;version="2.0.4", - org.eclipse.sirius.description.contribution.util;version="2.0.4", org.eclipse.sirius.tools.api.command;version="3.0.0", org.eclipse.sirius.tools.api.command.semantic;version="3.0.0", org.eclipse.sirius.tools.api.command.ui;version="3.0.0", diff --git a/plugins/org.eclipse.sirius/model/contribution.ecore b/plugins/org.eclipse.sirius/model/contribution.ecore deleted file mode 100644 index 6542b2a6e2..0000000000 --- a/plugins/org.eclipse.sirius/model/contribution.ecore +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="contribution" nsURI="http://www.eclipse.org/sirius/description/contribution/1.0.0" - nsPrefix="contribution"> - <eClassifiers xsi:type="ecore:EClass" name="FeatureContribution" abstract="true"> - <eStructuralFeatures xsi:type="ecore:EReference" name="sourceFeature" lowerBound="1" - eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EStructuralFeature"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="targetFeature" lowerBound="1" - eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EStructuralFeature"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="IgnoreFeatureContribution" eSuperTypes="#//FeatureContribution"/> - <eClassifiers xsi:type="ecore:EClass" name="SetFeatureContribution" eSuperTypes="#//FeatureContribution"/> - <eClassifiers xsi:type="ecore:EClass" name="AddFeatureContribution" eSuperTypes="#//FeatureContribution"/> - <eClassifiers xsi:type="ecore:EClass" name="RemoveFeatureContribution" eSuperTypes="#//FeatureContribution"/> - <eClassifiers xsi:type="ecore:EClass" name="ClearFeatureContribution" eSuperTypes="#//FeatureContribution"/> - <eClassifiers xsi:type="ecore:EClass" name="ResetFeatureContribution" eSuperTypes="#//FeatureContribution"/> - <eClassifiers xsi:type="ecore:EClass" name="EObjectReference" abstract="true" interface="true"/> - <eClassifiers xsi:type="ecore:EClass" name="DirectEObjectReference" eSuperTypes="#//EObjectReference"> - <eStructuralFeatures xsi:type="ecore:EReference" name="value" lowerBound="1" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="ComputedEObjectReference" eSuperTypes="#//EObjectReference"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="valueExpression" lowerBound="1" - eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Contribution"> - <eStructuralFeatures xsi:type="ecore:EReference" name="source" lowerBound="1" - eType="#//EObjectReference" containment="true"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="target" lowerBound="1" - eType="#//EObjectReference" containment="true"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="featureMask" ordered="false" - lowerBound="1" upperBound="-1" eType="#//FeatureContribution" containment="true"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="subContributions" upperBound="-1" - eType="#//Contribution" containment="true"/> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="ContributionProvider" abstract="true"> - <eStructuralFeatures xsi:type="ecore:EReference" name="contributions" upperBound="-1" - eType="#//Contribution" containment="true"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="ContributionPoint"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="origin" lowerBound="1" - eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EString"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="contributed" lowerBound="1" - eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"/> - </eClassifiers> -</ecore:EPackage> diff --git a/plugins/org.eclipse.sirius/model/contribution.genmodel b/plugins/org.eclipse.sirius/model/contribution.genmodel deleted file mode 100644 index 0095a54c64..0000000000 --- a/plugins/org.eclipse.sirius/model/contribution.genmodel +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<genmodel:GenModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" - xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" copyrightText="Copyright (c) 2007, 2013 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
http://www.eclipse.org/legal/epl-v10.html

Contributors:
 Obeo - initial API and implementation
" - modelDirectory="/org.eclipse.sirius/src-gen" creationIcons="false" editDirectory="/org.eclipse.sirius.ui/src-gen" - editorDirectory="" modelPluginID="org.eclipse.sirius" modelName="Contribution" - editPluginClass="org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin" editorPluginClass="org.eclipse.sirius.presentation.SiriusEditorPlugin" - nonNLSMarkers="true" testsDirectory="" importerID="org.eclipse.emf.importer.ecore" - containmentProxies="true" complianceLevel="5.0" copyrightFields="false" editPluginID="org.eclipse.sirius.ui" - editorPluginID="org.eclipse.sirius.editor" runtimeVersion="2.3" usedGenPackages="platform:/plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore"> - <foreignModel>contribution.ecore</foreignModel> - <genPackages prefix="Contribution" basePackage="org.eclipse.sirius.description" - disposableProviderFactory="true" ecorePackage="contribution.ecore#/"> - <genClasses image="false" ecoreClass="contribution.ecore#//FeatureContribution"> - <genFeatures createChild="false" propertyCategory="General" propertyDescription="The feature in the source object from which the contribution values are obtained." - propertySortChoices="true" ecoreFeature="ecore:EReference contribution.ecore#//FeatureContribution/sourceFeature"/> - <genFeatures createChild="false" propertyCategory="General" propertyDescription="The feature in the target object to which the contribution values are applied." - propertySortChoices="true" ecoreFeature="ecore:EReference contribution.ecore#//FeatureContribution/targetFeature"/> - </genClasses> - <genClasses ecoreClass="contribution.ecore#//IgnoreFeatureContribution"/> - <genClasses ecoreClass="contribution.ecore#//SetFeatureContribution"/> - <genClasses ecoreClass="contribution.ecore#//AddFeatureContribution"/> - <genClasses ecoreClass="contribution.ecore#//RemoveFeatureContribution"/> - <genClasses ecoreClass="contribution.ecore#//ClearFeatureContribution"/> - <genClasses ecoreClass="contribution.ecore#//ResetFeatureContribution"/> - <genClasses image="false" ecoreClass="contribution.ecore#//EObjectReference"/> - <genClasses ecoreClass="contribution.ecore#//DirectEObjectReference"> - <genFeatures createChild="false" propertyCategory="General" propertySortChoices="true" - ecoreFeature="ecore:EReference contribution.ecore#//DirectEObjectReference/value"/> - </genClasses> - <genClasses ecoreClass="contribution.ecore#//ComputedEObjectReference"> - <genFeatures createChild="false" propertyCategory="General" propertySortChoices="true" - ecoreFeature="ecore:EAttribute contribution.ecore#//ComputedEObjectReference/valueExpression"/> - </genClasses> - <genClasses image="false" ecoreClass="contribution.ecore#//Contribution"> - <genFeatures property="None" children="true" createChild="true" propertyCategory="" - propertyDescription="" ecoreFeature="ecore:EReference contribution.ecore#//Contribution/source"/> - <genFeatures property="None" children="true" createChild="true" propertyCategory="" - ecoreFeature="ecore:EReference contribution.ecore#//Contribution/target"/> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference contribution.ecore#//Contribution/featureMask"/> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference contribution.ecore#//Contribution/subContributions"/> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute contribution.ecore#//Contribution/description"/> - </genClasses> - <genClasses image="false" ecoreClass="contribution.ecore#//ContributionProvider"> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference contribution.ecore#//ContributionProvider/contributions"/> - </genClasses> - <genClasses ecoreClass="contribution.ecore#//ContributionPoint"> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute contribution.ecore#//ContributionPoint/origin"/> - <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference contribution.ecore#//ContributionPoint/contributed"/> - </genClasses> - </genPackages> -</genmodel:GenModel> diff --git a/plugins/org.eclipse.sirius/plugin.properties b/plugins/org.eclipse.sirius/plugin.properties index 377a647d30..8f906aa193 100644 --- a/plugins/org.eclipse.sirius/plugin.properties +++ b/plugins/org.eclipse.sirius/plugin.properties @@ -69,7 +69,6 @@ extension-point.resourceStrategy.name = org.eclipse.sirius.resourceStrategy extension-point.runtimeLogger.name = org.eclipse.sirius.runtimeLogger extension-point.sessionFactory.name = org.eclipse.sirius.sessionFactory extension-point.sessionManagerListener.name = org.eclipse.sirius.sessionManagerListener -extension-point.viewpointResourceType.name = org.eclipse.sirius.viewpointResourceType extension-point.viewpointSpecificationModel.name = org.eclipse.sirius.viewpointSpecificationModel extension-point.modelOperationManager.name= org.eclipse.sirius.modelOperationManager extension-point.dRepresentationLocationRule.name= org.eclipse.sirius.dRepresentationLocationRule diff --git a/plugins/org.eclipse.sirius/plugin.xml b/plugins/org.eclipse.sirius/plugin.xml index 3cb88180d8..55aba86c7a 100644 --- a/plugins/org.eclipse.sirius/plugin.xml +++ b/plugins/org.eclipse.sirius/plugin.xml @@ -23,8 +23,6 @@ <extension-point id="runtimeLogger" name="%extension-point.runtimeLogger.name" schema="schema/runtimeLogger.exsd"/> <extension-point id="deleteHook" name="%extension-point.deleteHook.name" schema="schema/deleteHook.exsd"/> <extension-point id="sessionFactory" name="%extension-point.sessionFactory.name" schema="schema/sessionFactory.exsd"/> - <extension-point id="viewpointSpecificationModel" name="%extension-point.viewpointSpecificationModel.name" schema="schema/viewpointSpecificationModel.exsd"/> - <extension-point id="viewpointResourceType" name="%extension-point.viewpointResourceType.name" schema="schema/viewpointResourceType.exsd"/> <extension-point id="migrationParticipant" name="%extension-point.migration.name" schema="schema/migrationParticipant.exsd"/> <extension-point id="repairParticipant" name="%extension-point.repairParticipant.name" schema="schema/repairParticipant.exsd"/> <extension-point id="resourceStrategy" name="%extension-point.resourceStrategy.name" schema="schema/resourceStrategy.exsd"/> @@ -425,13 +423,6 @@ kind="VSM"> </participant> </extension> - <extension point="org.eclipse.emf.ecore.generated_package"> - <!-- @generated contribution --> - <package - uri="http://www.eclipse.org/sirius/description/contribution/1.0.0" - class="org.eclipse.sirius.description.contribution.ContributionPackage" - genModel="model/contribution.genmodel"/> - </extension> <extension point="org.eclipse.emf.ecore.extension_parser"> <?gmfgen generated="false"?> diff --git a/plugins/org.eclipse.sirius/schema/viewpointResourceType.exsd b/plugins/org.eclipse.sirius/schema/viewpointResourceType.exsd deleted file mode 100644 index ea8b9669b3..0000000000 --- a/plugins/org.eclipse.sirius/schema/viewpointResourceType.exsd +++ /dev/null @@ -1,115 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.sirius" xmlns="http://www.w3.org/2001/XMLSchema"> -<annotation> - <appInfo> - <meta.schema plugin="org.eclipse.sirius" id="viewpointResourceType" name="org.eclipse.sirius.viewpointResourceType"/> - </appInfo> - <documentation> - This extension points allows to contribute handlers for resources which can contain Sirius definition beyond the standard *.odesign files. - </documentation> - </annotation> - - <element name="extension"> - <annotation> - <appInfo> - <meta.element /> - </appInfo> - </annotation> - <complexType> - <sequence> - <element ref="handler"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appInfo> - <meta.attribute translatable="true"/> - </appInfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="handler"> - <complexType> - <attribute name="class" type="string"> - <annotation> - <documentation> - - </documentation> - <appInfo> - <meta.attribute kind="java" basedOn=":org.eclipse.sirius.business.api.componentization.SiriusResourceHandler"/> - </appInfo> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appInfo> - <meta.section type="since"/> - </appInfo> - <documentation> - [Enter the first release in which this extension point appears.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="examples"/> - </appInfo> - <documentation> - [Enter extension point usage example here.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="apiinfo"/> - </appInfo> - <documentation> - See org.eclipse.sirius.business.internal.movida.registry.SiriusResourceHandler. - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="implementation"/> - </appInfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </documentation> - </annotation> - - <annotation> - <appInfo> - <meta.section type="copyright"/> - </appInfo> - <documentation> - Copyright (c) 2013 THALES GLOBAL SERVICES<br> -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 -<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> - </documentation> - - </annotation> - -</schema> diff --git a/plugins/org.eclipse.sirius/schema/viewpointSpecificationModel.exsd b/plugins/org.eclipse.sirius/schema/viewpointSpecificationModel.exsd deleted file mode 100644 index a1f0333c40..0000000000 --- a/plugins/org.eclipse.sirius/schema/viewpointSpecificationModel.exsd +++ /dev/null @@ -1,130 +0,0 @@ -<?xml version='1.0' encoding='UTF-8'?> -<!-- Schema file written by PDE --> -<schema targetNamespace="org.eclipse.sirius.movida" xmlns="http://www.w3.org/2001/XMLSchema"> -<annotation> - <appinfo> - <meta.schema plugin="org.eclipse.sirius.movida" id="viewpointSpecificationModel" name="org.eclipse.sirius.viewpointSpecificationModel"/> - </appinfo> - <documentation> - Registers one or several Viewpoint Specification Models (VSMs) defined in a plugin. - </documentation> - </annotation> - - <element name="extension"> - <annotation> - <appinfo> - <meta.element /> - </appinfo> - </annotation> - <complexType> - <sequence minOccurs="1" maxOccurs="unbounded"> - <element ref="definition"/> - </sequence> - <attribute name="point" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="id" type="string"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - <attribute name="name" type="string"> - <annotation> - <documentation> - - </documentation> - <appinfo> - <meta.attribute translatable="true"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="definition"> - <complexType> - <sequence minOccurs="0" maxOccurs="unbounded"> - <element ref="matcher"/> - </sequence> - <attribute name="path" type="string" use="required"> - <annotation> - <documentation> - The relative path to the VSM file (*.odesign). - </documentation> - <appinfo> - <meta.attribute kind="resource"/> - </appinfo> - </annotation> - </attribute> - </complexType> - </element> - - <element name="matcher"> - <complexType> - <attribute name="extension" type="string" use="required"> - <annotation> - <documentation> - - </documentation> - </annotation> - </attribute> - </complexType> - </element> - - <annotation> - <appinfo> - <meta.section type="since"/> - </appinfo> - <documentation> - [Enter the first release in which this extension point appears.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="examples"/> - </appinfo> - <documentation> - [Enter extension point usage example here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="apiinfo"/> - </appinfo> - <documentation> - [Enter API information here.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="implementation"/> - </appinfo> - <documentation> - [Enter information about supplied implementation of this extension point.] - </documentation> - </annotation> - - <annotation> - <appinfo> - <meta.section type="copyright"/> - </appinfo> - <documentation> - Copyright (c) 2013 THALES GLOBAL SERVICES<br> -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 -<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a> - </documentation> - - </annotation> - -</schema> diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/AddFeatureContribution.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/AddFeatureContribution.java deleted file mode 100644 index 370e662f4b..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/AddFeatureContribution.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Add Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getAddFeatureContribution() - * @model - * @generated - */ -public interface AddFeatureContribution extends FeatureContribution { -} // AddFeatureContribution diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ClearFeatureContribution.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ClearFeatureContribution.java deleted file mode 100644 index 04ef91aad5..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ClearFeatureContribution.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Clear Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getClearFeatureContribution() - * @model - * @generated - */ -public interface ClearFeatureContribution extends FeatureContribution { -} // ClearFeatureContribution diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ComputedEObjectReference.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ComputedEObjectReference.java deleted file mode 100644 index 4e9ca5b561..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ComputedEObjectReference.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Computed EObject Reference</b></em>'. <!-- - * end-user-doc --> - * - * <p> - * The following features are supported: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.ComputedEObjectReference#getValueExpression <em>Value - * Expression</em>}</li> - * </ul> - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getComputedEObjectReference() - * @model - * @generated - */ -public interface ComputedEObjectReference extends EObjectReference { - /** - * Returns the value of the '<em><b>Value Expression</b></em>' attribute. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value Expression</em>' attribute isn't clear, there really should be more of a - * description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Value Expression</em>' attribute. - * @see #setValueExpression(String) - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getComputedEObjectReference_ValueExpression() - * @model required="true" - * @generated - */ - String getValueExpression(); - - /** - * Sets the value of the ' - * {@link org.eclipse.sirius.description.contribution.ComputedEObjectReference#getValueExpression <em>Value - * Expression</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Value Expression</em>' attribute. - * @see #getValueExpression() - * @generated - */ - void setValueExpression(String value); - -} // ComputedEObjectReference diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/Contribution.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/Contribution.java deleted file mode 100644 index 0211db7bce..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/Contribution.java +++ /dev/null @@ -1,150 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Contribution</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.Contribution#getSource <em>Source</em>}</li> - * <li>{@link org.eclipse.sirius.description.contribution.Contribution#getTarget <em>Target</em>}</li> - * <li>{@link org.eclipse.sirius.description.contribution.Contribution#getFeatureMask <em>Feature Mask</em>}</li> - * <li>{@link org.eclipse.sirius.description.contribution.Contribution#getSubContributions <em>Sub Contributions</em>} - * </li> - * <li>{@link org.eclipse.sirius.description.contribution.Contribution#getDescription <em>Description</em>}</li> - * </ul> - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContribution() - * @model - * @generated - */ -public interface Contribution extends EObject { - /** - * Returns the value of the '<em><b>Source</b></em>' containment reference. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Source</em>' containment reference isn't clear, there really should be more of a - * description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Source</em>' containment reference. - * @see #setSource(EObjectReference) - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContribution_Source() - * @model containment="true" resolveProxies="true" required="true" - * @generated - */ - EObjectReference getSource(); - - /** - * Sets the value of the ' {@link org.eclipse.sirius.description.contribution.Contribution#getSource <em>Source</em> - * }' containment reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Source</em>' containment reference. - * @see #getSource() - * @generated - */ - void setSource(EObjectReference value); - - /** - * Returns the value of the '<em><b>Target</b></em>' containment reference. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Target</em>' containment reference isn't clear, there really should be more of a - * description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Target</em>' containment reference. - * @see #setTarget(EObjectReference) - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContribution_Target() - * @model containment="true" resolveProxies="true" required="true" - * @generated - */ - EObjectReference getTarget(); - - /** - * Sets the value of the ' {@link org.eclipse.sirius.description.contribution.Contribution#getTarget <em>Target</em> - * }' containment reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Target</em>' containment reference. - * @see #getTarget() - * @generated - */ - void setTarget(EObjectReference value); - - /** - * Returns the value of the '<em><b>Feature Mask</b></em>' containment reference list. The list contents are of type - * {@link org.eclipse.sirius.description.contribution.FeatureContribution}. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Feature Mask</em>' containment reference list isn't clear, there really should be more - * of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Feature Mask</em>' containment reference list. - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContribution_FeatureMask() - * @model containment="true" resolveProxies="true" required="true" ordered="false" - * @generated - */ - EList<FeatureContribution> getFeatureMask(); - - /** - * Returns the value of the '<em><b>Sub Contributions</b></em>' containment reference list. The list contents are of - * type {@link org.eclipse.sirius.description.contribution.Contribution}. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Sub Contributions</em>' containment reference list isn't clear, there really should be - * more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Sub Contributions</em>' containment reference list. - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContribution_SubContributions() - * @model containment="true" resolveProxies="true" - * @generated - */ - EList<Contribution> getSubContributions(); - - /** - * Returns the value of the '<em><b>Description</b></em>' attribute. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Description</em>' attribute isn't clear, there really should be more of a description - * here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Description</em>' attribute. - * @see #setDescription(String) - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContribution_Description() - * @model - * @generated - */ - String getDescription(); - - /** - * Sets the value of the ' {@link org.eclipse.sirius.description.contribution.Contribution#getDescription - * <em>Description</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Description</em>' attribute. - * @see #getDescription() - * @generated - */ - void setDescription(String value); - -} // Contribution diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionFactory.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionFactory.java deleted file mode 100644 index 69d97ff2da..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionFactory.java +++ /dev/null @@ -1,124 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -import org.eclipse.emf.ecore.EFactory; - -/** - * <!-- begin-user-doc --> The <b>Factory</b> for the model. It provides a create method for each non-abstract class of - * the model. <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage - * @generated - */ -public interface ContributionFactory extends EFactory { - /** - * The singleton instance of the factory. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - ContributionFactory eINSTANCE = org.eclipse.sirius.description.contribution.impl.ContributionFactoryImpl.init(); - - /** - * Returns a new object of class '<em>Ignore Feature Contribution</em>'. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @return a new object of class '<em>Ignore Feature Contribution</em>'. - * @generated - */ - IgnoreFeatureContribution createIgnoreFeatureContribution(); - - /** - * Returns a new object of class '<em>Set Feature Contribution</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Set Feature Contribution</em>'. - * @generated - */ - SetFeatureContribution createSetFeatureContribution(); - - /** - * Returns a new object of class '<em>Add Feature Contribution</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Add Feature Contribution</em>'. - * @generated - */ - AddFeatureContribution createAddFeatureContribution(); - - /** - * Returns a new object of class '<em>Remove Feature Contribution</em>'. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @return a new object of class '<em>Remove Feature Contribution</em>'. - * @generated - */ - RemoveFeatureContribution createRemoveFeatureContribution(); - - /** - * Returns a new object of class '<em>Clear Feature Contribution</em>'. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @return a new object of class '<em>Clear Feature Contribution</em>'. - * @generated - */ - ClearFeatureContribution createClearFeatureContribution(); - - /** - * Returns a new object of class '<em>Reset Feature Contribution</em>'. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @return a new object of class '<em>Reset Feature Contribution</em>'. - * @generated - */ - ResetFeatureContribution createResetFeatureContribution(); - - /** - * Returns a new object of class '<em>Direct EObject Reference</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Direct EObject Reference</em>'. - * @generated - */ - DirectEObjectReference createDirectEObjectReference(); - - /** - * Returns a new object of class '<em>Computed EObject Reference</em>'. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @return a new object of class '<em>Computed EObject Reference</em>'. - * @generated - */ - ComputedEObjectReference createComputedEObjectReference(); - - /** - * Returns a new object of class '<em>Contribution</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Contribution</em>'. - * @generated - */ - Contribution createContribution(); - - /** - * Returns a new object of class '<em>Point</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return a new object of class '<em>Point</em>'. - * @generated - */ - ContributionPoint createContributionPoint(); - - /** - * Returns the package supported by this factory. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the package supported by this factory. - * @generated - */ - ContributionPackage getContributionPackage(); - -} // ContributionFactory diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionPackage.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionPackage.java deleted file mode 100644 index 06f08b4ecd..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionPackage.java +++ /dev/null @@ -1,1041 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; - -/** - * <!-- begin-user-doc --> The <b>Package</b> for the model. It contains accessors for the meta objects to represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.ContributionFactory - * @model kind="package" - * @generated - */ -public interface ContributionPackage extends EPackage { - /** - * The package name. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNAME = "contribution"; //$NON-NLS-1$ - - /** - * The package namespace URI. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNS_URI = "http://www.eclipse.org/sirius/description/contribution/1.0.0"; //$NON-NLS-1$ - - /** - * The package namespace name. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - String eNS_PREFIX = "contribution"; //$NON-NLS-1$ - - /** - * The singleton instance of the package. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - ContributionPackage eINSTANCE = org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl.init(); - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.impl.FeatureContributionImpl - * <em>Feature Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.FeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getFeatureContribution() - * @generated - */ - int FEATURE_CONTRIBUTION = 0; - - /** - * The feature id for the '<em><b>Source Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int FEATURE_CONTRIBUTION__SOURCE_FEATURE = 0; - - /** - * The feature id for the '<em><b>Target Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int FEATURE_CONTRIBUTION__TARGET_FEATURE = 1; - - /** - * The number of structural features of the '<em>Feature Contribution</em>' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - * @ordered - */ - int FEATURE_CONTRIBUTION_FEATURE_COUNT = 2; - - /** - * The meta object id for the ' - * {@link org.eclipse.sirius.description.contribution.impl.IgnoreFeatureContributionImpl <em>Ignore Feature - * Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.IgnoreFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getIgnoreFeatureContribution() - * @generated - */ - int IGNORE_FEATURE_CONTRIBUTION = 1; - - /** - * The feature id for the '<em><b>Source Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int IGNORE_FEATURE_CONTRIBUTION__SOURCE_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE; - - /** - * The feature id for the '<em><b>Target Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int IGNORE_FEATURE_CONTRIBUTION__TARGET_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE; - - /** - * The number of structural features of the ' <em>Ignore Feature Contribution</em>' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int IGNORE_FEATURE_CONTRIBUTION_FEATURE_COUNT = ContributionPackage.FEATURE_CONTRIBUTION_FEATURE_COUNT + 0; - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.impl.SetFeatureContributionImpl - * <em>Set Feature Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.SetFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getSetFeatureContribution() - * @generated - */ - int SET_FEATURE_CONTRIBUTION = 2; - - /** - * The feature id for the '<em><b>Source Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int SET_FEATURE_CONTRIBUTION__SOURCE_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE; - - /** - * The feature id for the '<em><b>Target Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int SET_FEATURE_CONTRIBUTION__TARGET_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE; - - /** - * The number of structural features of the ' <em>Set Feature Contribution</em>' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - * @ordered - */ - int SET_FEATURE_CONTRIBUTION_FEATURE_COUNT = ContributionPackage.FEATURE_CONTRIBUTION_FEATURE_COUNT + 0; - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.impl.AddFeatureContributionImpl - * <em>Add Feature Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.AddFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getAddFeatureContribution() - * @generated - */ - int ADD_FEATURE_CONTRIBUTION = 3; - - /** - * The feature id for the '<em><b>Source Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int ADD_FEATURE_CONTRIBUTION__SOURCE_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE; - - /** - * The feature id for the '<em><b>Target Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int ADD_FEATURE_CONTRIBUTION__TARGET_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE; - - /** - * The number of structural features of the ' <em>Add Feature Contribution</em>' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - * @ordered - */ - int ADD_FEATURE_CONTRIBUTION_FEATURE_COUNT = ContributionPackage.FEATURE_CONTRIBUTION_FEATURE_COUNT + 0; - - /** - * The meta object id for the ' - * {@link org.eclipse.sirius.description.contribution.impl.RemoveFeatureContributionImpl <em>Remove Feature - * Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.RemoveFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getRemoveFeatureContribution() - * @generated - */ - int REMOVE_FEATURE_CONTRIBUTION = 4; - - /** - * The feature id for the '<em><b>Source Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int REMOVE_FEATURE_CONTRIBUTION__SOURCE_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE; - - /** - * The feature id for the '<em><b>Target Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int REMOVE_FEATURE_CONTRIBUTION__TARGET_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE; - - /** - * The number of structural features of the ' <em>Remove Feature Contribution</em>' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int REMOVE_FEATURE_CONTRIBUTION_FEATURE_COUNT = ContributionPackage.FEATURE_CONTRIBUTION_FEATURE_COUNT + 0; - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.impl.ClearFeatureContributionImpl - * <em>Clear Feature Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ClearFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getClearFeatureContribution() - * @generated - */ - int CLEAR_FEATURE_CONTRIBUTION = 5; - - /** - * The feature id for the '<em><b>Source Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int CLEAR_FEATURE_CONTRIBUTION__SOURCE_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE; - - /** - * The feature id for the '<em><b>Target Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int CLEAR_FEATURE_CONTRIBUTION__TARGET_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE; - - /** - * The number of structural features of the ' <em>Clear Feature Contribution</em>' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int CLEAR_FEATURE_CONTRIBUTION_FEATURE_COUNT = ContributionPackage.FEATURE_CONTRIBUTION_FEATURE_COUNT + 0; - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.impl.ResetFeatureContributionImpl - * <em>Reset Feature Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ResetFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getResetFeatureContribution() - * @generated - */ - int RESET_FEATURE_CONTRIBUTION = 6; - - /** - * The feature id for the '<em><b>Source Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int RESET_FEATURE_CONTRIBUTION__SOURCE_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE; - - /** - * The feature id for the '<em><b>Target Feature</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int RESET_FEATURE_CONTRIBUTION__TARGET_FEATURE = ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE; - - /** - * The number of structural features of the ' <em>Reset Feature Contribution</em>' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int RESET_FEATURE_CONTRIBUTION_FEATURE_COUNT = ContributionPackage.FEATURE_CONTRIBUTION_FEATURE_COUNT + 0; - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.EObjectReference <em>EObject - * Reference</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.EObjectReference - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getEObjectReference() - * @generated - */ - int EOBJECT_REFERENCE = 7; - - /** - * The number of structural features of the '<em>EObject Reference</em>' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - * @ordered - */ - int EOBJECT_REFERENCE_FEATURE_COUNT = 0; - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.impl.DirectEObjectReferenceImpl - * <em>Direct EObject Reference</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.DirectEObjectReferenceImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getDirectEObjectReference() - * @generated - */ - int DIRECT_EOBJECT_REFERENCE = 8; - - /** - * The feature id for the '<em><b>Value</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int DIRECT_EOBJECT_REFERENCE__VALUE = ContributionPackage.EOBJECT_REFERENCE_FEATURE_COUNT + 0; - - /** - * The number of structural features of the ' <em>Direct EObject Reference</em>' class. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - * @ordered - */ - int DIRECT_EOBJECT_REFERENCE_FEATURE_COUNT = ContributionPackage.EOBJECT_REFERENCE_FEATURE_COUNT + 1; - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.impl.ComputedEObjectReferenceImpl - * <em>Computed EObject Reference</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ComputedEObjectReferenceImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getComputedEObjectReference() - * @generated - */ - int COMPUTED_EOBJECT_REFERENCE = 9; - - /** - * The feature id for the '<em><b>Value Expression</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - * @ordered - */ - int COMPUTED_EOBJECT_REFERENCE__VALUE_EXPRESSION = ContributionPackage.EOBJECT_REFERENCE_FEATURE_COUNT + 0; - - /** - * The number of structural features of the ' <em>Computed EObject Reference</em>' class. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int COMPUTED_EOBJECT_REFERENCE_FEATURE_COUNT = ContributionPackage.EOBJECT_REFERENCE_FEATURE_COUNT + 1; - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.impl.ContributionImpl - * <em>Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getContribution() - * @generated - */ - int CONTRIBUTION = 10; - - /** - * The feature id for the '<em><b>Source</b></em>' containment reference. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - * @ordered - */ - int CONTRIBUTION__SOURCE = 0; - - /** - * The feature id for the '<em><b>Target</b></em>' containment reference. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - * @ordered - */ - int CONTRIBUTION__TARGET = 1; - - /** - * The feature id for the '<em><b>Feature Mask</b></em>' containment reference list. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - * @ordered - */ - int CONTRIBUTION__FEATURE_MASK = 2; - - /** - * The feature id for the '<em><b>Sub Contributions</b></em>' containment reference list. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int CONTRIBUTION__SUB_CONTRIBUTIONS = 3; - - /** - * The feature id for the '<em><b>Description</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int CONTRIBUTION__DESCRIPTION = 4; - - /** - * The number of structural features of the '<em>Contribution</em>' class. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @generated - * @ordered - */ - int CONTRIBUTION_FEATURE_COUNT = 5; - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.impl.ContributionProviderImpl - * <em>Provider</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ContributionProviderImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getContributionProvider() - * @generated - */ - int CONTRIBUTION_PROVIDER = 11; - - /** - * The feature id for the '<em><b>Contributions</b></em>' containment reference list. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - * @ordered - */ - int CONTRIBUTION_PROVIDER__CONTRIBUTIONS = 0; - - /** - * The number of structural features of the '<em>Provider</em>' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int CONTRIBUTION_PROVIDER_FEATURE_COUNT = 1; - - /** - * The meta object id for the ' {@link org.eclipse.sirius.description.contribution.impl.ContributionPointImpl - * <em>Point</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ContributionPointImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getContributionPoint() - * @generated - */ - int CONTRIBUTION_POINT = 12; - - /** - * The feature id for the '<em><b>Origin</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int CONTRIBUTION_POINT__ORIGIN = 0; - - /** - * The feature id for the '<em><b>Contributed</b></em>' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int CONTRIBUTION_POINT__CONTRIBUTED = 1; - - /** - * The number of structural features of the '<em>Point</em>' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - * @ordered - */ - int CONTRIBUTION_POINT_FEATURE_COUNT = 2; - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.FeatureContribution - * <em>Feature Contribution</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Feature Contribution</em>'. - * @see org.eclipse.sirius.description.contribution.FeatureContribution - * @generated - */ - EClass getFeatureContribution(); - - /** - * Returns the meta object for the reference ' - * {@link org.eclipse.sirius.description.contribution.FeatureContribution#getSourceFeature <em>Source Feature</em>} - * '. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the reference '<em>Source Feature</em>'. - * @see org.eclipse.sirius.description.contribution.FeatureContribution#getSourceFeature() - * @see #getFeatureContribution() - * @generated - */ - EReference getFeatureContribution_SourceFeature(); - - /** - * Returns the meta object for the reference ' - * {@link org.eclipse.sirius.description.contribution.FeatureContribution#getTargetFeature <em>Target Feature</em>} - * '. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the reference '<em>Target Feature</em>'. - * @see org.eclipse.sirius.description.contribution.FeatureContribution#getTargetFeature() - * @see #getFeatureContribution() - * @generated - */ - EReference getFeatureContribution_TargetFeature(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.IgnoreFeatureContribution - * <em>Ignore Feature Contribution</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Ignore Feature Contribution</em>'. - * @see org.eclipse.sirius.description.contribution.IgnoreFeatureContribution - * @generated - */ - EClass getIgnoreFeatureContribution(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.SetFeatureContribution - * <em>Set Feature Contribution</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Set Feature Contribution</em>'. - * @see org.eclipse.sirius.description.contribution.SetFeatureContribution - * @generated - */ - EClass getSetFeatureContribution(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.AddFeatureContribution - * <em>Add Feature Contribution</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Add Feature Contribution</em>'. - * @see org.eclipse.sirius.description.contribution.AddFeatureContribution - * @generated - */ - EClass getAddFeatureContribution(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.RemoveFeatureContribution - * <em>Remove Feature Contribution</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Remove Feature Contribution</em>'. - * @see org.eclipse.sirius.description.contribution.RemoveFeatureContribution - * @generated - */ - EClass getRemoveFeatureContribution(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.ClearFeatureContribution - * <em>Clear Feature Contribution</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Clear Feature Contribution</em>'. - * @see org.eclipse.sirius.description.contribution.ClearFeatureContribution - * @generated - */ - EClass getClearFeatureContribution(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.ResetFeatureContribution - * <em>Reset Feature Contribution</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Reset Feature Contribution</em>'. - * @see org.eclipse.sirius.description.contribution.ResetFeatureContribution - * @generated - */ - EClass getResetFeatureContribution(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.EObjectReference - * <em>EObject Reference</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>EObject Reference</em>'. - * @see org.eclipse.sirius.description.contribution.EObjectReference - * @generated - */ - EClass getEObjectReference(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.DirectEObjectReference - * <em>Direct EObject Reference</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Direct EObject Reference</em>'. - * @see org.eclipse.sirius.description.contribution.DirectEObjectReference - * @generated - */ - EClass getDirectEObjectReference(); - - /** - * Returns the meta object for the reference ' - * {@link org.eclipse.sirius.description.contribution.DirectEObjectReference#getValue <em>Value</em>}'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the reference '<em>Value</em>'. - * @see org.eclipse.sirius.description.contribution.DirectEObjectReference#getValue() - * @see #getDirectEObjectReference() - * @generated - */ - EReference getDirectEObjectReference_Value(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.ComputedEObjectReference - * <em>Computed EObject Reference</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Computed EObject Reference</em>'. - * @see org.eclipse.sirius.description.contribution.ComputedEObjectReference - * @generated - */ - EClass getComputedEObjectReference(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.sirius.description.contribution.ComputedEObjectReference#getValueExpression <em>Value - * Expression</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Value Expression</em>'. - * @see org.eclipse.sirius.description.contribution.ComputedEObjectReference#getValueExpression() - * @see #getComputedEObjectReference() - * @generated - */ - EAttribute getComputedEObjectReference_ValueExpression(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.Contribution - * <em>Contribution</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Contribution</em>'. - * @see org.eclipse.sirius.description.contribution.Contribution - * @generated - */ - EClass getContribution(); - - /** - * Returns the meta object for the containment reference ' - * {@link org.eclipse.sirius.description.contribution.Contribution#getSource <em>Source</em>}'. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @return the meta object for the containment reference '<em>Source</em>'. - * @see org.eclipse.sirius.description.contribution.Contribution#getSource() - * @see #getContribution() - * @generated - */ - EReference getContribution_Source(); - - /** - * Returns the meta object for the containment reference ' - * {@link org.eclipse.sirius.description.contribution.Contribution#getTarget <em>Target</em>}'. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @return the meta object for the containment reference '<em>Target</em>'. - * @see org.eclipse.sirius.description.contribution.Contribution#getTarget() - * @see #getContribution() - * @generated - */ - EReference getContribution_Target(); - - /** - * Returns the meta object for the containment reference list ' - * {@link org.eclipse.sirius.description.contribution.Contribution#getFeatureMask <em>Feature Mask</em>}'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the containment reference list ' <em>Feature Mask</em>'. - * @see org.eclipse.sirius.description.contribution.Contribution#getFeatureMask() - * @see #getContribution() - * @generated - */ - EReference getContribution_FeatureMask(); - - /** - * Returns the meta object for the containment reference list ' - * {@link org.eclipse.sirius.description.contribution.Contribution#getSubContributions <em>Sub Contributions</em>}'. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the containment reference list ' <em>Sub Contributions</em>'. - * @see org.eclipse.sirius.description.contribution.Contribution#getSubContributions() - * @see #getContribution() - * @generated - */ - EReference getContribution_SubContributions(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.sirius.description.contribution.Contribution#getDescription <em>Description</em>}'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Description</em>'. - * @see org.eclipse.sirius.description.contribution.Contribution#getDescription() - * @see #getContribution() - * @generated - */ - EAttribute getContribution_Description(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.ContributionProvider - * <em>Provider</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Provider</em>'. - * @see org.eclipse.sirius.description.contribution.ContributionProvider - * @generated - */ - EClass getContributionProvider(); - - /** - * Returns the meta object for the containment reference list ' - * {@link org.eclipse.sirius.description.contribution.ContributionProvider#getContributions <em>Contributions</em>} - * '. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the containment reference list ' <em>Contributions</em>'. - * @see org.eclipse.sirius.description.contribution.ContributionProvider#getContributions() - * @see #getContributionProvider() - * @generated - */ - EReference getContributionProvider_Contributions(); - - /** - * Returns the meta object for class ' {@link org.eclipse.sirius.description.contribution.ContributionPoint - * <em>Point</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for class '<em>Point</em>'. - * @see org.eclipse.sirius.description.contribution.ContributionPoint - * @generated - */ - EClass getContributionPoint(); - - /** - * Returns the meta object for the attribute ' - * {@link org.eclipse.sirius.description.contribution.ContributionPoint#getOrigin <em>Origin</em>}'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the attribute '<em>Origin</em>'. - * @see org.eclipse.sirius.description.contribution.ContributionPoint#getOrigin() - * @see #getContributionPoint() - * @generated - */ - EAttribute getContributionPoint_Origin(); - - /** - * Returns the meta object for the reference ' - * {@link org.eclipse.sirius.description.contribution.ContributionPoint#getContributed <em>Contributed</em>}'. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @return the meta object for the reference '<em>Contributed</em>'. - * @see org.eclipse.sirius.description.contribution.ContributionPoint#getContributed() - * @see #getContributionPoint() - * @generated - */ - EReference getContributionPoint_Contributed(); - - /** - * Returns the factory that creates the instances of the model. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the factory that creates the instances of the model. - * @generated - */ - ContributionFactory getContributionFactory(); - - /** - * <!-- begin-user-doc --> Defines literals for the meta objects that represent - * <ul> - * <li>each class,</li> - * <li>each feature of each class,</li> - * <li>each enum,</li> - * <li>and each data type</li> - * </ul> - * <!-- end-user-doc --> - * - * @generated - */ - interface Literals { - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.FeatureContributionImpl <em>Feature Contribution</em> - * }' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.FeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getFeatureContribution() - * @generated - */ - EClass FEATURE_CONTRIBUTION = ContributionPackage.eINSTANCE.getFeatureContribution(); - - /** - * The meta object literal for the '<em><b>Source Feature</b></em>' reference feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - EReference FEATURE_CONTRIBUTION__SOURCE_FEATURE = ContributionPackage.eINSTANCE.getFeatureContribution_SourceFeature(); - - /** - * The meta object literal for the '<em><b>Target Feature</b></em>' reference feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - EReference FEATURE_CONTRIBUTION__TARGET_FEATURE = ContributionPackage.eINSTANCE.getFeatureContribution_TargetFeature(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.IgnoreFeatureContributionImpl <em>Ignore Feature - * Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.IgnoreFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getIgnoreFeatureContribution() - * @generated - */ - EClass IGNORE_FEATURE_CONTRIBUTION = ContributionPackage.eINSTANCE.getIgnoreFeatureContribution(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.SetFeatureContributionImpl <em>Set Feature - * Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.SetFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getSetFeatureContribution() - * @generated - */ - EClass SET_FEATURE_CONTRIBUTION = ContributionPackage.eINSTANCE.getSetFeatureContribution(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.AddFeatureContributionImpl <em>Add Feature - * Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.AddFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getAddFeatureContribution() - * @generated - */ - EClass ADD_FEATURE_CONTRIBUTION = ContributionPackage.eINSTANCE.getAddFeatureContribution(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.RemoveFeatureContributionImpl <em>Remove Feature - * Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.RemoveFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getRemoveFeatureContribution() - * @generated - */ - EClass REMOVE_FEATURE_CONTRIBUTION = ContributionPackage.eINSTANCE.getRemoveFeatureContribution(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.ClearFeatureContributionImpl <em>Clear Feature - * Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ClearFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getClearFeatureContribution() - * @generated - */ - EClass CLEAR_FEATURE_CONTRIBUTION = ContributionPackage.eINSTANCE.getClearFeatureContribution(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.ResetFeatureContributionImpl <em>Reset Feature - * Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ResetFeatureContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getResetFeatureContribution() - * @generated - */ - EClass RESET_FEATURE_CONTRIBUTION = ContributionPackage.eINSTANCE.getResetFeatureContribution(); - - /** - * The meta object literal for the ' {@link org.eclipse.sirius.description.contribution.EObjectReference - * <em>EObject Reference</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.EObjectReference - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getEObjectReference() - * @generated - */ - EClass EOBJECT_REFERENCE = ContributionPackage.eINSTANCE.getEObjectReference(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.DirectEObjectReferenceImpl <em>Direct EObject - * Reference</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.DirectEObjectReferenceImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getDirectEObjectReference() - * @generated - */ - EClass DIRECT_EOBJECT_REFERENCE = ContributionPackage.eINSTANCE.getDirectEObjectReference(); - - /** - * The meta object literal for the '<em><b>Value</b></em>' reference feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - EReference DIRECT_EOBJECT_REFERENCE__VALUE = ContributionPackage.eINSTANCE.getDirectEObjectReference_Value(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.ComputedEObjectReferenceImpl <em>Computed EObject - * Reference</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ComputedEObjectReferenceImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getComputedEObjectReference() - * @generated - */ - EClass COMPUTED_EOBJECT_REFERENCE = ContributionPackage.eINSTANCE.getComputedEObjectReference(); - - /** - * The meta object literal for the '<em><b>Value Expression</b></em>' attribute feature. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @generated - */ - EAttribute COMPUTED_EOBJECT_REFERENCE__VALUE_EXPRESSION = ContributionPackage.eINSTANCE.getComputedEObjectReference_ValueExpression(); - - /** - * The meta object literal for the ' {@link org.eclipse.sirius.description.contribution.impl.ContributionImpl - * <em>Contribution</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ContributionImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getContribution() - * @generated - */ - EClass CONTRIBUTION = ContributionPackage.eINSTANCE.getContribution(); - - /** - * The meta object literal for the '<em><b>Source</b></em>' containment reference feature. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @generated - */ - EReference CONTRIBUTION__SOURCE = ContributionPackage.eINSTANCE.getContribution_Source(); - - /** - * The meta object literal for the '<em><b>Target</b></em>' containment reference feature. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @generated - */ - EReference CONTRIBUTION__TARGET = ContributionPackage.eINSTANCE.getContribution_Target(); - - /** - * The meta object literal for the '<em><b>Feature Mask</b></em>' containment reference list feature. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - EReference CONTRIBUTION__FEATURE_MASK = ContributionPackage.eINSTANCE.getContribution_FeatureMask(); - - /** - * The meta object literal for the '<em><b>Sub Contributions</b></em>' containment reference list feature. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - EReference CONTRIBUTION__SUB_CONTRIBUTIONS = ContributionPackage.eINSTANCE.getContribution_SubContributions(); - - /** - * The meta object literal for the '<em><b>Description</b></em>' attribute feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - EAttribute CONTRIBUTION__DESCRIPTION = ContributionPackage.eINSTANCE.getContribution_Description(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.ContributionProviderImpl <em>Provider</em>}' class. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ContributionProviderImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getContributionProvider() - * @generated - */ - EClass CONTRIBUTION_PROVIDER = ContributionPackage.eINSTANCE.getContributionProvider(); - - /** - * The meta object literal for the '<em><b>Contributions</b></em>' containment reference list feature. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - EReference CONTRIBUTION_PROVIDER__CONTRIBUTIONS = ContributionPackage.eINSTANCE.getContributionProvider_Contributions(); - - /** - * The meta object literal for the ' - * {@link org.eclipse.sirius.description.contribution.impl.ContributionPointImpl <em>Point</em>}' class. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.impl.ContributionPointImpl - * @see org.eclipse.sirius.description.contribution.impl.ContributionPackageImpl#getContributionPoint() - * @generated - */ - EClass CONTRIBUTION_POINT = ContributionPackage.eINSTANCE.getContributionPoint(); - - /** - * The meta object literal for the '<em><b>Origin</b></em>' attribute feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - EAttribute CONTRIBUTION_POINT__ORIGIN = ContributionPackage.eINSTANCE.getContributionPoint_Origin(); - - /** - * The meta object literal for the '<em><b>Contributed</b></em>' reference feature. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @generated - */ - EReference CONTRIBUTION_POINT__CONTRIBUTED = ContributionPackage.eINSTANCE.getContributionPoint_Contributed(); - - } - -} // ContributionPackage diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionPoint.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionPoint.java deleted file mode 100644 index 76d2c4e3f9..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionPoint.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Point</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.ContributionPoint#getOrigin <em>Origin</em>}</li> - * <li>{@link org.eclipse.sirius.description.contribution.ContributionPoint#getContributed <em>Contributed</em>}</li> - * </ul> - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContributionPoint() - * @model - * @generated - */ -public interface ContributionPoint extends EObject { - /** - * Returns the value of the '<em><b>Origin</b></em>' attribute. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Origin</em>' attribute isn't clear, there really should be more of a description - * here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Origin</em>' attribute. - * @see #setOrigin(String) - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContributionPoint_Origin() - * @model required="true" - * @generated - */ - String getOrigin(); - - /** - * Sets the value of the ' {@link org.eclipse.sirius.description.contribution.ContributionPoint#getOrigin - * <em>Origin</em>}' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Origin</em>' attribute. - * @see #getOrigin() - * @generated - */ - void setOrigin(String value); - - /** - * Returns the value of the '<em><b>Contributed</b></em>' reference. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Contributed</em>' reference isn't clear, there really should be more of a description - * here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Contributed</em>' reference. - * @see #setContributed(EObject) - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContributionPoint_Contributed() - * @model required="true" - * @generated - */ - EObject getContributed(); - - /** - * Sets the value of the ' {@link org.eclipse.sirius.description.contribution.ContributionPoint#getContributed - * <em>Contributed</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Contributed</em>' reference. - * @see #getContributed() - * @generated - */ - void setContributed(EObject value); - -} // ContributionPoint diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionProvider.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionProvider.java deleted file mode 100644 index a1ae917ee5..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ContributionProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Provider</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.ContributionProvider#getContributions <em>Contributions</em>} - * </li> - * </ul> - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContributionProvider() - * @model abstract="true" - * @generated - */ -public interface ContributionProvider extends EObject { - /** - * Returns the value of the '<em><b>Contributions</b></em>' containment reference list. The list contents are of - * type {@link org.eclipse.sirius.description.contribution.Contribution}. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Contributions</em>' containment reference list isn't clear, there really should be - * more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Contributions</em>' containment reference list. - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getContributionProvider_Contributions() - * @model containment="true" resolveProxies="true" - * @generated - */ - EList<Contribution> getContributions(); - -} // ContributionProvider diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/DirectEObjectReference.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/DirectEObjectReference.java deleted file mode 100644 index 5c35991ae0..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/DirectEObjectReference.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Direct EObject Reference</b></em>'. <!-- - * end-user-doc --> - * - * <p> - * The following features are supported: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.DirectEObjectReference#getValue <em>Value</em>}</li> - * </ul> - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getDirectEObjectReference() - * @model - * @generated - */ -public interface DirectEObjectReference extends EObjectReference { - /** - * Returns the value of the '<em><b>Value</b></em>' reference. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Value</em>' reference isn't clear, there really should be more of a description - * here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Value</em>' reference. - * @see #setValue(EObject) - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getDirectEObjectReference_Value() - * @model required="true" - * @generated - */ - EObject getValue(); - - /** - * Sets the value of the ' {@link org.eclipse.sirius.description.contribution.DirectEObjectReference#getValue - * <em>Value</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Value</em>' reference. - * @see #getValue() - * @generated - */ - void setValue(EObject value); - -} // DirectEObjectReference diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/EObjectReference.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/EObjectReference.java deleted file mode 100644 index 4b9fa9b750..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/EObjectReference.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -import org.eclipse.emf.ecore.EObject; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>EObject Reference</b></em>'. <!-- end-user-doc - * --> - * - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getEObjectReference() - * @model interface="true" abstract="true" - * @generated - */ -public interface EObjectReference extends EObject { -} // EObjectReference diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/FeatureContribution.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/FeatureContribution.java deleted file mode 100644 index 07aa0b5bb2..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/FeatureContribution.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * <p> - * The following features are supported: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.FeatureContribution#getSourceFeature <em>Source Feature</em>} - * </li> - * <li>{@link org.eclipse.sirius.description.contribution.FeatureContribution#getTargetFeature <em>Target Feature</em>} - * </li> - * </ul> - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getFeatureContribution() - * @model abstract="true" - * @generated - */ -public interface FeatureContribution extends EObject { - /** - * Returns the value of the '<em><b>Source Feature</b></em>' reference. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Source Feature</em>' reference isn't clear, there really should be more of a - * description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Source Feature</em>' reference. - * @see #setSourceFeature(EStructuralFeature) - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getFeatureContribution_SourceFeature() - * @model required="true" - * @generated - */ - EStructuralFeature getSourceFeature(); - - /** - * Sets the value of the ' {@link org.eclipse.sirius.description.contribution.FeatureContribution#getSourceFeature - * <em>Source Feature</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Source Feature</em>' reference. - * @see #getSourceFeature() - * @generated - */ - void setSourceFeature(EStructuralFeature value); - - /** - * Returns the value of the '<em><b>Target Feature</b></em>' reference. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Target Feature</em>' reference isn't clear, there really should be more of a - * description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Target Feature</em>' reference. - * @see #setTargetFeature(EStructuralFeature) - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getFeatureContribution_TargetFeature() - * @model required="true" - * @generated - */ - EStructuralFeature getTargetFeature(); - - /** - * Sets the value of the ' {@link org.eclipse.sirius.description.contribution.FeatureContribution#getTargetFeature - * <em>Target Feature</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Target Feature</em>' reference. - * @see #getTargetFeature() - * @generated - */ - void setTargetFeature(EStructuralFeature value); - -} // FeatureContribution diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/IgnoreFeatureContribution.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/IgnoreFeatureContribution.java deleted file mode 100644 index e6fbd124c6..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/IgnoreFeatureContribution.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Ignore Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getIgnoreFeatureContribution() - * @model - * @generated - */ -public interface IgnoreFeatureContribution extends FeatureContribution { -} // IgnoreFeatureContribution diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/RemoveFeatureContribution.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/RemoveFeatureContribution.java deleted file mode 100644 index deb4679c6a..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/RemoveFeatureContribution.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Remove Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getRemoveFeatureContribution() - * @model - * @generated - */ -public interface RemoveFeatureContribution extends FeatureContribution { -} // RemoveFeatureContribution diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ResetFeatureContribution.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ResetFeatureContribution.java deleted file mode 100644 index ae40145632..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/ResetFeatureContribution.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Reset Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getResetFeatureContribution() - * @model - * @generated - */ -public interface ResetFeatureContribution extends FeatureContribution { -} // ResetFeatureContribution diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/SetFeatureContribution.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/SetFeatureContribution.java deleted file mode 100644 index 391a289202..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/SetFeatureContribution.java +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution; - -/** - * <!-- begin-user-doc --> A representation of the model object ' <em><b>Set Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage#getSetFeatureContribution() - * @model - * @generated - */ -public interface SetFeatureContribution extends FeatureContribution { -} // SetFeatureContribution diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/AddFeatureContributionImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/AddFeatureContributionImpl.java deleted file mode 100644 index 85a20c1c53..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/AddFeatureContributionImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.sirius.description.contribution.AddFeatureContribution; -import org.eclipse.sirius.description.contribution.ContributionPackage; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Add Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * @generated - */ -public class AddFeatureContributionImpl extends FeatureContributionImpl implements AddFeatureContribution { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected AddFeatureContributionImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.ADD_FEATURE_CONTRIBUTION; - } - -} // AddFeatureContributionImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ClearFeatureContributionImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ClearFeatureContributionImpl.java deleted file mode 100644 index 7b712bf008..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ClearFeatureContributionImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.sirius.description.contribution.ClearFeatureContribution; -import org.eclipse.sirius.description.contribution.ContributionPackage; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Clear Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * @generated - */ -public class ClearFeatureContributionImpl extends FeatureContributionImpl implements ClearFeatureContribution { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ClearFeatureContributionImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.CLEAR_FEATURE_CONTRIBUTION; - } - -} // ClearFeatureContributionImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ComputedEObjectReferenceImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ComputedEObjectReferenceImpl.java deleted file mode 100644 index 3072faf407..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ComputedEObjectReferenceImpl.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.sirius.description.contribution.ComputedEObjectReference; -import org.eclipse.sirius.description.contribution.ContributionPackage; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Computed EObject Reference</b></em>'. <!-- - * end-user-doc --> - * <p> - * The following features are implemented: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.impl.ComputedEObjectReferenceImpl#getValueExpression <em>Value - * Expression</em>}</li> - * </ul> - * - * @generated - */ -public class ComputedEObjectReferenceImpl extends EObjectImpl implements ComputedEObjectReference { - /** - * The default value of the '{@link #getValueExpression() <em>Value Expression</em>}' attribute. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @see #getValueExpression() - * @generated - * @ordered - */ - protected static final String VALUE_EXPRESSION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getValueExpression() <em>Value Expression</em>}' attribute. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @see #getValueExpression() - * @generated - * @ordered - */ - protected String valueExpression = ComputedEObjectReferenceImpl.VALUE_EXPRESSION_EDEFAULT; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ComputedEObjectReferenceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.COMPUTED_EOBJECT_REFERENCE; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String getValueExpression() { - return valueExpression; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setValueExpression(String newValueExpression) { - String oldValueExpression = valueExpression; - valueExpression = newValueExpression; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ContributionPackage.COMPUTED_EOBJECT_REFERENCE__VALUE_EXPRESSION, oldValueExpression, valueExpression)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ContributionPackage.COMPUTED_EOBJECT_REFERENCE__VALUE_EXPRESSION: - return getValueExpression(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ContributionPackage.COMPUTED_EOBJECT_REFERENCE__VALUE_EXPRESSION: - setValueExpression((String) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case ContributionPackage.COMPUTED_EOBJECT_REFERENCE__VALUE_EXPRESSION: - setValueExpression(ComputedEObjectReferenceImpl.VALUE_EXPRESSION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case ContributionPackage.COMPUTED_EOBJECT_REFERENCE__VALUE_EXPRESSION: - return ComputedEObjectReferenceImpl.VALUE_EXPRESSION_EDEFAULT == null ? valueExpression != null : !ComputedEObjectReferenceImpl.VALUE_EXPRESSION_EDEFAULT.equals(valueExpression); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (valueExpression: "); //$NON-NLS-1$ - result.append(valueExpression); - result.append(')'); - return result.toString(); - } - -} // ComputedEObjectReferenceImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionFactoryImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionFactoryImpl.java deleted file mode 100644 index 0fc2e82512..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionFactoryImpl.java +++ /dev/null @@ -1,228 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.impl.EFactoryImpl; -import org.eclipse.emf.ecore.plugin.EcorePlugin; -import org.eclipse.sirius.description.contribution.AddFeatureContribution; -import org.eclipse.sirius.description.contribution.ClearFeatureContribution; -import org.eclipse.sirius.description.contribution.ComputedEObjectReference; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionFactory; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.ContributionPoint; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.description.contribution.IgnoreFeatureContribution; -import org.eclipse.sirius.description.contribution.RemoveFeatureContribution; -import org.eclipse.sirius.description.contribution.ResetFeatureContribution; -import org.eclipse.sirius.description.contribution.SetFeatureContribution; - -/** - * <!-- begin-user-doc --> An implementation of the model <b>Factory</b>. <!-- end-user-doc --> - * - * @generated - */ -public class ContributionFactoryImpl extends EFactoryImpl implements ContributionFactory { - /** - * Creates the default factory implementation. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public static ContributionFactory init() { - try { - ContributionFactory theContributionFactory = (ContributionFactory) EPackage.Registry.INSTANCE.getEFactory(ContributionPackage.eNS_URI); - if (theContributionFactory != null) { - return theContributionFactory; - } - } catch (Exception exception) { - EcorePlugin.INSTANCE.log(exception); - } - return new ContributionFactoryImpl(); - } - - /** - * Creates an instance of the factory. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ContributionFactoryImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EObject create(EClass eClass) { - switch (eClass.getClassifierID()) { - case ContributionPackage.IGNORE_FEATURE_CONTRIBUTION: - return createIgnoreFeatureContribution(); - case ContributionPackage.SET_FEATURE_CONTRIBUTION: - return createSetFeatureContribution(); - case ContributionPackage.ADD_FEATURE_CONTRIBUTION: - return createAddFeatureContribution(); - case ContributionPackage.REMOVE_FEATURE_CONTRIBUTION: - return createRemoveFeatureContribution(); - case ContributionPackage.CLEAR_FEATURE_CONTRIBUTION: - return createClearFeatureContribution(); - case ContributionPackage.RESET_FEATURE_CONTRIBUTION: - return createResetFeatureContribution(); - case ContributionPackage.DIRECT_EOBJECT_REFERENCE: - return createDirectEObjectReference(); - case ContributionPackage.COMPUTED_EOBJECT_REFERENCE: - return createComputedEObjectReference(); - case ContributionPackage.CONTRIBUTION: - return createContribution(); - case ContributionPackage.CONTRIBUTION_POINT: - return createContributionPoint(); - default: - throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public IgnoreFeatureContribution createIgnoreFeatureContribution() { - IgnoreFeatureContributionImpl ignoreFeatureContribution = new IgnoreFeatureContributionImpl(); - return ignoreFeatureContribution; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public SetFeatureContribution createSetFeatureContribution() { - SetFeatureContributionImpl setFeatureContribution = new SetFeatureContributionImpl(); - return setFeatureContribution; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public AddFeatureContribution createAddFeatureContribution() { - AddFeatureContributionImpl addFeatureContribution = new AddFeatureContributionImpl(); - return addFeatureContribution; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public RemoveFeatureContribution createRemoveFeatureContribution() { - RemoveFeatureContributionImpl removeFeatureContribution = new RemoveFeatureContributionImpl(); - return removeFeatureContribution; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ClearFeatureContribution createClearFeatureContribution() { - ClearFeatureContributionImpl clearFeatureContribution = new ClearFeatureContributionImpl(); - return clearFeatureContribution; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ResetFeatureContribution createResetFeatureContribution() { - ResetFeatureContributionImpl resetFeatureContribution = new ResetFeatureContributionImpl(); - return resetFeatureContribution; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public DirectEObjectReference createDirectEObjectReference() { - DirectEObjectReferenceImpl directEObjectReference = new DirectEObjectReferenceImpl(); - return directEObjectReference; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ComputedEObjectReference createComputedEObjectReference() { - ComputedEObjectReferenceImpl computedEObjectReference = new ComputedEObjectReferenceImpl(); - return computedEObjectReference; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Contribution createContribution() { - ContributionImpl contribution = new ContributionImpl(); - return contribution; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ContributionPoint createContributionPoint() { - ContributionPointImpl contributionPoint = new ContributionPointImpl(); - return contributionPoint; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ContributionPackage getContributionPackage() { - return (ContributionPackage) getEPackage(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @deprecated - * @generated - */ - @Deprecated - public static ContributionPackage getPackage() { - return ContributionPackage.eINSTANCE; - } - -} // ContributionFactoryImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionImpl.java deleted file mode 100644 index 7dbb27e03f..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionImpl.java +++ /dev/null @@ -1,481 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.EObjectReference; -import org.eclipse.sirius.description.contribution.FeatureContribution; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Contribution</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.impl.ContributionImpl#getSource <em>Source</em>}</li> - * <li>{@link org.eclipse.sirius.description.contribution.impl.ContributionImpl#getTarget <em>Target</em>}</li> - * <li>{@link org.eclipse.sirius.description.contribution.impl.ContributionImpl#getFeatureMask <em>Feature Mask</em>} - * </li> - * <li>{@link org.eclipse.sirius.description.contribution.impl.ContributionImpl#getSubContributions <em>Sub - * Contributions</em>}</li> - * <li>{@link org.eclipse.sirius.description.contribution.impl.ContributionImpl#getDescription <em>Description</em>} - * </li> - * </ul> - * - * @generated - */ -public class ContributionImpl extends EObjectImpl implements Contribution { - /** - * The cached value of the '{@link #getSource() <em>Source</em>}' containment reference. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see #getSource() - * @generated - * @ordered - */ - protected EObjectReference source; - - /** - * The cached value of the '{@link #getTarget() <em>Target</em>}' containment reference. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see #getTarget() - * @generated - * @ordered - */ - protected EObjectReference target; - - /** - * The cached value of the '{@link #getFeatureMask() <em>Feature Mask</em>}' containment reference list. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getFeatureMask() - * @generated - * @ordered - */ - protected EList<FeatureContribution> featureMask; - - /** - * The cached value of the '{@link #getSubContributions() <em>Sub Contributions</em>}' containment reference list. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @see #getSubContributions() - * @generated - * @ordered - */ - protected EList<Contribution> subContributions; - - /** - * The default value of the '{@link #getDescription() <em>Description</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getDescription() - * @generated - * @ordered - */ - protected static final String DESCRIPTION_EDEFAULT = null; - - /** - * The cached value of the '{@link #getDescription() <em>Description</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getDescription() - * @generated - * @ordered - */ - protected String description = ContributionImpl.DESCRIPTION_EDEFAULT; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ContributionImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.CONTRIBUTION; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EObjectReference getSource() { - if (source != null && source.eIsProxy()) { - InternalEObject oldSource = (InternalEObject) source; - source = (EObjectReference) eResolveProxy(oldSource); - if (source != oldSource) { - InternalEObject newSource = (InternalEObject) source; - NotificationChain msgs = oldSource.eInverseRemove(this, InternalEObject.EOPPOSITE_FEATURE_BASE - ContributionPackage.CONTRIBUTION__SOURCE, null, null); - if (newSource.eInternalContainer() == null) { - msgs = newSource.eInverseAdd(this, InternalEObject.EOPPOSITE_FEATURE_BASE - ContributionPackage.CONTRIBUTION__SOURCE, null, msgs); - } - if (msgs != null) { - msgs.dispatch(); - } - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, ContributionPackage.CONTRIBUTION__SOURCE, oldSource, source)); - } - } - } - return source; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EObjectReference basicGetSource() { - return source; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain basicSetSource(EObjectReference newSource, NotificationChain msgs) { - EObjectReference oldSource = source; - source = newSource; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContributionPackage.CONTRIBUTION__SOURCE, oldSource, newSource); - if (msgs == null) { - msgs = notification; - } else { - msgs.add(notification); - } - } - return msgs; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setSource(EObjectReference newSource) { - if (newSource != source) { - NotificationChain msgs = null; - if (source != null) { - msgs = ((InternalEObject) source).eInverseRemove(this, InternalEObject.EOPPOSITE_FEATURE_BASE - ContributionPackage.CONTRIBUTION__SOURCE, null, msgs); - } - if (newSource != null) { - msgs = ((InternalEObject) newSource).eInverseAdd(this, InternalEObject.EOPPOSITE_FEATURE_BASE - ContributionPackage.CONTRIBUTION__SOURCE, null, msgs); - } - msgs = basicSetSource(newSource, msgs); - if (msgs != null) { - msgs.dispatch(); - } - } else if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ContributionPackage.CONTRIBUTION__SOURCE, newSource, newSource)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EObjectReference getTarget() { - if (target != null && target.eIsProxy()) { - InternalEObject oldTarget = (InternalEObject) target; - target = (EObjectReference) eResolveProxy(oldTarget); - if (target != oldTarget) { - InternalEObject newTarget = (InternalEObject) target; - NotificationChain msgs = oldTarget.eInverseRemove(this, InternalEObject.EOPPOSITE_FEATURE_BASE - ContributionPackage.CONTRIBUTION__TARGET, null, null); - if (newTarget.eInternalContainer() == null) { - msgs = newTarget.eInverseAdd(this, InternalEObject.EOPPOSITE_FEATURE_BASE - ContributionPackage.CONTRIBUTION__TARGET, null, msgs); - } - if (msgs != null) { - msgs.dispatch(); - } - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, ContributionPackage.CONTRIBUTION__TARGET, oldTarget, target)); - } - } - } - return target; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EObjectReference basicGetTarget() { - return target; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public NotificationChain basicSetTarget(EObjectReference newTarget, NotificationChain msgs) { - EObjectReference oldTarget = target; - target = newTarget; - if (eNotificationRequired()) { - ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ContributionPackage.CONTRIBUTION__TARGET, oldTarget, newTarget); - if (msgs == null) { - msgs = notification; - } else { - msgs.add(notification); - } - } - return msgs; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setTarget(EObjectReference newTarget) { - if (newTarget != target) { - NotificationChain msgs = null; - if (target != null) { - msgs = ((InternalEObject) target).eInverseRemove(this, InternalEObject.EOPPOSITE_FEATURE_BASE - ContributionPackage.CONTRIBUTION__TARGET, null, msgs); - } - if (newTarget != null) { - msgs = ((InternalEObject) newTarget).eInverseAdd(this, InternalEObject.EOPPOSITE_FEATURE_BASE - ContributionPackage.CONTRIBUTION__TARGET, null, msgs); - } - msgs = basicSetTarget(newTarget, msgs); - if (msgs != null) { - msgs.dispatch(); - } - } else if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ContributionPackage.CONTRIBUTION__TARGET, newTarget, newTarget)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EList<FeatureContribution> getFeatureMask() { - if (featureMask == null) { - featureMask = new EObjectContainmentEList.Resolving<FeatureContribution>(FeatureContribution.class, this, ContributionPackage.CONTRIBUTION__FEATURE_MASK); - } - return featureMask; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EList<Contribution> getSubContributions() { - if (subContributions == null) { - subContributions = new EObjectContainmentEList.Resolving<Contribution>(Contribution.class, this, ContributionPackage.CONTRIBUTION__SUB_CONTRIBUTIONS); - } - return subContributions; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String getDescription() { - return description; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setDescription(String newDescription) { - String oldDescription = description; - description = newDescription; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ContributionPackage.CONTRIBUTION__DESCRIPTION, oldDescription, description)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION__SOURCE: - return basicSetSource(null, msgs); - case ContributionPackage.CONTRIBUTION__TARGET: - return basicSetTarget(null, msgs); - case ContributionPackage.CONTRIBUTION__FEATURE_MASK: - return ((InternalEList<?>) getFeatureMask()).basicRemove(otherEnd, msgs); - case ContributionPackage.CONTRIBUTION__SUB_CONTRIBUTIONS: - return ((InternalEList<?>) getSubContributions()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION__SOURCE: - if (resolve) { - return getSource(); - } - return basicGetSource(); - case ContributionPackage.CONTRIBUTION__TARGET: - if (resolve) { - return getTarget(); - } - return basicGetTarget(); - case ContributionPackage.CONTRIBUTION__FEATURE_MASK: - return getFeatureMask(); - case ContributionPackage.CONTRIBUTION__SUB_CONTRIBUTIONS: - return getSubContributions(); - case ContributionPackage.CONTRIBUTION__DESCRIPTION: - return getDescription(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION__SOURCE: - setSource((EObjectReference) newValue); - return; - case ContributionPackage.CONTRIBUTION__TARGET: - setTarget((EObjectReference) newValue); - return; - case ContributionPackage.CONTRIBUTION__FEATURE_MASK: - getFeatureMask().clear(); - getFeatureMask().addAll((Collection<? extends FeatureContribution>) newValue); - return; - case ContributionPackage.CONTRIBUTION__SUB_CONTRIBUTIONS: - getSubContributions().clear(); - getSubContributions().addAll((Collection<? extends Contribution>) newValue); - return; - case ContributionPackage.CONTRIBUTION__DESCRIPTION: - setDescription((String) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION__SOURCE: - setSource((EObjectReference) null); - return; - case ContributionPackage.CONTRIBUTION__TARGET: - setTarget((EObjectReference) null); - return; - case ContributionPackage.CONTRIBUTION__FEATURE_MASK: - getFeatureMask().clear(); - return; - case ContributionPackage.CONTRIBUTION__SUB_CONTRIBUTIONS: - getSubContributions().clear(); - return; - case ContributionPackage.CONTRIBUTION__DESCRIPTION: - setDescription(ContributionImpl.DESCRIPTION_EDEFAULT); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION__SOURCE: - return source != null; - case ContributionPackage.CONTRIBUTION__TARGET: - return target != null; - case ContributionPackage.CONTRIBUTION__FEATURE_MASK: - return featureMask != null && !featureMask.isEmpty(); - case ContributionPackage.CONTRIBUTION__SUB_CONTRIBUTIONS: - return subContributions != null && !subContributions.isEmpty(); - case ContributionPackage.CONTRIBUTION__DESCRIPTION: - return ContributionImpl.DESCRIPTION_EDEFAULT == null ? description != null : !ContributionImpl.DESCRIPTION_EDEFAULT.equals(description); - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (description: "); //$NON-NLS-1$ - result.append(description); - result.append(')'); - return result.toString(); - } - -} // ContributionImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionPackageImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionPackageImpl.java deleted file mode 100644 index 7eaee3cd95..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionPackageImpl.java +++ /dev/null @@ -1,630 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EPackage; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EcorePackage; -import org.eclipse.emf.ecore.impl.EPackageImpl; -import org.eclipse.sirius.description.contribution.AddFeatureContribution; -import org.eclipse.sirius.description.contribution.ClearFeatureContribution; -import org.eclipse.sirius.description.contribution.ComputedEObjectReference; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionFactory; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.ContributionPoint; -import org.eclipse.sirius.description.contribution.ContributionProvider; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.description.contribution.EObjectReference; -import org.eclipse.sirius.description.contribution.FeatureContribution; -import org.eclipse.sirius.description.contribution.IgnoreFeatureContribution; -import org.eclipse.sirius.description.contribution.RemoveFeatureContribution; -import org.eclipse.sirius.description.contribution.ResetFeatureContribution; -import org.eclipse.sirius.description.contribution.SetFeatureContribution; - -/** - * <!-- begin-user-doc --> An implementation of the model <b>Package</b>. <!-- end-user-doc --> - * - * @generated - */ -public class ContributionPackageImpl extends EPackageImpl implements ContributionPackage { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass featureContributionEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass ignoreFeatureContributionEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass setFeatureContributionEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass addFeatureContributionEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass removeFeatureContributionEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass clearFeatureContributionEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass resetFeatureContributionEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass eObjectReferenceEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass directEObjectReferenceEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass computedEObjectReferenceEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass contributionEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass contributionProviderEClass = null; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private EClass contributionPointEClass = null; - - /** - * Creates an instance of the model <b>Package</b>, registered with {@link org.eclipse.emf.ecore.EPackage.Registry - * EPackage.Registry} by the package package URI value. - * <p> - * Note: the correct way to create the package is via the static factory method {@link #init init()}, which also - * performs initialization of the package, or returns the registered package, if one already exists. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see org.eclipse.emf.ecore.EPackage.Registry - * @see org.eclipse.sirius.description.contribution.ContributionPackage#eNS_URI - * @see #init() - * @generated - */ - private ContributionPackageImpl() { - super(ContributionPackage.eNS_URI, ContributionFactory.eINSTANCE); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private static boolean isInited = false; - - /** - * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. - * - * <p> - * This method is used to initialize {@link ContributionPackage#eINSTANCE} when that field is accessed. Clients - * should not invoke it directly. Instead, they should simply access that field to obtain the package. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #eNS_URI - * @see #createPackageContents() - * @see #initializePackageContents() - * @generated - */ - public static ContributionPackage init() { - if (ContributionPackageImpl.isInited) { - return (ContributionPackage) EPackage.Registry.INSTANCE.getEPackage(ContributionPackage.eNS_URI); - } - - // Obtain or create and register package - ContributionPackageImpl theContributionPackage = (ContributionPackageImpl) (EPackage.Registry.INSTANCE.get(ContributionPackage.eNS_URI) instanceof ContributionPackageImpl - ? EPackage.Registry.INSTANCE.get(ContributionPackage.eNS_URI) : new ContributionPackageImpl()); - - ContributionPackageImpl.isInited = true; - - // Initialize simple dependencies - EcorePackage.eINSTANCE.eClass(); - - // Create package meta-data objects - theContributionPackage.createPackageContents(); - - // Initialize created meta-data - theContributionPackage.initializePackageContents(); - - // Mark meta-data to indicate it can't be changed - theContributionPackage.freeze(); - - // Update the registry and return the package - EPackage.Registry.INSTANCE.put(ContributionPackage.eNS_URI, theContributionPackage); - return theContributionPackage; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getFeatureContribution() { - return featureContributionEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EReference getFeatureContribution_SourceFeature() { - return (EReference) featureContributionEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EReference getFeatureContribution_TargetFeature() { - return (EReference) featureContributionEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getIgnoreFeatureContribution() { - return ignoreFeatureContributionEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getSetFeatureContribution() { - return setFeatureContributionEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getAddFeatureContribution() { - return addFeatureContributionEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getRemoveFeatureContribution() { - return removeFeatureContributionEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getClearFeatureContribution() { - return clearFeatureContributionEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getResetFeatureContribution() { - return resetFeatureContributionEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getEObjectReference() { - return eObjectReferenceEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getDirectEObjectReference() { - return directEObjectReferenceEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EReference getDirectEObjectReference_Value() { - return (EReference) directEObjectReferenceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getComputedEObjectReference() { - return computedEObjectReferenceEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EAttribute getComputedEObjectReference_ValueExpression() { - return (EAttribute) computedEObjectReferenceEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getContribution() { - return contributionEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EReference getContribution_Source() { - return (EReference) contributionEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EReference getContribution_Target() { - return (EReference) contributionEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EReference getContribution_FeatureMask() { - return (EReference) contributionEClass.getEStructuralFeatures().get(2); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EReference getContribution_SubContributions() { - return (EReference) contributionEClass.getEStructuralFeatures().get(3); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EAttribute getContribution_Description() { - return (EAttribute) contributionEClass.getEStructuralFeatures().get(4); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getContributionProvider() { - return contributionProviderEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EReference getContributionProvider_Contributions() { - return (EReference) contributionProviderEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EClass getContributionPoint() { - return contributionPointEClass; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EAttribute getContributionPoint_Origin() { - return (EAttribute) contributionPointEClass.getEStructuralFeatures().get(0); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EReference getContributionPoint_Contributed() { - return (EReference) contributionPointEClass.getEStructuralFeatures().get(1); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public ContributionFactory getContributionFactory() { - return (ContributionFactory) getEFactoryInstance(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private boolean isCreated = false; - - /** - * Creates the meta-model objects for the package. This method is guarded to have no affect on any invocation but - * its first. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void createPackageContents() { - if (isCreated) { - return; - } - isCreated = true; - - // Create classes and their features - featureContributionEClass = createEClass(ContributionPackage.FEATURE_CONTRIBUTION); - createEReference(featureContributionEClass, ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE); - createEReference(featureContributionEClass, ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE); - - ignoreFeatureContributionEClass = createEClass(ContributionPackage.IGNORE_FEATURE_CONTRIBUTION); - - setFeatureContributionEClass = createEClass(ContributionPackage.SET_FEATURE_CONTRIBUTION); - - addFeatureContributionEClass = createEClass(ContributionPackage.ADD_FEATURE_CONTRIBUTION); - - removeFeatureContributionEClass = createEClass(ContributionPackage.REMOVE_FEATURE_CONTRIBUTION); - - clearFeatureContributionEClass = createEClass(ContributionPackage.CLEAR_FEATURE_CONTRIBUTION); - - resetFeatureContributionEClass = createEClass(ContributionPackage.RESET_FEATURE_CONTRIBUTION); - - eObjectReferenceEClass = createEClass(ContributionPackage.EOBJECT_REFERENCE); - - directEObjectReferenceEClass = createEClass(ContributionPackage.DIRECT_EOBJECT_REFERENCE); - createEReference(directEObjectReferenceEClass, ContributionPackage.DIRECT_EOBJECT_REFERENCE__VALUE); - - computedEObjectReferenceEClass = createEClass(ContributionPackage.COMPUTED_EOBJECT_REFERENCE); - createEAttribute(computedEObjectReferenceEClass, ContributionPackage.COMPUTED_EOBJECT_REFERENCE__VALUE_EXPRESSION); - - contributionEClass = createEClass(ContributionPackage.CONTRIBUTION); - createEReference(contributionEClass, ContributionPackage.CONTRIBUTION__SOURCE); - createEReference(contributionEClass, ContributionPackage.CONTRIBUTION__TARGET); - createEReference(contributionEClass, ContributionPackage.CONTRIBUTION__FEATURE_MASK); - createEReference(contributionEClass, ContributionPackage.CONTRIBUTION__SUB_CONTRIBUTIONS); - createEAttribute(contributionEClass, ContributionPackage.CONTRIBUTION__DESCRIPTION); - - contributionProviderEClass = createEClass(ContributionPackage.CONTRIBUTION_PROVIDER); - createEReference(contributionProviderEClass, ContributionPackage.CONTRIBUTION_PROVIDER__CONTRIBUTIONS); - - contributionPointEClass = createEClass(ContributionPackage.CONTRIBUTION_POINT); - createEAttribute(contributionPointEClass, ContributionPackage.CONTRIBUTION_POINT__ORIGIN); - createEReference(contributionPointEClass, ContributionPackage.CONTRIBUTION_POINT__CONTRIBUTED); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private boolean isInitialized = false; - - /** - * Complete the initialization of the package and its meta-model. This method is guarded to have no affect on any - * invocation but its first. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public void initializePackageContents() { - if (isInitialized) { - return; - } - isInitialized = true; - - // Initialize package - setName(ContributionPackage.eNAME); - setNsPrefix(ContributionPackage.eNS_PREFIX); - setNsURI(ContributionPackage.eNS_URI); - - // Obtain other dependent packages - EcorePackage theEcorePackage = (EcorePackage) EPackage.Registry.INSTANCE.getEPackage(EcorePackage.eNS_URI); - - // Create type parameters - - // Set bounds for type parameters - - // Add supertypes to classes - ignoreFeatureContributionEClass.getESuperTypes().add(this.getFeatureContribution()); - setFeatureContributionEClass.getESuperTypes().add(this.getFeatureContribution()); - addFeatureContributionEClass.getESuperTypes().add(this.getFeatureContribution()); - removeFeatureContributionEClass.getESuperTypes().add(this.getFeatureContribution()); - clearFeatureContributionEClass.getESuperTypes().add(this.getFeatureContribution()); - resetFeatureContributionEClass.getESuperTypes().add(this.getFeatureContribution()); - directEObjectReferenceEClass.getESuperTypes().add(this.getEObjectReference()); - computedEObjectReferenceEClass.getESuperTypes().add(this.getEObjectReference()); - - // Initialize classes and features; add operations and parameters - initEClass(featureContributionEClass, FeatureContribution.class, "FeatureContribution", EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getFeatureContribution_SourceFeature(), theEcorePackage.getEStructuralFeature(), null, "sourceFeature", null, 1, 1, FeatureContribution.class, !EPackageImpl.IS_TRANSIENT, //$NON-NLS-1$ - !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, EPackageImpl.IS_UNIQUE, - !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - initEReference(getFeatureContribution_TargetFeature(), theEcorePackage.getEStructuralFeature(), null, "targetFeature", null, 1, 1, FeatureContribution.class, !EPackageImpl.IS_TRANSIENT, //$NON-NLS-1$ - !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, EPackageImpl.IS_UNIQUE, - !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - - initEClass(ignoreFeatureContributionEClass, IgnoreFeatureContribution.class, "IgnoreFeatureContribution", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ - EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - - initEClass(setFeatureContributionEClass, SetFeatureContribution.class, "SetFeatureContribution", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ - EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - - initEClass(addFeatureContributionEClass, AddFeatureContribution.class, "AddFeatureContribution", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ - EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - - initEClass(removeFeatureContributionEClass, RemoveFeatureContribution.class, "RemoveFeatureContribution", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ - EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - - initEClass(clearFeatureContributionEClass, ClearFeatureContribution.class, "ClearFeatureContribution", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ - EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - - initEClass(resetFeatureContributionEClass, ResetFeatureContribution.class, "ResetFeatureContribution", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ - EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - - initEClass(eObjectReferenceEClass, EObjectReference.class, "EObjectReference", EPackageImpl.IS_ABSTRACT, EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - - initEClass(directEObjectReferenceEClass, DirectEObjectReference.class, "DirectEObjectReference", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ - EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - initEReference(getDirectEObjectReference_Value(), theEcorePackage.getEObject(), null, "value", null, 1, 1, DirectEObjectReference.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, //$NON-NLS-1$ - EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, - EPackageImpl.IS_ORDERED); - - initEClass(computedEObjectReferenceEClass, ComputedEObjectReference.class, "ComputedEObjectReference", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, //$NON-NLS-1$ - EPackageImpl.IS_GENERATED_INSTANCE_CLASS); - initEAttribute(getComputedEObjectReference_ValueExpression(), theEcorePackage.getEString(), "valueExpression", null, 1, 1, ComputedEObjectReference.class, !EPackageImpl.IS_TRANSIENT, //$NON-NLS-1$ - !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - - initEClass(contributionEClass, Contribution.class, "Contribution", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getContribution_Source(), this.getEObjectReference(), null, "source", null, 1, 1, Contribution.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, //$NON-NLS-1$ - EPackageImpl.IS_CHANGEABLE, EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, - EPackageImpl.IS_ORDERED); - initEReference(getContribution_Target(), this.getEObjectReference(), null, "target", null, 1, 1, Contribution.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, //$NON-NLS-1$ - EPackageImpl.IS_CHANGEABLE, EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, - EPackageImpl.IS_ORDERED); - initEReference(getContribution_FeatureMask(), this.getFeatureContribution(), null, "featureMask", null, 1, -1, Contribution.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, //$NON-NLS-1$ - EPackageImpl.IS_CHANGEABLE, EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, - !EPackageImpl.IS_ORDERED); - initEReference(getContribution_SubContributions(), this.getContribution(), null, "subContributions", null, 0, -1, Contribution.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, //$NON-NLS-1$ - EPackageImpl.IS_CHANGEABLE, EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, - EPackageImpl.IS_ORDERED); - initEAttribute(getContribution_Description(), theEcorePackage.getEString(), "description", null, 0, 1, Contribution.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, //$NON-NLS-1$ - EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - - initEClass(contributionProviderEClass, ContributionProvider.class, "ContributionProvider", EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEReference(getContributionProvider_Contributions(), this.getContribution(), null, "contributions", null, 0, -1, ContributionProvider.class, !EPackageImpl.IS_TRANSIENT, //$NON-NLS-1$ - !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, EPackageImpl.IS_UNIQUE, - !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - - initEClass(contributionPointEClass, ContributionPoint.class, "ContributionPoint", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ - initEAttribute(getContributionPoint_Origin(), theEcorePackage.getEString(), "origin", null, 1, 1, ContributionPoint.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, //$NON-NLS-1$ - EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_UNSETTABLE, !EPackageImpl.IS_ID, EPackageImpl.IS_UNIQUE, !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - initEReference(getContributionPoint_Contributed(), theEcorePackage.getEObject(), null, "contributed", null, 1, 1, ContributionPoint.class, !EPackageImpl.IS_TRANSIENT, //$NON-NLS-1$ - !EPackageImpl.IS_VOLATILE, EPackageImpl.IS_CHANGEABLE, !EPackageImpl.IS_COMPOSITE, EPackageImpl.IS_RESOLVE_PROXIES, !EPackageImpl.IS_UNSETTABLE, EPackageImpl.IS_UNIQUE, - !EPackageImpl.IS_DERIVED, EPackageImpl.IS_ORDERED); - - // Create resource - createResource(ContributionPackage.eNS_URI); - } - -} // ContributionPackageImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionPointImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionPointImpl.java deleted file mode 100644 index 587e9fad59..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionPointImpl.java +++ /dev/null @@ -1,241 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.ContributionPoint; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Point</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.impl.ContributionPointImpl#getOrigin <em>Origin</em>}</li> - * <li>{@link org.eclipse.sirius.description.contribution.impl.ContributionPointImpl#getContributed <em>Contributed</em> - * }</li> - * </ul> - * - * @generated - */ -public class ContributionPointImpl extends EObjectImpl implements ContributionPoint { - /** - * The default value of the '{@link #getOrigin() <em>Origin</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getOrigin() - * @generated - * @ordered - */ - protected static final String ORIGIN_EDEFAULT = null; - - /** - * The cached value of the '{@link #getOrigin() <em>Origin</em>}' attribute. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getOrigin() - * @generated - * @ordered - */ - protected String origin = ContributionPointImpl.ORIGIN_EDEFAULT; - - /** - * The cached value of the '{@link #getContributed() <em>Contributed</em>}' reference. <!-- begin-user-doc --> <!-- - * end-user-doc --> - * - * @see #getContributed() - * @generated - * @ordered - */ - protected EObject contributed; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ContributionPointImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.CONTRIBUTION_POINT; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String getOrigin() { - return origin; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setOrigin(String newOrigin) { - String oldOrigin = origin; - origin = newOrigin; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ContributionPackage.CONTRIBUTION_POINT__ORIGIN, oldOrigin, origin)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EObject getContributed() { - if (contributed != null && contributed.eIsProxy()) { - InternalEObject oldContributed = (InternalEObject) contributed; - contributed = eResolveProxy(oldContributed); - if (contributed != oldContributed) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, ContributionPackage.CONTRIBUTION_POINT__CONTRIBUTED, oldContributed, contributed)); - } - } - } - return contributed; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EObject basicGetContributed() { - return contributed; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setContributed(EObject newContributed) { - EObject oldContributed = contributed; - contributed = newContributed; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ContributionPackage.CONTRIBUTION_POINT__CONTRIBUTED, oldContributed, contributed)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION_POINT__ORIGIN: - return getOrigin(); - case ContributionPackage.CONTRIBUTION_POINT__CONTRIBUTED: - if (resolve) { - return getContributed(); - } - return basicGetContributed(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION_POINT__ORIGIN: - setOrigin((String) newValue); - return; - case ContributionPackage.CONTRIBUTION_POINT__CONTRIBUTED: - setContributed((EObject) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION_POINT__ORIGIN: - setOrigin(ContributionPointImpl.ORIGIN_EDEFAULT); - return; - case ContributionPackage.CONTRIBUTION_POINT__CONTRIBUTED: - setContributed((EObject) null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION_POINT__ORIGIN: - return ContributionPointImpl.ORIGIN_EDEFAULT == null ? origin != null : !ContributionPointImpl.ORIGIN_EDEFAULT.equals(origin); - case ContributionPackage.CONTRIBUTION_POINT__CONTRIBUTED: - return contributed != null; - } - return super.eIsSet(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public String toString() { - if (eIsProxy()) { - return super.toString(); - } - - StringBuffer result = new StringBuffer(super.toString()); - result.append(" (origin: "); //$NON-NLS-1$ - result.append(origin); - result.append(')'); - return result.toString(); - } - -} // ContributionPointImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionProviderImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionProviderImpl.java deleted file mode 100644 index c89257a19d..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ContributionProviderImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import java.util.Collection; - -import org.eclipse.emf.common.notify.NotificationChain; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.emf.ecore.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.ContributionProvider; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Provider</b></em>'. <!-- end-user-doc --> - * <p> - * The following features are implemented: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.impl.ContributionProviderImpl#getContributions - * <em>Contributions</em>}</li> - * </ul> - * - * @generated - */ -public abstract class ContributionProviderImpl extends EObjectImpl implements ContributionProvider { - /** - * The cached value of the '{@link #getContributions() <em>Contributions</em>}' containment reference list. <!-- - * begin-user-doc --> <!-- end-user-doc --> - * - * @see #getContributions() - * @generated - * @ordered - */ - protected EList<Contribution> contributions; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ContributionProviderImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.CONTRIBUTION_PROVIDER; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EList<Contribution> getContributions() { - if (contributions == null) { - contributions = new EObjectContainmentEList.Resolving<Contribution>(Contribution.class, this, ContributionPackage.CONTRIBUTION_PROVIDER__CONTRIBUTIONS); - } - return contributions; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION_PROVIDER__CONTRIBUTIONS: - return ((InternalEList<?>) getContributions()).basicRemove(otherEnd, msgs); - } - return super.eInverseRemove(otherEnd, featureID, msgs); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION_PROVIDER__CONTRIBUTIONS: - return getContributions(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @SuppressWarnings("unchecked") - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION_PROVIDER__CONTRIBUTIONS: - getContributions().clear(); - getContributions().addAll((Collection<? extends Contribution>) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION_PROVIDER__CONTRIBUTIONS: - getContributions().clear(); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case ContributionPackage.CONTRIBUTION_PROVIDER__CONTRIBUTIONS: - return contributions != null && !contributions.isEmpty(); - } - return super.eIsSet(featureID); - } - -} // ContributionProviderImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/DirectEObjectReferenceImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/DirectEObjectReferenceImpl.java deleted file mode 100644 index 9d86e971cd..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/DirectEObjectReferenceImpl.java +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Direct EObject Reference</b></em>'. <!-- - * end-user-doc --> - * <p> - * The following features are implemented: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.impl.DirectEObjectReferenceImpl#getValue <em>Value</em>}</li> - * </ul> - * - * @generated - */ -public class DirectEObjectReferenceImpl extends EObjectImpl implements DirectEObjectReference { - /** - * The cached value of the '{@link #getValue() <em>Value</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc - * --> - * - * @see #getValue() - * @generated - * @ordered - */ - protected EObject value; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected DirectEObjectReferenceImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.DIRECT_EOBJECT_REFERENCE; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EObject getValue() { - if (value != null && value.eIsProxy()) { - InternalEObject oldValue = (InternalEObject) value; - value = eResolveProxy(oldValue); - if (value != oldValue) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, ContributionPackage.DIRECT_EOBJECT_REFERENCE__VALUE, oldValue, value)); - } - } - } - return value; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EObject basicGetValue() { - return value; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setValue(EObject newValue) { - EObject oldValue = value; - value = newValue; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ContributionPackage.DIRECT_EOBJECT_REFERENCE__VALUE, oldValue, value)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ContributionPackage.DIRECT_EOBJECT_REFERENCE__VALUE: - if (resolve) { - return getValue(); - } - return basicGetValue(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ContributionPackage.DIRECT_EOBJECT_REFERENCE__VALUE: - setValue((EObject) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case ContributionPackage.DIRECT_EOBJECT_REFERENCE__VALUE: - setValue((EObject) null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case ContributionPackage.DIRECT_EOBJECT_REFERENCE__VALUE: - return value != null; - } - return super.eIsSet(featureID); - } - -} // DirectEObjectReferenceImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/FeatureContributionImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/FeatureContributionImpl.java deleted file mode 100644 index 06915ff165..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/FeatureContributionImpl.java +++ /dev/null @@ -1,236 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.impl.ENotificationImpl; -import org.eclipse.emf.ecore.impl.EObjectImpl; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.FeatureContribution; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * <p> - * The following features are implemented: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.description.contribution.impl.FeatureContributionImpl#getSourceFeature <em>Source - * Feature</em>}</li> - * <li>{@link org.eclipse.sirius.description.contribution.impl.FeatureContributionImpl#getTargetFeature <em>Target - * Feature</em>}</li> - * </ul> - * - * @generated - */ -public abstract class FeatureContributionImpl extends EObjectImpl implements FeatureContribution { - /** - * The cached value of the '{@link #getSourceFeature() <em>Source Feature</em>}' reference. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see #getSourceFeature() - * @generated - * @ordered - */ - protected EStructuralFeature sourceFeature; - - /** - * The cached value of the '{@link #getTargetFeature() <em>Target Feature</em>}' reference. <!-- begin-user-doc --> - * <!-- end-user-doc --> - * - * @see #getTargetFeature() - * @generated - * @ordered - */ - protected EStructuralFeature targetFeature; - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected FeatureContributionImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.FEATURE_CONTRIBUTION; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EStructuralFeature getSourceFeature() { - if (sourceFeature != null && sourceFeature.eIsProxy()) { - InternalEObject oldSourceFeature = (InternalEObject) sourceFeature; - sourceFeature = (EStructuralFeature) eResolveProxy(oldSourceFeature); - if (sourceFeature != oldSourceFeature) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE, oldSourceFeature, sourceFeature)); - } - } - } - return sourceFeature; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EStructuralFeature basicGetSourceFeature() { - return sourceFeature; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setSourceFeature(EStructuralFeature newSourceFeature) { - EStructuralFeature oldSourceFeature = sourceFeature; - sourceFeature = newSourceFeature; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE, oldSourceFeature, sourceFeature)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public EStructuralFeature getTargetFeature() { - if (targetFeature != null && targetFeature.eIsProxy()) { - InternalEObject oldTargetFeature = (InternalEObject) targetFeature; - targetFeature = (EStructuralFeature) eResolveProxy(oldTargetFeature); - if (targetFeature != oldTargetFeature) { - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.RESOLVE, ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE, oldTargetFeature, targetFeature)); - } - } - } - return targetFeature; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public EStructuralFeature basicGetTargetFeature() { - return targetFeature; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void setTargetFeature(EStructuralFeature newTargetFeature) { - EStructuralFeature oldTargetFeature = targetFeature; - targetFeature = newTargetFeature; - if (eNotificationRequired()) { - eNotify(new ENotificationImpl(this, Notification.SET, ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE, oldTargetFeature, targetFeature)); - } - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public Object eGet(int featureID, boolean resolve, boolean coreType) { - switch (featureID) { - case ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE: - if (resolve) { - return getSourceFeature(); - } - return basicGetSourceFeature(); - case ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE: - if (resolve) { - return getTargetFeature(); - } - return basicGetTargetFeature(); - } - return super.eGet(featureID, resolve, coreType); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eSet(int featureID, Object newValue) { - switch (featureID) { - case ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE: - setSourceFeature((EStructuralFeature) newValue); - return; - case ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE: - setTargetFeature((EStructuralFeature) newValue); - return; - } - super.eSet(featureID, newValue); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public void eUnset(int featureID) { - switch (featureID) { - case ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE: - setSourceFeature((EStructuralFeature) null); - return; - case ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE: - setTargetFeature((EStructuralFeature) null); - return; - } - super.eUnset(featureID); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - public boolean eIsSet(int featureID) { - switch (featureID) { - case ContributionPackage.FEATURE_CONTRIBUTION__SOURCE_FEATURE: - return sourceFeature != null; - case ContributionPackage.FEATURE_CONTRIBUTION__TARGET_FEATURE: - return targetFeature != null; - } - return super.eIsSet(featureID); - } - -} // FeatureContributionImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/IgnoreFeatureContributionImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/IgnoreFeatureContributionImpl.java deleted file mode 100644 index da31cab5da..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/IgnoreFeatureContributionImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.IgnoreFeatureContribution; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Ignore Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * @generated - */ -public class IgnoreFeatureContributionImpl extends FeatureContributionImpl implements IgnoreFeatureContribution { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected IgnoreFeatureContributionImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.IGNORE_FEATURE_CONTRIBUTION; - } - -} // IgnoreFeatureContributionImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/RemoveFeatureContributionImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/RemoveFeatureContributionImpl.java deleted file mode 100644 index 412239972f..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/RemoveFeatureContributionImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.RemoveFeatureContribution; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Remove Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * @generated - */ -public class RemoveFeatureContributionImpl extends FeatureContributionImpl implements RemoveFeatureContribution { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected RemoveFeatureContributionImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.REMOVE_FEATURE_CONTRIBUTION; - } - -} // RemoveFeatureContributionImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ResetFeatureContributionImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ResetFeatureContributionImpl.java deleted file mode 100644 index 3cce3b304b..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/ResetFeatureContributionImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.ResetFeatureContribution; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Reset Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * @generated - */ -public class ResetFeatureContributionImpl extends FeatureContributionImpl implements ResetFeatureContribution { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ResetFeatureContributionImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.RESET_FEATURE_CONTRIBUTION; - } - -} // ResetFeatureContributionImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/SetFeatureContributionImpl.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/SetFeatureContributionImpl.java deleted file mode 100644 index 3adc937f6f..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/impl/SetFeatureContributionImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.impl; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.SetFeatureContribution; - -/** - * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Set Feature Contribution</b></em>'. <!-- - * end-user-doc --> - * - * @generated - */ -public class SetFeatureContributionImpl extends FeatureContributionImpl implements SetFeatureContribution { - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected SetFeatureContributionImpl() { - super(); - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override - protected EClass eStaticClass() { - return ContributionPackage.Literals.SET_FEATURE_CONTRIBUTION; - } - -} // SetFeatureContributionImpl diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/util/ContributionAdapterFactory.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/util/ContributionAdapterFactory.java deleted file mode 100644 index 042fa6e5fb..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/util/ContributionAdapterFactory.java +++ /dev/null @@ -1,361 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.util; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.description.contribution.AddFeatureContribution; -import org.eclipse.sirius.description.contribution.ClearFeatureContribution; -import org.eclipse.sirius.description.contribution.ComputedEObjectReference; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.ContributionPoint; -import org.eclipse.sirius.description.contribution.ContributionProvider; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.description.contribution.EObjectReference; -import org.eclipse.sirius.description.contribution.FeatureContribution; -import org.eclipse.sirius.description.contribution.IgnoreFeatureContribution; -import org.eclipse.sirius.description.contribution.RemoveFeatureContribution; -import org.eclipse.sirius.description.contribution.ResetFeatureContribution; -import org.eclipse.sirius.description.contribution.SetFeatureContribution; - -/** - * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides an adapter <code>createXXX</code> - * method for each class of the model. <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage - * @generated - */ -public class ContributionAdapterFactory extends AdapterFactoryImpl { - /** - * The cached model package. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected static ContributionPackage modelPackage; - - /** - * Creates an instance of the adapter factory. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ContributionAdapterFactory() { - if (ContributionAdapterFactory.modelPackage == null) { - ContributionAdapterFactory.modelPackage = ContributionPackage.eINSTANCE; - } - } - - /** - * Returns whether this factory is applicable for the type of the object. <!-- begin-user-doc --> This - * implementation returns <code>true</code> if the object is either the model's package or is an instance object of - * the model. <!-- end-user-doc --> - * - * @return whether this factory is applicable for the type of the object. - * @generated - */ - @Override - public boolean isFactoryForType(Object object) { - if (object == ContributionAdapterFactory.modelPackage) { - return true; - } - if (object instanceof EObject) { - return ((EObject) object).eClass().getEPackage() == ContributionAdapterFactory.modelPackage; - } - return false; - } - - /** - * The switch that delegates to the <code>createXXX</code> methods. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected ContributionSwitch<Adapter> modelSwitch = new ContributionSwitch<Adapter>() { - @Override - public Adapter caseFeatureContribution(FeatureContribution object) { - return createFeatureContributionAdapter(); - } - - @Override - public Adapter caseIgnoreFeatureContribution(IgnoreFeatureContribution object) { - return createIgnoreFeatureContributionAdapter(); - } - - @Override - public Adapter caseSetFeatureContribution(SetFeatureContribution object) { - return createSetFeatureContributionAdapter(); - } - - @Override - public Adapter caseAddFeatureContribution(AddFeatureContribution object) { - return createAddFeatureContributionAdapter(); - } - - @Override - public Adapter caseRemoveFeatureContribution(RemoveFeatureContribution object) { - return createRemoveFeatureContributionAdapter(); - } - - @Override - public Adapter caseClearFeatureContribution(ClearFeatureContribution object) { - return createClearFeatureContributionAdapter(); - } - - @Override - public Adapter caseResetFeatureContribution(ResetFeatureContribution object) { - return createResetFeatureContributionAdapter(); - } - - @Override - public Adapter caseEObjectReference(EObjectReference object) { - return createEObjectReferenceAdapter(); - } - - @Override - public Adapter caseDirectEObjectReference(DirectEObjectReference object) { - return createDirectEObjectReferenceAdapter(); - } - - @Override - public Adapter caseComputedEObjectReference(ComputedEObjectReference object) { - return createComputedEObjectReferenceAdapter(); - } - - @Override - public Adapter caseContribution(Contribution object) { - return createContributionAdapter(); - } - - @Override - public Adapter caseContributionProvider(ContributionProvider object) { - return createContributionProviderAdapter(); - } - - @Override - public Adapter caseContributionPoint(ContributionPoint object) { - return createContributionPointAdapter(); - } - - @Override - public Adapter defaultCase(EObject object) { - return createEObjectAdapter(); - } - }; - - /** - * Creates an adapter for the <code>target</code>. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param target - * the object to adapt. - * @return the adapter for the <code>target</code>. - * @generated - */ - @Override - public Adapter createAdapter(Notifier target) { - return modelSwitch.doSwitch((EObject) target); - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.FeatureContribution <em>Feature Contribution</em>}'. <!-- - * begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to - * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.FeatureContribution - * @generated - */ - public Adapter createFeatureContributionAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.IgnoreFeatureContribution <em>Ignore Feature Contribution</em> - * }'. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's - * useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.IgnoreFeatureContribution - * @generated - */ - public Adapter createIgnoreFeatureContributionAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.SetFeatureContribution <em>Set Feature Contribution</em>}'. - * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful - * to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.SetFeatureContribution - * @generated - */ - public Adapter createSetFeatureContributionAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.AddFeatureContribution <em>Add Feature Contribution</em>}'. - * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful - * to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.AddFeatureContribution - * @generated - */ - public Adapter createAddFeatureContributionAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.RemoveFeatureContribution <em>Remove Feature Contribution</em> - * }'. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's - * useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.RemoveFeatureContribution - * @generated - */ - public Adapter createRemoveFeatureContributionAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.ClearFeatureContribution <em>Clear Feature Contribution</em>} - * '. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's - * useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.ClearFeatureContribution - * @generated - */ - public Adapter createClearFeatureContributionAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.ResetFeatureContribution <em>Reset Feature Contribution</em>} - * '. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's - * useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.ResetFeatureContribution - * @generated - */ - public Adapter createResetFeatureContributionAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.EObjectReference <em>EObject Reference</em>}'. <!-- - * begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful to - * ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.EObjectReference - * @generated - */ - public Adapter createEObjectReferenceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.DirectEObjectReference <em>Direct EObject Reference</em>}'. - * <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's useful - * to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.DirectEObjectReference - * @generated - */ - public Adapter createDirectEObjectReferenceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.ComputedEObjectReference <em>Computed EObject Reference</em>} - * '. <!-- begin-user-doc --> This default implementation returns null so that we can easily ignore cases; it's - * useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.ComputedEObjectReference - * @generated - */ - public Adapter createComputedEObjectReferenceAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' {@link org.eclipse.sirius.description.contribution.Contribution - * <em>Contribution</em>}'. <!-- begin-user-doc --> This default implementation returns null so that we can easily - * ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. <!-- end-user-doc - * --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.Contribution - * @generated - */ - public Adapter createContributionAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.ContributionProvider <em>Provider</em>}'. <!-- begin-user-doc - * --> This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case - * when inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.ContributionProvider - * @generated - */ - public Adapter createContributionProviderAdapter() { - return null; - } - - /** - * Creates a new adapter for an object of class ' - * {@link org.eclipse.sirius.description.contribution.ContributionPoint <em>Point</em>}'. <!-- begin-user-doc --> - * This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when - * inheritance will catch all the cases anyway. <!-- end-user-doc --> - * - * @return the new adapter. - * @see org.eclipse.sirius.description.contribution.ContributionPoint - * @generated - */ - public Adapter createContributionPointAdapter() { - return null; - } - - /** - * Creates a new adapter for the default case. <!-- begin-user-doc --> This default implementation returns null. - * <!-- end-user-doc --> - * - * @return the new adapter. - * @generated - */ - public Adapter createEObjectAdapter() { - return null; - } - -} // ContributionAdapterFactory diff --git a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/util/ContributionSwitch.java b/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/util/ContributionSwitch.java deleted file mode 100644 index 80d7b7da20..0000000000 --- a/plugins/org.eclipse.sirius/src-gen/org/eclipse/sirius/description/contribution/util/ContributionSwitch.java +++ /dev/null @@ -1,437 +0,0 @@ -/** - * Copyright (c) 2007, 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - * - */ -package org.eclipse.sirius.description.contribution.util; - -import java.util.List; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.description.contribution.AddFeatureContribution; -import org.eclipse.sirius.description.contribution.ClearFeatureContribution; -import org.eclipse.sirius.description.contribution.ComputedEObjectReference; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.description.contribution.ContributionPoint; -import org.eclipse.sirius.description.contribution.ContributionProvider; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.description.contribution.EObjectReference; -import org.eclipse.sirius.description.contribution.FeatureContribution; -import org.eclipse.sirius.description.contribution.IgnoreFeatureContribution; -import org.eclipse.sirius.description.contribution.RemoveFeatureContribution; -import org.eclipse.sirius.description.contribution.ResetFeatureContribution; -import org.eclipse.sirius.description.contribution.SetFeatureContribution; - -/** - * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance hierarchy. It supports the call - * {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each class of the model, - * starting with the actual class of the object and proceeding up the inheritance hierarchy until a non-null result is - * returned, which is the result of the switch. <!-- end-user-doc --> - * - * @see org.eclipse.sirius.description.contribution.ContributionPackage - * @generated - */ -public class ContributionSwitch<T> { - /** - * The cached model package <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - protected static ContributionPackage modelPackage; - - /** - * Creates an instance of the switch. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - public ContributionSwitch() { - if (ContributionSwitch.modelPackage == null) { - ContributionSwitch.modelPackage = ContributionPackage.eINSTANCE; - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that - * result. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that - * result. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == ContributionSwitch.modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject); - } - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that - * result. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - protected T doSwitch(int classifierID, EObject theEObject) { - switch (classifierID) { - case ContributionPackage.FEATURE_CONTRIBUTION: { - FeatureContribution featureContribution = (FeatureContribution) theEObject; - T result = caseFeatureContribution(featureContribution); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.IGNORE_FEATURE_CONTRIBUTION: { - IgnoreFeatureContribution ignoreFeatureContribution = (IgnoreFeatureContribution) theEObject; - T result = caseIgnoreFeatureContribution(ignoreFeatureContribution); - if (result == null) { - result = caseFeatureContribution(ignoreFeatureContribution); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.SET_FEATURE_CONTRIBUTION: { - SetFeatureContribution setFeatureContribution = (SetFeatureContribution) theEObject; - T result = caseSetFeatureContribution(setFeatureContribution); - if (result == null) { - result = caseFeatureContribution(setFeatureContribution); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.ADD_FEATURE_CONTRIBUTION: { - AddFeatureContribution addFeatureContribution = (AddFeatureContribution) theEObject; - T result = caseAddFeatureContribution(addFeatureContribution); - if (result == null) { - result = caseFeatureContribution(addFeatureContribution); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.REMOVE_FEATURE_CONTRIBUTION: { - RemoveFeatureContribution removeFeatureContribution = (RemoveFeatureContribution) theEObject; - T result = caseRemoveFeatureContribution(removeFeatureContribution); - if (result == null) { - result = caseFeatureContribution(removeFeatureContribution); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.CLEAR_FEATURE_CONTRIBUTION: { - ClearFeatureContribution clearFeatureContribution = (ClearFeatureContribution) theEObject; - T result = caseClearFeatureContribution(clearFeatureContribution); - if (result == null) { - result = caseFeatureContribution(clearFeatureContribution); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.RESET_FEATURE_CONTRIBUTION: { - ResetFeatureContribution resetFeatureContribution = (ResetFeatureContribution) theEObject; - T result = caseResetFeatureContribution(resetFeatureContribution); - if (result == null) { - result = caseFeatureContribution(resetFeatureContribution); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.EOBJECT_REFERENCE: { - EObjectReference eObjectReference = (EObjectReference) theEObject; - T result = caseEObjectReference(eObjectReference); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.DIRECT_EOBJECT_REFERENCE: { - DirectEObjectReference directEObjectReference = (DirectEObjectReference) theEObject; - T result = caseDirectEObjectReference(directEObjectReference); - if (result == null) { - result = caseEObjectReference(directEObjectReference); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.COMPUTED_EOBJECT_REFERENCE: { - ComputedEObjectReference computedEObjectReference = (ComputedEObjectReference) theEObject; - T result = caseComputedEObjectReference(computedEObjectReference); - if (result == null) { - result = caseEObjectReference(computedEObjectReference); - } - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.CONTRIBUTION: { - Contribution contribution = (Contribution) theEObject; - T result = caseContribution(contribution); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.CONTRIBUTION_PROVIDER: { - ContributionProvider contributionProvider = (ContributionProvider) theEObject; - T result = caseContributionProvider(contributionProvider); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - case ContributionPackage.CONTRIBUTION_POINT: { - ContributionPoint contributionPoint = (ContributionPoint) theEObject; - T result = caseContributionPoint(contributionPoint); - if (result == null) { - result = defaultCase(theEObject); - } - return result; - } - default: - return defaultCase(theEObject); - } - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Feature Contribution</em>'. <!-- - * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Feature Contribution</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseFeatureContribution(FeatureContribution object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Ignore Feature Contribution</em>'. <!-- - * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Ignore Feature Contribution</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseIgnoreFeatureContribution(IgnoreFeatureContribution object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Set Feature Contribution</em>'. <!-- - * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Set Feature Contribution</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseSetFeatureContribution(SetFeatureContribution object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Add Feature Contribution</em>'. <!-- - * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Add Feature Contribution</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseAddFeatureContribution(AddFeatureContribution object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Remove Feature Contribution</em>'. <!-- - * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Remove Feature Contribution</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseRemoveFeatureContribution(RemoveFeatureContribution object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Clear Feature Contribution</em>'. <!-- - * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Clear Feature Contribution</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseClearFeatureContribution(ClearFeatureContribution object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Reset Feature Contribution</em>'. <!-- - * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Reset Feature Contribution</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseResetFeatureContribution(ResetFeatureContribution object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>EObject Reference</em>'. <!-- - * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>EObject Reference</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseEObjectReference(EObjectReference object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Direct EObject Reference</em>'. <!-- - * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Direct EObject Reference</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseDirectEObjectReference(DirectEObjectReference object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Computed EObject Reference</em>'. <!-- - * begin-user-doc --> This implementation returns null; returning a non-null result will terminate the switch. <!-- - * end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Computed EObject Reference</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseComputedEObjectReference(ComputedEObjectReference object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Contribution</em>'. <!-- begin-user-doc --> - * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Contribution</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseContribution(Contribution object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Provider</em>'. <!-- begin-user-doc --> - * This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Provider</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseContributionProvider(ContributionProvider object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>Point</em>'. <!-- begin-user-doc --> This - * implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>Point</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) - * @generated - */ - public T caseContributionPoint(ContributionPoint object) { - return null; - } - - /** - * Returns the result of interpreting the object as an instance of ' <em>EObject</em>'. <!-- begin-user-doc --> This - * implementation returns null; returning a non-null result will terminate the switch, but this is the last case - * anyway. <!-- end-user-doc --> - * - * @param object - * the target of the switch. - * @return the result of interpreting the object as an instance of ' <em>EObject</em>'. - * @see #doSwitch(org.eclipse.emf.ecore.EObject) - * @generated - */ - public T defaultCase(EObject object) { - return null; - } - -} // ContributionSwitch diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/componentization/ViewpointRegistry.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/componentization/ViewpointRegistry.java index 7472705081..fbf5842299 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/componentization/ViewpointRegistry.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/componentization/ViewpointRegistry.java @@ -22,7 +22,6 @@ import org.eclipse.emf.ecore.util.ECrossReferenceAdapter; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.sirius.business.api.query.IdentifiedElementQuery; import org.eclipse.sirius.business.internal.componentization.ViewpointRegistryImpl; -import org.eclipse.sirius.business.internal.movida.Movida; import org.eclipse.sirius.viewpoint.description.Component; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; @@ -132,11 +131,7 @@ public class ViewpointRegistry implements IResourceChangeListener { private static class ViewpointRegistryHolder { private static ViewpointRegistry instance; static { - if (Movida.isEnabled()) { - instance = new org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry(); - } else { - instance = new ViewpointRegistryImpl(); - } + instance = new ViewpointRegistryImpl(); instance.init(10); } } 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 ad853df74e..c8180040dc 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 @@ -107,31 +107,16 @@ public abstract class AbstractRepresentationDialectServices implements DialectSe */ protected abstract boolean isSupported(RepresentationDescription description); - /** - * {@inheritDoc} - */ @Override public void notify(RepresentationNotification notification) { // Empty default implementation. } - - /** - * {@inheritDoc} - */ + @Override public void updateRepresentationsExtendedBy(Session session, Viewpoint viewpoint, boolean activated) { // No support for representation extension by default. } - - /** - * {@inheritDoc} - */ - @Override - public void refreshEffectiveRepresentationDescription(DRepresentation representation, IProgressMonitor monitor) { - // Do nothing by default, not all dialects have effective representation - // descriptions. - } - + @Override public void refresh(DRepresentation representation, IProgressMonitor monitor) { refresh(representation, false, monitor); @@ -492,25 +477,16 @@ public abstract class AbstractRepresentationDialectServices implements DialectSe return shouldInitializeRepresentation; } - /** - * {@inheritDoc} - */ @Override public void invalidateMappingCache() { // No cache to invalidate by default } - /** - * {@inheritDoc} - */ @Override public Option<? extends AbstractCommandTask> createTask(CommandContext context, ModelAccessor extPackage, ModelOperation op, Session session, UICallBack uiCallback) { return Options.newNone(); } - /** - * {@inheritDoc} - */ @Override public boolean allowsEStructuralFeatureCustomization(EObject choice) { // Do not support structural feature customization by default 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 2414a3bdf6..20e08d82e1 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, 2017 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2018 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 @@ -85,16 +85,6 @@ public interface DialectServices { DRepresentation copyRepresentation(DRepresentation representation, String name, Session session, IProgressMonitor monitor); /** - * Refresh the actual representation description used for the specified representation when the context changes. - * - * @param representation - * the representation whose description to update. - * @param monitor - * to monitor the refresh operation. - */ - void refreshEffectiveRepresentationDescription(DRepresentation representation, IProgressMonitor monitor); - - /** * Refresh a representation. By default a lazy refresh is done, i.e. only view model elements for which UI parts * will be visible will be created by the refresh. To do a full refresh use * {@link DialectServices#refresh(DRepresentation, boolean, IProgressMonitor)} with true as second parameter. diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/helper/SiriusResourceHelper.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/helper/SiriusResourceHelper.java index 603cfd6e9e..37c586bf7f 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/helper/SiriusResourceHelper.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/helper/SiriusResourceHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2010 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2018 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 @@ -21,17 +21,11 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.sirius.business.api.query.ViewpointQuery; import org.eclipse.sirius.business.api.session.Session; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.base.Options; import org.eclipse.sirius.viewpoint.DAnalysis; import org.eclipse.sirius.viewpoint.DView; import org.eclipse.sirius.viewpoint.description.Viewpoint; -import com.google.common.base.Objects; - /** * An helper uses to manage the Sirius resource (between the {@link ResourceSet} * of the @@ -197,38 +191,4 @@ public final class SiriusResourceHelper { } return false; } - - /** - * Finds the viewpoint instance with the specified logical URI inside the - * editing domain of the session, optionally loading it if it is not - * already. - * - * @param session - * the session in which to look for. - * @param uri - * the logical URI of the viewpoint to locate. - * @param loadOnDemand - * whether or not to try to load the resource providing the - * specified viewpoint if it is not already loaded in the - * session's editing domain. - * @return a Sirius instance from the session's editing domain with the - * specified logical URI, if it could be found or loaded. - */ - public static Option<Viewpoint> getCorrespondingViewpoint(Session session, URI uri, boolean loadOnDemand) { - ViewpointRegistry registry = (ViewpointRegistry) org.eclipse.sirius.business.api.componentization.ViewpointRegistry.getInstance(); - Option<URI> providerURI = registry.getProvider(uri); - if (providerURI.some()) { - TransactionalEditingDomain domain = session.getTransactionalEditingDomain(); - Resource editingDomainResource = domain.getResourceSet().getResource(providerURI.get(), loadOnDemand); - if (editingDomainResource != null) { - for (Viewpoint vp : registry.getSiriusResourceHandler().collectViewpointDefinitions(editingDomainResource)) { - Option<URI> vpURI = new ViewpointQuery(vp).getViewpointURI(); - if (vpURI.some() && Objects.equal(vpURI.get(), uri)) { - return Options.newSome(vp); - } - } - } - } - return Options.newNone(); - } } diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/session/danalysis/DAnalysisSessionHelper.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/session/danalysis/DAnalysisSessionHelper.java index eb46f3f3c7..6f9fc97e51 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/session/danalysis/DAnalysisSessionHelper.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/api/session/danalysis/DAnalysisSessionHelper.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 THALES GLOBAL SERVICES. + * Copyright (c) 2007, 2018 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 @@ -16,18 +16,14 @@ import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; -import java.util.Set; -import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.sirius.business.api.query.DAnalysisQuery; import org.eclipse.sirius.business.api.query.EObjectQuery; import org.eclipse.sirius.business.api.query.RepresentationDescriptionQuery; import org.eclipse.sirius.business.api.query.URIQuery; -import org.eclipse.sirius.business.api.query.ViewpointQuery; import org.eclipse.sirius.business.api.resource.ResourceDescriptor; -import org.eclipse.sirius.business.internal.movida.ViewpointSelection; import org.eclipse.sirius.common.tools.api.util.EqualityHelper; import org.eclipse.sirius.ext.base.Option; import org.eclipse.sirius.viewpoint.DAnalysis; @@ -39,10 +35,7 @@ import org.eclipse.sirius.viewpoint.ViewpointFactory; import org.eclipse.sirius.viewpoint.description.RepresentationDescription; import org.eclipse.sirius.viewpoint.description.Viewpoint; -import com.google.common.base.Function; -import com.google.common.collect.Iterables; import com.google.common.collect.Iterators; -import com.google.common.collect.Sets; /** * Helper for {@link DAnalysisSession}. @@ -339,28 +332,6 @@ public final class DAnalysisSessionHelper { } /** - * Creates a {@link ViewpointSelection} representing the set of currently - * selected/enabled viewpoints in the specified session. - * - * @param registry - * the registry to be used by the selection. - * @param session - * the session. - * @return the set of currently selected viewpoints in the session. - */ - public static ViewpointSelection getViewpointSelection(org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry registry, DAnalysisSession session) { - ViewpointSelection selection = new ViewpointSelection(registry); - Set<URI> selectedBefore = Sets.newHashSet(Iterables.transform(session.getSelectedViewpoints(false), new Function<Viewpoint, URI>() { - @Override - public URI apply(Viewpoint from) { - return new ViewpointQuery(from).getViewpointURI().get(); - } - })); - selection.setSelected(selectedBefore); - return selection; - } - - /** * Complete the models references of the DAnalysis according to all the * {@link DSemanticDecorator} of the {@link DRepresentation} * contained(precisely referenced by the DRepresentationDescriptor contained diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ContributionBuilder.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ContributionBuilder.java deleted file mode 100644 index 8a1707301f..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ContributionBuilder.java +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.Iterator; - -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.sirius.description.contribution.ComputedEObjectReference; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionFactory; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.description.contribution.FeatureContribution; -import org.eclipse.sirius.ext.emf.EStructuralFeatureQuery; - -import com.google.common.base.Preconditions; - -/** - * Builder class to facilitate the creation of complex <code>Contribution</code> - * . - * - * @author pierre-charles.david@obeo.fr - */ -public class ContributionBuilder { - private static ContributionFactory factory = ContributionFactory.eINSTANCE; - - private EClass sourceType; - - private EClass targetType; - - private Contribution contribution; - - /** - * Constructor. - */ - public ContributionBuilder() { - contribution = factory.createContribution(); - } - - /** - * Returns the contribution built. - * - * @return the contribution built. - */ - public Contribution build() { - return contribution; - } - - /** - * Sets the source of the contribution to a direct reference to the - * specified object. - * - * @param source - * the object to use as source for the contribution. - * @return the builder itself. - */ - public ContributionBuilder from(EObject source) { - this.sourceType = source.eClass(); - DirectEObjectReference ref = factory.createDirectEObjectReference(); - ref.setValue(source); - contribution.setSource(ref); - return this; - } - - /** - * Sets the source of the contribution to a computed reference using the - * specified expression. - * - * @param expression - * the expression to use to find the contribution source. - * @param srcType - * the expected type of the resolved contribution source. - * @return the builder itself. - */ - public ContributionBuilder from(String expression, EClass srcType) { - this.sourceType = srcType; - ComputedEObjectReference ref = factory.createComputedEObjectReference(); - ref.setValueExpression(expression); - contribution.setSource(ref); - return this; - } - - /** - * Sets the target of the contribution to a direct reference to the - * specified object. - * - * @param target - * the object to use as target for the contribution. - * @return the builder itself. - */ - public ContributionBuilder to(EObject target) { - this.targetType = target.eClass(); - DirectEObjectReference ref = factory.createDirectEObjectReference(); - ref.setValue(target); - contribution.setTarget(ref); - return this; - } - - /** - * Sets the target of the contribution to a computed reference using the - * specified expression. - * - * @param expression - * the expression to use to find the contribution target. - * @param tgtType - * the expected type of the resolved contribution target. - * @return the builder itself. - */ - public ContributionBuilder to(String expression, EClass tgtType) { - this.targetType = tgtType; - ComputedEObjectReference ref = factory.createComputedEObjectReference(); - ref.setValueExpression(expression); - contribution.setTarget(ref); - return this; - } - - // CHECKSTYLE:OFF - - public ContributionBuilder keep(EStructuralFeature targetFeature) { - removeFeatureContributionsTo(targetFeature); - return this; - } - - public ContributionBuilder keep(String targetFeature) { - return keep(targetType.getEStructuralFeature(targetFeature)); - } - - public ContributionBuilder set(EStructuralFeature targetFeature, EStructuralFeature sourceFeature) { - FeatureContribution fc = factory.createSetFeatureContribution(); - configureFeatureContribution(fc, targetFeature, sourceFeature); - return this; - } - - public ContributionBuilder set(EStructuralFeature feature) { - return set(feature, feature); - } - - public ContributionBuilder set(String targetFeature, String sourceFeature) { - return set(targetType.getEStructuralFeature(targetFeature), sourceType.getEStructuralFeature(sourceFeature)); - } - - public ContributionBuilder set(String feature) { - return set(feature, feature); - } - - public ContributionBuilder setAllAttributes() { - for (EAttribute attr : targetType.getEAllAttributes()) { - if (attr.isChangeable() && !attr.isDerived()) { - set(attr); - } - } - return this; - } - - public ContributionBuilder addAllAttributes() { - for (EAttribute attr : targetType.getEAllAttributes()) { - if (attr.isChangeable() && !attr.isDerived() && attr.isMany()) { - add(attr); - } - } - return this; - } - - public ContributionBuilder add(EStructuralFeature targetFeature, EStructuralFeature sourceFeature) { - FeatureContribution fc = factory.createAddFeatureContribution(); - configureFeatureContribution(fc, targetFeature, sourceFeature); - return this; - } - - public ContributionBuilder add(EStructuralFeature feature) { - return add(feature, feature); - } - - public ContributionBuilder add(String targetFeature, String sourceFeature) { - return add(targetType.getEStructuralFeature(targetFeature), sourceType.getEStructuralFeature(sourceFeature)); - } - - public ContributionBuilder add(String feature) { - return add(feature, feature); - } - - public ContributionBuilder remove(EStructuralFeature targetFeature, EStructuralFeature sourceFeature) { - FeatureContribution fc = factory.createRemoveFeatureContribution(); - configureFeatureContribution(fc, targetFeature, sourceFeature); - return this; - } - - public ContributionBuilder remove(EStructuralFeature feature) { - return remove(feature, feature); - } - - public ContributionBuilder remove(String targetFeature, String sourceFeature) { - return remove(targetType.getEStructuralFeature(targetFeature), sourceType.getEStructuralFeature(sourceFeature)); - } - - public ContributionBuilder remove(String feature) { - return remove(feature, feature); - } - - private void configureFeatureContribution(FeatureContribution fc, EStructuralFeature targetFeature, EStructuralFeature sourceFeature) { - Preconditions.checkArgument(new EStructuralFeatureQuery(sourceFeature).isAssignableFrom(targetFeature)); - fc.setSourceFeature(sourceFeature); - fc.setTargetFeature(targetFeature); - addFeatureContribution(fc); - } - - private void addFeatureContribution(FeatureContribution fc) { - removeFeatureContributionsTo(fc.getTargetFeature()); - contribution.getFeatureMask().add(fc); - } - - private void removeFeatureContributionsTo(EStructuralFeature targetFeature) { - for (Iterator<FeatureContribution> iter = contribution.getFeatureMask().iterator(); iter.hasNext();) { - FeatureContribution existingFc = iter.next(); - if (existingFc.getTargetFeature().equals(targetFeature)) { - iter.remove(); - } - } - } - // CHECKSTYLE:ON - -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ContributionFinder.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ContributionFinder.java deleted file mode 100644 index 7fe2d3d127..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ContributionFinder.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.ContributionPackage; -import org.eclipse.sirius.ext.emf.AllContents; - -import com.google.common.base.Function; -import com.google.common.collect.Iterables; -/** - * Implementations of a - * {@code Function<EObject, Iterable<Contribution>>} for the common - * cases. - * - * @author pierre-charles.david@obeo.fr - */ -public final class ContributionFinder { - private ContributionFinder() { - // Prevents instantiation. - } - - /** - * Returns a contribution provider with a fixed set of contributions, - * independently of the input model. - * - * @param contribs - * the contributions to provide. - * @return a function which provides the specified contributions to all - * input models. - */ - public static Function<Iterable<EObject>, Iterable<Contribution>> providing(Contribution... contribs) { - return providing(Arrays.asList(contribs)); - } - - /** - * Returns a contribution provider with a fixed set of contributions, - * independently of the input model. - * - * @param contribs - * the contributions to provide. - * @return a function which provides the specified contributions to all - * input models. - */ - public static Function<Iterable<EObject>, Iterable<Contribution>> providing(final Iterable<Contribution> contribs) { - return new Function<Iterable<EObject>, Iterable<Contribution>>() { - public Iterable<Contribution> apply(Iterable<EObject> from) { - return contribs; - } - }; - } - - /** - * Returns a contribution provider which looks for all the - * {@link Contribution} elements contained inside the input model (including - * the input model itself if it is a contribution. - * - * @return a function which finds all the Contribution elements in the input - * model. - */ - public static Function<Iterable<EObject>, Iterable<Contribution>> intrinsic() { - return new Function<Iterable<EObject>, Iterable<Contribution>>() { - public Iterable<Contribution> apply(Iterable<EObject> from) { - List<Contribution> result = new ArrayList<>(); - for (EObject root : from) { - Iterables.addAll(result, Iterables.filter(AllContents.of(root, ContributionPackage.eINSTANCE.getContribution(), true), Contribution.class)); - } - return result; - } - }; - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ContributionPointHelper.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ContributionPointHelper.java deleted file mode 100644 index 84337356d2..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ContributionPointHelper.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.List; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.description.contribution.ContributionFactory; -import org.eclipse.sirius.description.contribution.ContributionPoint; - -import com.google.common.base.Objects; - -/** - * Helper class to deal with {@link ContributionPoint}s. - * - * @author pierre-charles.david@obeo.fr - */ -public final class ContributionPointHelper { - private ContributionPointHelper() { - // Prevent instantiation. - } - - /** - * Create a new contribution point with the specified values. - * - * @param point - * the contributed object. - * @param origin - * the identifier for the original location of the contributed - * object. - * @return the new {@link ContributionPoint}. - */ - public static ContributionPoint make(EObject point, String origin) { - ContributionPoint cp = ContributionFactory.eINSTANCE.createContributionPoint(); - cp.setContributed(point); - cp.setOrigin(origin); - return cp; - } - - /** - * Updates a list of contribution points to make new data, but only if the - * new data is not equivalent to the current values. Note that the - * implementation considers that an update is needed if the contribution - * points re equivalent but are not in the same order. - * - * @param originalPoints - * the original list of contribution points to update. - * @param newPoints - * the new contribution points to consider. - */ - public static void updateIfNeeded(EList<ContributionPoint> originalPoints, List<ContributionPoint> newPoints) { - if (!sameContributions(originalPoints, newPoints)) { - originalPoints.clear(); - originalPoints.addAll(newPoints); - } - } - - private static boolean sameContributions(EList<ContributionPoint> contributionPoints, List<ContributionPoint> newPoints) { - boolean result = true; - if (contributionPoints.size() != newPoints.size()) { - result = false; - } else { - for (int i = 0; i < contributionPoints.size(); i++) { - ContributionPoint oldPoint = contributionPoints.get(i); - ContributionPoint newPoint = newPoints.get(i); - if (!sameContribution(oldPoint, newPoint)) { - result = false; - break; - } - } - } - return result; - } - - private static boolean sameContribution(ContributionPoint oldPoint, ContributionPoint newPoint) { - return Objects.equal(oldPoint.getContributed(), newPoint.getContributed()) && Objects.equal(oldPoint.getOrigin(), newPoint.getOrigin()); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/FeatureContributor.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/FeatureContributor.java deleted file mode 100644 index d9039319cb..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/FeatureContributor.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.text.MessageFormat; -import java.util.Collection; -import java.util.Collections; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.sirius.description.contribution.AddFeatureContribution; -import org.eclipse.sirius.description.contribution.ClearFeatureContribution; -import org.eclipse.sirius.description.contribution.FeatureContribution; -import org.eclipse.sirius.description.contribution.IgnoreFeatureContribution; -import org.eclipse.sirius.description.contribution.RemoveFeatureContribution; -import org.eclipse.sirius.description.contribution.ResetFeatureContribution; -import org.eclipse.sirius.description.contribution.SetFeatureContribution; -import org.eclipse.sirius.description.contribution.util.ContributionSwitch; -import org.eclipse.sirius.ext.emf.EStructuralFeatureQuery; -import org.eclipse.sirius.viewpoint.Messages; - -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; - -/** - * A feature contribution can modify the value of a single feature in a target - * object, using a value from a type-compatible feature in a source object. How - * exactly the value of target feature is combined with the initial value of the - * source feature depends on the contribution mode. - * - * @author pierre-charles.david@obeo.fr - */ -public class FeatureContributor { - private final FeatureContribution contribution; - - private Set<EObject> additions; - - /** - * Constructor. - * - * @param contribution - * the definition of the contribution to apply. - */ - public FeatureContributor(FeatureContribution contribution) { - this.contribution = Preconditions.checkNotNull(contribution); - // Preconditions.checkArgument(contribution.getSourceFeature() != null, - // "No source feature specified."); - Preconditions.checkArgument(contribution.getTargetFeature() != null, Messages.FeatureContributor_noTargetFeatureErrorMsg); - Preconditions.checkArgument(contribution.getTargetFeature().isChangeable(), Messages.FeatureContributor_unmodifiableFeatureErrorMsg); - Preconditions.checkArgument(new EStructuralFeatureQuery(contribution.getTargetFeature()).isAssignableFrom(contribution.getSourceFeature()), - Messages.FeatureContributor_imcompatibleFeaturesErrorMsg); - } - - /** - * Apply the contribution using the specified source and target objects. - * - * @param target - * the object in which to contribute. - * @param source - * the object from which to obtain the values to contribute. - * @return the set of root elements added inside the target object of the - * last application. - */ - public Set<EObject> apply(final EObject target, final EObject source) { - Preconditions.checkNotNull(source, Messages.FeatureContributor_noSourceSpefifiedErrorMsg); - Preconditions.checkNotNull(target, Messages.FeatureContributor_noTargetSpecifiedErrorMsg); - this.additions = Collections.emptySet(); - ContributionSwitch<Void> contributionSwitch = new ContributionSwitch<Void>() { - @Override - public Void caseIgnoreFeatureContribution(IgnoreFeatureContribution object) { - // Ignore has nothing to do. - return null; - }; - - @Override - public Void caseSetFeatureContribution(SetFeatureContribution sfc) { - doSet(target, source, sfc); - return null; - } - - @Override - public Void caseAddFeatureContribution(AddFeatureContribution afc) { - doAdd(target, source, afc); - return null; - } - - @Override - public Void caseRemoveFeatureContribution(RemoveFeatureContribution afc) { - doRemove(target, source, afc); - return null; - } - - @Override - public Void caseClearFeatureContribution(ClearFeatureContribution cfc) { - doClear(target, cfc); - return null; - } - - @Override - public Void caseResetFeatureContribution(ResetFeatureContribution rfc) { - doReset(target, rfc); - return null; - } - }; - contributionSwitch.doSwitch(contribution); - return additions; - } - - private void doSet(EObject target, EObject source, SetFeatureContribution sfc) { - EStructuralFeature sourceFeature = sfc.getSourceFeature(); - EStructuralFeature targetFeature = sfc.getTargetFeature(); - - Object value = sourceFeature != null ? source.eGet(sourceFeature) : source; - target.eSet(targetFeature, value); - - if (isAddition()) { - additions = Collections.singleton((EObject) value); - } - } - - private void doAdd(final EObject target, final EObject source, AddFeatureContribution afc) { - EStructuralFeature sourceFeature = afc.getSourceFeature(); - if (sourceFeature != null) { - Preconditions.checkArgument(sourceFeature.isMany()); - checkFeatureIsPresent(source, sourceFeature, Messages.FeatureContributor_sourceObject); - } - - EStructuralFeature targetFeature = afc.getTargetFeature(); - Preconditions.checkArgument(targetFeature.isMany()); - checkFeatureIsPresent(target, targetFeature, Messages.FeatureContributor_targetObject); - - Collection<Object> targetValues = getMany(target, targetFeature); - Collection<Object> sourceValues; - if (sourceFeature != null) { - sourceValues = getMany(source, sourceFeature); - } else { - sourceValues = Collections.<Object> singletonList(source); - } - - if (isAddition()) { - // Get to objects from sourceValues before they are removed when - // added to the source. - additions = ImmutableSet.copyOf(Iterables.filter(sourceValues, EObject.class)); - } - - targetValues.addAll(sourceValues); - } - - private void doRemove(final EObject target, final EObject source, RemoveFeatureContribution afc) { - EStructuralFeature sourceFeature = afc.getSourceFeature(); - if (sourceFeature != null) { - Preconditions.checkArgument(sourceFeature.isMany()); - checkFeatureIsPresent(source, sourceFeature, Messages.FeatureContributor_sourceObject); - } - - EStructuralFeature targetFeature = afc.getTargetFeature(); - Preconditions.checkArgument(targetFeature.isMany()); - checkFeatureIsPresent(target, targetFeature, Messages.FeatureContributor_targetObject); - - Collection<Object> targetValues = getMany(target, targetFeature); - Collection<Object> sourceValues; - if (sourceFeature != null) { - sourceValues = getMany(source, sourceFeature); - } else { - sourceValues = Collections.<Object> singletonList(source); - } - targetValues.removeAll(sourceValues); - } - - private void doClear(EObject target, ClearFeatureContribution cfc) { - EStructuralFeature targetFeature = cfc.getTargetFeature(); - Preconditions.checkArgument(targetFeature.isMany()); - checkFeatureIsPresent(target, targetFeature, Messages.FeatureContributor_targetObject); - - Collection<Object> targetValues = getMany(target, targetFeature); - targetValues.clear(); - } - - private void doReset(EObject target, ResetFeatureContribution rfc) { - EStructuralFeature targetFeature = rfc.getTargetFeature(); - checkFeatureIsPresent(target, targetFeature, Messages.FeatureContributor_targetObject); - target.eUnset(targetFeature); - } - - /** - * Get the values of a many-valued feature as a collection. - */ - @SuppressWarnings("unchecked") - private Collection<Object> getMany(EObject target, EStructuralFeature targetFeature) { - Object rawValue = target.eGet(targetFeature); - if (rawValue != null && !(rawValue instanceof Collection<?>)) { - throw new RuntimeException(MessageFormat.format(Messages.FeatureContributor_unexpectedTypeErrorMsg, featureString(targetFeature), rawValue.getClass())); - } - return (Collection<Object>) rawValue; - } - - private String featureString(EStructuralFeature feature) { - return feature.getContainerClass().getName() + "." + feature.getName(); //$NON-NLS-1$ - } - - private void checkFeatureIsPresent(EObject obj, EStructuralFeature feature, String name) { - boolean present = new EStructuralFeatureQuery(feature).existsIn(obj); - Preconditions.checkArgument(present, MessageFormat.format(Messages.FeatureContributor_featureMissingMsg, name, obj, featureString(feature))); - } - - private boolean isAddition() { - return contribution.getTargetFeature() instanceof EReference && ((EReference) contribution.getTargetFeature()).isContainment(); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/IdentifierBasedMatcher.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/IdentifierBasedMatcher.java deleted file mode 100644 index 5dd38b189d..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/IdentifierBasedMatcher.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Obeo. - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; - -import com.google.common.base.Function; -import com.google.common.base.Objects; -import com.google.common.base.Preconditions; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; - -/** - * A matcher that uses logical identifiers to match elements from two different - * models. - * - * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a> - */ -public class IdentifierBasedMatcher implements Matcher { - private final Function<EObject, Object> idFunction; - - /** - * Constructor. - * - * @param idFunction - * the function to use to obtain the identifier from a model - * element. - */ - public IdentifierBasedMatcher(Function<EObject, Object> idFunction) { - this.idFunction = Preconditions.checkNotNull(idFunction); - } - - /** - * {@inheritDoc} - */ - public boolean areSameLogicalElement(EObject obj1, EObject obj2) { - Object id1 = idFunction.apply(Preconditions.checkNotNull(obj1)); - Object id2 = idFunction.apply(Preconditions.checkNotNull(obj2)); - return Objects.equal(id1, id2); - } - - /** - * {@inheritDoc} - */ - public BiMap<EObject, EObject> computeMatches(Collection<EObject> values1, Collection<EObject> values2) { - BiMap<EObject, EObject> result = HashBiMap.create(); - Map<Object, EObject> matchingElements = computeIds(values2); - for (EObject obj : values1) { - Object id1 = idFunction.apply(obj); - EObject match = matchingElements.get(id1); - if (match != null && values2.contains(match)) { - result.put(obj, match); - } - } - return result; - } - - private Map<Object, EObject> computeIds(Iterable<EObject> elements) { - Map<Object, EObject> result = new HashMap<>(); - for (EObject obj : elements) { - result.put(idFunction.apply(obj), obj); - } - return result; - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/IncrementalModelContributor.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/IncrementalModelContributor.java deleted file mode 100644 index 26759b79e2..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/IncrementalModelContributor.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.emf.ecore.util.EcoreUtil.Copier; -import org.eclipse.sirius.business.api.query.ViewpointQuery; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.FeatureContribution; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.emf.AllContents; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Function; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -/** - * Similar to a {@link ModelContributor}, but successive operations with - * different inputs incrementally modify the result of the first one. - * - * @author pierre-charles.david@obeo.fr - */ -public class IncrementalModelContributor extends ModelContributor { - /** - * The resulting model. <code>null</code> initially, before the first - * contribution application. - */ - private EObject model; - - private Map<EObject, Object> modelIds; - - private Function<EObject, Object> idFunction; - - private Map<EObject, Object> contributions; - - private Copier currentCopier; - - private Map<Viewpoint, String> viewpointUris; - - private List<EStructuralFeature> targetsWithEOpposites; - - /** - * Create a new {@link IncrementalModelContributor}. - * - * @param contributionFinder - * the function to use to find all the potentially applicable - * contributions from a source model. - * @param resolver - * the resolver to use on the contributions to locate their - * actual source and target elements. - * @param idFunction - * the function used to obtain logical identifiers for model - * elements, required to perform the incremental update. - * - */ - public IncrementalModelContributor(Function<Iterable<EObject>, Iterable<Contribution>> contributionFinder, ReferenceResolver resolver, Function<EObject, Object> idFunction) { - super(contributionFinder, resolver); - this.idFunction = Preconditions.checkNotNull(idFunction); - } - - /** - * Applies all the applicable contributions found in the sources (including - * the target model itself) to the target model. - * - * @param targetModel - * the model to which the contributions should be applied. - * @param contributionSources - * source models, in addition to the target model itself, which - * may provide contributions. - * @return the modified target model, with the contributions applied. - */ - public EObject apply(EObject targetModel, Collection<? extends EObject> contributionSources) { - Collection<EObject> referenceInputs = Lists.newArrayList(contributionSources); - currentCopier = new EcoreUtil.Copier(); - List<EObject> inputs = Lists.newArrayList(currentCopier.copyAll(referenceInputs)); - currentCopier.copyReferences(); - - Map<EObject, Object> inputIds = new HashMap<>(); - for (EObject root : referenceInputs) { - for (EObject obj : AllContents.of(root, true)) { - inputIds.put(currentCopier.get(obj), idFunction.apply(obj)); - } - } - - viewpointUris = new HashMap<>(); - for (Viewpoint originalVP : Iterables.filter(currentCopier.keySet(), Viewpoint.class)) { - Option<URI> uri = new ViewpointQuery(originalVP).getViewpointURI(); - if (uri.some()) { - viewpointUris.put((Viewpoint) currentCopier.get(originalVP), uri.get().toString()); - } - } - - EObject result = super.apply(currentCopier.get(targetModel), inputs); - postProcess(result); - contributions = Maps.newHashMap(Maps.filterKeys(inputIds, Predicates.in(additions))); - - if (model == null) { - model = result; - modelIds = Maps.newHashMap(Maps.filterKeys(inputIds, new Predicate<EObject>() { - public boolean apply(EObject input) { - return input == model || EcoreUtil.isAncestor(model, input); - } - })); - } else { - Function<EObject, Object> f = update(result, inputIds); - Map<EObject, Object> newIds = new HashMap<>(); - for (EObject obj : AllContents.of(model, true)) { - newIds.put(obj, f.apply(obj)); - } - modelIds = newIds; - } - return model; - } - - /** - * Allow sub-classes to adjust the resulting model right after the - * contributions have been applied. - * - * @param result - * the result model. - */ - protected void postProcess(EObject result) { - // Nothing by default. - } - - /** - * Returns the identifier associated with obj, which must be an element of - * the result model. - * - * @param obj - * an element of the result model. - * @return the identifier of obj. - */ - public Object getIdentifier(EObject obj) { - return modelIds.get(obj); - } - - /** - * Reset the state of the contributor. - * - * @param newModel - * the model. - * @param ids - * the identifiers of every elements of the model. - */ - public void resetState(EObject newModel, Map<EObject, ? extends Object> ids) { - this.model = newModel; - this.modelIds = Maps.newHashMap(ids); - } - - public Map<EObject, Object> getContributionPoints() { - return ImmutableMap.copyOf(contributions); - } - - /** - * Returns the logical Sirius URI of a copied Sirius instance. The URI - * can not be retrieved from the copy as it is not inside a resource. - * - * @param copiedSirius - * a copied instance of Sirius - * @return the logical URI of the Sirius, as retrived from the original - * instance which lives in a VSM. - */ - protected String getSiriusURI(Viewpoint copiedSirius) { - return viewpointUris.get(copiedSirius); - } - - /** - * {@inheritDoc} - */ - @Override - protected List<Contribution> findAllContributions(EObject targetModel, Iterable<EObject> sources) { - /* - * Return the versions of the Contribution objects from the copied - * sources, not the original (as those would point to original elements - * as their source and targets). - */ - List<Contribution> rawResult = super.findAllContributions(targetModel, sources); - List<Contribution> result = Lists.newArrayListWithCapacity(rawResult.size()); - for (Contribution contribution : rawResult) { - if (currentCopier.containsKey(contribution)) { - EObject copy = currentCopier.get(contribution); - if (copy instanceof Contribution) { - result.add((Contribution) copy); - } - } else { - result.add(contribution); - } - } - targetsWithEOpposites = new ArrayList<>(); - for (Contribution contribution : result) { - for (FeatureContribution fc : contribution.getFeatureMask()) { - if (fc.getTargetFeature() instanceof EReference && ((EReference) fc.getTargetFeature()).getEOpposite() != null) { - targetsWithEOpposites.add(((EReference) fc.getTargetFeature()).getEOpposite()); - } - } - } - return result; - } - - private Function<EObject, Object> update(EObject result, final Map<EObject, Object> inputIds) { - Function<EObject, Object> idFunction2 = new Function<EObject, Object>() { - public Object apply(EObject from) { - if (modelIds.containsKey(from)) { - return modelIds.get(from); - } else { - return inputIds.get(from); - } - } - }; - Matcher matcher = new IdentifierBasedMatcher(idFunction2); - Updater updater = new Updater(matcher, model, result); - updater.setFeaturesToIgnore(targetsWithEOpposites); - updater.update(); - return idFunction2; - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/IntrinsicPathIdentifier.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/IntrinsicPathIdentifier.java deleted file mode 100644 index d14e4f8f66..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/IntrinsicPathIdentifier.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; - -import com.google.common.base.Function; - -/** - * A function to obtain the path of an EObject, relative to its top-most parent. - * The function produces the same results regardless of whether the element is - * in a resource or not. - * - * @author pierre-charles.david@obeo.fr - */ -public class IntrinsicPathIdentifier implements Function<EObject, String> { - /** - * {@inheritDoc} - */ - public String apply(EObject from) { - /* - * Code taken from inside EcoreUtil.getURI(), but EcoreUtil.getURI() - * does not use it if we are inside a resource or if the elements have - * intrinsic IDs, and we want a result independent of these. - */ - InternalEObject internalEObject = (InternalEObject) from; - List<String> uriFragmentPath = new ArrayList<String>(); - for (InternalEObject container = internalEObject.eInternalContainer(); container != null; container = internalEObject.eInternalContainer()) { - uriFragmentPath.add(container.eURIFragmentSegment(internalEObject.eContainingFeature(), internalEObject)); - internalEObject = container; - } - - StringBuilder result = new StringBuilder("#//"); //$NON-NLS-1$ - for (int i = uriFragmentPath.size() - 1; i >= 0; --i) { - result.append('/'); - result.append(uriFragmentPath.get(i)); - } - return result.toString(); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/Matcher.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/Matcher.java deleted file mode 100644 index 66b2ace045..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/Matcher.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Obeo. - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.Collection; - -import org.eclipse.emf.ecore.EObject; - -import com.google.common.collect.BiMap; - -/** - * Matches elements from two physically different models as logically - * equivalent. - * - * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a> - */ -public interface Matcher { - /** - * Tests whether two elements, which may be different Java instances, - * represent the same logical elements (in the context of the matcher). - * - * @param obj1 - * the first element. - * @param obj2 - * the second element. - * @return <code>true</code> if both EObject represent the same logical - * element. - */ - boolean areSameLogicalElement(EObject obj1, EObject obj2); - - /** - * Compute matching pairs of logically equivalent objects from the two - * specified lists. - * - * @param values1 - * a list of {@link EObject}s. - * @param values2 - * a list of {@link EObject}s. - * @return for each element e1 of list1 for which there is a logically - * equivalent element e2 in values2, an entry in the map exists from - * e1 to e2. - */ - BiMap<EObject, EObject> computeMatches(Collection<EObject> values1, Collection<EObject> values2); -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ModelContributor.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ModelContributor.java deleted file mode 100644 index 81d544e8cd..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ModelContributor.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.FeatureContribution; -import org.eclipse.sirius.ext.base.Option; - -import com.google.common.base.Function; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Lists; -/** - * Applies a set of contributions on a whole target model. - * - * @author pierre-charles.david@obeo.fr - */ -public class ModelContributor { - - /** - * The set of root elements added inside the target model during the last - * application of this contributor. - */ - protected Set<EObject> additions; - - /** - * The function to use to find all the potentially applicable contributions - * from a source model. - */ - protected Function<Iterable<EObject>, Iterable<Contribution>> contributionFinder; - - /** - * The resolver to use on the contributions to locate their actual source - * and target elements. - */ - private final ReferenceResolver resolver; - - /** - * Create a new {@link ModelContributor}. - * - * @param contributionFinder - * the function to use to find all the potentially applicable - * contributions from a source model. They should be returned in - * the order the must be applied. - * @param resolver - * the resolver to use on the contributions to locate their - * actual source and target elements. - * - */ - public ModelContributor(Function<Iterable<EObject>, Iterable<Contribution>> contributionFinder, ReferenceResolver resolver) { - this.contributionFinder = Preconditions.checkNotNull(contributionFinder); - this.resolver = Preconditions.checkNotNull(resolver); - } - - /** - * Applies all the applicable contributions found in the sources (including - * the target model itself) to the target model. - * - * @param targetModel - * the model to which the contributions should be applied. - * @param contributionSources - * source models, in addition to the target model itself, which - * may provide contributions. - * @return the modified target model, with the contributions applied. - */ - public EObject apply(final EObject targetModel, Collection<? extends EObject> contributionSources) { - Preconditions.checkNotNull(targetModel); - Preconditions.checkNotNull(contributionSources); - - final List<EObject> allSources = Lists.newArrayList(contributionSources); - List<Contribution> allContributions = findAllContributions(targetModel, allSources); - List<ResolvedContribution> resolvedContributions = resolve(allContributions, allSources); - - additions = new HashSet<>(); - for (ResolvedContribution rc : resolvedContributions) { - for (ResolvedFeatureContribution rfc : rc.getResolvedFeatureContributions()) { - additions.addAll(rfc.apply()); - } - } - - return targetModel; - } - - /** - * Returns the set of root elements added inside the target model during the - * last application of this contributor. - * - * @return the set of root elements added inside the target model. - */ - public Set<EObject> getAdditions() { - return ImmutableSet.copyOf(additions); - } - - /** - * Finds all the contributions to apply, in the order they should be - * applied. - * - * @param targetModel - * the target model. - * @param sources - * all the contribution sources. - * @return all the contributions to apply, in the order they should be - * applied. - */ - protected List<Contribution> findAllContributions(EObject targetModel, Iterable<EObject> sources) { - return Lists.newArrayList(contributionFinder.apply(sources)); - } - - private List<ResolvedContribution> resolve(Collection<Contribution> contributions, List<EObject> roots) { - List<ResolvedContribution> result = new ArrayList<>(); - for (Contribution contribution : contributions) { - HashMap<String, Object> context = new HashMap<>(); - context.put("self", contribution); //$NON-NLS-1$ - context.put("sources", roots); //$NON-NLS-1$ - Option<EObject> source = resolver.resolve(contribution.getSource(), context); - Option<EObject> target = resolver.resolve(contribution.getTarget(), context); - if (source.some() && target.some()) { - result.add(new ResolvedContribution(contribution, source.get(), target.get())); - } - } - return result; - } - - /** - * A contribution with its source an target resolved to concrete objects. - */ - private static class ResolvedContribution { - final Contribution contribution; - - final EObject sourceObject; - - final EObject targetObject; - - ResolvedContribution(Contribution contribution, EObject sourceObject, EObject targetObject) { - this.contribution = contribution; - this.sourceObject = sourceObject; - this.targetObject = targetObject; - } - - public Collection<ResolvedFeatureContribution> getResolvedFeatureContributions() { - Collection<ResolvedFeatureContribution> result = Lists.newArrayListWithExpectedSize(contribution.getFeatureMask().size()); - for (FeatureContribution fc : contribution.getFeatureMask()) { - result.add(new ResolvedFeatureContribution(fc, sourceObject, targetObject)); - } - return result; - } - } - - /** - * A feature contribution with its source an target resolved to concrete - * objects. - */ - private static class ResolvedFeatureContribution { - final FeatureContribution featureContribution; - - final EObject sourceObject; - - final EObject targetObject; - - ResolvedFeatureContribution(FeatureContribution featureContribution, EObject sourceObject, EObject targetObject) { - this.featureContribution = featureContribution; - this.sourceObject = sourceObject; - this.targetObject = targetObject; - } - - public Set<EObject> apply() { - return new FeatureContributor(featureContribution).apply(targetObject, sourceObject); - } - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ModelContributorAdapter.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ModelContributorAdapter.java deleted file mode 100644 index 7cf14a040b..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ModelContributorAdapter.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.impl.AdapterImpl; -import org.eclipse.emf.ecore.EObject; - -/** - * An adapter which can be used to attach an {@link IncrementalModelContributor} - * to an arbitrary {@link EObject} at runtime. The attachment is not persistent. - * - * @author pierre-charles.david@obeo.fr - */ -// CHECKSTYLE:OFF (work in progress) -public class ModelContributorAdapter extends AdapterImpl { - private final IncrementalModelContributor imc; - - public static ModelContributorAdapter attach(EObject target, IncrementalModelContributor imc) { - ModelContributorAdapter result = new ModelContributorAdapter(imc); - target.eAdapters().add(result); - return result; - } - - public static ModelContributorAdapter detach(EObject target) { - ModelContributorAdapter mca = find(target); - if (mca != null) { - target.eAdapters().remove(mca); - } - return mca; - } - - public static ModelContributorAdapter find(EObject target) { - for (Adapter adapter : target.eAdapters()) { - if (adapter instanceof ModelContributorAdapter) { - return (ModelContributorAdapter) adapter; - } - } - return null; - } - - public ModelContributorAdapter(IncrementalModelContributor imc) { - this.imc = imc; - } - - public IncrementalModelContributor getModelContributor() { - return imc; - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ReferenceResolver.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ReferenceResolver.java deleted file mode 100644 index 611b8c1c85..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ReferenceResolver.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.description.contribution.EObjectReference; -import org.eclipse.sirius.ext.base.Option; - -/** - * Resolves {@link EObjectReference}s. - * - * @author pierre-charles.david@obeo.fr - */ -public interface ReferenceResolver { - /** - * Resolves an {@link EObjectReference} to a concrete {@link EObject}. - * - * @param ref - * the reference to resolve. - * @param context - * the context of the resolution, as a set of variables bindings. - * @return the {@link EObject} denoted by the reference, if it could be - * determined. - */ - Option<EObject> resolve(EObjectReference ref, Map<String, Object> context); -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/RepresentationExtensionsFinder.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/RepresentationExtensionsFinder.java deleted file mode 100644 index 595749f4fd..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/RepresentationExtensionsFinder.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.List; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.business.api.componentization.ViewpointRegistry; -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.Session; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRelations; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.viewpoint.description.DescriptionPackage; -import org.eclipse.sirius.viewpoint.description.RepresentationDescription; -import org.eclipse.sirius.viewpoint.description.RepresentationExtensionDescription; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Functions; -import com.google.common.base.Preconditions; -import com.google.common.collect.BiMap; -import com.google.common.collect.HashBiMap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; - -/** - * Locates all the representation extensions which apply to some representation - * description, depending on the context. - * - * @author pierre-charles.david@obeo.fr - */ -public class RepresentationExtensionsFinder { - /** - * The representation for which we want to find extensions. - */ - private final RepresentationDescription extensionTarget; - - /** - * Constructor. - * - * @param extensionTarget - * the representation for which we want to find extensions. - */ - public RepresentationExtensionsFinder(RepresentationDescription extensionTarget) { - this.extensionTarget = Preconditions.checkNotNull(extensionTarget); - } - - /** - * Finds all the representations extensions which can be applied to this - * target in the specified context. - * - * @param context - * the set of viewpoints in which to look for extensions. - * @return all the representation extensions which apply to this target - * representation in the specified context. The - * RepresentationExtensionDescriptions returned are the instances - * loaded in the session's ResourceSet. - */ - public List<RepresentationExtensionDescription> findApplicableExtensions(Iterable<Viewpoint> context) { - String targetSiriusURI = getTargetSiriusURI(); - String targetRepresentationName = extensionTarget.getName(); - if (targetSiriusURI != null && targetRepresentationName != null) { - return findApplicableExtensions(context, targetSiriusURI, targetRepresentationName); - } else { - return Collections.emptyList(); - } - } - - /** - * Tests whether the specified viewpoint contains anything that can affect - * this representation. If it is the case, this means the representation - * must be updated whenever the Sirius is enabled or disabled. - * - * @param vp - * the viewpoint why may affect the representation. - * @return <code>true</code> if the viewpoint contains any representation - * description extension which applies to the representation. - */ - public boolean isAffectedBy(Viewpoint vp) { - return !findApplicableExtensions(Collections.singleton(vp)).isEmpty(); - } - - /** - * Returns the subset of the viewpoints currently selected in the session - * which are relevant for the specified representation description. This - * includes the representation description's parent Sirius, all the - * Viewpoints it reuses, all the Viewpoints which extend any of those, and - * recursively all the Viewpoints those reuses or are extended by. - * - * @param session - * the session in which the representation description is used. - * @return all the Viewpoints which are relevant for the computation of the - * effective representation description. - */ - public LinkedHashSet<Viewpoint> findAllRelevantViewpoints(Session session) { - RepresentationDescription mainRepresentationDescription = extensionTarget; - LinkedHashSet<Viewpoint> result = new LinkedHashSet<>(); - Viewpoint mainVP = new RepresentationDescriptionQuery(mainRepresentationDescription).getParentViewpoint(); - if (mainVP != null) { - BiMap<URI, Viewpoint> candidates = HashBiMap.create(); - for (Viewpoint vp : session.getSelectedViewpoints(false)) { - Option<URI> uri = new ViewpointQuery(vp).getViewpointURI(); - if (uri.some()) { - candidates.put(uri.get(), vp); - } - } - ViewpointRelations relations = ((org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry) ViewpointRegistry.getInstance()).getRelations(); - /* - * Seed the result with the representation's parent Sirius and - * augment it with the viewpoints we reuse or are extended by until - * we reach a fixpoint. Guaranteed to terminate as the set of - * Viewpoints we can add is finite (at the most, all the selected - * Viewpoints). - */ - boolean changed = result.add(mainVP); - while (changed) { - changed = false; - // Add all the Viewpoints we reuse. - for (Viewpoint v1 : Lists.newArrayList(result)) { - URI uri = candidates.inverse().get(v1); - changed = changed || Iterables.addAll(result, Iterables.transform(relations.getReuse().apply(uri), Functions.forMap(candidates))); - } - // Add all the Viewpoints which extend any of us. - for (Viewpoint v : session.getSelectedViewpoints(false)) { - URI extenderUri = candidates.inverse().get(v); - for (URI extendeeUri : relations.getCustomize().apply(extenderUri)) { - if (result.contains(candidates.get(extendeeUri))) { - changed = changed || result.add(v); - } - } - } - } - } - return result; - } - - private String getTargetSiriusURI() { - Option<EObject> parentVp = new EObjectQuery(extensionTarget).getFirstAncestorOfType(DescriptionPackage.eINSTANCE.getViewpoint()); - if (parentVp.some()) { - Option<URI> viewpointURI = new ViewpointQuery((Viewpoint) parentVp.get()).getViewpointURI(); - if (viewpointURI.some()) { - return viewpointURI.get().toString(); - } - } - return null; - } - - private List<RepresentationExtensionDescription> findApplicableExtensions(Iterable<Viewpoint> context, String targetSiriusURI, String targetRepresentationName) { - List<RepresentationExtensionDescription> result = new ArrayList<>(); - for (Viewpoint vp : context) { - for (RepresentationExtensionDescription ext : vp.getOwnedRepresentationExtensions()) { - if (appliesTo(ext, targetSiriusURI, targetRepresentationName)) { - result.add(ext); - } - } - } - return result; - } - - private boolean appliesTo(RepresentationExtensionDescription ext, String targetViewpointURI, String targetRepresentationName) { - return targetViewpointURI.matches(ext.getViewpointURI()) && targetRepresentationName.matches(ext.getRepresentationName()); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ReuseHelper.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ReuseHelper.java deleted file mode 100644 index ce8fd777e2..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/ReuseHelper.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.sirius.description.contribution.Contribution; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.ext.emf.AllContents; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -public class ReuseHelper { - - /** - * Tests whether an object contains any contribution which use elements from - * another as source and contribute to the target (or any of its children). - * - * @param target - * the reuse target. - * @param potentialSource - * the potential source of reuse. - * @return <code>true</code> if the target contains any contribution which - * get values from the source (or any of its descendant) and put - * them in the target (or any of its descendants). - */ - public boolean reuses(final EObject target, final EObject potentialSource) { - return Iterables.any(Iterables.filter(AllContents.of(target, true), Contribution.class), new Predicate<Contribution>() { - public boolean apply(Contribution input) { - if (input.getSource() instanceof DirectEObjectReference && input.getTarget() instanceof DirectEObjectReference) { - EObject sourceValue = ((DirectEObjectReference) input.getSource()).getValue(); - EObject targetValue = ((DirectEObjectReference) input.getTarget()).getValue(); - boolean fromSource = sourceValue == potentialSource || EcoreUtil.isAncestor(potentialSource, sourceValue); - boolean toTarget = targetValue == target || EcoreUtil.isAncestor(target, targetValue); - return fromSource && toTarget; - } else { - return false; - } - } - }); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/SiriusReferenceResolver.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/SiriusReferenceResolver.java deleted file mode 100644 index e8e3d0f5e8..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/SiriusReferenceResolver.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.util.Map; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.sirius.common.tools.api.interpreter.EvaluationException; -import org.eclipse.sirius.common.tools.api.interpreter.IInterpreter; -import org.eclipse.sirius.description.contribution.ComputedEObjectReference; -import org.eclipse.sirius.description.contribution.DirectEObjectReference; -import org.eclipse.sirius.description.contribution.EObjectReference; -import org.eclipse.sirius.description.contribution.util.ContributionSwitch; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.base.Options; - -import com.google.common.base.Preconditions; - -/** - * Resolves {@link EObjectReference}s using a Sirius {@link IInterpreter} - * (typically from a session) for computed references. - * - * @author pierre-charles.david@obeo.fr - */ -public class SiriusReferenceResolver implements ReferenceResolver { - private static final String SOURCES_VARIABLE_NAME = "sources"; //$NON-NLS-1$ - - /** - * The interpreter to use for computed expressions. - */ - private final IInterpreter interpreter; - - /** - * Constructor. - * - * @param interpreter - * the interpreter to use for computed expressions. - */ - public SiriusReferenceResolver(IInterpreter interpreter) { - this.interpreter = Preconditions.checkNotNull(interpreter); - } - - /** - * {@inheritDoc} - */ - public Option<EObject> resolve(EObjectReference ref, final Map<String, Object> context) { - Preconditions.checkNotNull(ref); - - ContributionSwitch<EObject> contributionSwitch = new ContributionSwitch<EObject>() { - @Override - public EObject caseDirectEObjectReference(DirectEObjectReference directRef) { - return resolveDirectReference(directRef); - } - - @Override - public EObject caseComputedEObjectReference(ComputedEObjectReference computedRef) { - return resolveComputedReference(computedRef, context); - }; - }; - EObject result = contributionSwitch.doSwitch(ref); - - return Options.fromNullable(result); - } - - private EObject resolveDirectReference(DirectEObjectReference directRef) { - return directRef.getValue(); - } - - private EObject resolveComputedReference(ComputedEObjectReference computedRef, Map<String, Object> context) { - EObject result = null; - String expr = computedRef.getValueExpression(); - if (expr != null && interpreter.provides(expr) && context.get("self") instanceof EObject) { //$NON-NLS-1$ - try { - interpreter.setVariable(SOURCES_VARIABLE_NAME, context.get(SOURCES_VARIABLE_NAME)); - result = interpreter.evaluateEObject((EObject) context.get("self"), expr); //$NON-NLS-1$ - } catch (EvaluationException e) { - // TODO Log warning - } finally { - interpreter.unSetVariable(SOURCES_VARIABLE_NAME); - } - } - return result; - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/Updater.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/Updater.java deleted file mode 100644 index bfcf11b8f4..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/contribution/Updater.java +++ /dev/null @@ -1,344 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2015 Obeo. - * 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.contribution; - -import java.text.MessageFormat; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.emf.common.util.ECollections; -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.ecore.EAttribute; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EReference; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.sirius.ext.emf.AllContents; -import org.eclipse.sirius.viewpoint.Messages; - -import com.google.common.base.Function; -import com.google.common.base.Functions; -import com.google.common.base.Objects; -import com.google.common.base.Preconditions; -import com.google.common.collect.BiMap; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Ordering; - -/** - * An updater can modify a model in place to match the structure of a new - * version of that model. - * - * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a> - */ -public class Updater { - /** - * The root element of the model to update. - */ - private final EObject element; - - /** - * The root element of the reference model to match. - */ - private final EObject reference; - - /** - * The matcher used to identify logically equivalent elements between the - * two models. - */ - private final Matcher matcher; - - /** - * <code>true</code> if this is a root updater, <code>false</code> if it is - * an Updater created by another one as part of the recursive process. - */ - private boolean isRoot; - - /** - * The set of elements which were contained in the initial model but were - * removed during the update because they do not exist in the reference - * model to match. - */ - private Set<EObject> orphaned; - - private List<EStructuralFeature> ignored = Collections.emptyList(); - - /** - * Constructor. - * - * @param matcher - * the matcher to use to identify equivalent elements between the - * target and reference models. - * @param element - * the old version of the model to update. - * @param reference - * the new version of the model to update to. - */ - public Updater(Matcher matcher, EObject element, EObject reference) { - this.matcher = Preconditions.checkNotNull(matcher); - this.element = Preconditions.checkNotNull(element); - this.reference = Preconditions.checkNotNull(reference); - this.isRoot = true; - } - - /** - * Performs the update. - * - * @return the old model, updated to match the structure of the new one. - */ - public EObject update() { - orphaned = new HashSet<>(); - if (!matcher.areSameLogicalElement(element, reference)) { - throw new IllegalArgumentException(Messages.Updater_updateElementLogicallyDifferentErrorMsg); - } else if (element.eClass() != reference.eClass()) { - String msg = MessageFormat.format(Messages.Updater_updateElementDifferentReferenceTypeErrorMsg, element.eClass(), reference.eClass()); - throw new IllegalArgumentException(msg); - } else { - updateAttributes(); - updateReferences(); - if (isRoot) { - fixReferences(); - } - return element; - } - } - - private void updateAttributes() { - for (EAttribute attr : element.eClass().getEAllAttributes()) { - if (attr.isChangeable() && !attr.isDerived() && !ignored.contains(attr)) { - updateAttribute(attr); - } - } - } - - private void updateAttribute(EAttribute attr) { - if (element.eIsSet(attr) && !reference.eIsSet(attr)) { - element.eUnset(attr); - } else if (attr.isMany()) { - updateManyValuesAttribute(attr); - } else { - updateSingleValueAttribute(attr); - } - } - - private void updateSingleValueAttribute(EAttribute attr) { - Object oldValue = element.eGet(attr); - Object newValue = reference.eGet(attr); - if (!Objects.equal(oldValue, newValue)) { - element.eSet(attr, reference.eGet(attr)); - } - } - - private void updateManyValuesAttribute(EAttribute attr) { - Collection<Object> oldValues = getMany(element, attr); - Collection<Object> newValues = getMany(reference, attr); - if (!Iterables.elementsEqual(oldValues, newValues)) { - oldValues.clear(); - oldValues.addAll(newValues); - } - } - - private void updateReferences() { - for (EReference ref : element.eClass().getEAllReferences()) { - if (ref.isChangeable() && !ref.isDerived() && !ignored.contains(ref)) { - updateReference(ref); - } - } - } - - private void updateReference(EReference ref) { - if (ref.isMany()) { - updateManyValuesReference(ref); - } else if (element.eIsSet(ref) && !reference.eIsSet(ref)) { - element.eUnset(ref); - } else { - updateSingleValueReference(ref); - } - } - - private void updateSingleValueReference(EReference ref) { - EObject oldValue = (EObject) element.eGet(ref); - EObject newValue = (EObject) reference.eGet(ref); - if (oldValue != null && newValue != null && matcher.areSameLogicalElement(oldValue, newValue) && ref.isContainment()) { - recursiveUpdate(oldValue, newValue); - } else if (oldValue != newValue && !matcher.areSameLogicalElement(oldValue, newValue)) { - element.eSet(ref, newValue); - } - } - - private void updateManyValuesReference(EReference ref) { - EList<EObject> oldValues = getManyEObjects(element, ref); - EList<EObject> newValues = getManyEObjects(reference, ref); - BiMap<EObject, EObject> matches = matcher.computeMatches(oldValues, newValues); - removeObsoleteElements(oldValues, matches.keySet()); - reorderMatchingElements(oldValues, newValues, matches); - addMissingElements(oldValues, newValues, matches); - if (ref.isContainment()) { - updateMatchingElements(oldValues, matches); - } - } - - /** - * Removes from the list the elements which are not present in the specified - * set. - */ - private void removeObsoleteElements(EList<EObject> values, Set<EObject> tokeep) { - for (Iterator<EObject> iter = values.iterator(); iter.hasNext(); /**/) { - EObject obj = iter.next(); - if (!tokeep.contains(obj)) { - iter.remove(); - orphaned.add(obj); - } - } - } - - /** - * Reorders the elements in oldValues so that their relative order matches - * the one of their equivalent in newValues. - * <p> - * We do this simply by sorting the oldValues list according to the index of - * the corresponding element in the newValues list. - */ - private void reorderMatchingElements(EList<EObject> oldValues, EList<EObject> newValues, BiMap<EObject, EObject> matches) { - Map<EObject, Integer> targetIndices = Maps.newHashMapWithExpectedSize(newValues.size()); - for (int i = 0; i < newValues.size(); i++) { - targetIndices.put(newValues.get(i), i); - } - Function<EObject, Integer> matchingElementIndex = Functions.compose(Functions.forMap(targetIndices), Functions.forMap(matches)); - ECollections.sort(oldValues, Ordering.natural().onResultOf(matchingElementIndex)); - } - - /** - * Adds to oldValues the elements from newValues which are do not already - * have an equivalent. The elements are added at the correct location. - * <p> - * The ELists we are are containment ELists, so adding an element from one - * to the other modifies the source list, messing the index computation. We - * do this in two passes: compute which elements are missing and the - * locations they should be inserted in into a simple array, and then apply - * the necessary changes. - */ - private void addMissingElements(EList<EObject> oldValues, EList<EObject> newValues, BiMap<EObject, EObject> matches) { - EObject[] missing = new EObject[newValues.size()]; - for (int i = 0; i < newValues.size(); i++) { - EObject newValue = newValues.get(i); - boolean isMissingElement = !matches.containsValue(newValue); - if (isMissingElement) { - missing[i] = newValue; - } - } - for (int i = 0; i < missing.length; i++) { - if (missing[i] != null) { - oldValues.add(i, missing[i]); - } - } - } - - /** - * Recursively updates the elements from oldValues which have a matching - * element using that matching elements as a reference. - */ - private void updateMatchingElements(EList<EObject> oldValues, BiMap<EObject, EObject> matches) { - for (Map.Entry<EObject, EObject> entry : matches.entrySet()) { - recursiveUpdate(entry.getKey(), entry.getValue()); - } - } - - private void recursiveUpdate(EObject obj, EObject ref) { - Updater updater = new Updater(matcher, obj, ref); - updater.isRoot = false; - updater.setFeaturesToIgnore(this.ignored); - updater.update(); - this.orphaned.addAll(updater.orphaned); - } - - private void fixReferences() { - BiMap<EObject, EObject> matches = matcher.computeMatches(Lists.newArrayList(AllContents.of(reference, true)), Lists.newArrayList(AllContents.of(element, true))); - for (EObject obj : AllContents.of(element, true)) { - fixReferences(obj, matches); - } - } - - private void fixReferences(EObject obj, BiMap<EObject, EObject> matches) { - for (EReference ref : obj.eClass().getEAllReferences()) { - if (!ref.isContainment() && ref.isChangeable() && !ref.isDerived() && ref.getEOpposite() == null) { - fixReference(obj, ref, matches); - } - } - } - - private void fixReference(EObject obj, EReference ref, BiMap<EObject, EObject> matches) { - if (ref.isMany()) { - EList<EObject> values = getManyEObjects(obj, ref); - // Update remaining references to the reference model to point to - // the equivalent element in the updated model. - for (int i = 0; i < values.size(); i++) { - EObject value = values.get(i); - if (matches.containsKey(value)) { - values.set(i, matches.get(value)); - } - } - // Remove references to orphaned elements. - for (Iterator<EObject> iter = values.iterator(); iter.hasNext(); /**/) { - EObject eObject = iter.next(); - if (orphaned.contains(eObject)) { - iter.remove(); - } - } - } else { - Object value = obj.eGet(ref); - if (matches.containsKey(value)) { - obj.eSet(ref, matches.get(value)); - } else if (orphaned.contains(value)) { - obj.eUnset(ref); - } - } - } - - /** - * Get the values of a many-valued feature as a collection. - */ - @SuppressWarnings("unchecked") - private Collection<Object> getMany(EObject target, EStructuralFeature targetFeature) { - Object rawValue = target.eGet(targetFeature); - if (rawValue != null && !(rawValue instanceof Collection<?>)) { - throw new RuntimeException(MessageFormat.format(Messages.FeatureContributor_unexpectedTypeErrorMsg, targetFeature.getName(), rawValue.getClass())); - } - return (Collection<Object>) rawValue; - } - - /** - * Get the values of a many-valued feature as a collection. - */ - @SuppressWarnings("unchecked") - private EList<EObject> getManyEObjects(EObject target, EReference ref) { - Object rawValue = target.eGet(ref); - if (rawValue != null && !(rawValue instanceof EList<?>)) { - throw new RuntimeException(MessageFormat.format(Messages.FeatureContributor_unexpectedTypeErrorMsg, ref.getName(), rawValue.getClass())); - } - return (EList<EObject>) rawValue; - } - - /** - * Indicate a list of features which should not be updated. - * - * @param ignore - * the features to ignore during the update. - */ - public void setFeaturesToIgnore(List<EStructuralFeature> ignore) { - this.ignored = ignore; - } -} 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 005336c38f..6f85ac1d42 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, 2017 THALES GLOBAL SERVICES and others. + * Copyright (c) 2007, 2018 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 @@ -37,7 +37,6 @@ import org.eclipse.sirius.business.api.helper.task.AbstractCommandTask; import org.eclipse.sirius.business.api.query.EObjectQuery; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.danalysis.DAnalysisSession; -import org.eclipse.sirius.business.internal.movida.Movida; import org.eclipse.sirius.common.tools.api.util.EclipseUtil; import org.eclipse.sirius.common.tools.api.util.EqualityHelper; import org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor; @@ -92,15 +91,6 @@ public class DialectManagerImpl implements DialectManager { } @Override - public void refreshEffectiveRepresentationDescription(DRepresentation representation, IProgressMonitor monitor) { - if (Movida.isEnabled()) { - for (Dialect dialect : dialects.values()) { - dialect.getServices().refreshEffectiveRepresentationDescription(representation, monitor); - } - } - } - - @Override public void refresh(final DRepresentation representation, final IProgressMonitor monitor) { refresh(representation, false, monitor); } diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/dialect/ViewpointMetamodelsProvider.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/dialect/ViewpointMetamodelsProvider.java index 3c0835f329..d1d99c3e05 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/dialect/ViewpointMetamodelsProvider.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/dialect/ViewpointMetamodelsProvider.java @@ -1,5 +1,5 @@ /** - * Copyright (c) 2015 Obeo + * Copyright (c) 2015, 2018 Obeo * 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 @@ -37,7 +37,6 @@ public class ViewpointMetamodelsProvider implements MetamodelDescriptorProvider result.add(new EcoreMetamodelDescriptor(org.eclipse.sirius.viewpoint.description.tool.ToolPackage.eINSTANCE)); result.add(new EcoreMetamodelDescriptor(org.eclipse.sirius.viewpoint.description.validation.ValidationPackage.eINSTANCE)); result.add(new EcoreMetamodelDescriptor(org.eclipse.sirius.viewpoint.description.audit.AuditPackage.eINSTANCE)); - result.add(new EcoreMetamodelDescriptor(org.eclipse.sirius.description.contribution.ContributionPackage.eINSTANCE)); return result; } diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/DynamicVSMLoader.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/DynamicVSMLoader.java deleted file mode 100644 index 9c41b653e1..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/DynamicVSMLoader.java +++ /dev/null @@ -1,235 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida; - -import java.text.MessageFormat; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistryListener; -import org.eclipse.sirius.ext.base.Option; - -import com.google.common.base.Joiner; -import com.google.common.base.Preconditions; -import com.google.common.collect.Sets; -import com.google.common.collect.Sets.SetView; - -/** - * A VSM Reloader is responsible for keeping the VSM resources loaded in a - * resource set in sync with the logical Viewpoints actually needed in the - * resource set's context. It makes sure that all the VSMs required by the - * context, and only them, are loaded and properly resolved. - * - * @author pierre-charles.david@obeo.fr - */ -public class DynamicVSMLoader implements ViewpointRegistryListener { - /** - * The registry to use for information about which logical viewpoints are - * available, which concrete resources they map to, and when and how they - * change. - */ - private final ViewpointRegistry registry; - - /** - * The resource set to manage. - */ - private final ResourceSet resourceSet; - - /** - * The logical URIs of all the Viewpoints which are explicitly required. - */ - private final Set<URI> requiredViewpoints = new HashSet<>(); - - /** - * The physical URIs of all the VSMs which provide the required Viewpoints. - */ - private final Set<URI> requiredProviders = new HashSet<>(); - - private final Set<URI> protectedResources = new HashSet<>(); - - private Runnable errorHandler; - - /** - * Constructor. - * - * @param resourceSet - * the resource set to manage. - * @param registry - * the registry to use. - */ - public DynamicVSMLoader(ResourceSet resourceSet, ViewpointRegistry registry) { - this.resourceSet = Preconditions.checkNotNull(resourceSet); - this.registry = Preconditions.checkNotNull(registry); - this.registry.addListener(this); - } - - /** - * Returns the registry used by this loader. - * - * @return the registry used by this loader. - */ - public ViewpointRegistry getRegistry() { - return registry; - } - - /** - * Returns the logical URIs of all the Viewpoints required. - * - * @return the logical URIs of all the Viewpoints required. - */ - public Set<URI> getRequiredViewpoints() { - return requiredViewpoints; - } - - public synchronized void setErrorHandler(Runnable errorHandler) { - this.errorHandler = errorHandler; - } - - /** - * Mark the resource identified by the specified URI as protected: the - * loader will not attempt to load, reload or unload it. - * - * @param uri - * the physical URI of the resource to consider as protected. - */ - public synchronized void protect(URI uri) { - this.protectedResources.add(Preconditions.checkNotNull(uri)); - } - - /** - * Mark the resource identified by the specified URI as not protected. - * - * @param uri - * the physical URI of the resource to consider as not protected. - */ - public synchronized void unprotect(URI uri) { - this.protectedResources.remove(Preconditions.checkNotNull(uri)); - } - - /** - * Tell this loader that the viewpoint specified by the supplied logical URI - * should always be loaded in the resource set, along with its dependencies. - * - * @param viewpoint - * the logical Sirius URI of the Sirius which is required. - */ - public synchronized void require(URI viewpoint) { - Preconditions.checkNotNull(viewpoint); - Option<URI> provider = registry.getProvider(viewpoint); - Preconditions.checkState(provider.some(), MessageFormat.format("The specified viewpoint {0} is not available.", viewpoint.toString())); //$NON-NLS-1$ - boolean added = this.requiredViewpoints.add(viewpoint); - if (added) { - refresh(); - } - } - - /** - * Tell this loader that the viewpoint specified by the supplied logical URI - * is no longer explicitly required. The underlying resource may be unloaded - * from the resource set if the loader detects that it is no longer - * required, even indirectly. Does nothing if the specified viewpoint was - * not an explicit requirement. - * - * @param viewpoint - * the logical Sirius URI of the Sirius which is no longer - * directly required. - */ - public synchronized void unrequire(URI viewpoint) { - boolean removed = this.requiredViewpoints.remove(Preconditions.checkNotNull(viewpoint)); - if (removed) { - refresh(); - } - } - - /** - * Stop managing the resource set and release all resources. - */ - public void dispose() { - this.registry.removeListener(this); - } - - /** - * {@inheritDoc} - */ - @Override - public synchronized void registryChanged(ViewpointRegistry reg, Set<URI> removed, Set<URI> added, Set<URI> changed) { - assert reg == this.registry; - SetView<URI> absentRequirements = Sets.intersection(requiredViewpoints, removed); - if (!absentRequirements.isEmpty()) { - if (errorHandler != null) { - errorHandler.run(); - } else { - throw new IllegalStateException("The required viewpoints " + Joiner.on(", ").join(absentRequirements) + " are not available anymore."); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ - } - } - refresh(); - } - - private void refresh() { - Set<URI> providers = computeRequiredProviders(); - Set<Resource> maybeUnneeded = getAndUnloadPotentialUnneededProviders(providers); - loadAndResolve(providers); - removeUnneededResources(maybeUnneeded); - setRequiredProviders(providers); - } - - private Set<URI> computeRequiredProviders() { - Set<URI> newProviders = new HashSet<>(); - for (URI uri : requiredViewpoints) { - Option<URI> provider = registry.getProvider(uri); - assert provider.some(); - newProviders.add(provider.get()); - } - return newProviders; - } - - private Set<Resource> getAndUnloadPotentialUnneededProviders(Set<URI> required) { - Set<Resource> maybeUnneeded = new HashSet<>(); - for (Resource res : resourceSet.getResources()) { - if (!required.contains(res.getURI()) && res.getURI().isPlatform() && !protectedResources.contains(res.getURI())) { - maybeUnneeded.add(res); - res.unload(); - } - } - return maybeUnneeded; - } - - private void loadAndResolve(Set<URI> providers) { - for (URI uri : providers) { - if (!requiredProviders.contains(uri)) { - Resource res = resourceSet.getResource(uri, true); - EcoreUtil.resolveAll(res); - } - } - } - - /** - * Resources identified as potentially unneeded can be completely removed of - * the resolution step has not loaded them. - */ - private void removeUnneededResources(Set<Resource> maybeUnneeded) { - for (Resource resource : maybeUnneeded) { - if (!resource.isLoaded()) { - resourceSet.getResources().remove(resource); - } - } - } - - private void setRequiredProviders(Set<URI> newProviders) { - requiredProviders.clear(); - requiredProviders.addAll(newProviders); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/Movida.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/Movida.java deleted file mode 100644 index 3be0575070..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/Movida.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida; - -/** - * Configuration class used to control if Movida-specific behaviors are enabled - * or not in the rest of Sirius. - * - * @author pierre-charles.david@obeo.fr - */ -public final class Movida { - private static final boolean ENABLED = Boolean.valueOf(System.getProperty("movida")); //$NON-NLS-1$ - - private Movida() { - // Prevents instantiation. - } - - /** - * If true, enable the Movida-specific behaviors. - * - * @return <code>true</code> if we should use the new behaviors. - */ - public static boolean isEnabled() { - return ENABLED; - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/VSMResolver.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/VSMResolver.java deleted file mode 100644 index f5f3ed4eca..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/VSMResolver.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida; - -import java.text.MessageFormat; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.base.relations.Relation; - -import com.google.common.base.Function; -import com.google.common.base.Joiner; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; - -/** - * Resolves a set of logical Sirius URIs into the complete set of physical VSM - * resources required to be loaded to provide all these Viewpoints. - * - * @author pierre-charles.david@obeo.fr - */ -public class VSMResolver { - /** - * The registry to use for logical to physical URI resolution. - */ - private final ViewpointRegistry registry; - - /** - * Constructor. - * - * @param regsitry - * the registry to use for logical to physical URI resolution. - */ - public VSMResolver(ViewpointRegistry regsitry) { - this.registry = Preconditions.checkNotNull(regsitry); - } - - /** - * Resolves a set of logical Sirius URIs into the set of physical URIs of - * all the resources required to provide these viewpoints, including their - * dependencies. - * - * @param logicalURIs - * the set of logical Sirius URIs to resolve. - * @return the physical URIs of all the resources which must be loaded to - * provide all the specified viewpoints. - * @throws IllegalArgumentException - * if some of the (directly or indirectly) required viewpoints - * can not be resolved into a physical resource. - */ - public Set<URI> resolve(Set<URI> logicalURIs) throws IllegalArgumentException { - Preconditions.checkNotNull(logicalURIs); - Set<URI> allLogical = computeAllLogicalRequirements(logicalURIs); - final Set<URI> missing = new HashSet<>(); - Iterable<URI> allPhysical = Iterables.transform(allLogical, new Function<URI, URI>() { - @Override - public URI apply(URI from) { - Option<URI> provider = registry.getProvider(from); - if (provider.some()) { - return provider.get(); - } else { - missing.add(from); - return null; - } - } - }); - if (!missing.isEmpty()) { - String msg = MessageFormat.format("Some of the required logical Sirius URIs could not be resolved to physical resources: {0}.", Joiner.on(", ").join(missing)); //$NON-NLS-1$//$NON-NLS-2$ - throw new IllegalArgumentException(msg); - } else { - return ImmutableSet.copyOf(Iterables.filter(allPhysical, Predicates.notNull())); - } - } - - private Set<URI> computeAllLogicalRequirements(Set<URI> logicalURIs) { - Set<URI> allLogical = new HashSet<>(); - Relation<URI> requires = registry.getRelations().getTransitiveRequires(); - for (URI uri : logicalURIs) { - allLogical.add(uri); - allLogical.addAll(requires.apply(uri)); - } - return allLogical; - } - -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/ViewpointDependenciesTracker.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/ViewpointDependenciesTracker.java deleted file mode 100644 index 8aa7d5afd7..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/ViewpointDependenciesTracker.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida; - -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistryListener; -import org.eclipse.sirius.ext.base.relations.DependencyTracker; -import org.eclipse.sirius.ext.base.relations.Relation; - -import com.google.common.base.Preconditions; - -/** - * Tracks various kinds of dependencies between a set of Viewpoints. - * - * @author pierre-charles.david@obeo.fr - */ -public class ViewpointDependenciesTracker extends DependencyTracker<URI> { - /** - * Notifies the trackers of changes in the registry so that their - * information is up to date. - * - * @author pierre-charles.david@obeo.fr - */ - private class TrackerUpdater implements ViewpointRegistryListener { - /** - * {@inheritDoc} - */ - public void registryChanged(ViewpointRegistry reg, Set<URI> removed, Set<URI> added, Set<URI> changed) { - for (URI r : removed) { - ViewpointDependenciesTracker.this.remove(r); - } - for (URI a : added) { - ViewpointDependenciesTracker.this.add(a); - } - for (URI c : changed) { - ViewpointDependenciesTracker.this.update(c); - } - } - } - - private final ViewpointRegistry registry; - - private final TrackerUpdater updater; - - /** - * Constructor. - * - * @param registry - * the registry to use to resolve Sirius URIs. - */ - public ViewpointDependenciesTracker(ViewpointRegistry registry) { - this(registry, Preconditions.checkNotNull(registry).getRelations().getTransitiveRequires()); - } - - /** - * Constructor. - * - * @param registry - * the registry to use to resolve Sirius URIs. - * @param relation - * the viewpoint relation to track. - */ - public ViewpointDependenciesTracker(ViewpointRegistry registry, Relation<URI> relation) { - super(Preconditions.checkNotNull(relation)); - this.registry = Preconditions.checkNotNull(registry); - this.updater = new TrackerUpdater(); - this.registry.addListener(this.updater); - } - - /** - * Dispose this tracker. - */ - public void dispose() { - this.registry.removeListener(this.updater); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/ViewpointResourceOperations.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/ViewpointResourceOperations.java deleted file mode 100644 index 638173df4a..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/ViewpointResourceOperations.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.InternalEObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.sirius.business.api.query.ViewpointQuery; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Preconditions; -import com.google.common.collect.Iterables; - -/** - * Operations to manipulate Viewpoints Resources (VSMs). - * - * @author pierre-charles.david@obeo.fr - */ -public class ViewpointResourceOperations { - /** - * The Sirius resource to manipulate. - */ - private final Resource resource; - - /** - * Constructor. - * - * @param resource - * the viewpoint resource to manipulate. - */ - public ViewpointResourceOperations(Resource resource) { - this.resource = Preconditions.checkNotNull(resource); - } - - /** - * Unloads the resource, and reset all the proxy URIs for viewpoints elements - * to the corresponding logical (instead of physical) URI, so that when - * references to these elements are re-resolved later, they are resolved - * taking the logical/physical mapping at that time. - */ - public void unloadAndResetProxyURIs() { - Map<EObject, URI> logicalURIs = computeLogicalURIs(); - resource.unload(); - for (InternalEObject obj : Iterables.filter(logicalURIs.keySet(), InternalEObject.class)) { - if (obj.eIsProxy()) { - obj.eSetProxyURI(logicalURIs.get(obj)); - } - } - } - - /** - * For each element of the resource which appears inside a Sirius - * definition (including the Sirius definitions themselves), returns the - * logical Sirius URI designating the element. - */ - private Map<EObject, URI> computeLogicalURIs() { - Preconditions.checkState(resource.isLoaded()); - - Map<EObject, URI> logicalURIs = new HashMap<>(); - URI currentSiriusURI = null; - Iterator<EObject> allContents = EcoreUtil.getAllProperContents(resource, false); - while (allContents.hasNext()) { - EObject internal = allContents.next(); - if (internal instanceof Viewpoint) { - currentSiriusURI = new ViewpointQuery((Viewpoint) internal).getViewpointURI().get(); - } - if (currentSiriusURI != null) { - String fragment = internal.eResource().getURIFragment(internal); - logicalURIs.put(internal, currentSiriusURI.appendFragment(fragment)); - } - } - return logicalURIs; - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/ViewpointSelection.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/ViewpointSelection.java deleted file mode 100644 index e558364551..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/ViewpointSelection.java +++ /dev/null @@ -1,243 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida; - -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.sirius.business.api.query.ViewpointURIQuery; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Function; -import com.google.common.base.Joiner; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Ordering; -import com.google.common.collect.Sets; - -/** - * Represents a set of logical Viewpoints, for example the ones requested by a - * user, and provides validation on the consistency of the selection. - * - * @author pierre-charles.david@obeo.fr - */ -public class ViewpointSelection { - private static final String INVALID_VIEWPOINT_URI = "Selection must contain only logical Viewpoint URIs"; //$NON-NLS-1$ - - /** - * The set of logical Sirius URIs which make up the selection itself. - */ - private final Set<URI> logicalViewpoints = new HashSet<>(); - - /** - * The registry to use for viewpoint informations. - */ - private final ViewpointRegistry registry; - - /** - * True if the selection has changed since the last time validation was - * performed. - */ - private boolean needsValidation; - - /** - * Whether or not the selection is consistent. The value of this field is - * only meaningful when <code>needsValidation</code> is false. - */ - private boolean isValid; - - private Set<URI> unavailable = Collections.emptySet(); - - private Set<URI> conflicts = Collections.emptySet(); - - private final Predicate<URI> isValidViewpointURI = new Predicate<URI>() { - @Override - public boolean apply(URI input) { - return ViewpointURIQuery.isValidViewpointURI(input); - } - }; - - private final Function<URI, Viewpoint> viewpointImplementation = new Function<URI, Viewpoint>() { - @Override - public Viewpoint apply(URI from) { - return registry.getViewpoint(from); - } - }; - - /** - * Constructor. - * - * @param registry - * the registry to use for viewpoint informations. - */ - public ViewpointSelection(ViewpointRegistry registry) { - this.registry = Preconditions.checkNotNull(registry); - } - - /** - * Return the current selection. It may not be consistent. - * - * @return the current selection. - */ - public Set<URI> getSelected() { - return ImmutableSet.copyOf(logicalViewpoints); - } - - /** - * Sets the whole set of selected viewpoints at once. - * - * @param selection - * the logical URIs of all the viewpoints to put in the - * selection. - */ - public void setSelected(Set<URI> selection) { - Preconditions.checkArgument(Iterables.all(selection, isValidViewpointURI), INVALID_VIEWPOINT_URI); - logicalViewpoints.clear(); - logicalViewpoints.addAll(selection); - needsValidation = true; - } - - /** - * Add a single viewpoint to the selection. - * - * @param viewpoint - * the logical URI of the viewpoint to add. - */ - public void select(URI viewpoint) { - Preconditions.checkArgument(isValidViewpointURI.apply(viewpoint), INVALID_VIEWPOINT_URI); - boolean added = logicalViewpoints.add(viewpoint); - if (added) { - needsValidation = true; - } - } - - /** - * Remove a single viewpoint from the selection. - * - * @param viewpoint - * the logical URI of the viewpoint to remove. - */ - public void deselect(URI viewpoint) { - Preconditions.checkArgument(isValidViewpointURI.apply(viewpoint), INVALID_VIEWPOINT_URI); - boolean removed = logicalViewpoints.remove(viewpoint); - if (removed) { - needsValidation = true; - } - } - - /** - * Check whether the current set of selected viewpoints is consistent, i.e. - * all the requested viewpoints are available and there are no internal - * conflicts between any two pairs of viewpoints. - * - * @return <code>true</code> if the current selection is consistent. - */ - public boolean isValid() { - validate(); - return isValid; - } - - /** - * Returns the set of logical URIs which are in the selection but are not - * currently available in the registry, making the selection invalid. - * - * @return the URIs of the logical viewpoints which are selected but not - * available. - */ - public Set<URI> getUnavailableViewpoints() { - return ImmutableSet.copyOf(unavailable); - } - - /** - * Returns the set of logical URIs which are in the selection but are in - * conflict with at least one another selected viewpoint. - * - * @return the URIs of the logical viewpoints which are selected but for - * which there is a conflict. - */ - public Set<URI> getConflictingViewpoints() { - return ImmutableSet.copyOf(conflicts); - } - - /** - * Recompute the validity of the current selection. - */ - public void validate() { - if (needsValidation) { - isValid = allRequiredViewpointAreAvailable() && noConflictsBetweenRequiredViewpoints(); - needsValidation = false; - } - } - - /** - * Returns a message describing the validation errors, if any. - * - * @return a message describing the validation errors. - */ - public String getErrorMessage() { - validate(); - Function<URI, String> shortName = new Function<URI, String>() { - @Override - public String apply(URI uri) { - return new ViewpointURIQuery(uri).getViewpointName(); - } - }; - // CHECKSTYLE:OFF - StringBuilder sb = new StringBuilder(); - if (conflicts != null && !conflicts.isEmpty()) { - sb.append("Conflicts with: " + Joiner.on(", ").join(Iterables.transform(conflicts, shortName))).append("\n"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - } - if (unavailable != null && !unavailable.isEmpty()) { - sb.append("Missing: " + Joiner.on(", ").join(Iterables.transform(unavailable, shortName))).append("\n"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - } - // CHECKSTYLE:ON - return sb.toString(); - } - - private boolean allRequiredViewpointAreAvailable() { - unavailable = Sets.newHashSet(Iterables.filter(logicalViewpoints, new Predicate<URI>() { - @Override - public boolean apply(URI input) { - return viewpointImplementation.apply(input) == null; - } - })); - return unavailable.isEmpty(); - } - - private boolean noConflictsBetweenRequiredViewpoints() { - Set<URI> forbidden = new HashSet<>(); - for (URI uri : logicalViewpoints) { - Viewpoint vp = viewpointImplementation.apply(uri); - if (vp != null) { - Iterables.addAll(forbidden, vp.getConflicts()); - } - } - conflicts = Sets.intersection(logicalViewpoints, forbidden); - return conflicts.isEmpty(); - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - List<URI> uris = Lists.newArrayList(logicalViewpoints); - Collections.sort(uris, Ordering.usingToString()); - return "Viewpoint Selection: " + Joiner.on(", ").join(uris); //$NON-NLS-1$//$NON-NLS-2$ - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/CompositeViewpointResourceHandler.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/CompositeViewpointResourceHandler.java deleted file mode 100644 index 2b3ba6caff..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/CompositeViewpointResourceHandler.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.sirius.business.api.componentization.ViewpointResourceHandler; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Predicate; -import com.google.common.collect.Iterables; - -/** - * A {@link ViewpointResourceHandler} which handles all the resources handled by - * any of a configurable set of primitive handlers. If multiple handlers can - * handle a given resource, only the first one (in the order of their - * registration) is used. - * - * @author pierre-charles.david@obeo.fr - */ -public class CompositeViewpointResourceHandler implements ViewpointResourceHandler { - private final List<ViewpointResourceHandler> handlers = new ArrayList<>(); - - /** - * Registers a new {@link ViewpointResourceHandler}. Does nothing if it is - * already registered. - * - * @param handler - * the handler for some new type of Sirius resource to - * support. - */ - public synchronized void addResourceType(ViewpointResourceHandler handler) { - if (!this.handlers.contains(handler)) { - this.handlers.add(handler); - } - } - - /** - * Unregisters a {@link ViewpointResourceHandler}. Does nothing if it was - * not already registered. - * - * @param handler - * the handler for some new type of Sirius resource to - * support. - */ - public synchronized void removeResourceType(ViewpointResourceHandler handler) { - this.handlers.remove(handler); - } - - /** - * {@inheritDoc} - */ - public synchronized boolean handles(final URI uri) { - return Iterables.any(handlers, new Predicate<ViewpointResourceHandler>() { - public boolean apply(ViewpointResourceHandler handler) { - return handler.handles(uri); - } - }); - } - - /** - * {@inheritDoc} - */ - public synchronized Set<Viewpoint> collectViewpointDefinitions(Resource res) { - final URI uri = res.getURI(); - for (ViewpointResourceHandler handler : handlers) { - if (handler.handles(uri)) { - return handler.collectViewpointDefinitions(res); - } - } - return Collections.emptySet(); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/DefaultViewpointResourceHandler.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/DefaultViewpointResourceHandler.java deleted file mode 100644 index 721585da03..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/DefaultViewpointResourceHandler.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.sirius.business.api.componentization.ViewpointResourceHandler; -import org.eclipse.sirius.business.api.query.FileQuery; -import org.eclipse.sirius.viewpoint.description.Group; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; - -/** - * The default implementation of {@link ViewpointResourceHandler} for - * <code>*.odesign</code> files. - * - * @author pierre-charles.david@obeo.fr - */ -public class DefaultViewpointResourceHandler implements ViewpointResourceHandler { - /** - * {@inheritDoc} - */ - public boolean handles(URI uri) { - return uri != null && new FileQuery(uri.fileExtension()).isVSMFile(); - } - - /** - * {@inheritDoc} - */ - public Set<Viewpoint> collectViewpointDefinitions(Resource res) { - Set<Viewpoint> viewpoints = new HashSet<>(); - for (Group group : Iterables.filter(res.getContents(), Group.class)) { - for (Viewpoint viewpoint : group.getOwnedViewpoints()) { - viewpoints.add(viewpoint); - } - } - return ImmutableSet.copyOf(Iterables.filter(viewpoints, Predicates.notNull())); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/Entry.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/Entry.java deleted file mode 100644 index 2e057cc9c4..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/Entry.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.sirius.business.api.query.EObjectQuery; -import org.eclipse.sirius.business.api.query.URIQuery; -import org.eclipse.sirius.business.api.query.ViewpointQuery; -import org.eclipse.sirius.business.api.query.ViewpointURIQuery; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Preconditions; - -/** - * Represents Sirius definition known to the registry, with all the - * associated meta-data about its current status and relations with other - * Sirius definitions. - * - * @author pierre-charles.david@obeo.fr - */ -public class Entry { - /** - * The Sirius URI (<code>viewpoint:/...</code>) identifying this entry. - * This logical identifier never changes for a given entry, even though the - * actual Sirius it resolves to may come from different resources at - * different times. - */ - private final URI identifier; - - /** - * The concrete Sirius which implements the logical Sirius URI - * identifying this entry. - */ - private final Viewpoint viewpoint; - - /** - * The entries representing the Viewpoints we declares a conflict with. - */ - private final Set<URI> conflicts = new HashSet<>(); - - /** - * The entries representing the Viewpoints we declares a "reuses" relation - * with. - */ - private final Set<URI> reused = new HashSet<>(); - - /** - * The entries representing the Viewpoints we declares a "extends" relation - * with. - */ - private final Set<URI> customizes = new HashSet<>(); - - /** - * The current life-cycle state of the Sirius represented by this entry. - * If <code>null</code>, the entry is new and no status has been computed - * yet. - */ - private ViewpointState state; - - /** - * Any diagnostics related to this entry, in particular errors and warnings - * which can explain the state of the entry. - */ - private final Collection<Diagnostic> diagnostics = new ArrayList<>(); - - /** - * Creates a new entry representing a Sirius. - * - * @param viewpoint - * the Sirius this entry represents. - */ - public Entry(Viewpoint viewpoint) { - this.viewpoint = Preconditions.checkNotNull(viewpoint); - Preconditions.checkState(viewpoint.eResource() != null); - Option<URI> id = new ViewpointQuery(this.viewpoint).getViewpointURI(); - assert id.some(); - this.identifier = id.get(); - this.state = ViewpointState.UNDEFINED; - fillDepdendencies(this.conflicts, viewpoint.getConflicts()); - fillDepdendencies(this.reused, viewpoint.getReuses()); - fillDepdendencies(this.customizes, viewpoint.getCustomizes()); - } - - /** - * Returns the logical Sirius URI provided by this entry. - * - * @return the logical Sirius URI provided by this entry. - */ - public URI getLogicalURI() { - return identifier; - } - - /** - * Returns the concrete Sirius instance which implements this entry's - * logical URI. - * - * @return the concrete Sirius instance implementing this entry. - */ - public Viewpoint getSirius() { - return viewpoint; - } - - /** - * Returns the concrete resource from which this entry's implementation - * comes from. - * - * @return the concrete resource from which this entry's implementation - * comes from. - */ - public Resource getResource() { - return viewpoint.eResource(); - } - - /** - * Returns the current state of this entry. - * - * @return the current state of this entry. - */ - public ViewpointState getState() { - return state; - } - - /** - * Sets the state of this entry. - * - * @param state - * the new state for this entry. - */ - public void setState(ViewpointState state) { - this.state = Preconditions.checkNotNull(state); - } - - /** - * Returns the diagnostics associated to this entry. Clients may modify the - * list. - * - * @return the diagnostics associated to this entry. - */ - public Collection<Diagnostic> getDiagnostics() { - return diagnostics; - } - - /** - * Returns the entries of all the Viewpoints this one depends on in any way, - * i.e. all the Viewpoints which must be present and valid for this one to - * be usable. - * - * @return all the dependencies of the Sirius represented by this entry. - */ - public Set<URI> getDeclaredDependencies() { - Set<URI> result = new LinkedHashSet<>(); - /* - * Note that Sirius we declare a conflict with are not part of our - * dependencies, because the whole point is that this Sirius should - * be usable even if they are not present. - */ - result.addAll(reused); - result.addAll(customizes); - return Collections.unmodifiableSet(result); - } - - private void fillDepdendencies(Set<URI> uris, List<URI> declared) { - for (URI uri : declared) { - try { - if (ViewpointURIQuery.isValidViewpointURI(uri)) { - uris.add(uri); - } else { - // TODO: the declared URI is syntactically valid as a URI, - // but is not a Sirius URI - // report warning and continue. - } - } catch (IllegalArgumentException e) { - // TODO: the declared URI's syntax is invalid, report warning - // and continue. - } - } - } - - /** - * Returns the set of actual physical dependencies of this Sirius, - * ignoring the Sirius environment. - * - * @return the set of actual physical dependencies of this Sirius. - */ - public Set<URI> getActualDependencies() { - Set<URI> result = new HashSet<>(); - EObjectQuery q = new EObjectQuery(viewpoint); - result.addAll(q.getResolvedDependencies()); - result.addAll(q.getUnresolvedDependencies()); - result.remove(URIQuery.VIEWPOINT_ENVIRONMENT_QUERY); - return result; - } - - /** - * {@inheritDoc} - */ - @Override - public String toString() { - return identifier.toString(); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/MaskingPolicy.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/MaskingPolicy.java deleted file mode 100644 index 5a7b1e16c1..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/MaskingPolicy.java +++ /dev/null @@ -1,343 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2013, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.ExecutionException; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.sirius.business.api.componentization.ViewpointResourceHandler; -import org.eclipse.sirius.business.api.query.ViewpointQuery; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Function; -import com.google.common.base.Functions; -import com.google.common.base.Objects; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ArrayListMultimap; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.ListMultimap; -import com.google.common.collect.Ordering; -import com.google.common.collect.Sets; - -/** - * The masking policy keeps track of which of the loaded resources are masked - * and which actually contribute visible Sirius definitions. Only Viewpoints - * defined in resources which are not masked are visible in the registry. It - * must be notified by the registry each time a resource has been - * {@link #resourceLoaded(Resource) loaded} or is about to be - * {@link #aboutToUnload(Resource) unloaded}. - * - * @author pierre-charles.david@obeo.fr - */ -public class MaskingPolicy { - /** - * A simple class to communicate to clients which resources where newly - * masked or unmasked. - */ - public static class MaskingChange { - Set<Resource> masked = new HashSet<>(); - - Set<Resource> unmasked = new HashSet<>(); - - /** - * Checks the internal consistency of this object. - * - * @return <code>true</code> if the change looks consistent. - */ - public boolean isConsistent() { - return Sets.intersection(masked, unmasked).isEmpty(); - } - } - - /** - * A simple descriptor of the concrete implementation of a logical Sirius by - * a specific resource. We use such an descriptor instead of referencing the - * Viewpoints themselves so that the descriptors stay usable event when the - * Sirius's resource has been unloaded. - */ - private static class SiriusImplementation { - /** The logical Sirius URI. */ - private final URI logicalURI; - - /** The resource which provides the logical Sirius. */ - private final Resource provider; - - SiriusImplementation(URI logicalURI, Resource provider) { - this.logicalURI = Preconditions.checkNotNull(logicalURI); - this.provider = Preconditions.checkNotNull(provider); - } - - /** - * {@inheritDoc} - */ - @Override - public int hashCode() { - return Objects.hashCode(logicalURI, provider); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean equals(Object obj) { - if (obj instanceof SiriusImplementation) { - SiriusImplementation that = (SiriusImplementation) obj; - return Objects.equal(this.logicalURI, that.logicalURI) && Objects.equal(this.provider, that.provider); - } else { - return false; - } - } - - @Override - public String toString() { - return logicalURI.toString() + " (" + provider.getURI().toString() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - - /** - * The comparator used to order concurrent implementations of the same - * logical Sirius URI. - */ - private Ordering<SiriusImplementation> viewpointComparator; - - /** - * All the Viewpoints from all the loaded VSMs, whether they are visible or - * not, organized by their Sirius URI. For each logical Sirius URI, the - * providers are ordered using <code>viewpointComparator</code>, putting the - * higher priority at the beginning. - */ - private final ListMultimap<URI, SiriusImplementation> viewpointImplementations = ArrayListMultimap.create(); - - /** - * For each loaded resource A, gives the sum of the number of Viewpoints - * from another resource which masks an equivalent Sirius from the resource - * A. A resource (and all the Viewpoints it defines) is visible if and only - * if this sum is 0. - */ - private final LoadingCache<Resource, Integer> score = CacheBuilder.newBuilder().<Resource, Integer> build(CacheLoader.from(Functions.constant(0))); - - /** - * The handler used to find Sirius instances inside loaded resources. - */ - private final ViewpointResourceHandler resourceHandler; - - /** - * Constructor. - * - * @param comparator - * the comparator used to determining the priority between - * resource for masking computation. - * @param resourceHandler - * the handler used to find Sirius instances inside loaded - * resources. - */ - public MaskingPolicy(Comparator<URI> comparator, ViewpointResourceHandler resourceHandler) { - this.viewpointComparator = Ordering.from(comparator).onResultOf(new Function<SiriusImplementation, URI>() { - @Override - public URI apply(SiriusImplementation vp) { - // The ordering used for masking depends only on the resource's - // priority (as defined by the supplied comparator). - return vp.provider.getURI(); - } - }).reverse(); // reverse to have the highest priority elements first. - this.resourceHandler = Preconditions.checkNotNull(resourceHandler); - } - - /** - * This method must be called by the registry right after a new resource has - * been loaded in the resource set. - * - * @param loaded - * the newly loaded resource. - * @return a description of which resources are newly masked or unmasked by - * the change. - */ - public synchronized MaskingChange resourceLoaded(Resource loaded) { - Preconditions.checkNotNull(loaded); - Preconditions.checkState(loaded.isLoaded(), "The resource is not loaded: " + loaded); //$NON-NLS-1$ - - MaskingChange change = new MaskingChange(); - for (Viewpoint viewpoint : resourceHandler.collectViewpointDefinitions(loaded)) { - Option<URI> uri = new ViewpointQuery(viewpoint).getViewpointURI(); - Preconditions.checkState(uri.some(), "Could not identify logical Sirius URI for Sirius " + viewpoint); //$NON-NLS-1$ - SiriusImplementation vi = new SiriusImplementation(uri.get(), loaded); - List<SiriusImplementation> implementations = viewpointImplementations.get(vi.logicalURI); - int insertionPoint = insertSorted(implementations, vi); - if (insertionPoint == -1) { - MaskingChange result = new MaskingChange(); - result.masked.add(loaded); - return result; - } - - updateScore(loaded, insertionPoint, change); - // All viewpoints after the insertion point get their resource's - // score increased by 1. - for (int i = insertionPoint + 1; i < implementations.size(); i++) { - updateScore(implementations.get(i).provider, 1, change); - } - } - return change; - } - - /** - * This method must be called by the registry right before it unloads a - * resource from the resource set. The resource should still be loaded and - * its content accessible when the method is called. - * <p> - * Assumes the resource will actually get unloaded right after this call; if - * it is not the case, the internal state of the <code>MaskingPolicy</code> - * might get corrupted. - * - * @param unloaded - * the resource which will get unloaded, but is still accessible - * at this time. - * @return a description of which resources are newly masked or unmasked by - * the change. - */ - public synchronized MaskingChange aboutToUnload(final Resource unloaded) { - Preconditions.checkNotNull(unloaded); - Preconditions.checkState(unloaded.isLoaded(), "The resource is not loaded: " + unloaded); //$NON-NLS-1$ - - MaskingChange change = new MaskingChange(); - Set<SiriusImplementation> viewpointsFromUnloadedResource = ImmutableSet.copyOf(Iterables.filter(this.viewpointImplementations.values(), new Predicate<SiriusImplementation>() { - @Override - public boolean apply(SiriusImplementation input) { - return input.provider == unloaded; - } - })); - for (SiriusImplementation vi : viewpointsFromUnloadedResource) { - List<SiriusImplementation> providers = viewpointImplementations.get(vi.logicalURI); - int index = removeSorted(providers, vi); - - // All viewpoints which were after the removed one get their - // resource's score decreased by 1. - for (int i = index; i < providers.size(); i++) { - updateScore(providers.get(i).provider, -1, change); - } - } - score.invalidate(unloaded); - change.masked.add(unloaded); - assert change.isConsistent(); - return change; - } - - /** - * Inserts the viewpoint into the sorted list of providers, keeping the - * whole list sorted (by viewpointComparator). - * - * @param providers - * the list of existing implementers of the logical Sirius. The - * list must be sorted according to viewpointComparator. - * @param viewpoint - * a new concrete implementer of the same logical Sirius. - * @return the index in the list at which the new Sirius has been inserted - * to keep the whole properly sorted. - */ - private int insertSorted(List<SiriusImplementation> providers, SiriusImplementation viewpoint) { - assert viewpointComparator.isOrdered(providers); - int x = viewpointComparator.binarySearch(providers, viewpoint); - if (x >= 0) { - // This means two VSMs from the same source (and thus the same - // priority) define the same logical Sirius. This case is not - // supported: the first one wins and the second VSM (this one) is - // ignored/masked. - return -1; - } else { - assert x < 0 : "The viewpoint should not already be present in the list"; //$NON-NLS-1$ - int insertionPoint = -x - 1; // See Collections.binarySearch((). - providers.add(insertionPoint, viewpoint); - assert viewpointComparator.isOrdered(providers); - return insertionPoint; - } - } - - /** - * Removes the viewpoint from the sorted list of providers. - * - * @param providers - * the list of existing implementers of the logical Sirius. The - * list must be sorted according to viewpointComparator. - * @param viewpoint - * a concrete implementer of the logical Sirius to be removed. - * @return the index in the list at which the Sirius removed was before. - */ - private int removeSorted(List<SiriusImplementation> providers, SiriusImplementation viewpoint) { - assert providers != null && providers.contains(viewpoint) : "Trying to remove unknown viewpoint implementation " + viewpoint; //$NON-NLS-1$ - assert viewpointComparator.isOrdered(providers); - int index = viewpointComparator.binarySearch(providers, viewpoint); - providers.remove(viewpoint); - return index; - } - - private void updateScore(Resource res, int delta, MaskingChange change) { - int oldValue; - try { - oldValue = score.get(res); - } catch (ExecutionException e) { - oldValue = 0; - } - int newValue = oldValue + delta; - assert newValue >= 0; - score.put(res, newValue); - if (oldValue == 0 && newValue > 0) { - change.masked.add(res); - } else if (oldValue >= 0 && newValue == 0) { - change.unmasked.add(res); - } - } - - /** - * Tests whether the specified resource is masked. - * - * @param res - * a resource loaded in the registry's resource set. - * @return <code>true</code> iff the resource is masked by at least one - * another resource. - */ - public synchronized boolean isMasked(Resource res) { - return score.asMap().containsKey(res) && score.getIfPresent(res).intValue() > 0; - } - - /** - * Finds all the resources which are not masked by any other. - * - * @return all the unmasked resources. - */ - public synchronized Set<Resource> getUnmaskedResources() { - Set<Resource> unmasked = new HashSet<>(); - for (Resource resource : score.asMap().keySet()) { - if (!isMasked(resource)) { - unmasked.add(resource); - } - } - return ImmutableSet.copyOf(unmasked); - } - - /** - * Finds all the resources which are masked by at least one another. - * - * @return all the loaded but masked resources. - */ - public synchronized Set<Resource> getMaskedResources() { - return ImmutableSet.copyOf(Sets.difference(score.asMap().keySet(), getUnmaskedResources())); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/StatusUpdater.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/StatusUpdater.java deleted file mode 100644 index 31435eff53..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/StatusUpdater.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -import org.eclipse.emf.common.util.BasicDiagnostic; -import org.eclipse.emf.common.util.Diagnostic; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.Diagnostician; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry.RegistryChange; - -import com.google.common.base.Function; -import com.google.common.base.Functions; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.Sets; -import com.google.common.collect.Sets.SetView; - -/** - * Updates or re-computes the status of all the entries in the registry. - * - * @author pierre-charles.david@obeo.fr - */ -public class StatusUpdater { - private static final String DIAGNOSTICS_SOURCE = "Sirius Registry"; //$NON-NLS-1$ - - private static final int UNDECLARED_DEPENDENCY = 0; - - private static final int DECLARED_DEPENDENCY_UNAVAILABLE = 1; - - private static final int PHYSICAL_DEPENDENCY_UNAVAILABLE = 2; - - private final ResourceSetImpl resourceSet; - - private final Map<URI, Entry> entries; - - @SuppressWarnings("unused") - private final RegistryChange change; - - /** - * Constructor. - * - * @param resourceSet - * the resource set in which the Viewpoints are loaded. - * @param entries - * the entries whose status should be updated. - * @param change - * a description of the actual change which triggered an update. - */ - public StatusUpdater(ResourceSetImpl resourceSet, Map<URI, Entry> entries, RegistryChange change) { - this.resourceSet = Preconditions.checkNotNull(resourceSet); - this.entries = Preconditions.checkNotNull(Collections.unmodifiableMap(entries)); - this.change = Preconditions.checkNotNull(change); - } - - /** - * Updates the status of all the entries in the registry. - */ - public void updateStatus() { - checkAllLogicalDependenciesAreAvailable(); - checkAllActualDependenciesAreDeclared(); - checkAllActualDependenciesAreAvailable(); - resolveCrossResourcesReferences(); - performSemanticValidation(); - } - - private void performSemanticValidation() { - for (Entry entry : entries.values()) { - performSemanticValidation(entry); - } - } - - private void performSemanticValidation(Entry entry) { - Diagnostic result = Diagnostician.INSTANCE.validate(entry.getSirius()); - if (result.getSeverity() > Diagnostic.WARNING) { - entry.setState(ViewpointState.INVALID); - } - entry.getDiagnostics().add(result); - } - - private void resolveCrossResourcesReferences() { - for (Entry entry : entries.values()) { - if (entry.getState() != ViewpointState.INVALID) { - try { - EcoreUtil.resolveAll(entry.getSirius()); - entry.setState(ViewpointState.RESOLVED); - // CHECKSTYLE:OFF - } catch (RuntimeException e) { - // CHECKSTYLE:ON - entry.setState(ViewpointState.INVALID); - } - } - } - } - - private void checkAllActualDependenciesAreAvailable() { - for (Entry entry : entries.values()) { - checkAllActualDependenciesAreAvailable(entry); - } - } - - private void checkAllActualDependenciesAreAvailable(Entry entry) { - Set<URI> actualPhysical = ImmutableSet.copyOf(Iterables.transform(entry.getActualDependencies(), new Function<URI, URI>() { - @Override - public URI apply(URI from) { - return resourceSet.getURIConverter().normalize(from); - } - })); - Set<URI> availablePhysical = ImmutableSet.copyOf(Iterables.transform(entries.values(), new Function<Entry, URI>() { - @Override - public URI apply(Entry from) { - return from.getResource().getURI(); - }; - })); - Set<URI> unavailable = Sets.difference(actualPhysical, availablePhysical); - if (!unavailable.isEmpty()) { - entry.setState(ViewpointState.INVALID); - Object[] data = Iterables.toArray(Iterables.transform(unavailable, Functions.toStringFunction()), String.class); - addDiagnostic(entry, Diagnostic.ERROR, PHYSICAL_DEPENDENCY_UNAVAILABLE, "Sirius definition depends on resources not available.", data); //$NON-NLS-1$ - } - } - - private void checkAllLogicalDependenciesAreAvailable() { - for (Entry entry : entries.values()) { - checkLogicalDependenciesAvailable(entry); - } - } - - private void checkLogicalDependenciesAvailable(Entry entry) { - for (URI dependency : entry.getDeclaredDependencies()) { - if (!entries.containsKey(dependency)) { - entry.setState(ViewpointState.INVALID); - addDiagnostic(entry, Diagnostic.ERROR, DECLARED_DEPENDENCY_UNAVAILABLE, "Invalid dependency declared to unavailable Sirius.", new Object[] { dependency }); //$NON-NLS-1$ - } - } - } - - private void checkAllActualDependenciesAreDeclared() { - for (Entry entry : entries.values()) { - checkActualDependencies(entry); - } - } - - private void checkActualDependencies(Entry entry) { - Set<URI> declared = Sets.newHashSet(entry.getDeclaredDependencies()); - // Include both the logical URIs and their corresponding physical URIs - // in the declared set. - Set<URI> declaredResolved = Sets.newHashSet(Iterables.transform(declared, new Function<URI, URI>() { - @Override - public URI apply(URI from) { - return resourceSet.getURIConverter().normalize(from); - } - })); - declared.addAll(declaredResolved); - Set<URI> actual = entry.getActualDependencies(); - SetView<URI> undeclared = Sets.difference(actual, declared); - if (!undeclared.isEmpty()) { - entry.setState(ViewpointState.INVALID); - Object[] data = Iterables.toArray(Iterables.transform(undeclared, Functions.toStringFunction()), String.class); - addDiagnostic(entry, Diagnostic.ERROR, UNDECLARED_DEPENDENCY, "Sirius has undeclared dependencies to other resources.", data); //$NON-NLS-1$ - } - } - - private void addDiagnostic(Entry entry, int severity, int code, String message, Object[] data) { - entry.getDiagnostics().add(new BasicDiagnostic(severity, DIAGNOSTICS_SOURCE, code, message, data)); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointRegistry.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointRegistry.java deleted file mode 100644 index 3e93312794..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointRegistry.java +++ /dev/null @@ -1,779 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -import java.io.IOException; -import java.text.MessageFormat; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.NoSuchElementException; -import java.util.Set; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.common.util.WrappedException; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.emf.ecore.util.ECrossReferenceAdapter; -import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.sirius.business.api.componentization.ViewpointRegistryFilter; -import org.eclipse.sirius.business.api.componentization.ViewpointRegistryListener2; -import org.eclipse.sirius.business.api.componentization.ViewpointResourceHandler; -import org.eclipse.sirius.business.api.dialect.DialectManager; -import org.eclipse.sirius.business.api.query.RepresentationDescriptionQuery; -import org.eclipse.sirius.business.api.query.ResourceQuery; -import org.eclipse.sirius.business.api.query.ViewpointURIQuery; -import org.eclipse.sirius.business.internal.movida.ViewpointDependenciesTracker; -import org.eclipse.sirius.business.internal.movida.ViewpointResourceOperations; -import org.eclipse.sirius.business.internal.movida.registry.MaskingPolicy.MaskingChange; -import org.eclipse.sirius.business.internal.movida.registry.monitoring.CompositeResourceMonitor; -import org.eclipse.sirius.business.internal.movida.registry.monitoring.LegacyPluginMonitor; -import org.eclipse.sirius.business.internal.movida.registry.monitoring.PluginMonitor; -import org.eclipse.sirius.business.internal.movida.registry.monitoring.ViewpointResourceListener; -import org.eclipse.sirius.business.internal.movida.registry.monitoring.ViewpointResourceMonitor; -import org.eclipse.sirius.business.internal.movida.registry.monitoring.WorkspaceMonitor; -import org.eclipse.sirius.common.tools.api.util.EclipseUtil; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.ext.base.Options; -import org.eclipse.sirius.ext.base.relations.Relation; -import org.eclipse.sirius.viewpoint.SiriusPlugin; -import org.eclipse.sirius.viewpoint.description.Component; -import org.eclipse.sirius.viewpoint.description.RepresentationDescription; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Function; -import com.google.common.base.Joiner; -import com.google.common.base.Objects; -import com.google.common.base.Preconditions; -import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -import com.google.common.collect.Lists; -import com.google.common.collect.Ordering; -import com.google.common.collect.Sets; - -/** - * The registry of all canonical Sirius definitions known in the system. - * - * @author pierre-charles.david@obeo.fr - */ -public class ViewpointRegistry extends org.eclipse.sirius.business.api.componentization.ViewpointRegistry implements ViewpointResourceListener { - private static final String UNABLE_TO_LOAD_THIS_FILE = "The viewpoint registry was not able to load this file "; //$NON-NLS-1$ - - /** - * Internal class used to record entries changes. - */ - static class RegistryChange { - Set<URI> removed = new HashSet<>(); - - Set<URI> added = new HashSet<>(); - - Set<URI> changed = new HashSet<>(); - - public RegistryChange normalize() { - // Elements which were both added and removed are considered as - // changed. - this.changed.addAll(Sets.intersection(this.added, this.removed)); - // Make sure the three categories are exclusive. - this.added.removeAll(this.changed); - this.removed.removeAll(this.changed); - return this; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - // CHECKSTYLE:OFF - sb.append("Removed:\n\t").append(Joiner.on("\n\t").join(removed)).append("\n"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - sb.append("Added:\n\t").append(Joiner.on("\n\t").join(added)).append("\n"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - sb.append("Changed:\n\t").append(Joiner.on("\n\t").join(changed)).append("\n"); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - // CHECKSTYLE:ON - return sb.toString(); - } - } - - private static final String VIEWPOINT_RESOURCE_TYPE_EXTENSION_POINT = "org.eclipse.sirius.viewpointResourceType"; //$NON-NLS-1$ - - /** - * The monitors from which we find the VSMs. - */ - private final CompositeResourceMonitor monitors = new CompositeResourceMonitor(); - - /** - * The resource set in which the detected VSMs are all loaded. - */ - private final ResourceSetImpl resourceSet = new ResourceSetImpl(); - - /** - * The Sirius resource handler used by this registry. - */ - private final CompositeViewpointResourceHandler compositeResourceHandler = new CompositeViewpointResourceHandler(); - - /** - * The helper used to compute which of the resources and viewpoints loaded - * are visible or masked. - */ - private final MaskingPolicy maskingPolicy = new MaskingPolicy(monitors, compositeResourceHandler); - - /** - * The entries in the registry, indexed by their Sirius URI - * (viewpoint:/...). Each entry corresponds to a single, visible Sirius - * provided by an unmasked Resource. - */ - private final Map<URI, Entry> entries = new HashMap<>(); - - /** - * The listeners which are notified of changes in the registry entries. - */ - private final CopyOnWriteArrayList<ViewpointRegistryListener> listeners = new CopyOnWriteArrayList<ViewpointRegistryListener>(); - - /** - * The listeners which are notified of changes in the registry entries. - */ - private final CopyOnWriteArrayList<ViewpointRegistryListener2> legacyListeners = new CopyOnWriteArrayList<ViewpointRegistryListener2>(); - - /** - * A transient object used to store changes in the entries so that they are - * all notified in a single call. - */ - private RegistryChange currentChange; - - private ECrossReferenceAdapter crossReferencer = new ECrossReferenceAdapter(); - - private LegacyPluginMonitor legacyMonitor; - - private CopyOnWriteArrayList<ViewpointRegistryFilter> filters = new CopyOnWriteArrayList<ViewpointRegistryFilter>(); - - /** - * Constructor. - */ - public ViewpointRegistry() { - resourceSet.setURIConverter(new ViewpointURIConverter(this)); - resourceSet.eAdapters().add(crossReferencer); - monitors.setListener(this); - legacyMonitor = new LegacyPluginMonitor(this); - configureResourceHandler(); - monitors.addMonitor("Legacy Plugins", legacyMonitor); //$NON-NLS-1$ - monitors.addMonitor("Plugins", new PluginMonitor(Platform.getExtensionRegistry(), compositeResourceHandler)); //$NON-NLS-1$ - monitors.addMonitor("Workspace", new WorkspaceMonitor(ResourcesPlugin.getWorkspace(), compositeResourceHandler)); //$NON-NLS-1$ - } - - private void configureResourceHandler() { - compositeResourceHandler.addResourceType(new DefaultViewpointResourceHandler()); - IConfigurationElement[] elements = EclipseUtil.getConfigurationElementsFor(VIEWPOINT_RESOURCE_TYPE_EXTENSION_POINT); - for (IConfigurationElement element : elements) { - if ("handler".equals(element.getName())) { //$NON-NLS-1$ - Object handler; - try { - handler = element.createExecutableExtension("class"); //$NON-NLS-1$ - if (handler instanceof ViewpointResourceHandler) { - compositeResourceHandler.addResourceType((ViewpointResourceHandler) handler); - } - } catch (CoreException e) { - reportWarning("Could not instantiate contributed Sirius Resource Type handler " + element.getAttribute("class")); //$NON-NLS-1$//$NON-NLS-2$ - } - } - } - } - - private void reportWarning(String message) { - SiriusPlugin.getDefault().warning(message, null); - } - - /** - * Starts the registry. - */ - public void start() { - if (!isRunning()) { - monitors.start(); - } - } - - /** - * Stops the registry and dispose of all the system resources. - */ - public void stop() { - if (isRunning()) { - monitors.stop(); - entries.clear(); - resourceSet.getResources().clear(); - resourceSet.eAdapters().clear(); - } - } - - /** - * Tests whether this registry is currently running. - * - * @return <code>true</code> if this registry is started. - */ - public boolean isRunning() { - return monitors.isRunning(); - } - - /** - * Adds a new listener to be notified of changes in this registry. Does - * nothing if the listener was already registered. - * - * @param listener - * the listener to add. - */ - public void addListener(ViewpointRegistryListener listener) { - this.listeners.addIfAbsent(listener); - } - - /** - * Removes a listener from the ones to notify of changes in this registry. - * Does nothing if the <code>listener</code> was not actually a listener of - * this registry. - * - * @param listener - * the listener to remove. - */ - public void removeListener(ViewpointRegistryListener listener) { - this.listeners.remove(listener); - } - - /** - * Notify all the registry's listeners of the specified changes. - */ - private void fireRegistryChange(RegistryChange change) { - ImmutableSet<URI> removed = ImmutableSet.copyOf(change.removed); - ImmutableSet<URI> added = ImmutableSet.copyOf(change.added); - ImmutableSet<URI> changed = ImmutableSet.copyOf(change.changed); - for (ViewpointRegistryListener listener : this.listeners) { - listener.registryChanged(this, removed, added, changed); - } - - for (ViewpointRegistryListener2 legacyListener : legacyListeners) { - legacyListener.modelerDesciptionFilesLoaded(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public void resourceEvent(ViewpointResourceMonitor origin, Set<URI> removed, Set<URI> added, Set<URI> changed) { - /* - * This method is the only one from which the content of the registry - * changes. - */ - synchronized (this) { - /* - * The change is stored in a field to avoid passing it along every - * call. There is no risk of confusion as all public methods on the - * registry are synchronized on the registry itself, so we can not - * have multiple calls to e.g. resourceEvent() at the same time. - */ - this.currentChange = new RegistryChange(); - for (URI r : removed) { - resourceRemoved(r); - } - for (URI a : added) { - resourceAdded(a); - } - for (URI c : changed) { - resourceChanged(c); - } - this.currentChange.normalize(); - new StatusUpdater(this.resourceSet, this.entries, this.currentChange).updateStatus(); - fireRegistryChange(this.currentChange); - // Don't hang on the values which are not needed anymore. - this.currentChange = null; - DialectManager.INSTANCE.invalidateMappingCache(); - } - } - - /** - * Returns the Sirius resource handler used by this registry. - * - * @return the Sirius resource handler used by this registry. - */ - public ViewpointResourceHandler getSiriusResourceHandler() { - return compositeResourceHandler; - } - - /** - * Returns the registry entry currently representing the specified logical - * Sirius URI, if any. - * - * @param viewpointURI - * a logical Sirius URI. - * @return the registry entry currently representing the specified logical - * Sirius. - */ - Option<Entry> getEntry(URI viewpointURI) { - Preconditions.checkNotNull(viewpointURI); - Preconditions.checkArgument(ViewpointURIQuery.isValidViewpointURI(viewpointURI)); - synchronized (this) { - Entry entry = entries.get(viewpointURI); - return Options.fromNullable(entry); - } - } - - /** - * Invoked when one of our monitors has detected a new resource which may - * contain VSMs. - * - * @param uri - * the concrete URI of the potential VSM resource. - */ - private void resourceAdded(URI uri) { - Option<Resource> vsm = load(uri); - if (vsm.some()) { - MaskingChange change = maskingPolicy.resourceLoaded(vsm.get()); - updateEntries(change); - updateResourcesStatus(change); - } - } - - /** - * Invoked when one of our monitors has detected that a previously existing - * VSM resource has disappeared. - * - * @param uri - * the concrete URI of the VSM resource which was removed. - */ - private void resourceRemoved(URI uri) { - Option<Resource> res = findResource(uri); - if (res.some()) { - MaskingChange change = maskingPolicy.aboutToUnload(res.get()); - updateEntries(change); - updateResourcesStatus(change); - resourceSet.getResources().remove(res.get()); - } else { - warning(MessageFormat.format("Inconsistent notification: can not remove unknown resource at {0}", uri), null); //$NON-NLS-1$ - } - } - - /** - * Invoked when one of our monitors has detected a change in the content of - * an already known VSM resource. - * - * @param uri - * the concrete URI of the VSM resource whose content has - * changed. - */ - private void resourceChanged(URI uri) { - /* - * Dumb implementation for now, modeling a change as a removal of the - * old version and the addition for the new one. - */ - resourceRemoved(uri); - resourceAdded(uri); - } - - private void updateResourcesStatus(MaskingChange change) { - for (Resource masked : change.masked) { - // Unload all masked resource so that other Sirius which - // depend on them can get re-resolved onto the non-masked - // version of their element, if any. - new ViewpointResourceOperations(masked).unloadAndResetProxyURIs(); - } - for (Resource unmasked : change.unmasked) { - ensureLoaded(unmasked); - } - } - - private void updateEntries(MaskingChange change) { - for (Resource masked : change.masked) { - unregisterViewpointsFrom(masked); - } - for (Resource unmasked : change.unmasked) { - registerViewpointsFrom(unmasked); - } - } - - private Option<Resource> findResource(final URI uri) { - try { - Resource match = Iterables.find(resourceSet.getResources(), new Predicate<Resource>() { - @Override - public boolean apply(Resource input) { - return input.getURI().equals(uri); - } - }); - return match != null ? Options.newSome(match) : Options.<Resource> newNone(); - } catch (NoSuchElementException nsee) { - return Options.newNone(); - } - } - - /** - * Loads the model at the specified URI into the resource set. This assumes - * it is not already loaded. No resolution is performed for references to - * other resources. The resource is loaded only if it can be done without - * errors. - */ - private Option<Resource> load(URI uri) { - Preconditions.checkNotNull(uri); - Preconditions.checkArgument(uri.isPlatform(), "Unsupported URI scheme: " + uri); //$NON-NLS-1$ - - final Option<Resource> result; - Resource vsm; - try { - vsm = resourceSet.getResource(uri, true); - if (vsm == null) { - warning(MessageFormat.format("Unable to load the VSM at {0}", uri), null); //$NON-NLS-1$ - result = Options.newNone(); - } else if (!vsm.getErrors().isEmpty()) { - warning(MessageFormat.format("Errors occured while trying to load the VSM at {0}", uri), null); //$NON-NLS-1$ - vsm.unload(); - resourceSet.getResources().remove(vsm); - result = Options.newNone(); - } else { - result = Options.newSome(vsm); - } - return result; - } catch (final WrappedException e) { - SiriusPlugin.getDefault().warning(UNABLE_TO_LOAD_THIS_FILE + uri, e.exception()); - /* CHECKSTYLE:OFF -> we should handle this kind of exception */ - } catch (final RuntimeException e) { - /* CHECKSTYLE:ON */ - SiriusPlugin.getDefault().warning(UNABLE_TO_LOAD_THIS_FILE + uri, e); - } - return Options.newNone(); - } - - private void ensureLoaded(Resource unmasked) { - if (!unmasked.isLoaded()) { - try { - unmasked.load(Collections.emptyMap()); - } catch (IOException e) { - warning(MessageFormat.format("Unable to load the VSM at {0}", unmasked.getURI()), e); //$NON-NLS-1$ - } - } - } - - /** - * Add an entry in the registry for each of the Sirius defined in the - * specified resource. - * - * @return the new entries added to the registry. - */ - private Set<Entry> registerViewpointsFrom(Resource vsm) { - Set<Entry> newEntries = createNewEntries(vsm); - for (Entry entry : newEntries) { - Preconditions.checkState(!entries.containsKey(entry.getLogicalURI())); - addEntry(entry); - } - return newEntries; - } - - /** - * Removes from the registry all entries for Sirius defined in the specified - * resource. - * - * @return the old entries removed from the registry. - */ - private Set<Entry> unregisterViewpointsFrom(Resource vsm) { - Set<Entry> unregistered = new HashSet<>(); - for (Entry entry : Lists.newArrayList(entries.values())) { - if (Objects.equal(entry.getResource(), vsm)) { - removeEntry(entry); - unregistered.add(entry); - } - } - return unregistered; - } - - private Entry addEntry(Entry entry) { - Entry result = entries.put(entry.getLogicalURI(), entry); - this.currentChange.added.add(entry.getLogicalURI()); - return result; - } - - private void removeEntry(Entry entry) { - entries.remove(entry.getLogicalURI()); - this.currentChange.removed.add(entry.getLogicalURI()); - } - - /** - * Creates, but does not add to the registry, new entries for each of the - * Sirius defined in the specified resource. - */ - private Set<Entry> createNewEntries(Resource vsm) { - ensureLoaded(vsm); - Set<Entry> newEntries = new HashSet<>(); - for (Viewpoint viewpoint : compositeResourceHandler.collectViewpointDefinitions(vsm)) { - newEntries.add(new Entry(viewpoint)); - } - return newEntries; - } - - // CHECKSTYLE:OFF - private void warning(String message, Throwable th) { - if (th == null) { - System.out.println("WARN: " + message); //$NON-NLS-1$ - } else { - System.out.println("WARN: " + message + "(" + th.toString() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - System.out.flush(); - } - - public void dumpStatus(StringBuilder out) { - out.append("Entries:\n"); //$NON-NLS-1$ - for (URI uri : Ordering.usingToString().sortedCopy(entries.keySet())) { - Entry entry = entries.get(uri); - out.append(" - ").append(uri).append(" => ").append(entry.getResource().getURI()).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - - out.append("\n"); //$NON-NLS-1$ - out.append("ResourceSet:\n"); //$NON-NLS-1$ - for (Resource res : resourceSet.getResources()) { - out.append(" - ").append(res.getURI()).append(" [loaded=").append(String.valueOf(res.isLoaded())).append("]").append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - out.append("\tResolved dependencies:\n\t\t").append(Joiner.on("\n\t\t").join(new ResourceQuery(res).getResolvedDependencies())).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - out.append("\tUnresolved dependencies:\n\t\t").append(Joiner.on("\n\t\t").join(new ResourceQuery(res).getUnresolvedDependencies())).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - - out.append("\n"); //$NON-NLS-1$ - out.append("Transitive dependencies:\n"); //$NON-NLS-1$ - ViewpointDependenciesTracker tracker = new ViewpointDependenciesTracker(this); - for (URI uri : Sets.newHashSet(entries.keySet())) { - if (uri.toString().startsWith("viewpoint:/t/")) { //$NON-NLS-1$ - tracker.add(uri); - } - } - for (URI uri : tracker.getTrackedElements()) { - out.append(uri).append("\n"); //$NON-NLS-1$ - out.append(" - direct: ").append(Joiner.on(", ").join(tracker.getDependencies(uri))).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - out.append(" - reverse: ").append(Joiner.on(", ").join(tracker.getReverseDependencies(uri))).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - out.append("\n"); //$NON-NLS-1$ - } - tracker.dispose(); - } - - // CHECKSTYLE:ON - - /** - * Returns a {@link ViewpointRelations} which can be used to see various - * interesting relationships between the Viewpoints in this registry as - * Relations. - * - * @return a view of various relationships between the Viewpoints in this - * registry as Relations. - */ - public ViewpointRelations getRelations() { - return new ViewpointRelations(this); - } - - /** - * Returns a newly initialized tracker for the viewpoints in this registry - * on the specified relation. The tracker will be automatically updated when - * the content of the registry changes. It must be - * {@link ViewpointDependenciesTracker#dispose() disposed} when not needed - * anymore. - * - * @param vpRelation - * the relation to track. - * @return a tracker for the specified relation among the viewpoints in this - * registry. - */ - public ViewpointDependenciesTracker createTrackerFor(Relation<URI> vpRelation) { - ViewpointDependenciesTracker tracker = new ViewpointDependenciesTracker(this, vpRelation); - for (URI uri : entries.keySet()) { - tracker.add(uri); - } - return tracker; - } - - /** - * Returns the concrete physical URI of the resource which currently - * provides the specified logical Sirius, if any. - * - * @param logicalURI - * the logical Sirius URI of the viewpoint to look for. - * - * @return the concrete URI of the resource which provides the Sirius. - */ - public Option<URI> getProvider(URI logicalURI) { - Option<Entry> entry = getEntry(logicalURI); - if (entry.some()) { - return Options.newSome(entry.get().getResource().getURI()); - } else { - return Options.newNone(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public synchronized Set<Viewpoint> getViewpoints() { - return ImmutableSet.copyOf(Iterables.transform(entries.values(), new Function<Entry, Viewpoint>() { - @Override - public Viewpoint apply(Entry from) { - return from.getSirius(); - } - })); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isFromPlugin(Viewpoint viewpoint) { - if (viewpoint != null) { - Resource viewpointResource = viewpoint.eResource(); - if (viewpointResource != null) { - URI uri = viewpointResource.getURI(); - return uri.isPlatformPlugin(); - } - } - return false; - } - - /** - * {@inheritDoc} - */ - @Override - public EObject find(EObject eObject) { - EObject eObj = null; - try { - eObj = resourceSet.getEObject(EcoreUtil.getURI(eObject), true); - } catch (final WrappedException e) { - /* fail silently */ - } - return eObj != null ? eObj : eObject; - } - - /** - * {@inheritDoc} - */ - @Override - public ECrossReferenceAdapter getCrossReferencer() { - return crossReferencer; - } - - /** - * {@inheritDoc} - */ - @Override - public Viewpoint getViewpoint(RepresentationDescription description) { - return new RepresentationDescriptionQuery(description).getParentViewpoint(); - } - - /** - * {@inheritDoc} - */ - @Override - public Viewpoint getViewpoint(URI viewpointUri) { - if (entries.containsKey(viewpointUri)) { - return (entries.get(viewpointUri)).getSirius(); - } else { - return null; - } - } - - /** - * {@inheritDoc} - */ - @Override - public boolean addListener(ViewpointRegistryListener2 listener) { - return legacyListeners.addIfAbsent(listener); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean removeListener(ViewpointRegistryListener2 listener) { - return legacyListeners.remove(listener); - } - - /** - * {@inheritDoc} - */ - @Override - public Set<Viewpoint> registerFromPlugin(String modelerModelResourcePath) { - try { - return legacyMonitor.registerFromPlugin(modelerModelResourcePath); - } catch (final WrappedException e) { - SiriusPlugin.getDefault().warning(UNABLE_TO_LOAD_THIS_FILE + modelerModelResourcePath, e.exception()); - /* CHECKSTYLE:OFF -> we should handle this kind of exception */ - } catch (final RuntimeException e) { - /* CHECKSTYLE:ON */ - SiriusPlugin.getDefault().warning(UNABLE_TO_LOAD_THIS_FILE + modelerModelResourcePath, e); - } - return Collections.emptySet(); - } - - /** - * {@inheritDoc} - */ - @Override - public void disposeFromPlugin(Viewpoint viewpoint) { - legacyMonitor.disposeFromPlugin(viewpoint); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean addFilter(ViewpointRegistryFilter filter) { - return this.filters.add(filter); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean removeFilter(ViewpointRegistryFilter filter) { - return this.filters.remove(filter); - } - - /** - * {@inheritDoc} - */ - @Override - public void removeFilter(String id) { - Iterator<ViewpointRegistryFilter> iter = filters.iterator(); - while (iter.hasNext()) { - ViewpointRegistryFilter filter = iter.next(); - if (Objects.equal(id, filter.getId())) { - iter.remove(); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public <T extends Component> void registerFromWorkspace(Set<T> components) { - - } - - /** - * {@inheritDoc} - */ - @Override - public void init(int size) { - start(); - } - - /** - * {@inheritDoc} - */ - @Override - public void dispose() { - if (isRunning()) { - stop(); - } - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointRegistryListener.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointRegistryListener.java deleted file mode 100644 index 91a543898f..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointRegistryListener.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -import java.util.Set; - -import org.eclipse.emf.common.util.URI; - -/** - * A <code>ViewpointRegistryListener</code> can be notified when changes occur - * in the set of visible viewpoints available from the registry. - * - * @author pierre-charles.david@obeo.fr - */ -public interface ViewpointRegistryListener { - /** - * Indicates that the set of entries in the registry has changed. - * <p> - * All the different kinds of notifications are grouped in a single call to - * this method so that logically consistent changes are notified in a single - * atomic notification. - * <p> - * Note that a given URI can not appear in more than one of the parameters: - * the sets are mutually exclusive. - * - * @param registry - * the registry whose entries changed. - * @param removed - * the logical URIs of the Viewpoint definitions which have - * disappeared. When this notification is received, the receiver - * must assume they are not accessible anymore. - * @param added - * the logical URIs of the new Viewpoint definitions which have - * appeared. When this notification is received, the receiver can - * assume they are accessible. - * @param changed - * the logical URIs of the Viewpoint definition whose content or - * state has changed. For an URI to be in this set, it must have - * been previously <code>added</code> and not yet - * <code>removed</code>. When this notification is received, the - * receiver can assume the changes have already taken place in - * the registry. - */ - void registryChanged(ViewpointRegistry registry, Set<URI> removed, Set<URI> added, Set<URI> changed); -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointRelations.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointRelations.java deleted file mode 100644 index 00562ac26d..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointRelations.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -import java.util.Collections; -import java.util.Set; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.emf.common.util.URI; -import org.eclipse.sirius.ext.base.relations.Relation; -import org.eclipse.sirius.ext.base.relations.TransitiveClosure; -import org.eclipse.sirius.ext.base.relations.UnionRelation; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Preconditions; -import com.google.common.base.Predicates; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; -/** - * Exposes the various relations which can exist between viewpoints are - * {@link Relation}s. - * - * @author pierre-charles.david@obeo.fr - */ -public class ViewpointRelations { - /** - * Base class to handle declared viewpoints dependencies as Relations. - * - * @author pierre-charles.david@obeo.fr - */ - private abstract class AbstractViewpointDependency implements Relation<URI> { - /** - * {@inheritDoc} - */ - public Set<URI> apply(URI from) { - Viewpoint vp = registry.getViewpoint(from); - if (vp != null) { - EList<URI> declared = getDependencies(vp); - return ImmutableSet.copyOf(Iterables.filter(declared, Predicates.notNull())); - } - return Collections.emptySet(); - } - - protected abstract EList<URI> getDependencies(Viewpoint vp); - } - - /** - * The registry to use to resolve the URIs used for declared dependencies. - */ - private final ViewpointRegistry registry; - - private final Relation<URI> reuse = new AbstractViewpointDependency() { - @Override - protected EList<URI> getDependencies(Viewpoint vp) { - return vp.getReuses(); - } - }; - - private final Relation<URI> customize = new AbstractViewpointDependency() { - @Override - protected EList<URI> getDependencies(Viewpoint vp) { - return vp.getCustomizes(); - } - }; - - private final Relation<URI> conflicts = new AbstractViewpointDependency() { - @Override - protected EList<URI> getDependencies(Viewpoint vp) { - return vp.getConflicts(); - } - }; - - @SuppressWarnings("unchecked") - private final Relation<URI> transitiveRequires = new TransitiveClosure<URI>(new UnionRelation<URI>(reuse, customize)); - - /** - * Constructor. - * - * @param registry - * the registry to use to resolve the URIs used for declared - * dependencies. - */ - public ViewpointRelations(ViewpointRegistry registry) { - this.registry = Preconditions.checkNotNull(registry); - } - - /** - * Return a relation representing the direct reuse between viewpoints. - * - * @return a relation representing the direct reuse between viewpoints. - */ - public Relation<URI> getReuse() { - return reuse; - } - - /** - * Return a relation representing the direct conflict between viewpoints. - * - * @return a relation representing the direct conflict between viewpoints. - */ - public Relation<URI> getConflicts() { - return conflicts; - } - - /** - * Return a relation representing the transitive reuse between viewpoints. - * - * @return a relation representing the transitive reuse between viewpoints. - */ - public Relation<URI> getTransitiveRequires() { - return transitiveRequires; - } - - /** - * Return a relation representing the direct customization between - * viewpoints. - * - * @return a relation representing the direct customization between - * viewpoints. - */ - public Relation<URI> getCustomize() { - return customize; - } - - /** - * Returns a relation representing the direct requirements between - * viewpoints. - * - * @return a relation representing the direct requirements between - * viewpoints. - */ - public Relation<URI> getRequires() { - return new UnionRelation<URI>(customize, reuse); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointState.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointState.java deleted file mode 100644 index cd2555b812..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointState.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -/** - * The status of a Viewpoint definition. - * - * @author pierre-charles.david@obeo.fr - */ -public enum ViewpointState { - /** - * The Viewpoint has been identified, but its actual state has not been - * determined yet. - */ - UNDEFINED, - /** - * The Viewpoint is present and loaded, but the model is not valid. - */ - INVALID, - /** - * The Viewpoint is present and valid, but some of its dependencies are not. - */ - INSTALLED, - /** - * The Viewpoint and all its dependencies are valid. It is ready to be used - * in a session, but is not actually enabled in any open sessions. - */ - RESOLVED -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointURIConverter.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointURIConverter.java deleted file mode 100644 index 25a09f01a2..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointURIConverter.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl; -import org.eclipse.sirius.business.api.query.ViewpointURIQuery; -import org.eclipse.sirius.ext.base.Option; - -import com.google.common.base.Preconditions; -/** - * The converter used to normalize Viewpoint URIs into the URI of the concrete - * resource their are currently provided by. - * - * @author pierre-charles.david@obeo.fr - */ -public final class ViewpointURIConverter extends ExtensibleURIConverterImpl { - private final ViewpointRegistry registry; - - /** - * Constructor. - * - * @param registry - * the registry used to translate logical viewpoint URIs into - * physical URIs. - */ - public ViewpointURIConverter(ViewpointRegistry registry) { - this.registry = Preconditions.checkNotNull(registry); - } - - /** - * Normalizes logical <code>viewpoint:/pluginId/ViewpointName</code> URIs - * into the physical (platform) URI of the resource which currently provides - * this Sirius in the registry. Non viewpoint URIs and viewpoint URIs - * unknown to the registry are handled using the default behavior. - * <p> - * {@inheritDoc} - */ - @Override - public URI normalize(URI uri) { - if (ViewpointURIQuery.isValidViewpointURI(uri)) { - ViewpointURIQuery q = new ViewpointURIQuery(uri); - Option<Entry> entry = registry.getEntry(q.getBaseURI()); - if (entry.some()) { - return entry.get().getResource().getURI(); - } - } - return super.normalize(uri); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointURIHandler.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointURIHandler.java deleted file mode 100644 index e003e891d4..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/ViewpointURIHandler.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.xmi.impl.URIHandlerImpl; -import org.eclipse.sirius.business.api.query.ViewpointURIQuery; -import org.eclipse.sirius.business.internal.movida.Movida; -import org.eclipse.sirius.ext.base.Option; - -import com.google.common.base.Preconditions; - -/** - * This class overrides URIHandlerImpl.PlatformSchemeAware to normalize baseURI - * before processing super.deresolve(uri). - * - * @author smonnier, pcdavid - */ -public class ViewpointURIHandler extends URIHandlerImpl.PlatformSchemeAware { - private final ResourceSet resourceSet; - - /** - * Constructor. - * - * @param resourceSet - * the resource set to use for the conversion of physical URIs to - * logical <code>viewpoint:/</code> URIs on save.. - */ - public ViewpointURIHandler(ResourceSet resourceSet) { - this.resourceSet = Preconditions.checkNotNull(resourceSet); - } - - /** - * {@inheritDoc} - */ - @Override - public URI deresolve(URI uri) { - if (!baseURI.isPlatform() && "viewpoint".equals(baseURI.scheme())) { //$NON-NLS-1$ - baseURI = resourceSet.getURIConverter().normalize(baseURI); - } - if (Movida.isEnabled()) { - Option<URI> viewpointURI = ViewpointURIQuery.asViewpointURI(uri, resourceSet); - if (viewpointURI.some()) { - return viewpointURI.get(); - } - } - return super.deresolve(uri); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/AbstractViewpointResourceMonitor.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/AbstractViewpointResourceMonitor.java deleted file mode 100644 index 7ab67f0446..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/AbstractViewpointResourceMonitor.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry.monitoring; - -import java.util.Set; - -import org.eclipse.emf.common.util.URI; - -import com.google.common.base.Preconditions; -import com.google.common.collect.Sets; - -/** - * A partial implementation of ViewpointResourceMonitor to use as a starting - * point. - * - * @author pierre-charles.david@obeo.fr - */ -public abstract class AbstractViewpointResourceMonitor implements ViewpointResourceMonitor { - /** - * The listener to notify when we detect interesting events. - */ - protected ViewpointResourceListener listener; - - /** - * Whether or not we are actively monitoring. - */ - protected volatile boolean running; - - /** - * {@inheritDoc} - */ - public synchronized void setListener(ViewpointResourceListener listener) { - this.listener = listener; - } - - /** - * {@inheritDoc} - */ - public boolean isRunning() { - return running; - } - - /** - * {@inheritDoc} - */ - protected synchronized void notifyResourcesEvents(Set<URI> removed, Set<URI> added, Set<URI> changed) { - Preconditions.checkNotNull(removed); - Preconditions.checkNotNull(added); - Preconditions.checkNotNull(changed); - assert Sets.intersection(removed, added).isEmpty() && Sets.intersection(added, changed).isEmpty() && Sets.intersection(changed, removed).isEmpty(); - - if (listener != null && !(removed.isEmpty() && added.isEmpty() && changed.isEmpty())) { - listener.resourceEvent(this, removed, added, changed); - } - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/CompositeResourceMonitor.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/CompositeResourceMonitor.java deleted file mode 100644 index 98430323b3..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/CompositeResourceMonitor.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry.monitoring; - -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.sirius.viewpoint.Messages; - -import com.google.common.base.Preconditions; -import com.google.common.collect.Iterables; - -/** - * Aggregates an ordered set of resource monitors. - * - * @author pierre-charles.david@obeo.fr - */ -public class CompositeResourceMonitor extends AbstractViewpointResourceMonitor implements ViewpointResourceListener, Comparator<URI> { - /** - * The aggregated monitors. - */ - private final List<ViewpointResourceMonitor> monitors = new ArrayList<>(); - - /** - * The names of the aggregated monitors, in the same order as in - * <code>monitors</code>. - */ - private final List<String> names = new ArrayList<>(); - - /** - * A map to keep track of which monitor detected each of the currently - * active URIs; - */ - private final Map<URI, ViewpointResourceMonitor> origins = new HashMap<>(); - - /** - * Adds a new monitor to this composite. - * - * @param name - * the symbolic name of this monitor. Must not be already in use - * in this composite. - * @param monitor - * the monitor to add. - * @throws IllegalStateException - * if this composite or the monitor is already running, is - * already registered here, or if the specified name is already - * in use. - */ - public synchronized void addMonitor(String name, ViewpointResourceMonitor monitor) throws IllegalStateException { - Preconditions.checkState(!this.isRunning() && !monitor.isRunning(), Messages.CompositeResourceMonitor_addMonitorErrorMsg); - Preconditions.checkState(!monitors.contains(monitor), Messages.CompositeResourceMonitor_alreadyRegisteredErrorMsg); - Preconditions.checkState(!names.contains(name), MessageFormat.format(Messages.CompositeResourceMonitor_alreadyUsedNameErrorMsg, name)); - - monitors.add(monitor); - names.add(name); - monitor.setListener(this); - } - - /** - * {@inheritDoc} - */ - @Override - public synchronized void start() { - this.running = true; - for (ViewpointResourceMonitor monitor : monitors) { - monitor.start(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public synchronized void stop() { - for (ViewpointResourceMonitor monitor : monitors) { - monitor.stop(); - } - origins.clear(); - this.running = false; - } - - /** - * Tests whether a URI comes from a source with a higher priority than - * another one, and thus may shadow it. Whether or not the content of - * <code>override</code> actually overrides the content of - * <code>shadowed</code> - * - * @param override - * the URI of the resource which may mask the other. - * @param shadowed - * the URI of the resource which my be masked by the other. - * @return <code>true</code> if both URIs were detected by monitors from - * this composite, and <code>override</code> was detected by a - * monitor which has a higher priority than the one which detected - * <code>shadowed</code>, <code>false</code> otherwise. - */ - public boolean canMask(URI override, URI shadowed) { - return compare(override, shadowed) > 0; - } - - /** - * Forwards the notifications received from the our registered sources to - * our own listener. The origin of the notification is kept: this composite - * is transparent. - * <p> - * {@inheritDoc} - */ - @Override - public synchronized void resourceEvent(ViewpointResourceMonitor origin, Set<URI> removed, Set<URI> added, Set<URI> changed) { - if (this.listener != null) { - for (URI a : Iterables.concat(added, changed)) { - origins.put(a, origin); - } - - this.listener.resourceEvent(origin, removed, added, changed); - - // Only forget about the removes URIs after the listener has been - // notified, as it may still want to use us to compare() removed - // URIs with other ones. - for (URI r : removed) { - origins.remove(r); - } - } - } - - /** - * Compares two URIs according to the priority of their origin. A URI is - * considered to be higher than another one if it comes from a higher - * priority source, and thus can potentially mask the other. - * <p> - * {@inheritDoc} - */ - @Override - public synchronized int compare(URI uri1, URI uri2) { - ViewpointResourceMonitor src1 = origins.get(uri1); - ViewpointResourceMonitor src2 = origins.get(uri2); - if (src1 != null && src2 != null) { - int index1 = monitors.indexOf(src1); - int index2 = monitors.indexOf(src2); - if (index1 != -1 && index2 != -1) { - return index1 - index2; - } - } - throw new IllegalArgumentException(Messages.CompositeResourceMonitor_uriCompareErrorMsg); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/LegacyPluginMonitor.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/LegacyPluginMonitor.java deleted file mode 100644 index da51670293..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/LegacyPluginMonitor.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry.monitoring; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.sirius.business.api.componentization.ISiriusComponent; -import org.eclipse.sirius.business.api.query.ViewpointQuery; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; -import org.eclipse.sirius.common.tools.api.util.EclipseUtil; -import org.eclipse.sirius.ext.base.Option; -import org.eclipse.sirius.viewpoint.description.Viewpoint; - -import com.google.common.base.Predicate; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; - -/** - * A monitor which provides compatibility with the legacy APIs used for Sirius - * registration. - * - * @author pierre-charles.david@obeo.fr - */ -public class LegacyPluginMonitor extends AbstractViewpointResourceMonitor { - private final ViewpointRegistry registry; - - private final Set<URI> knownURIs = new HashSet<>(); - - /** - * Constructor. - * - * @param registry - * the registry to which the VSMs are registered. - */ - public LegacyPluginMonitor(ViewpointRegistry registry) { - this.registry = registry; - } - - /** - * {@inheritDoc} - */ - public void start() { - this.running = true; - EclipseUtil.getExtensionPlugins(ISiriusComponent.CLASS_TO_EXTEND, ISiriusComponent.ID, ISiriusComponent.CLASS_ATTRIBUTE); - } - - /** - * {@inheritDoc} - */ - public void stop() { - this.running = false; - } - - /** - * Register all components in the resource. This method should be called on - * org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext) - * - * @param modelerModelResourcePath - * the platform file path ("pluginname/rep1/rep2/file.odesign) - * @return the added Viewpoints; - */ - public Set<Viewpoint> registerFromPlugin(String modelerModelResourcePath) { - try { - final URI uri = URI.createPlatformPluginURI(modelerModelResourcePath, true); - // if (SiriusURIQuery.isValidSiriusURI(uri)) { - return registerFromPlugin(uri); - // } - } catch (IllegalArgumentException e) { - // Do nothing if the URI is invalid. - } - return Collections.emptySet(); - } - - private Set<Viewpoint> registerFromPlugin(final URI uri) { - if (knownURIs.contains(uri)) { - notifyResourcesEvents(Collections.<URI> emptySet(), Collections.<URI> emptySet(), Collections.singleton(uri)); - } else { - notifyResourcesEvents(Collections.<URI> emptySet(), Collections.singleton(uri), Collections.<URI> emptySet()); - } - return ImmutableSet.copyOf(Iterables.filter(registry.getViewpoints(), new Predicate<Viewpoint>() { - public boolean apply(Viewpoint input) { - Resource r = input.eResource(); - return r != null && r.getURI().equals(uri); - } - })); - } - - /** - * Dispose a {@link Viewpoint}. This method should be called on - * {@link org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)} - * - * @param viewpoint - * the viewpoint to dispose - */ - public void disposeFromPlugin(Viewpoint viewpoint) { - if (viewpoint != null) { - Option<URI> uri = new ViewpointQuery(viewpoint).getViewpointURI(); - if (uri.some()) { - notifyResourcesEvents(Collections.singleton(uri.get()), Collections.<URI> emptySet(), Collections.<URI> emptySet()); - knownURIs.remove(uri.get()); - } - } - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/PluginMonitor.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/PluginMonitor.java deleted file mode 100644 index ac3d9905cc..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/PluginMonitor.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry.monitoring; - -import java.util.Collections; -import java.util.HashSet; -import java.util.LinkedHashSet; -import java.util.Set; - -import org.eclipse.core.runtime.ContributorFactoryOSGi; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IContributor; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.emf.common.util.URI; -import org.eclipse.sirius.business.api.componentization.ViewpointResourceHandler; -import org.eclipse.sirius.viewpoint.SiriusPlugin; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.framework.BundleListener; - -import com.google.common.base.Preconditions; - -/** - * Monitors VSMs installed in Eclipse plug-ins and registered through the - * appropriate extension point. - * - * @author pierre-charles.david@obeo.fr - */ -public class PluginMonitor extends AbstractViewpointResourceMonitor { - /** - * The identifier for the extension point used to register VSMs. - */ - public static final String VSM_REGISTRATION_EXTENSION_POINT = "org.eclipse.sirius.viewpointSpecificationModel"; //$NON-NLS-1$ - - /** - * The bundle listener which detects VSMs registered in bundles which - * dynamically installed or un-installed. - */ - private final class SiriusRegistrationBundleListener implements BundleListener { - /** - * {@inheritDoc} - */ - @Override - public void bundleChanged(BundleEvent event) { - Bundle bundle = event.getBundle(); - // FIXME Study OSGi's bundle life-cycle to understand which state - // and events to listen to and how to react to them. - switch (event.getType()) { - case BundleEvent.INSTALLED: - addAllRegisteredVSMs(bundle); - break; - case BundleEvent.UNINSTALLED: - removeAllRegisteredVSMs(bundle); - break; - default: - // Ignore. - break; - } - } - - private void addAllRegisteredVSMs(Bundle bundle) { - Set<URI> discovered = findRegisteredVSMs(bundle); - notifyResourcesEvents(Collections.<URI> emptySet(), discovered, Collections.<URI> emptySet()); - } - - private void removeAllRegisteredVSMs(Bundle bundle) { - Set<URI> discovered = findRegisteredVSMs(bundle); - notifyResourcesEvents(discovered, Collections.<URI> emptySet(), Collections.<URI> emptySet()); - } - } - - /** - * The extension registry to use to discover the registered VSMs. - */ - private final IExtensionRegistry extensionRegistry; - - /** - * The handler used to check if the declared resources are of a supported - * type. - */ - private final ViewpointResourceHandler resourceHandler; - - /** - * The listener used for dynamic bundle installation support. - */ - private final BundleListener bundleListener = new SiriusRegistrationBundleListener(); - - /** - * Constructor. - * - * @param extensionRegistry - * the extension registry to use to discover the registered VSMs. - * @param resourceType - * the handler used to check if the declared resources are of a - * supported type. - */ - public PluginMonitor(IExtensionRegistry extensionRegistry, ViewpointResourceHandler resourceType) { - this.extensionRegistry = Preconditions.checkNotNull(extensionRegistry); - this.resourceHandler = Preconditions.checkNotNull(resourceType); - } - - /** - * {@inheritDoc} - */ - @Override - public void start() { - this.running = true; - detectRegisteredVSMs(); - registerBundleListener(); - } - - /** - * {@inheritDoc} - */ - @Override - public void stop() { - unregisterBundleListener(); - this.running = false; - } - - private void registerBundleListener() { - BundleContext context = SiriusPlugin.getDefault().getBundle().getBundleContext(); - context.addBundleListener(this.bundleListener); - } - - private void unregisterBundleListener() { - BundleContext context = SiriusPlugin.getDefault().getBundle().getBundleContext(); - context.removeBundleListener(this.bundleListener); - } - - private void detectRegisteredVSMs() { - IConfigurationElement[] elements = extensionRegistry.getConfigurationElementsFor(VSM_REGISTRATION_EXTENSION_POINT); - Set<URI> discovered = detectRegisteredVSMs(elements); - notifyResourcesEvents(Collections.<URI> emptySet(), discovered, Collections.<URI> emptySet()); - } - - private Set<URI> findRegisteredVSMs(Bundle bundle) { - Preconditions.checkNotNull(bundle); - IContributor contrib = ContributorFactoryOSGi.createContributor(bundle); - IExtension[] extensions = extensionRegistry.getExtensions(contrib.getName()); - if (extensions == null) { - return Collections.emptySet(); - } else { - Set<URI> discovered = new HashSet<>(); - for (IExtension ext : extensions) { - if (ext.getExtensionPointUniqueIdentifier().equals(VSM_REGISTRATION_EXTENSION_POINT)) { - Set<URI> registered = detectRegisteredVSMs(ext.getConfigurationElements()); - discovered.addAll(registered); - } - } - return discovered; - } - } - - private Set<URI> detectRegisteredVSMs(IConfigurationElement[] elements) { - Preconditions.checkNotNull(elements); - Set<URI> discovered = new LinkedHashSet<>(); - for (IConfigurationElement element : elements) { - String contributingPlugin = element.getContributor().getName(); - String localPath = element.getAttribute("path"); //$NON-NLS-1$ - if (localPath == null) { - reportWarning("Missing 'path' attribute for VSM definition in " + contributingPlugin + "; ignoring this definition."); //$NON-NLS-1$//$NON-NLS-2$ - continue; - } - try { - URI uri = URI.createPlatformPluginURI("/" + contributingPlugin + "/" + localPath, true); //$NON-NLS-1$ //$NON-NLS-2$ - if (!pluginResourceExists(contributingPlugin, localPath)) { - reportWarning("Not resource found at specified location " + uri + " in " + contributingPlugin); //$NON-NLS-1$//$NON-NLS-2$ - continue; - } - if (!resourceHandler.handles(uri)) { - reportWarning("Registered resource is not of a supported type: " + uri); //$NON-NLS-1$ - continue; - } - boolean newEntry = discovered.add(uri); - if (!newEntry) { - reportWarning("Duplicate registration of " + uri + " in " + contributingPlugin); //$NON-NLS-1$//$NON-NLS-2$ - } - } catch (IllegalArgumentException iea) { - reportWarning("Invalid 'path' attribute for VSM definition in " + contributingPlugin + "; ignoring this definition."); //$NON-NLS-1$//$NON-NLS-2$ - } - } - return discovered; - } - - private boolean pluginResourceExists(String pluginId, String localPath) { - Bundle bundle = Platform.getBundle(pluginId); - if (bundle != null) { - return FileLocator.find(bundle, new Path(localPath), null) != null; - } else { - return false; - } - } - - private void reportWarning(String message) { - SiriusPlugin.getDefault().warning(message, null); - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/ViewpointResourceListener.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/ViewpointResourceListener.java deleted file mode 100644 index 342170a807..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/ViewpointResourceListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry.monitoring; - -import java.util.Set; - -import org.eclipse.emf.common.util.URI; - -/** - * A <code>ViewpointResourceListener</code> can be notified of the appearance, - * disappearance and changes in resources which can potentially contain - * viewpoint definitions. - * <p> - * Note: a resource move is modeled by a removal followed by an addition, - * whether or not the resource's content changes during the move. - * - * @author pierre-charles.david@obeo.fr - */ -public interface ViewpointResourceListener { - /** - * Invoked when relevant changes in resources potentially containing VSMs - * are detected. - * <p> - * All the different kinds of notifications are grouped in a single call to - * this method so that logically consistent changes may be notified in a - * single atomic notification, although this is not a strict requirement for - * {@link ViewpointResourceMonitor}s. - * <p> - * Note that a given URI can not appear in more than one of the parameters: - * the sets are mutually exclusive. - * - * @param origin - * the monitor which detected the change. - * - * @param removed - * the URIs of the resources which have disappeared. When this - * notification is received, the receiver must assume they are - * not accessible anymore. - * @param added - * the URIs of the new resources which have appeared. When this - * notification is received, the receiver can assume they are - * accessible. - * @param changed - * the URIs of the resources whose content has changed. For an - * URI to be in this set, it must have been previously - * <code>added</code> and not yet <code>removed</code>. When this - * notification is received, the receiver can assume they are - * accessible and (re)loading them will yield the updated - * content. - */ - void resourceEvent(ViewpointResourceMonitor origin, Set<URI> removed, Set<URI> added, Set<URI> changed); -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/ViewpointResourceMonitor.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/ViewpointResourceMonitor.java deleted file mode 100644 index 1a10baab16..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/ViewpointResourceMonitor.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry.monitoring; - -/** - * A monitor that can discover resources which may contain Sirius - * definitions, and detect changes in those resources. Concrete implementations - * are specialized in specific sources of such resources (i.e. the workspace or - * plug-ins). - * <p> - * When created, a monitor is initially inactive. It must be configured by - * setting the {{@link #setListener(ViewpointResourceListener) listener} to - * notify before it can be {{@link #start() started}. - * <p> - * Notifications may be sent to the listener synchronously right during the call - * to {@link #start()} or asynchronously, depending on the implementation. - * - * @author pierre-charles.david@obeo.fr - */ -public interface ViewpointResourceMonitor { - /** - * The listener to notify when a change is detected. May be - * <code>null</code>, but any change detected while there is no valid - * listener is lost. - * - * @param listener - * the listener to notify. - */ - void setListener(ViewpointResourceListener listener); - - /** - * Starts the monitor if it is not already running. Does nothing if it was - * already running. Re-starting a monitor which was previously - * {@link #stop() stopped} has the same effect as starting a new instance - * from scratch; in particular, it will re-discover all the existing - * resources as if they were just added. - */ - void start(); - - /** - * Stops the monitor if it is running. Does nothing if its was already - * stopped. - */ - void stop(); - - /** - * Tests whether the monitor is actively monitoring its source. - * - * @return <code>true</code> if this monitor is running. - */ - boolean isRunning(); -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/WorkspaceMonitor.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/WorkspaceMonitor.java deleted file mode 100644 index 4b249b9adf..0000000000 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/movida/registry/monitoring/WorkspaceMonitor.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 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 - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -package org.eclipse.sirius.business.internal.movida.registry.monitoring; - -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.Set; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.IResourceProxy; -import org.eclipse.core.resources.IResourceProxyVisitor; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.emf.common.util.URI; -import org.eclipse.sirius.business.api.componentization.ViewpointResourceHandler; - -import com.google.common.base.Preconditions; - -/** - * Monitors VSMs in the Eclipse workspace. - * - * @author pierre-charles.david@obeo.fr - */ -public class WorkspaceMonitor extends AbstractViewpointResourceMonitor { - /** - * The workspace to monitor. - */ - private final IWorkspace workspace; - - /** - * The workspace event listener. - */ - private final IResourceChangeListener workspaceChangeListener = new WorkspaceListener(); - - /** - * The handler used to check if the declared resources are of a supported - * type. - */ - private final ViewpointResourceHandler resourceHandler; - - /** - * The visitor used for initial discovery of all the VSMs existing in the - * workspace. - */ - private final class VSMProxyVisitor implements IResourceProxyVisitor { - Set<URI> detected = new LinkedHashSet<>(); - - /** - * {@inheritDoc} - */ - public boolean visit(IResourceProxy proxy) throws CoreException { - if (proxy.isAccessible()) { - IResource res = proxy.requestResource(); - if (isVSM(res)) { - detected.add(URI.createPlatformResourceURI(res.getFullPath().toString(), true)); - return false; - } - } - return true; - } - } - - /** - * The listener notified of workspace changes. - */ - private final class WorkspaceListener implements IResourceChangeListener { - public void resourceChanged(IResourceChangeEvent event) { - IResourceDelta delta = event.getDelta(); - if (delta != null) { - try { - VSMDeltaVisitor visitor = new VSMDeltaVisitor(); - delta.accept(visitor); - notifyResourcesEvents(visitor.removed, visitor.added, visitor.changed); - } catch (CoreException e) { - reportCoreException(e); - } - } - } - } - - /** - * The visitor used to detect VSM workspace changes. - */ - private final class VSMDeltaVisitor implements IResourceDeltaVisitor { - Set<URI> added = new LinkedHashSet<>(); - - Set<URI> removed = new LinkedHashSet<>(); - - Set<URI> changed = new LinkedHashSet<>(); - - /** - * {@inheritDoc} - */ - public boolean visit(IResourceDelta delta) throws CoreException { - IResource res = delta.getResource(); - if (isVSM(res)) { - IPath fullPath = delta.getFullPath(); - URI uri = URI.createPlatformResourceURI(fullPath.toString(), true); - switch (delta.getKind()) { - case IResourceDelta.ADDED: - added.add(uri); - break; - case IResourceDelta.REMOVED: - removed.add(uri); - break; - case IResourceDelta.CHANGED: - // Ignore markers-only changes - if (delta.getMarkerDeltas().length == 0) { - changed.add(uri); - } - break; - default: - // Ignore other delta kinds. - break; - } - return false; - } - return true; - } - } - - /** - * Constructor. - * - * @param workspace - * the workspace to monitor. - * @param resourceHandler - * the handler used to check if the declared resources are of a - * supported type. - */ - public WorkspaceMonitor(IWorkspace workspace, ViewpointResourceHandler resourceHandler) { - this.workspace = Preconditions.checkNotNull(workspace); - this.resourceHandler = Preconditions.checkNotNull(resourceHandler); - } - - /** - * {@inheritDoc} - */ - public void start() { - this.running = true; - // NOTE Possible race condition here: we may lose change notifications - // for URIs which change after they have been detected but before we - // have registered the change listener. - detectExistingVSMs(); - workspace.addResourceChangeListener(workspaceChangeListener, IResourceChangeEvent.POST_CHANGE); - } - - /** - * {@inheritDoc} - */ - public void stop() { - workspace.removeResourceChangeListener(workspaceChangeListener); - this.running = false; - } - - private void detectExistingVSMs() { - try { - VSMProxyVisitor detector = new VSMProxyVisitor(); - workspace.getRoot().accept(detector, IResource.NONE); - notifyResourcesEvents(Collections.<URI> emptySet(), detector.detected, Collections.<URI> emptySet()); - } catch (CoreException e) { - reportCoreException(e); - } - } - - private void reportCoreException(CoreException e) { - throw new RuntimeException(e); - } - - private boolean isVSM(IResource res) { - if (res.getType() == IResource.FILE) { - URI uri = URI.createPlatformResourceURI(res.getFullPath().toString(), true); - return resourceHandler.handles(uri); - } else { - return false; - } - } -} diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/SessionFactoryImpl.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/SessionFactoryImpl.java index 14b5f8e4e9..f8a26b66bf 100644 --- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/SessionFactoryImpl.java +++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/SessionFactoryImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 THALES GLOBAL SERVICES. + * Copyright (c) 2008, 2018 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 @@ -30,9 +30,6 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.sirius.business.api.query.ResourceQuery; import org.eclipse.sirius.business.api.session.Session; import org.eclipse.sirius.business.api.session.factory.SessionFactory; -import org.eclipse.sirius.business.internal.movida.Movida; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointRegistry; -import org.eclipse.sirius.business.internal.movida.registry.ViewpointURIConverter; import org.eclipse.sirius.business.internal.session.danalysis.DAnalysisSessionImpl; import org.eclipse.sirius.common.tools.api.editing.EditingDomainFactoryService; import org.eclipse.sirius.common.tools.api.resource.ResourceSetFactory; @@ -135,11 +132,6 @@ public class SessionFactoryImpl implements SessionFactory { */ protected void configureDomain(TransactionalEditingDomain transactionalEditingDomain, URI sessionResourceUri) { ResourceSet set = transactionalEditingDomain.getResourceSet(); - - if (Movida.isEnabled()) { - set.setURIConverter(new ViewpointURIConverter((ViewpointRegistry) org.eclipse.sirius.business.api.componentization.ViewpointRegistry.getInstance())); - } - if (set instanceof ResourceSetImpl) { ResourceSetImpl resourceSetImpl = (ResourceSetImpl) set; new ResourceSetImpl.MappedResourceLocator(resourceSetImpl); |
