diff options
| author | pguilet | 2018-02-22 16:40:11 +0000 |
|---|---|---|
| committer | Pierre Guilet | 2018-02-28 13:19:23 +0000 |
| commit | f7513dac9aa9dacd68354f4cd9bd834ae07b5756 (patch) | |
| tree | b82891c8815a12f578e209911e64a27a91508fd5 | |
| parent | 5d91fd395ffac08c50ad6aa36329a24a9e9a6826 (diff) | |
| download | org.eclipse.sirius-f7513dac9aa9dacd68354f4cd9bd834ae07b5756.tar.gz org.eclipse.sirius-f7513dac9aa9dacd68354f4cd9bd834ae07b5756.tar.xz org.eclipse.sirius-f7513dac9aa9dacd68354f4cd9bd834ae07b5756.zip | |
[509070] Update generic layout algorithm integration to handle options
Options supported are String, Integer, Double, Boolean, Enum, EnumSet
Bug: 509070
Change-Id: I1a03ba2adf199797a7107642030dae0adb38fe1a
Signed-off-by: pguilet <pierre.guilet@obeo.fr>
36 files changed, 1752 insertions, 267 deletions
diff --git a/plugins/org.eclipse.sirius.diagram.elk/src/org/eclipse/sirius/diagram/elk/DiagramElkPlugin.java b/plugins/org.eclipse.sirius.diagram.elk/src/org/eclipse/sirius/diagram/elk/DiagramElkPlugin.java index 89ad1c31a1..7c9ee89132 100644 --- a/plugins/org.eclipse.sirius.diagram.elk/src/org/eclipse/sirius/diagram/elk/DiagramElkPlugin.java +++ b/plugins/org.eclipse.sirius.diagram.elk/src/org/eclipse/sirius/diagram/elk/DiagramElkPlugin.java @@ -10,10 +10,20 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.elk; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import org.eclipse.elk.core.data.LayoutAlgorithmData; import org.eclipse.elk.core.data.LayoutMetaDataService; +import org.eclipse.elk.core.data.LayoutOptionData; +import org.eclipse.elk.core.data.LayoutOptionData.Target; +import org.eclipse.elk.core.data.LayoutOptionData.Type; +import org.eclipse.elk.core.data.LayoutOptionData.Visibility; +import org.eclipse.elk.core.options.CoreOptions; +import org.eclipse.sirius.diagram.description.LayoutOption; +import org.eclipse.sirius.diagram.ui.api.layout.EnumChoice; +import org.eclipse.sirius.diagram.ui.api.layout.LayoutOptionFactory; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -36,9 +46,60 @@ public class DiagramElkPlugin extends AbstractUIPlugin { super.start(context); plugin = this; + // we fill the Sirius layout algorithm registry with all ELK algorithms. Collection<LayoutAlgorithmData> algorithmData = LayoutMetaDataService.getInstance().getAlgorithmData(); for (LayoutAlgorithmData layoutAlgorithmData : algorithmData) { - DiagramUIPlugin.getPlugin().addLayoutProvider(layoutAlgorithmData.getId(), layoutAlgorithmData.getName(), () -> new ELKLayoutNodeProvider(), null); + + List<LayoutOptionData> optionDatas = LayoutMetaDataService.getInstance().getOptionData(layoutAlgorithmData, Target.PARENTS); + List<LayoutOption> layoutOptions = new ArrayList<>(); + LayoutOptionFactory layoutOptionFactory = new LayoutOptionFactory(); + for (LayoutOptionData layoutOptionData : optionDatas) { + if (!CoreOptions.ALGORITHM.getId().equals(layoutOptionData.getId()) && !layoutOptionData.getVisibility().equals(Visibility.HIDDEN)) { + switch (layoutOptionData.getType()) { + case STRING: + layoutOptions.add(layoutOptionFactory.createStringOption((String) layoutOptionData.getDefault(), layoutOptionData.getId(), layoutOptionData.getDescription(), + layoutOptionData.getName())); + break; + case BOOLEAN: + layoutOptions.add(layoutOptionFactory.createBooleanOption((Boolean) layoutOptionData.getDefault(), layoutOptionData.getId(), layoutOptionData.getDescription(), + layoutOptionData.getName())); + break; + case INT: + layoutOptions.add(layoutOptionFactory.createIntegerOption((Integer) layoutOptionData.getDefault(), layoutOptionData.getId(), layoutOptionData.getDescription(), + layoutOptionData.getName())); + break; + case DOUBLE: + layoutOptions.add(layoutOptionFactory.createDoubleOption((Double) layoutOptionData.getDefault(), layoutOptionData.getId(), layoutOptionData.getDescription(), + layoutOptionData.getName())); + break; + case ENUMSET: + case ENUM: + + String[] choices = layoutOptionData.getChoices(); + List<EnumChoice> choicesList = new ArrayList<>(); + for (int i = 0; i < choices.length; i++) { + String choiceId = choices[i]; + choicesList.add(new EnumChoice(choiceId, "")); + + } + String defaultValue = null; + Object defaultObject = layoutOptionData.getDefaultDefault(); + if (defaultObject instanceof Enum) { + defaultValue = ((Enum<?>) defaultObject).name(); + } + if (layoutOptionData.getType() == Type.ENUM) { + layoutOptions.add(layoutOptionFactory.createEnumOption(choicesList, layoutOptionData.getId(), layoutOptionData.getDescription(), layoutOptionData.getName(), defaultValue)); + } else { + layoutOptions.add(layoutOptionFactory.createEnumSetOption(choicesList, layoutOptionData.getId(), layoutOptionData.getDescription(), layoutOptionData.getName())); + } + + break; + default: + break; + } + } + } + DiagramUIPlugin.getPlugin().addLayoutProvider(layoutAlgorithmData.getId(), layoutAlgorithmData.getName(), () -> new ELKLayoutNodeProvider(), layoutOptions); } } diff --git a/plugins/org.eclipse.sirius.diagram.elk/src/org/eclipse/sirius/diagram/elk/ElkDiagramLayoutConnector.java b/plugins/org.eclipse.sirius.diagram.elk/src/org/eclipse/sirius/diagram/elk/ElkDiagramLayoutConnector.java index 111601a5f0..acc9b9c3d3 100644 --- a/plugins/org.eclipse.sirius.diagram.elk/src/org/eclipse/sirius/diagram/elk/ElkDiagramLayoutConnector.java +++ b/plugins/org.eclipse.sirius.diagram.elk/src/org/eclipse/sirius/diagram/elk/ElkDiagramLayoutConnector.java @@ -13,6 +13,7 @@ package org.eclipse.sirius.diagram.elk; import java.util.ArrayList; import java.util.Collection; +import java.util.EnumSet; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -32,6 +33,8 @@ import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.PointList; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.elk.core.IGraphLayoutEngine; +import org.eclipse.elk.core.data.LayoutMetaDataService; +import org.eclipse.elk.core.data.LayoutOptionData; import org.eclipse.elk.core.math.ElkPadding; import org.eclipse.elk.core.math.KVector; import org.eclipse.elk.core.options.CoreOptions; @@ -53,6 +56,7 @@ import org.eclipse.elk.graph.properties.IProperty; import org.eclipse.elk.graph.properties.IPropertyHolder; import org.eclipse.elk.graph.properties.Property; import org.eclipse.elk.graph.util.ElkGraphUtil; +import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain; @@ -70,11 +74,18 @@ import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart; import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure; import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.description.BooleanLayoutOption; +import org.eclipse.sirius.diagram.description.CustomLayoutConfiguration; +import org.eclipse.sirius.diagram.description.DescriptionPackage; import org.eclipse.sirius.diagram.description.DiagramDescription; -import org.eclipse.sirius.diagram.description.GenericLayout; +import org.eclipse.sirius.diagram.description.DoubleLayoutOption; +import org.eclipse.sirius.diagram.description.EnumLayoutOption; +import org.eclipse.sirius.diagram.description.EnumLayoutValue; +import org.eclipse.sirius.diagram.description.EnumSetLayoutOption; +import org.eclipse.sirius.diagram.description.IntegerLayoutOption; +import org.eclipse.sirius.diagram.description.LayoutOption; +import org.eclipse.sirius.diagram.description.StringLayoutOption; +import org.eclipse.sirius.diagram.ui.business.api.query.EditPartQuery; import org.eclipse.sirius.diagram.ui.tools.api.figure.SiriusWrapLabel; import org.eclipse.swt.SWTException; import org.eclipse.swt.graphics.Font; @@ -296,6 +307,11 @@ public class ElkDiagramLayoutConnector implements IDiagramLayoutConnector { return false; } + public <E extends Enum<E>> EnumSet<E> of(E e, EnumSet<E> enumSet) { + enumSet.add(e); + return enumSet; + } + /** * Creates the actual mapping given an edit part which functions as the root * for the layout. @@ -339,22 +355,13 @@ public class ElkDiagramLayoutConnector implements IDiagramLayoutConnector { mapping.getGraphMap().put(topNode, layoutRootPart); } - // we set the ELK algorithm to use from viewpoint id defined. - final View view = layoutRootPart.getNotationView(); - final EObject modelElement = view.getElement(); - if (view instanceof Diagram && modelElement instanceof DDiagram) { - final DDiagram vp = (DDiagram) modelElement; - final DiagramDescription desc = vp.getDescription(); - if (desc != null) { - final GenericLayout layout = (GenericLayout) desc.getLayout(); - topNode.setProperty(CoreOptions.ALGORITHM, layout.getID().trim()); - // topNode.setProperty(CoreOptions.PADDING, new ElkPadding(50)); - } - } + configureGlobalOptions(layoutRootPart, topNode); mapping.setLayoutGraph(topNode); - if (selection != null && !selection.isEmpty()) { + if (selection != null && !selection.isEmpty()) + + { // layout only the selected elements double minx = Integer.MAX_VALUE; double miny = Integer.MAX_VALUE; @@ -378,6 +385,91 @@ public class ElkDiagramLayoutConnector implements IDiagramLayoutConnector { } /** + * Configure global options for top node of the graph coming from VSM + * specification. + * + * @param layoutRootPart + * root edit part. + * @param topNode + * top node to be configured with global options. + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + private void configureGlobalOptions(final IGraphicalEditPart layoutRootPart, ElkNode topNode) { + // we set the ELK algorithm to use from viewpoint id defined and the + // global options. + + EditPartQuery editPartQuery = new EditPartQuery(layoutRootPart); + DiagramDescription diagramDescription = editPartQuery.getDiagramDescription(); + + if (diagramDescription != null) { + final CustomLayoutConfiguration layout = (CustomLayoutConfiguration) diagramDescription.getLayout(); + topNode.setProperty(CoreOptions.ALGORITHM, layout.getId().trim()); + EList<LayoutOption> layoutOptions = layout.getLayoutOptions(); + for (LayoutOption layoutOption : layoutOptions) { + LayoutOptionData layoutProperty = LayoutMetaDataService.getInstance().getOptionData(layoutOption.getId()); + + switch (layoutOption.eClass().getClassifierID()) { + case DescriptionPackage.ENUM_LAYOUT_OPTION: + EnumLayoutOption enumOption = (EnumLayoutOption) layoutOption; + int enumValueCount = layoutProperty.getEnumValueCount(); + Enum<?> elkEnum = null; + int i = 0; + while (i < enumValueCount && elkEnum == null) { + layoutProperty.getEnumValue(i); + Enum<?> enumValue = layoutProperty.getEnumValue(i); + if (enumOption.getValue().getName().equals(enumValue.name())) { + elkEnum = enumValue; + } + i++; + } + topNode.setProperty(layoutProperty, elkEnum); + break; + + case DescriptionPackage.ENUM_SET_LAYOUT_OPTION: + EnumSetLayoutOption enumSetOption = (EnumSetLayoutOption) layoutOption; + enumValueCount = layoutProperty.getEnumValueCount(); + + if (enumValueCount > 0) { + EnumSet enumSet = EnumSet.noneOf(layoutProperty.getEnumValue(0).getDeclaringClass()); + List<EnumLayoutValue> values = enumSetOption.getValues(); + for (EnumLayoutValue enumLayoutValue : values) { + i = 0; + while (i < enumValueCount) { + Enum enumValue = layoutProperty.getEnumValue(i); + if (enumLayoutValue.getName().equals(enumValue.name())) { + enumSet = of(enumValue, enumSet); + break; + } + i++; + } + } + topNode.setProperty(layoutProperty, enumSet); + } + break; + case DescriptionPackage.BOOLEAN_LAYOUT_OPTION: + BooleanLayoutOption booleanOption = (BooleanLayoutOption) layoutOption; + topNode.setProperty(layoutProperty, booleanOption.isValue()); + break; + case DescriptionPackage.INTEGER_LAYOUT_OPTION: + IntegerLayoutOption integerOption = (IntegerLayoutOption) layoutOption; + topNode.setProperty(layoutProperty, integerOption.getValue()); + break; + case DescriptionPackage.DOUBLE_LAYOUT_OPTION: + DoubleLayoutOption doubleOption = (DoubleLayoutOption) layoutOption; + topNode.setProperty(layoutProperty, doubleOption.getValue()); + break; + case DescriptionPackage.STRING_LAYOUT_OPTION: + StringLayoutOption stringOption = (StringLayoutOption) layoutOption; + topNode.setProperty(layoutProperty, stringOption.getValue().trim()); + break; + default: + break; + } + } + } + } + + /** * Transfer all layout data from the last created KGraph instance to the * original diagram. The diagram is not modified yet, but all required * preparations are performed. This is separated from diff --git a/plugins/org.eclipse.sirius.diagram.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.diagram.ui/META-INF/MANIFEST.MF index 4ad069c190..9afbfe8652 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.diagram.ui/META-INF/MANIFEST.MF @@ -53,11 +53,12 @@ Export-Package: org.eclipse.sirius.diagram.description.concern.provider;version= org.eclipse.sirius.diagram.description.tool.provider;version="3.0.0", org.eclipse.sirius.diagram.internal.description.provider;version="4.0.0", org.eclipse.sirius.diagram.provider;version="4.0.0", - org.eclipse.sirius.diagram.ui.business.api;version="5.1.0", + org.eclipse.sirius.diagram.ui.api.layout;version="6.0.0", + org.eclipse.sirius.diagram.ui.business.api;version="6.0.0", org.eclipse.sirius.diagram.ui.business.api.helper.graphicalfilters;version="2.0.4", org.eclipse.sirius.diagram.ui.business.api.image;version="2.0.4", org.eclipse.sirius.diagram.ui.business.api.provider;version="2.1.1", - org.eclipse.sirius.diagram.ui.business.api.query;version="2.0.4", + org.eclipse.sirius.diagram.ui.business.api.query;version="5.1.0", org.eclipse.sirius.diagram.ui.business.api.view;version="2.0.4", org.eclipse.sirius.diagram.ui.business.internal.bracket;version="2.1.0";x-internal:=true, org.eclipse.sirius.diagram.ui.business.internal.bracket.handles;version="2.0.4";x-internal:=true, diff --git a/plugins/org.eclipse.sirius.diagram.ui/icons/full/obj16/CustomLayoutConfiguration.gif b/plugins/org.eclipse.sirius.diagram.ui/icons/full/obj16/CustomLayoutConfiguration.gif Binary files differindex d92f34c8ae..c4f19bdf85 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/icons/full/obj16/CustomLayoutConfiguration.gif +++ b/plugins/org.eclipse.sirius.diagram.ui/icons/full/obj16/CustomLayoutConfiguration.gif diff --git a/plugins/org.eclipse.sirius.diagram.ui/icons/full/obj16/LayoutOption.gif b/plugins/org.eclipse.sirius.diagram.ui/icons/full/obj16/LayoutOption.gif Binary files differindex c00aedf413..92075a8a35 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/icons/full/obj16/LayoutOption.gif +++ b/plugins/org.eclipse.sirius.diagram.ui/icons/full/obj16/LayoutOption.gif diff --git a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties index f2efe6cb2c..93edbedfdc 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/plugin.properties +++ b/plugins/org.eclipse.sirius.diagram.ui/plugin.properties @@ -1298,3 +1298,9 @@ _UI_EnumLayoutOption_choices_feature = Choices _UI_EnumLayoutValue_description_feature = Description _UI_EnumLayoutValue_name_feature = Name _UI_CustomLayoutConfiguration_description_feature = Description +_UI_EnumSetLayoutOption_type = Enum Set Layout Option +_UI_EnumSetLayoutOption_value_feature = Value +_UI_EnumSetLayoutOption_choices_feature = Choices +_UI_EnumSetLayoutOption_values_feature = Values +_UI_EnumOption_type = Enum Option +_UI_EnumOption_choices_feature = Choices diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/CustomLayoutConfigurationItemProviderSpec.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/CustomLayoutConfigurationItemProviderSpec.java index 1e49d7e2df..c587485034 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/CustomLayoutConfigurationItemProviderSpec.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/CustomLayoutConfigurationItemProviderSpec.java @@ -15,8 +15,8 @@ import java.util.Map; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.sirius.diagram.description.EnumLayoutOption; -import org.eclipse.sirius.diagram.description.GenericLayout; +import org.eclipse.sirius.diagram.description.CustomLayoutConfiguration; +import org.eclipse.sirius.diagram.description.EnumOption; import org.eclipse.sirius.diagram.description.LayoutOption; import org.eclipse.sirius.diagram.description.provider.CustomLayoutConfigurationItemProvider; import org.eclipse.sirius.diagram.ui.internal.layout.GenericLayoutProviderSupplier; @@ -43,21 +43,21 @@ public class CustomLayoutConfigurationItemProviderSpec extends CustomLayoutConfi @Override public String getText(Object object) { - GenericLayout layout = (GenericLayout) object; + CustomLayoutConfiguration layout = (CustomLayoutConfiguration) object; return layout.getLabel(); } @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { Map<String, GenericLayoutProviderSupplier> layoutProviderRegistry = DiagramUIPlugin.getPlugin().getLayoutProviderRegistry(); - GenericLayout layout = (GenericLayout) object; + CustomLayoutConfiguration layout = (CustomLayoutConfiguration) object; - GenericLayoutProviderSupplier genericLayoutProviderSupplier = layoutProviderRegistry.get(layout.getID()); + GenericLayoutProviderSupplier genericLayoutProviderSupplier = layoutProviderRegistry.get(layout.getId()); Map<String, LayoutOption> layoutOptions = genericLayoutProviderSupplier.getLayoutOptions(); for (LayoutOption layoutOption : layoutOptions.values()) { LayoutOption copy = EcoreUtil.copy(layoutOption); - if (copy instanceof EnumLayoutOption) { - ((EnumLayoutOption) copy).getChoices().clear(); + if (copy instanceof EnumOption) { + ((EnumOption) copy).getChoices().clear(); } newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.CUSTOM_LAYOUT_CONFIGURATION__LAYOUT_OPTIONS, copy)); } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/DiagramDescriptionItemProviderSpec.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/DiagramDescriptionItemProviderSpec.java index ea956fc897..00c0512509 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/DiagramDescriptionItemProviderSpec.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/DiagramDescriptionItemProviderSpec.java @@ -10,8 +10,11 @@ *******************************************************************************/ package org.eclipse.sirius.diagram.internal.description.provider; +import java.util.Collection; + import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.sirius.common.tools.api.util.MessageTranslator; +import org.eclipse.sirius.diagram.description.CustomLayoutConfiguration; import org.eclipse.sirius.diagram.description.provider.DiagramDescriptionItemProvider; import org.eclipse.sirius.viewpoint.description.IdentifiedElement; @@ -35,11 +38,20 @@ public class DiagramDescriptionItemProviderSpec extends DiagramDescriptionItemPr /** * {@inheritDoc} * - * This method has been overridden in order to return a localized text if - * available. + * This method has been overridden in order to return a localized text if available. */ + @Override public String getText(Object object) { return MessageTranslator.INSTANCE.getMessage((IdentifiedElement) object, super.getText(object)); } + @Override + public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { + if (child instanceof CustomLayoutConfiguration) { + return ((CustomLayoutConfiguration) child).getLabel(); + } + + return super.getCreateChildText(owner, feature, child, selection); + } + } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/EnumLayoutOptionItemProviderSpec.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/EnumLayoutOptionItemProviderSpec.java index 3bc0fd3def..eec6e228f6 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/EnumLayoutOptionItemProviderSpec.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/EnumLayoutOptionItemProviderSpec.java @@ -16,9 +16,9 @@ import java.util.Map; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.sirius.diagram.description.CustomLayoutConfiguration; import org.eclipse.sirius.diagram.description.EnumLayoutOption; import org.eclipse.sirius.diagram.description.EnumLayoutValue; -import org.eclipse.sirius.diagram.description.GenericLayout; import org.eclipse.sirius.diagram.description.LayoutOption; import org.eclipse.sirius.diagram.description.provider.EnumLayoutOptionItemProvider; import org.eclipse.sirius.diagram.ui.internal.layout.GenericLayoutProviderSupplier; @@ -53,8 +53,8 @@ public class EnumLayoutOptionItemProviderSpec extends EnumLayoutOptionItemProvid protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { Map<String, GenericLayoutProviderSupplier> layoutProviderRegistry = DiagramUIPlugin.getPlugin().getLayoutProviderRegistry(); EnumLayoutOption layoutOption = (EnumLayoutOption) object; - GenericLayout layout = (GenericLayout) layoutOption.eContainer(); - GenericLayoutProviderSupplier genericLayoutProviderSupplier = layoutProviderRegistry.get(layout.getID()); + CustomLayoutConfiguration layout = (CustomLayoutConfiguration) layoutOption.eContainer(); + GenericLayoutProviderSupplier genericLayoutProviderSupplier = layoutProviderRegistry.get(layout.getId()); Map<String, LayoutOption> layoutOptions = genericLayoutProviderSupplier.getLayoutOptions(); EnumLayoutOption layoutOptionTemplate = (EnumLayoutOption) layoutOptions.get(layoutOption.getId()); EList<EnumLayoutValue> choices = layoutOptionTemplate.getChoices(); diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/EnumSetLayoutOptionItemProviderSpec.java b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/EnumSetLayoutOptionItemProviderSpec.java new file mode 100644 index 0000000000..93a05916d0 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/internal/description/provider/EnumSetLayoutOptionItemProviderSpec.java @@ -0,0 +1,76 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.diagram.internal.description.provider; + +import java.util.Collection; +import java.util.Map; + +import org.eclipse.emf.common.notify.AdapterFactory; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.sirius.diagram.description.CustomLayoutConfiguration; +import org.eclipse.sirius.diagram.description.EnumLayoutOption; +import org.eclipse.sirius.diagram.description.EnumLayoutValue; +import org.eclipse.sirius.diagram.description.EnumSetLayoutOption; +import org.eclipse.sirius.diagram.description.LayoutOption; +import org.eclipse.sirius.diagram.description.provider.EnumSetLayoutOptionItemProvider; +import org.eclipse.sirius.diagram.ui.internal.layout.GenericLayoutProviderSupplier; +import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; + +/** + * Customize the label of {@link EnumLayoutOption} items in VSM editor. Also override child descriptor to propose + * available {@link EnumLayoutValue} with their attributes already filled. + * + * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> + * + */ +public class EnumSetLayoutOptionItemProviderSpec extends EnumSetLayoutOptionItemProvider { + + /** + * Default constructor. + * + * @param adapterFactory + * factory to use. + */ + public EnumSetLayoutOptionItemProviderSpec(AdapterFactory adapterFactory) { + super(adapterFactory); + } + + @Override + public String getText(Object object) { + LayoutOption layout = (LayoutOption) object; + return layout.getLabel(); + } + + @Override + protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { + Map<String, GenericLayoutProviderSupplier> layoutProviderRegistry = DiagramUIPlugin.getPlugin().getLayoutProviderRegistry(); + EnumSetLayoutOption layoutOption = (EnumSetLayoutOption) object; + CustomLayoutConfiguration layout = (CustomLayoutConfiguration) layoutOption.eContainer(); + GenericLayoutProviderSupplier genericLayoutProviderSupplier = layoutProviderRegistry.get(layout.getId()); + Map<String, LayoutOption> layoutOptions = genericLayoutProviderSupplier.getLayoutOptions(); + EnumSetLayoutOption layoutOptionTemplate = (EnumSetLayoutOption) layoutOptions.get(layoutOption.getId()); + EList<EnumLayoutValue> choices = layoutOptionTemplate.getChoices(); + for (EnumLayoutValue enumLayoutValue : choices) { + newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.ENUM_SET_LAYOUT_OPTION__VALUES, EcoreUtil.copy(enumLayoutValue))); + } + } + + @Override + public String getCreateChildText(Object owner, Object feature, Object child, Collection<?> selection) { + if (child instanceof EnumLayoutValue) { + return ((EnumLayoutValue) child).getName(); + } + + return super.getCreateChildText(owner, feature, child, selection); + } + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/CustomLayoutConfigurationItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/CustomLayoutConfigurationItemProvider.java index 82b28f5c05..edf148ea81 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/CustomLayoutConfigurationItemProvider.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/CustomLayoutConfigurationItemProvider.java @@ -192,6 +192,8 @@ public class CustomLayoutConfigurationItemProvider extends DocumentedElementItem newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.CUSTOM_LAYOUT_CONFIGURATION__LAYOUT_OPTIONS, DescriptionFactory.eINSTANCE.createDoubleLayoutOption())); newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.CUSTOM_LAYOUT_CONFIGURATION__LAYOUT_OPTIONS, DescriptionFactory.eINSTANCE.createEnumLayoutOption())); + + newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.CUSTOM_LAYOUT_CONFIGURATION__LAYOUT_OPTIONS, DescriptionFactory.eINSTANCE.createEnumSetLayoutOption())); } /** diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DescriptionItemProviderAdapterFactory.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DescriptionItemProviderAdapterFactory.java index 1cf9ebb889..dba1c65e73 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DescriptionItemProviderAdapterFactory.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DescriptionItemProviderAdapterFactory.java @@ -44,6 +44,7 @@ import org.eclipse.sirius.diagram.internal.description.provider.DiagramDescripti import org.eclipse.sirius.diagram.internal.description.provider.DoubleLayoutOptionItemProviderSpec; import org.eclipse.sirius.diagram.internal.description.provider.EnumLayoutOptionItemProviderSpec; import org.eclipse.sirius.diagram.internal.description.provider.EnumLayoutValueItemProviderSpec; +import org.eclipse.sirius.diagram.internal.description.provider.EnumSetLayoutOptionItemProviderSpec; import org.eclipse.sirius.diagram.internal.description.provider.IntegerLayoutOptionItemProviderSpec; import org.eclipse.sirius.diagram.internal.description.provider.StringLayoutOptionItemProviderSpec; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; @@ -573,6 +574,30 @@ public class DescriptionItemProviderAdapterFactory extends DescriptionAdapterFac } /** + * This keeps track of the one adapter used for all + * {@link org.eclipse.sirius.diagram.description.EnumSetLayoutOption} instances. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + */ + protected EnumSetLayoutOptionItemProvider enumSetLayoutOptionItemProvider; + + /** + * This creates an adapter for a {@link org.eclipse.sirius.diagram.description.EnumSetLayoutOption}. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated NOT + */ + @Override + public Adapter createEnumSetLayoutOptionAdapter() { + if (enumSetLayoutOptionItemProvider == null) { + enumSetLayoutOptionItemProvider = new EnumSetLayoutOptionItemProviderSpec(this); + } + + return enumSetLayoutOptionItemProvider; + } + + /** * This keeps track of the one adapter used for all {@link org.eclipse.sirius.diagram.description.EnumLayoutValue} * instances. <!-- begin-user-doc --> <!-- end-user-doc --> * @@ -825,6 +850,9 @@ public class DescriptionItemProviderAdapterFactory extends DescriptionAdapterFac if (enumLayoutOptionItemProvider != null) { enumLayoutOptionItemProvider.dispose(); } + if (enumSetLayoutOptionItemProvider != null) { + enumSetLayoutOptionItemProvider.dispose(); + } if (enumLayoutValueItemProvider != null) { enumLayoutValueItemProvider.dispose(); } diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java index 22630c62a6..c1999d0dde 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/DiagramDescriptionItemProvider.java @@ -31,7 +31,6 @@ import org.eclipse.sirius.diagram.description.CustomLayoutConfiguration; import org.eclipse.sirius.diagram.description.DescriptionFactory; import org.eclipse.sirius.diagram.description.DiagramDescription; import org.eclipse.sirius.diagram.description.EdgeMapping; -import org.eclipse.sirius.diagram.description.GenericLayout; import org.eclipse.sirius.diagram.description.Layer; import org.eclipse.sirius.diagram.description.concern.ConcernFactory; import org.eclipse.sirius.diagram.description.concern.ConcernSet; @@ -544,9 +543,6 @@ public class DiagramDescriptionItemProvider extends DragAndDropTargetDescription concernSet.getOwnedConcernDescriptions().add(ConcernFactory.eINSTANCE.createConcernDescription()); newChildDescriptors.add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__CONCERNS, concernSet)); - newChildDescriptors.add( - createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__LAYOUT, DescriptionFactory.eINSTANCE.createCustomLayoutConfiguration())); - addAllCustomLayoutChildDescriptors(newChildDescriptors); newChildDescriptors .add(createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__LAYOUT, DescriptionFactory.eINSTANCE.createOrderedTreeLayout())); @@ -617,7 +613,7 @@ public class DiagramDescriptionItemProvider extends DragAndDropTargetDescription newChildDescriptors.add( createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__LAYOUT, DescriptionFactory.eINSTANCE.createCustomLayoutConfiguration())); - + addAllCustomLayoutChildDescriptors(newChildDescriptors); newChildDescriptors.add( createChildParameter(org.eclipse.sirius.diagram.description.DescriptionPackage.Literals.DIAGRAM_DESCRIPTION__DIAGRAM_INITIALISATION, ToolFactory.eINSTANCE.createInitialOperation())); @@ -684,8 +680,8 @@ public class DiagramDescriptionItemProvider extends DragAndDropTargetDescription // child type currently available for is Layer (see // collectNewChildDescriptors). return getString("_UI_CreateChild_text2", new Object[] { getTypeText(child), "Default", getTypeText(owner) }); //$NON-NLS-1$ //$NON-NLS-2$ - } else if (child instanceof GenericLayout) { - return ((GenericLayout) child).getLabel(); + } else if (child instanceof CustomLayoutConfiguration) { + return ((CustomLayoutConfiguration) child).getLabel(); } String createChildText = super.getCreateChildText(owner, feature, child, selection); if (child != null && isNormalEdgeMapping(child)) { diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EnumLayoutOptionItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EnumLayoutOptionItemProvider.java index bad6d3dd70..914c835b45 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EnumLayoutOptionItemProvider.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EnumLayoutOptionItemProvider.java @@ -29,7 +29,7 @@ import org.eclipse.sirius.diagram.description.EnumLayoutOption; * * @generated */ -public class EnumLayoutOptionItemProvider extends LayoutOptionItemProvider { +public class EnumLayoutOptionItemProvider extends EnumOptionItemProvider { /** * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> * @@ -66,7 +66,6 @@ public class EnumLayoutOptionItemProvider extends LayoutOptionItemProvider { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(DescriptionPackage.Literals.ENUM_LAYOUT_OPTION__VALUE); - childrenFeatures.add(DescriptionPackage.Literals.ENUM_LAYOUT_OPTION__CHOICES); } return childrenFeatures; } @@ -109,7 +108,6 @@ public class EnumLayoutOptionItemProvider extends LayoutOptionItemProvider { switch (notification.getFeatureID(EnumLayoutOption.class)) { case DescriptionPackage.ENUM_LAYOUT_OPTION__VALUE: - case DescriptionPackage.ENUM_LAYOUT_OPTION__CHOICES: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } @@ -127,8 +125,6 @@ public class EnumLayoutOptionItemProvider extends LayoutOptionItemProvider { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENUM_LAYOUT_OPTION__VALUE, DescriptionFactory.eINSTANCE.createEnumLayoutValue())); - - newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.ENUM_LAYOUT_OPTION__CHOICES, DescriptionFactory.eINSTANCE.createEnumLayoutValue())); } /** @@ -142,7 +138,7 @@ public class EnumLayoutOptionItemProvider extends LayoutOptionItemProvider { Object childFeature = feature; Object childObject = child; - boolean qualify = childFeature == DescriptionPackage.Literals.ENUM_LAYOUT_OPTION__VALUE || childFeature == DescriptionPackage.Literals.ENUM_LAYOUT_OPTION__CHOICES; + boolean qualify = childFeature == DescriptionPackage.Literals.ENUM_OPTION__CHOICES || childFeature == DescriptionPackage.Literals.ENUM_LAYOUT_OPTION__VALUE; if (qualify) { return getString("_UI_CreateChild_text2", //$NON-NLS-1$ diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EnumOptionItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EnumOptionItemProvider.java new file mode 100644 index 0000000000..e857935a9e --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EnumOptionItemProvider.java @@ -0,0 +1,130 @@ +/** + * Copyright (c) 2007, 2017 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.diagram.description.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.emf.edit.provider.ViewerNotification; +import org.eclipse.sirius.diagram.description.DescriptionFactory; +import org.eclipse.sirius.diagram.description.DescriptionPackage; +import org.eclipse.sirius.diagram.description.EnumOption; + +/** + * This is the item provider adapter for a {@link org.eclipse.sirius.diagram.description.EnumOption} object. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ +public class EnumOptionItemProvider extends LayoutOptionItemProvider { + /** + * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EnumOptionItemProvider(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(DescriptionPackage.Literals.ENUM_OPTION__CHOICES); + } + 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 = ((EnumOption) object).getId(); + return label == null || label.length() == 0 ? getString("_UI_EnumOption_type") : //$NON-NLS-1$ + getString("_UI_EnumOption_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(EnumOption.class)) { + case DescriptionPackage.ENUM_OPTION__CHOICES: + 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(DescriptionPackage.Literals.ENUM_OPTION__CHOICES, DescriptionFactory.eINSTANCE.createEnumLayoutValue())); + } + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EnumSetLayoutOptionItemProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EnumSetLayoutOptionItemProvider.java new file mode 100644 index 0000000000..77a770edcc --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/description/provider/EnumSetLayoutOptionItemProvider.java @@ -0,0 +1,150 @@ +/** + * Copyright (c) 2007, 2017 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.diagram.description.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.emf.edit.provider.ViewerNotification; +import org.eclipse.sirius.diagram.description.DescriptionFactory; +import org.eclipse.sirius.diagram.description.DescriptionPackage; +import org.eclipse.sirius.diagram.description.EnumSetLayoutOption; + +/** + * This is the item provider adapter for a {@link org.eclipse.sirius.diagram.description.EnumSetLayoutOption} object. + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ +public class EnumSetLayoutOptionItemProvider extends EnumOptionItemProvider { + /** + * This constructs an instance from a factory and a notifier. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + public EnumSetLayoutOptionItemProvider(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(DescriptionPackage.Literals.ENUM_SET_LAYOUT_OPTION__VALUES); + } + 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 = ((EnumSetLayoutOption) object).getId(); + return label == null || label.length() == 0 ? getString("_UI_EnumSetLayoutOption_type") : //$NON-NLS-1$ + getString("_UI_EnumSetLayoutOption_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(EnumSetLayoutOption.class)) { + case DescriptionPackage.ENUM_SET_LAYOUT_OPTION__VALUES: + 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(DescriptionPackage.Literals.ENUM_SET_LAYOUT_OPTION__VALUES, DescriptionFactory.eINSTANCE.createEnumLayoutValue())); + } + + /** + * 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 == DescriptionPackage.Literals.ENUM_OPTION__CHOICES || childFeature == DescriptionPackage.Literals.ENUM_SET_LAYOUT_OPTION__VALUES; + + 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); + } + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/ui/provider/DiagramUIPlugin.java b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/ui/provider/DiagramUIPlugin.java index 799061c050..6b3cfd7138 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/ui/provider/DiagramUIPlugin.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src-gen/org/eclipse/sirius/diagram/ui/provider/DiagramUIPlugin.java @@ -157,7 +157,8 @@ public final class DiagramUIPlugin extends EMFPlugin { private DynamicDiagramUIPreferences dynamicPreferences; /** - * A registry containing all layout providers that can be specified directly in the VSM. + * A registry containing all layout providers that can be specified directly in the VSM. A layout provider + * provides a layout algorithm that can be used when doing an arrange all on a Sirius diagram. */ private Map<String, GenericLayoutProviderSupplier> layoutProviderRegistry; diff --git a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/api/layout/EnumChoice.java b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/api/layout/EnumChoice.java new file mode 100644 index 0000000000..9d97b77b82 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/api/layout/EnumChoice.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.diagram.ui.api.layout; + +/** + * + * A component defining an Enum choice with its name and a description. It is used to provide Enum choice for an enum + * option of a layout algorithm in VSM editor. + * + * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> + * + */ +public class EnumChoice { + /** + * The name of the enum choice. + */ + private String name; + + /** + * The description of the enum choice. + */ + private String description; + + /** + * Initialize this Enum choice with given name and description. + * + * @param name + * the name of this enum choice. + * @param description + * the description of this enum choice. + */ + public EnumChoice(String name, String description) { + this.name = name; + this.description = description; + } + + /** + * Returns the description of the enum choice. + * + * @return the description of the enum choice. + */ + public String getDescription() { + return description; + } + + /** + * Returns the name of the enum choice. + * + * @return the name of the enum choice. + */ + public String getName() { + return name; + } + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/api/layout/LayoutOptionFactory.java b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/api/layout/LayoutOptionFactory.java new file mode 100644 index 0000000000..029c651b6d --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/api/layout/LayoutOptionFactory.java @@ -0,0 +1,210 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.diagram.ui.api.layout; + +import java.util.List; + +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.sirius.diagram.description.BooleanLayoutOption; +import org.eclipse.sirius.diagram.description.DescriptionFactory; +import org.eclipse.sirius.diagram.description.DescriptionPackage; +import org.eclipse.sirius.diagram.description.DoubleLayoutOption; +import org.eclipse.sirius.diagram.description.EnumLayoutOption; +import org.eclipse.sirius.diagram.description.EnumLayoutValue; +import org.eclipse.sirius.diagram.description.EnumOption; +import org.eclipse.sirius.diagram.description.IntegerLayoutOption; +import org.eclipse.sirius.diagram.description.LayoutOption; +import org.eclipse.sirius.diagram.description.StringLayoutOption; + +/** + * This factory allows to create layout algorithm options that should be available for edition in the VSM editor. You + * can specify its id, description. The label that should be used to display your option in UI. And the default value. + * Option types supported are String, Boolean, Integer, Double and Enum. For Enum you must specify available + * choices/literal. + * + * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> + * + */ +public class LayoutOptionFactory { + /** + * Returns a new layout option with the type EnumSet. + * + * @param choices + * a list of {@link EnumChoice} that will be proposed to the VSM specifier to configure an enum option of + * a layout algorithm. + * @param id + * the enumset option id allowing to identified it from other options. + * @param description + * a description of the option. + * @param label + * a label used in Sirius UI to represent the option. + * @return a new layout option with the type Enum. + */ + public LayoutOption createEnumSetOption(List<EnumChoice> choices, String id, String description, String label) { + EnumOption layoutOption = DescriptionFactory.eINSTANCE.createEnumSetLayoutOption(); + layoutOption.setDescription(description); + layoutOption.setLabel(label); + layoutOption.setId(id); + + for (EnumChoice enumChoice : choices) { + EnumLayoutValue layoutValue = DescriptionFactory.eINSTANCE.createEnumLayoutValue(); + layoutValue.setDescription(enumChoice.getDescription()); + layoutValue.setName(enumChoice.getName()); + layoutOption.setDescription(description); + layoutOption.getChoices().add(layoutValue); + } + return layoutOption; + } + + /** + * Returns a new layout option with the type Enum. + * + * @param choices + * a list of {@link EnumChoice} that will be proposed to the VSM specifier to configure an enum option of + * a layout algorithm. + * @param id + * the enum option id allowing to identified it from other options. + * @param description + * a description of the option. + * @param label + * a label used in Sirius UI to represent the option. + * @param defaultValue + * the default option's value of the layout algorithm. + * @return a new layout option with the type Enum. + */ + public LayoutOption createEnumOption(List<EnumChoice> choices, String id, String description, String label, String defaultValue) { + EnumLayoutOption layoutOption = DescriptionFactory.eINSTANCE.createEnumLayoutOption(); + layoutOption.setDescription(description); + layoutOption.setLabel(label); + layoutOption.setId(id); + + for (EnumChoice enumChoice : choices) { + EnumLayoutValue layoutValue = DescriptionFactory.eINSTANCE.createEnumLayoutValue(); + layoutValue.setDescription(enumChoice.getDescription()); + layoutValue.setName(enumChoice.getName()); + layoutOption.setDescription(description); + layoutOption.getChoices().add(layoutValue); + if (enumChoice.getName().equals(defaultValue)) { + layoutOption.setValue(layoutValue); + } + } + + return layoutOption; + } + + /** + * Returns a new layout option with the type String. + * + * @param defaultValue + * the default option's value of the layout algorithm. + * @param id + * the option's id allowing to identified it from other options. + * @param description + * a description of the option. + * @param label + * a label used in Sirius UI to represent the option. + * @return a new layout option with the type String. + */ + public LayoutOption createStringOption(String defaultValue, String id, String description, String label) { + StringLayoutOption layoutOption = DescriptionFactory.eINSTANCE.createStringLayoutOption(); + setCommonAttributes(id, description, label, layoutOption); + if (defaultValue != null) { + layoutOption.setValue(defaultValue); + } + return layoutOption; + } + + /** + * Returns a new layout option with the type Integer. + * + * @param defaultValue + * the default option's value of the layout algorithm. + * @param id + * the option's id allowing to identified it from other options. + * @param description + * a description of the option. + * @param label + * a label used in Sirius UI to represent the option. + * @return a new layout option with the type Integer. + */ + public LayoutOption createIntegerOption(Integer defaultValue, String id, String description, String label) { + IntegerLayoutOption layoutOption = DescriptionFactory.eINSTANCE.createIntegerLayoutOption(); + setCommonAttributes(id, description, label, layoutOption); + if (defaultValue != null) { + layoutOption.setValue(defaultValue); + } + return layoutOption; + } + + /** + * Returns a new layout option with the type Double. + * + * @param defaultValue + * the default option's value of the layout algorithm. + * @param id + * the option's id allowing to identified it from other options. + * @param description + * a description of the option. + * @param label + * a label used in Sirius UI to represent the option. + * @return a new layout option with the type Double. + */ + public LayoutOption createDoubleOption(Double defaultValue, String id, String description, String label) { + + DoubleLayoutOption layoutOption = DescriptionFactory.eINSTANCE.createDoubleLayoutOption(); + setCommonAttributes(id, description, label, layoutOption); + if (defaultValue != null) { + layoutOption.setValue(defaultValue); + } + return layoutOption; + } + + /** + * Method to set commons attributes of different options. + * + * @param id + * the id to set. + * @param descriptionthe + * description to set. + * @param label + * the label to set. + * @param layoutOption + * the options that needs to have its attributes set. + */ + private void setCommonAttributes(String id, String description, String label, LayoutOption layoutOption) { + layoutOption.setId(id); + layoutOption.setLabel(label); + layoutOption.setDescription(description); + } + + /** + * Returns a new layout option with the type Boolean. + * + * @param defaultValue + * the default option's value of the layout algorithm. + * @param id + * the option's id allowing to identified it from other options. + * @param description + * a description of the option. + * @param label + * a label used in Sirius UI to represent the option. + * @return a new layout option with the type Boolean. + */ + public LayoutOption createBooleanOption(Boolean defaultValue, String id, String description, String label) { + BooleanLayoutOption layoutOption = (BooleanLayoutOption) EcoreUtil.create(DescriptionPackage.eINSTANCE.getBooleanLayoutOption()); + setCommonAttributes(id, description, label, layoutOption); + if (defaultValue != null) { + layoutOption.setValue(defaultValue); + } + return layoutOption; + } + +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/business/api/query/EditPartQuery.java b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/business/api/query/EditPartQuery.java new file mode 100644 index 0000000000..1bc398a300 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/business/api/query/EditPartQuery.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ +package org.eclipse.sirius.diagram.ui.business.api.query; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.EditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.description.DiagramDescription; +import org.eclipse.sirius.diagram.ui.edit.api.part.IDDiagramEditPart; +import org.eclipse.sirius.diagram.ui.edit.api.part.IDiagramElementEditPart; + +/** + * A class aggregating all the queries (read-only!) having an {@link IGraphicalEditPart} as a starting point. + * + * @author <a href="mailto:pierre.guilet@obeo.fr">Pierre Guilet</a> + * + */ +public final class EditPartQuery { + + private IGraphicalEditPart editPart; + + /** + * Create a new query. + * + * @param editPart + * the {@link IGraphicalEditPart} to query. + */ + public EditPartQuery(IGraphicalEditPart editPart) { + this.editPart = editPart; + } + + /** + * Return the {@link DiagramDescription} associated to the edit part or to one of its ancestor. + * + * @return the {@link DiagramDescription} associated to the edit part or to one of its ancestor. Null if no such + * element exists. + */ + public DiagramDescription getDiagramDescription() { + IDDiagramEditPart effectiveDiagramEditPart = null; + if (editPart instanceof IDiagramElementEditPart) { + effectiveDiagramEditPart = getDiagramEditPart(editPart); + } else if (editPart instanceof IDDiagramEditPart) { + effectiveDiagramEditPart = (IDDiagramEditPart) editPart; + } + if (effectiveDiagramEditPart != null) { + EObject resolvedSemanticElement = effectiveDiagramEditPart.resolveSemanticElement(); + if (resolvedSemanticElement instanceof DDiagram) { + return ((DDiagram) resolvedSemanticElement).getDescription(); + } + } + + return null; + } + + /** + * Returns the {@link IDDiagramEditPart} that is an ancestor of the given {@link EditPart}. + * + * @param editPart + * the edit part from which we look for an {@link IDDiagramEditPart} ancestor. + * @return the {@link IDDiagramEditPart} that is an ancestor of the given {@link EditPart}. Null if no such element + * exists. + */ + private IDDiagramEditPart getDiagramEditPart(EditPart theEditPart) { + IDDiagramEditPart result = null; + EditPart parent = theEditPart.getParent(); + if (parent instanceof IDDiagramEditPart) { + result = (IDDiagramEditPart) parent; + } else if (parent != null) { + result = getDiagramEditPart(parent); + } + return result; + } +} diff --git a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/internal/layout/GenericLayoutProvider.java b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/internal/layout/GenericLayoutProvider.java index ed89f9eab2..fe543cdf35 100644 --- a/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/internal/layout/GenericLayoutProvider.java +++ b/plugins/org.eclipse.sirius.diagram.ui/src/org/eclipse/sirius/diagram/ui/internal/layout/GenericLayoutProvider.java @@ -18,8 +18,8 @@ import org.eclipse.gmf.runtime.diagram.ui.services.layout.AbstractLayoutEditPart import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.sirius.diagram.DDiagram; +import org.eclipse.sirius.diagram.description.CustomLayoutConfiguration; import org.eclipse.sirius.diagram.description.DiagramDescription; -import org.eclipse.sirius.diagram.description.GenericLayout; import org.eclipse.sirius.diagram.description.Layout; import org.eclipse.sirius.diagram.ui.provider.DiagramUIPlugin; import org.eclipse.sirius.diagram.ui.tools.api.layout.provider.DefaultLayoutProvider; @@ -70,8 +70,8 @@ public class GenericLayoutProvider implements LayoutProvider { final DiagramDescription desc = vp.getDescription(); if (desc != null) { final Layout layout = desc.getLayout(); - if (layout instanceof GenericLayout) { - return DiagramUIPlugin.getPlugin().getLayoutProviderRegistry().get(((GenericLayout) layout).getID()).getLayoutProviderSupplier(); + if (layout instanceof CustomLayoutConfiguration) { + return DiagramUIPlugin.getPlugin().getLayoutProviderRegistry().get(((CustomLayoutConfiguration) layout).getId()).getLayoutProviderSupplier(); } } } diff --git a/plugins/org.eclipse.sirius.diagram/model/diagram.ecore b/plugins/org.eclipse.sirius.diagram/model/diagram.ecore index 54190a0372..8baf3e4fb9 100644 --- a/plugins/org.eclipse.sirius.diagram/model/diagram.ecore +++ b/plugins/org.eclipse.sirius.diagram/model/diagram.ecore @@ -1716,9 +1716,15 @@ <eClassifiers xsi:type="ecore:EClass" name="DoubleLayoutOption" eSuperTypes="#//description/LayoutOption"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDouble"/> </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="EnumLayoutOption" eSuperTypes="#//description/LayoutOption"> + <eClassifiers xsi:type="ecore:EClass" name="EnumLayoutOption" eSuperTypes="#//description/EnumOption"> <eStructuralFeatures xsi:type="ecore:EReference" name="value" eType="#//description/EnumLayoutValue" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="EnumSetLayoutOption" eSuperTypes="#//description/EnumOption"> + <eStructuralFeatures xsi:type="ecore:EReference" name="values" upperBound="-1" + eType="#//description/EnumLayoutValue" containment="true"/> + </eClassifiers> + <eClassifiers xsi:type="ecore:EClass" name="EnumOption" abstract="true" eSuperTypes="#//description/LayoutOption"> <eStructuralFeatures xsi:type="ecore:EReference" name="choices" upperBound="-1" eType="#//description/EnumLayoutValue" containment="true"/> </eClassifiers> diff --git a/plugins/org.eclipse.sirius.diagram/model/diagram.genmodel b/plugins/org.eclipse.sirius.diagram/model/diagram.genmodel index d93f0c3912..b5e50efb12 100644 --- a/plugins/org.eclipse.sirius.diagram/model/diagram.genmodel +++ b/plugins/org.eclipse.sirius.diagram/model/diagram.genmodel @@ -620,7 +620,12 @@ </genClasses> <genClasses image="false" ecoreClass="diagram.ecore#//description/EnumLayoutOption"> <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference diagram.ecore#//description/EnumLayoutOption/value"/> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference diagram.ecore#//description/EnumLayoutOption/choices"/> + </genClasses> + <genClasses image="false" ecoreClass="diagram.ecore#//description/EnumSetLayoutOption"> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference diagram.ecore#//description/EnumSetLayoutOption/values"/> + </genClasses> + <genClasses image="false" ecoreClass="diagram.ecore#//description/EnumOption"> + <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference diagram.ecore#//description/EnumOption/choices"/> </genClasses> <genClasses ecoreClass="diagram.ecore#//description/EnumLayoutValue"> <genFeatures createChild="false" ecoreFeature="ecore:EAttribute diagram.ecore#//description/EnumLayoutValue/name"/> diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionFactory.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionFactory.java index edbc415828..ffb4f9f158 100644 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionFactory.java +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionFactory.java @@ -203,6 +203,14 @@ public interface DescriptionFactory extends EFactory { EnumLayoutOption createEnumLayoutOption(); /** + * Returns a new object of class '<em>Enum Set Layout Option</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return a new object of class '<em>Enum Set Layout Option</em>'. + * @generated + */ + EnumSetLayoutOption createEnumSetLayoutOption(); + + /** * Returns a new object of class '<em>Enum Layout Value</em>'. <!-- begin-user-doc --> <!-- end-user-doc --> * * @return a new object of class '<em>Enum Layout Value</em>'. diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionPackage.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionPackage.java index 1bb27850c3..051b68c182 100644 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionPackage.java +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/DescriptionPackage.java @@ -68,7 +68,7 @@ public interface DescriptionPackage extends EPackage { * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getDragAndDropTargetDescription() * @generated */ - int DRAG_AND_DROP_TARGET_DESCRIPTION = 29; + int DRAG_AND_DROP_TARGET_DESCRIPTION = 31; /** * The feature id for the '<em><b>Drop Descriptions</b></em>' reference list. <!-- begin-user-doc --> <!-- @@ -2984,6 +2984,58 @@ public interface DescriptionPackage extends EPackage { int DOUBLE_LAYOUT_OPTION_FEATURE_COUNT = DescriptionPackage.LAYOUT_OPTION_FEATURE_COUNT + 1; /** + * The meta object id for the '{@link org.eclipse.sirius.diagram.description.impl.EnumOptionImpl <em>Enum + * Option</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.sirius.diagram.description.impl.EnumOptionImpl + * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getEnumOption() + * @generated + */ + int ENUM_OPTION = 26; + + /** + * The feature id for the '<em><b>Id</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int ENUM_OPTION__ID = DescriptionPackage.LAYOUT_OPTION__ID; + + /** + * The feature id for the '<em><b>Label</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int ENUM_OPTION__LABEL = DescriptionPackage.LAYOUT_OPTION__LABEL; + + /** + * The feature id for the '<em><b>Description</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int ENUM_OPTION__DESCRIPTION = DescriptionPackage.LAYOUT_OPTION__DESCRIPTION; + + /** + * The feature id for the '<em><b>Choices</b></em>' containment reference list. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + * @ordered + */ + int ENUM_OPTION__CHOICES = DescriptionPackage.LAYOUT_OPTION_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Enum Option</em>' class. <!-- begin-user-doc --> <!-- end-user-doc + * --> + * + * @generated + * @ordered + */ + int ENUM_OPTION_FEATURE_COUNT = DescriptionPackage.LAYOUT_OPTION_FEATURE_COUNT + 1; + + /** * The meta object id for the '{@link org.eclipse.sirius.diagram.description.impl.EnumLayoutOptionImpl <em>Enum * Layout Option</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> * @@ -2999,7 +3051,7 @@ public interface DescriptionPackage extends EPackage { * @generated * @ordered */ - int ENUM_LAYOUT_OPTION__ID = DescriptionPackage.LAYOUT_OPTION__ID; + int ENUM_LAYOUT_OPTION__ID = DescriptionPackage.ENUM_OPTION__ID; /** * The feature id for the '<em><b>Label</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -3007,7 +3059,7 @@ public interface DescriptionPackage extends EPackage { * @generated * @ordered */ - int ENUM_LAYOUT_OPTION__LABEL = DescriptionPackage.LAYOUT_OPTION__LABEL; + int ENUM_LAYOUT_OPTION__LABEL = DescriptionPackage.ENUM_OPTION__LABEL; /** * The feature id for the '<em><b>Description</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -3015,7 +3067,16 @@ public interface DescriptionPackage extends EPackage { * @generated * @ordered */ - int ENUM_LAYOUT_OPTION__DESCRIPTION = DescriptionPackage.LAYOUT_OPTION__DESCRIPTION; + int ENUM_LAYOUT_OPTION__DESCRIPTION = DescriptionPackage.ENUM_OPTION__DESCRIPTION; + + /** + * The feature id for the '<em><b>Choices</b></em>' containment reference list. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + * @ordered + */ + int ENUM_LAYOUT_OPTION__CHOICES = DescriptionPackage.ENUM_OPTION__CHOICES; /** * The feature id for the '<em><b>Value</b></em>' containment reference. <!-- begin-user-doc --> <!-- end-user-doc @@ -3024,7 +3085,50 @@ public interface DescriptionPackage extends EPackage { * @generated * @ordered */ - int ENUM_LAYOUT_OPTION__VALUE = DescriptionPackage.LAYOUT_OPTION_FEATURE_COUNT + 0; + int ENUM_LAYOUT_OPTION__VALUE = DescriptionPackage.ENUM_OPTION_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Enum Layout Option</em>' class. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + * @ordered + */ + int ENUM_LAYOUT_OPTION_FEATURE_COUNT = DescriptionPackage.ENUM_OPTION_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.eclipse.sirius.diagram.description.impl.EnumSetLayoutOptionImpl <em>Enum + * Set Layout Option</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.sirius.diagram.description.impl.EnumSetLayoutOptionImpl + * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getEnumSetLayoutOption() + * @generated + */ + int ENUM_SET_LAYOUT_OPTION = 25; + + /** + * The feature id for the '<em><b>Id</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int ENUM_SET_LAYOUT_OPTION__ID = DescriptionPackage.ENUM_OPTION__ID; + + /** + * The feature id for the '<em><b>Label</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int ENUM_SET_LAYOUT_OPTION__LABEL = DescriptionPackage.ENUM_OPTION__LABEL; + + /** + * The feature id for the '<em><b>Description</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + * @ordered + */ + int ENUM_SET_LAYOUT_OPTION__DESCRIPTION = DescriptionPackage.ENUM_OPTION__DESCRIPTION; /** * The feature id for the '<em><b>Choices</b></em>' containment reference list. <!-- begin-user-doc --> <!-- @@ -3033,16 +3137,25 @@ public interface DescriptionPackage extends EPackage { * @generated * @ordered */ - int ENUM_LAYOUT_OPTION__CHOICES = DescriptionPackage.LAYOUT_OPTION_FEATURE_COUNT + 1; + int ENUM_SET_LAYOUT_OPTION__CHOICES = DescriptionPackage.ENUM_OPTION__CHOICES; /** - * The number of structural features of the '<em>Enum Layout Option</em>' class. <!-- begin-user-doc --> <!-- + * The feature id for the '<em><b>Values</b></em>' containment reference list. <!-- begin-user-doc --> <!-- + * end-user-doc --> + * + * @generated + * @ordered + */ + int ENUM_SET_LAYOUT_OPTION__VALUES = DescriptionPackage.ENUM_OPTION_FEATURE_COUNT + 0; + + /** + * The number of structural features of the '<em>Enum Set Layout Option</em>' class. <!-- begin-user-doc --> <!-- * end-user-doc --> * * @generated * @ordered */ - int ENUM_LAYOUT_OPTION_FEATURE_COUNT = DescriptionPackage.LAYOUT_OPTION_FEATURE_COUNT + 2; + int ENUM_SET_LAYOUT_OPTION_FEATURE_COUNT = DescriptionPackage.ENUM_OPTION_FEATURE_COUNT + 1; /** * The meta object id for the '{@link org.eclipse.sirius.diagram.description.impl.EnumLayoutValueImpl <em>Enum @@ -3052,7 +3165,7 @@ public interface DescriptionPackage extends EPackage { * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getEnumLayoutValue() * @generated */ - int ENUM_LAYOUT_VALUE = 25; + int ENUM_LAYOUT_VALUE = 27; /** * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -3087,7 +3200,7 @@ public interface DescriptionPackage extends EPackage { * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getMappingBasedDecoration() * @generated */ - int MAPPING_BASED_DECORATION = 26; + int MAPPING_BASED_DECORATION = 28; /** * The feature id for the '<em><b>Name</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -3166,7 +3279,7 @@ public interface DescriptionPackage extends EPackage { * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getLayer() * @generated */ - int LAYER = 27; + int LAYER = 29; /** * The feature id for the '<em><b>Documentation</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -3323,7 +3436,7 @@ public interface DescriptionPackage extends EPackage { * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getAdditionalLayer() * @generated */ - int ADDITIONAL_LAYER = 28; + int ADDITIONAL_LAYER = 30; /** * The feature id for the '<em><b>Documentation</b></em>' attribute. <!-- begin-user-doc --> <!-- end-user-doc --> @@ -3498,7 +3611,7 @@ public interface DescriptionPackage extends EPackage { * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getFoldingStyle() * @generated */ - int FOLDING_STYLE = 30; + int FOLDING_STYLE = 32; /** * The meta object id for the '{@link org.eclipse.sirius.diagram.description.LayoutDirection <em>Layout @@ -3508,7 +3621,7 @@ public interface DescriptionPackage extends EPackage { * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getLayoutDirection() * @generated */ - int LAYOUT_DIRECTION = 31; + int LAYOUT_DIRECTION = 33; /** * The meta object id for the '{@link org.eclipse.sirius.diagram.description.CenteringStyle <em>Centering @@ -3518,7 +3631,7 @@ public interface DescriptionPackage extends EPackage { * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getCenteringStyle() * @generated */ - int CENTERING_STYLE = 32; + int CENTERING_STYLE = 34; /** * Returns the meta object for class '{@link org.eclipse.sirius.diagram.description.DiagramDescription <em>Diagram @@ -4838,16 +4951,48 @@ public interface DescriptionPackage extends EPackage { EReference getEnumLayoutOption_Value(); /** + * Returns the meta object for class '{@link org.eclipse.sirius.diagram.description.EnumSetLayoutOption <em>Enum Set + * Layout Option</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return the meta object for class '<em>Enum Set Layout Option</em>'. + * @see org.eclipse.sirius.diagram.description.EnumSetLayoutOption + * @generated + */ + EClass getEnumSetLayoutOption(); + + /** * Returns the meta object for the containment reference list - * '{@link org.eclipse.sirius.diagram.description.EnumLayoutOption#getChoices <em>Choices</em>}'. <!-- + * '{@link org.eclipse.sirius.diagram.description.EnumSetLayoutOption#getValues <em>Values</em>}'. <!-- * begin-user-doc --> <!-- end-user-doc --> * + * @return the meta object for the containment reference list '<em>Values</em>'. + * @see org.eclipse.sirius.diagram.description.EnumSetLayoutOption#getValues() + * @see #getEnumSetLayoutOption() + * @generated + */ + EReference getEnumSetLayoutOption_Values(); + + /** + * Returns the meta object for class '{@link org.eclipse.sirius.diagram.description.EnumOption <em>Enum + * Option</em>}'. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @return the meta object for class '<em>Enum Option</em>'. + * @see org.eclipse.sirius.diagram.description.EnumOption + * @generated + */ + EClass getEnumOption(); + + /** + * Returns the meta object for the containment reference list + * '{@link org.eclipse.sirius.diagram.description.EnumOption#getChoices <em>Choices</em>}'. <!-- begin-user-doc --> + * <!-- end-user-doc --> + * * @return the meta object for the containment reference list '<em>Choices</em>'. - * @see org.eclipse.sirius.diagram.description.EnumLayoutOption#getChoices() - * @see #getEnumLayoutOption() + * @see org.eclipse.sirius.diagram.description.EnumOption#getChoices() + * @see #getEnumOption() * @generated */ - EReference getEnumLayoutOption_Choices(); + EReference getEnumOption_Choices(); /** * Returns the meta object for class '{@link org.eclipse.sirius.diagram.description.EnumLayoutValue <em>Enum Layout @@ -6133,12 +6278,40 @@ public interface DescriptionPackage extends EPackage { EReference ENUM_LAYOUT_OPTION__VALUE = DescriptionPackage.eINSTANCE.getEnumLayoutOption_Value(); /** + * The meta object literal for the '{@link org.eclipse.sirius.diagram.description.impl.EnumSetLayoutOptionImpl + * <em>Enum Set Layout Option</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.sirius.diagram.description.impl.EnumSetLayoutOptionImpl + * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getEnumSetLayoutOption() + * @generated + */ + EClass ENUM_SET_LAYOUT_OPTION = DescriptionPackage.eINSTANCE.getEnumSetLayoutOption(); + + /** + * The meta object literal for the '<em><b>Values</b></em>' containment reference list feature. <!-- + * begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + EReference ENUM_SET_LAYOUT_OPTION__VALUES = DescriptionPackage.eINSTANCE.getEnumSetLayoutOption_Values(); + + /** + * The meta object literal for the '{@link org.eclipse.sirius.diagram.description.impl.EnumOptionImpl <em>Enum + * Option</em>}' class. <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @see org.eclipse.sirius.diagram.description.impl.EnumOptionImpl + * @see org.eclipse.sirius.diagram.description.impl.DescriptionPackageImpl#getEnumOption() + * @generated + */ + EClass ENUM_OPTION = DescriptionPackage.eINSTANCE.getEnumOption(); + + /** * The meta object literal for the '<em><b>Choices</b></em>' containment reference list feature. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @generated */ - EReference ENUM_LAYOUT_OPTION__CHOICES = DescriptionPackage.eINSTANCE.getEnumLayoutOption_Choices(); + EReference ENUM_OPTION__CHOICES = DescriptionPackage.eINSTANCE.getEnumOption_Choices(); /** * The meta object literal for the '{@link org.eclipse.sirius.diagram.description.impl.EnumLayoutValueImpl diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/EnumLayoutOption.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/EnumLayoutOption.java index 75c1537885..3d21635a4f 100644 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/EnumLayoutOption.java +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/EnumLayoutOption.java @@ -11,8 +11,6 @@ */ package org.eclipse.sirius.diagram.description; -import org.eclipse.emf.common.util.EList; - /** * <!-- begin-user-doc --> A representation of the model object '<em><b>Enum Layout Option</b></em>'. <!-- end-user-doc * --> @@ -28,7 +26,7 @@ import org.eclipse.emf.common.util.EList; * @model abstract="true" * @generated */ -public interface EnumLayoutOption extends LayoutOption { +public interface EnumLayoutOption extends EnumOption { /** * Returns the value of the '<em><b>Value</b></em>' containment reference. <!-- begin-user-doc --> * <p> @@ -56,20 +54,4 @@ public interface EnumLayoutOption extends LayoutOption { */ void setValue(EnumLayoutValue value); - /** - * Returns the value of the '<em><b>Choices</b></em>' containment reference list. The list contents are of type - * {@link org.eclipse.sirius.diagram.description.EnumLayoutValue}. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Choices</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>Choices</em>' containment reference list. - * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getEnumLayoutOption_Choices() - * @model containment="true" resolveProxies="true" - * @generated - */ - EList<EnumLayoutValue> getChoices(); - } // EnumLayoutOption diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/EnumOption.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/EnumOption.java new file mode 100644 index 0000000000..348657e580 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/EnumOption.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2007, 2017 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.diagram.description; + +import org.eclipse.emf.common.util.EList; + +/** + * <!-- begin-user-doc --> A representation of the model object '<em><b>Enum Option</b></em>'. <!-- end-user-doc --> + * + * <p> + * The following features are supported: + * </p> + * <ul> + * <li>{@link org.eclipse.sirius.diagram.description.EnumOption#getChoices <em>Choices</em>}</li> + * </ul> + * + * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getEnumOption() + * @model abstract="true" + * @generated + */ +public interface EnumOption extends LayoutOption { + /** + * Returns the value of the '<em><b>Choices</b></em>' containment reference list. The list contents are of type + * {@link org.eclipse.sirius.diagram.description.EnumLayoutValue}. <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Choices</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>Choices</em>' containment reference list. + * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getEnumOption_Choices() + * @model containment="true" resolveProxies="true" + * @generated + */ + EList<EnumLayoutValue> getChoices(); + +} // EnumOption diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/EnumSetLayoutOption.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/EnumSetLayoutOption.java new file mode 100644 index 0000000000..b431fe2a14 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/EnumSetLayoutOption.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2007, 2017 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.diagram.description; + +import org.eclipse.emf.common.util.EList; + +/** + * <!-- begin-user-doc --> A representation of the model object '<em><b>Enum Set Layout Option</b></em>'. <!-- + * end-user-doc --> + * + * <p> + * The following features are supported: + * </p> + * <ul> + * <li>{@link org.eclipse.sirius.diagram.description.EnumSetLayoutOption#getValues <em>Values</em>}</li> + * </ul> + * + * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getEnumSetLayoutOption() + * @model + * @generated + */ +public interface EnumSetLayoutOption extends EnumOption { + /** + * Returns the value of the '<em><b>Values</b></em>' containment reference list. The list contents are of type + * {@link org.eclipse.sirius.diagram.description.EnumLayoutValue}. <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Values</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>Values</em>' containment reference list. + * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getEnumSetLayoutOption_Values() + * @model containment="true" resolveProxies="true" + * @generated + */ + EList<EnumLayoutValue> getValues(); + +} // EnumSetLayoutOption diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/GenericLayout.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/GenericLayout.java deleted file mode 100644 index d0f6473024..0000000000 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/GenericLayout.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * Copyright (c) 2007, 2017 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.diagram.description; - -import org.eclipse.emf.common.util.EList; - -/** - * <!-- begin-user-doc --> A representation of the model object '<em><b>Generic Layout</b></em>'. <!-- end-user-doc --> - * - * <p> - * The following features are supported: - * </p> - * <ul> - * <li>{@link org.eclipse.sirius.diagram.description.GenericLayout#getID <em>ID</em>}</li> - * <li>{@link org.eclipse.sirius.diagram.description.GenericLayout#getLabel <em>Label</em>}</li> - * <li>{@link org.eclipse.sirius.diagram.description.GenericLayout#getDescription <em>Description</em>}</li> - * <li>{@link org.eclipse.sirius.diagram.description.GenericLayout#getLayoutOptions <em>Layout Options</em>}</li> - * </ul> - * - * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getGenericLayout() - * @model - * @generated - */ -public interface GenericLayout extends Layout { - /** - * Returns the value of the '<em><b>ID</b></em>' attribute. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>ID</em>' attribute isn't clear, there really should be more of a description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>ID</em>' attribute. - * @see #setID(String) - * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getGenericLayout_ID() - * @model - * @generated - */ - String getID(); - - /** - * Sets the value of the '{@link org.eclipse.sirius.diagram.description.GenericLayout#getID <em>ID</em>}' attribute. - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>ID</em>' attribute. - * @see #getID() - * @generated - */ - void setID(String value); - - /** - * Returns the value of the '<em><b>Label</b></em>' attribute. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Label</em>' attribute isn't clear, there really should be more of a description - * here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Label</em>' attribute. - * @see #setLabel(String) - * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getGenericLayout_Label() - * @model - * @generated - */ - String getLabel(); - - /** - * Sets the value of the '{@link org.eclipse.sirius.diagram.description.GenericLayout#getLabel <em>Label</em>}' - * attribute. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @param value - * the new value of the '<em>Label</em>' attribute. - * @see #getLabel() - * @generated - */ - void setLabel(String value); - - /** - * 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.diagram.description.DescriptionPackage#getGenericLayout_Description() - * @model - * @generated - */ - String getDescription(); - - /** - * Sets the value of the '{@link org.eclipse.sirius.diagram.description.GenericLayout#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); - - /** - * Returns the value of the '<em><b>Layout Options</b></em>' containment reference list. The list contents are of - * type {@link org.eclipse.sirius.diagram.description.LayoutOption}. <!-- begin-user-doc --> - * <p> - * If the meaning of the '<em>Layout Options</em>' reference list isn't clear, there really should be more of a - * description here... - * </p> - * <!-- end-user-doc --> - * - * @return the value of the '<em>Layout Options</em>' containment reference list. - * @see org.eclipse.sirius.diagram.description.DescriptionPackage#getGenericLayout_LayoutOptions() - * @model containment="true" resolveProxies="true" - * @generated - */ - EList<LayoutOption> getLayoutOptions(); - -} // GenericLayout diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionFactoryImpl.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionFactoryImpl.java index 6039230888..797ab2c5a3 100644 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionFactoryImpl.java +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionFactoryImpl.java @@ -49,6 +49,7 @@ import org.eclipse.sirius.diagram.description.EdgeMapping; import org.eclipse.sirius.diagram.description.EdgeMappingImport; import org.eclipse.sirius.diagram.description.EnumLayoutOption; import org.eclipse.sirius.diagram.description.EnumLayoutValue; +import org.eclipse.sirius.diagram.description.EnumSetLayoutOption; import org.eclipse.sirius.diagram.description.FoldingStyle; import org.eclipse.sirius.diagram.description.IntegerLayoutOption; import org.eclipse.sirius.diagram.description.Layer; @@ -139,6 +140,8 @@ public class DescriptionFactoryImpl extends EFactoryImpl implements DescriptionF return createDoubleLayoutOption(); case DescriptionPackage.ENUM_LAYOUT_OPTION: return createEnumLayoutOption(); + case DescriptionPackage.ENUM_SET_LAYOUT_OPTION: + return createEnumSetLayoutOption(); case DescriptionPackage.ENUM_LAYOUT_VALUE: return createEnumLayoutValue(); case DescriptionPackage.MAPPING_BASED_DECORATION: @@ -429,6 +432,17 @@ public class DescriptionFactoryImpl extends EFactoryImpl implements DescriptionF * @generated */ @Override + public EnumSetLayoutOption createEnumSetLayoutOption() { + EnumSetLayoutOptionImpl enumSetLayoutOption = new EnumSetLayoutOptionImpl(); + return enumSetLayoutOption; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override public EnumLayoutValue createEnumLayoutValue() { EnumLayoutValueImpl enumLayoutValue = new EnumLayoutValueImpl(); return enumLayoutValue; diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionPackageImpl.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionPackageImpl.java index 959b206b08..c1eb2db405 100644 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionPackageImpl.java +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/DescriptionPackageImpl.java @@ -43,6 +43,8 @@ import org.eclipse.sirius.diagram.description.EdgeMapping; import org.eclipse.sirius.diagram.description.EdgeMappingImport; import org.eclipse.sirius.diagram.description.EnumLayoutOption; import org.eclipse.sirius.diagram.description.EnumLayoutValue; +import org.eclipse.sirius.diagram.description.EnumOption; +import org.eclipse.sirius.diagram.description.EnumSetLayoutOption; import org.eclipse.sirius.diagram.description.FoldingStyle; import org.eclipse.sirius.diagram.description.IEdgeMapping; import org.eclipse.sirius.diagram.description.IntegerLayoutOption; @@ -253,6 +255,20 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * * @generated */ + private EClass enumSetLayoutOptionEClass = null; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + private EClass enumOptionEClass = null; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ private EClass enumLayoutValueEClass = null; /** @@ -1537,8 +1553,38 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP * @generated */ @Override - public EReference getEnumLayoutOption_Choices() { - return (EReference) enumLayoutOptionEClass.getEStructuralFeatures().get(1); + public EClass getEnumSetLayoutOption() { + return enumSetLayoutOptionEClass; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EReference getEnumSetLayoutOption_Values() { + return (EReference) enumSetLayoutOptionEClass.getEStructuralFeatures().get(0); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EClass getEnumOption() { + return enumOptionEClass; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EReference getEnumOption_Choices() { + return (EReference) enumOptionEClass.getEStructuralFeatures().get(0); } /** @@ -1969,7 +2015,12 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP enumLayoutOptionEClass = createEClass(DescriptionPackage.ENUM_LAYOUT_OPTION); createEReference(enumLayoutOptionEClass, DescriptionPackage.ENUM_LAYOUT_OPTION__VALUE); - createEReference(enumLayoutOptionEClass, DescriptionPackage.ENUM_LAYOUT_OPTION__CHOICES); + + enumSetLayoutOptionEClass = createEClass(DescriptionPackage.ENUM_SET_LAYOUT_OPTION); + createEReference(enumSetLayoutOptionEClass, DescriptionPackage.ENUM_SET_LAYOUT_OPTION__VALUES); + + enumOptionEClass = createEClass(DescriptionPackage.ENUM_OPTION); + createEReference(enumOptionEClass, DescriptionPackage.ENUM_OPTION__CHOICES); enumLayoutValueEClass = createEClass(DescriptionPackage.ENUM_LAYOUT_VALUE); createEAttribute(enumLayoutValueEClass, DescriptionPackage.ENUM_LAYOUT_VALUE__NAME); @@ -2089,7 +2140,9 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP stringLayoutOptionEClass.getESuperTypes().add(this.getLayoutOption()); integerLayoutOptionEClass.getESuperTypes().add(this.getLayoutOption()); doubleLayoutOptionEClass.getESuperTypes().add(this.getLayoutOption()); - enumLayoutOptionEClass.getESuperTypes().add(this.getLayoutOption()); + enumLayoutOptionEClass.getESuperTypes().add(this.getEnumOption()); + enumSetLayoutOptionEClass.getESuperTypes().add(this.getEnumOption()); + enumOptionEClass.getESuperTypes().add(this.getLayoutOption()); mappingBasedDecorationEClass.getESuperTypes().add(theDescriptionPackage_1.getDecorationDescription()); layerEClass.getESuperTypes().add(theDescriptionPackage_1.getDocumentedElement()); layerEClass.getESuperTypes().add(theDescriptionPackage_1.getEndUserDocumentedElement()); @@ -2489,7 +2542,14 @@ public class DescriptionPackageImpl extends EPackageImpl implements DescriptionP initEReference(getEnumLayoutOption_Value(), this.getEnumLayoutValue(), null, "value", null, 0, 1, EnumLayoutOption.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(getEnumLayoutOption_Choices(), this.getEnumLayoutValue(), null, "choices", null, 0, -1, EnumLayoutOption.class, !EPackageImpl.IS_TRANSIENT, !EPackageImpl.IS_VOLATILE, //$NON-NLS-1$ + + initEClass(enumSetLayoutOptionEClass, EnumSetLayoutOption.class, "EnumSetLayoutOption", !EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getEnumSetLayoutOption_Values(), this.getEnumLayoutValue(), null, "values", null, 0, -1, EnumSetLayoutOption.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(enumOptionEClass, EnumOption.class, "EnumOption", EPackageImpl.IS_ABSTRACT, !EPackageImpl.IS_INTERFACE, EPackageImpl.IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ + initEReference(getEnumOption_Choices(), this.getEnumLayoutValue(), null, "choices", null, 0, -1, EnumOption.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); diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/EnumLayoutOptionImpl.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/EnumLayoutOptionImpl.java index fd45491860..8604786432 100644 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/EnumLayoutOptionImpl.java +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/EnumLayoutOptionImpl.java @@ -11,16 +11,11 @@ */ package org.eclipse.sirius.diagram.description.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.util.EObjectContainmentEList; -import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.sirius.diagram.description.DescriptionPackage; import org.eclipse.sirius.diagram.description.EnumLayoutOption; import org.eclipse.sirius.diagram.description.EnumLayoutValue; @@ -37,7 +32,7 @@ import org.eclipse.sirius.diagram.description.EnumLayoutValue; * * @generated */ -public class EnumLayoutOptionImpl extends LayoutOptionImpl implements EnumLayoutOption { +public class EnumLayoutOptionImpl extends EnumOptionImpl implements EnumLayoutOption { /** * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. <!-- begin-user-doc --> <!-- * end-user-doc --> @@ -49,16 +44,6 @@ public class EnumLayoutOptionImpl extends LayoutOptionImpl implements EnumLayout protected EnumLayoutValue value; /** - * The cached value of the '{@link #getChoices() <em>Choices</em>}' containment reference list. <!-- begin-user-doc - * --> <!-- end-user-doc --> - * - * @see #getChoices() - * @generated - * @ordered - */ - protected EList<EnumLayoutValue> choices; - - /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated @@ -162,25 +147,10 @@ public class EnumLayoutOptionImpl extends LayoutOptionImpl implements EnumLayout * @generated */ @Override - public EList<EnumLayoutValue> getChoices() { - if (choices == null) { - choices = new EObjectContainmentEList.Resolving<EnumLayoutValue>(EnumLayoutValue.class, this, DescriptionPackage.ENUM_LAYOUT_OPTION__CHOICES); - } - return choices; - } - - /** - * <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DescriptionPackage.ENUM_LAYOUT_OPTION__VALUE: return basicSetValue(null, msgs); - case DescriptionPackage.ENUM_LAYOUT_OPTION__CHOICES: - return ((InternalEList<?>) getChoices()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } @@ -198,8 +168,6 @@ public class EnumLayoutOptionImpl extends LayoutOptionImpl implements EnumLayout return getValue(); } return basicGetValue(); - case DescriptionPackage.ENUM_LAYOUT_OPTION__CHOICES: - return getChoices(); } return super.eGet(featureID, resolve, coreType); } @@ -216,10 +184,6 @@ public class EnumLayoutOptionImpl extends LayoutOptionImpl implements EnumLayout case DescriptionPackage.ENUM_LAYOUT_OPTION__VALUE: setValue((EnumLayoutValue) newValue); return; - case DescriptionPackage.ENUM_LAYOUT_OPTION__CHOICES: - getChoices().clear(); - getChoices().addAll((Collection<? extends EnumLayoutValue>) newValue); - return; } super.eSet(featureID, newValue); } @@ -235,9 +199,6 @@ public class EnumLayoutOptionImpl extends LayoutOptionImpl implements EnumLayout case DescriptionPackage.ENUM_LAYOUT_OPTION__VALUE: setValue((EnumLayoutValue) null); return; - case DescriptionPackage.ENUM_LAYOUT_OPTION__CHOICES: - getChoices().clear(); - return; } super.eUnset(featureID); } @@ -252,8 +213,6 @@ public class EnumLayoutOptionImpl extends LayoutOptionImpl implements EnumLayout switch (featureID) { case DescriptionPackage.ENUM_LAYOUT_OPTION__VALUE: return value != null; - case DescriptionPackage.ENUM_LAYOUT_OPTION__CHOICES: - return choices != null && !choices.isEmpty(); } return super.eIsSet(featureID); } diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/EnumOptionImpl.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/EnumOptionImpl.java new file mode 100644 index 0000000000..7175fc3a35 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/EnumOptionImpl.java @@ -0,0 +1,154 @@ +/** + * Copyright (c) 2007, 2017 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.diagram.description.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.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.sirius.diagram.description.DescriptionPackage; +import org.eclipse.sirius.diagram.description.EnumLayoutValue; +import org.eclipse.sirius.diagram.description.EnumOption; + +/** + * <!-- begin-user-doc --> An implementation of the model object '<em><b>Enum Option</b></em>'. <!-- end-user-doc --> + * <p> + * The following features are implemented: + * </p> + * <ul> + * <li>{@link org.eclipse.sirius.diagram.description.impl.EnumOptionImpl#getChoices <em>Choices</em>}</li> + * </ul> + * + * @generated + */ +public abstract class EnumOptionImpl extends LayoutOptionImpl implements EnumOption { + /** + * The cached value of the '{@link #getChoices() <em>Choices</em>}' containment reference list. <!-- begin-user-doc + * --> <!-- end-user-doc --> + * + * @see #getChoices() + * @generated + * @ordered + */ + protected EList<EnumLayoutValue> choices; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected EnumOptionImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DescriptionPackage.Literals.ENUM_OPTION; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EList<EnumLayoutValue> getChoices() { + if (choices == null) { + choices = new EObjectContainmentEList.Resolving<EnumLayoutValue>(EnumLayoutValue.class, this, DescriptionPackage.ENUM_OPTION__CHOICES); + } + return choices; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DescriptionPackage.ENUM_OPTION__CHOICES: + return ((InternalEList<?>) getChoices()).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 DescriptionPackage.ENUM_OPTION__CHOICES: + return getChoices(); + } + 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 DescriptionPackage.ENUM_OPTION__CHOICES: + getChoices().clear(); + getChoices().addAll((Collection<? extends EnumLayoutValue>) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DescriptionPackage.ENUM_OPTION__CHOICES: + getChoices().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DescriptionPackage.ENUM_OPTION__CHOICES: + return choices != null && !choices.isEmpty(); + } + return super.eIsSet(featureID); + } + +} // EnumOptionImpl diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/EnumSetLayoutOptionImpl.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/EnumSetLayoutOptionImpl.java new file mode 100644 index 0000000000..1dcefa36f4 --- /dev/null +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/impl/EnumSetLayoutOptionImpl.java @@ -0,0 +1,155 @@ +/** + * Copyright (c) 2007, 2017 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.diagram.description.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.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.eclipse.sirius.diagram.description.DescriptionPackage; +import org.eclipse.sirius.diagram.description.EnumLayoutValue; +import org.eclipse.sirius.diagram.description.EnumSetLayoutOption; + +/** + * <!-- begin-user-doc --> An implementation of the model object '<em><b>Enum Set Layout Option</b></em>'. <!-- + * end-user-doc --> + * <p> + * The following features are implemented: + * </p> + * <ul> + * <li>{@link org.eclipse.sirius.diagram.description.impl.EnumSetLayoutOptionImpl#getValues <em>Values</em>}</li> + * </ul> + * + * @generated + */ +public class EnumSetLayoutOptionImpl extends EnumOptionImpl implements EnumSetLayoutOption { + /** + * The cached value of the '{@link #getValues() <em>Values</em>}' containment reference list. <!-- begin-user-doc + * --> <!-- end-user-doc --> + * + * @see #getValues() + * @generated + * @ordered + */ + protected EList<EnumLayoutValue> values; + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + protected EnumSetLayoutOptionImpl() { + super(); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return DescriptionPackage.Literals.ENUM_SET_LAYOUT_OPTION; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public EList<EnumLayoutValue> getValues() { + if (values == null) { + values = new EObjectContainmentEList.Resolving<EnumLayoutValue>(EnumLayoutValue.class, this, DescriptionPackage.ENUM_SET_LAYOUT_OPTION__VALUES); + } + return values; + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case DescriptionPackage.ENUM_SET_LAYOUT_OPTION__VALUES: + return ((InternalEList<?>) getValues()).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 DescriptionPackage.ENUM_SET_LAYOUT_OPTION__VALUES: + return getValues(); + } + 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 DescriptionPackage.ENUM_SET_LAYOUT_OPTION__VALUES: + getValues().clear(); + getValues().addAll((Collection<? extends EnumLayoutValue>) newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case DescriptionPackage.ENUM_SET_LAYOUT_OPTION__VALUES: + getValues().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * <!-- begin-user-doc --> <!-- end-user-doc --> + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case DescriptionPackage.ENUM_SET_LAYOUT_OPTION__VALUES: + return values != null && !values.isEmpty(); + } + return super.eIsSet(featureID); + } + +} // EnumSetLayoutOptionImpl diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/util/DescriptionAdapterFactory.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/util/DescriptionAdapterFactory.java index 497ef0ed4f..f3464d852f 100644 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/util/DescriptionAdapterFactory.java +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/util/DescriptionAdapterFactory.java @@ -36,6 +36,8 @@ import org.eclipse.sirius.diagram.description.EdgeMapping; import org.eclipse.sirius.diagram.description.EdgeMappingImport; import org.eclipse.sirius.diagram.description.EnumLayoutOption; import org.eclipse.sirius.diagram.description.EnumLayoutValue; +import org.eclipse.sirius.diagram.description.EnumOption; +import org.eclipse.sirius.diagram.description.EnumSetLayoutOption; import org.eclipse.sirius.diagram.description.IEdgeMapping; import org.eclipse.sirius.diagram.description.IntegerLayoutOption; import org.eclipse.sirius.diagram.description.Layer; @@ -235,6 +237,16 @@ public class DescriptionAdapterFactory extends AdapterFactoryImpl { } @Override + public Adapter caseEnumSetLayoutOption(EnumSetLayoutOption object) { + return createEnumSetLayoutOptionAdapter(); + } + + @Override + public Adapter caseEnumOption(EnumOption object) { + return createEnumOptionAdapter(); + } + + @Override public Adapter caseEnumLayoutValue(EnumLayoutValue object) { return createEnumLayoutValueAdapter(); } @@ -682,6 +694,33 @@ public class DescriptionAdapterFactory extends AdapterFactoryImpl { } /** + * Creates a new adapter for an object of class '{@link org.eclipse.sirius.diagram.description.EnumSetLayoutOption + * <em>Enum Set Layout Option</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.diagram.description.EnumSetLayoutOption + * @generated + */ + public Adapter createEnumSetLayoutOptionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.eclipse.sirius.diagram.description.EnumOption <em>Enum + * Option</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.diagram.description.EnumOption + * @generated + */ + public Adapter createEnumOptionAdapter() { + return null; + } + + /** * Creates a new adapter for an object of class '{@link org.eclipse.sirius.diagram.description.EnumLayoutValue * <em>Enum Layout Value</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. <!-- diff --git a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/util/DescriptionSwitch.java b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/util/DescriptionSwitch.java index 81b8380d47..195d0df1ae 100644 --- a/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/util/DescriptionSwitch.java +++ b/plugins/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/util/DescriptionSwitch.java @@ -36,6 +36,8 @@ import org.eclipse.sirius.diagram.description.EdgeMapping; import org.eclipse.sirius.diagram.description.EdgeMappingImport; import org.eclipse.sirius.diagram.description.EnumLayoutOption; import org.eclipse.sirius.diagram.description.EnumLayoutValue; +import org.eclipse.sirius.diagram.description.EnumOption; +import org.eclipse.sirius.diagram.description.EnumSetLayoutOption; import org.eclipse.sirius.diagram.description.IEdgeMapping; import org.eclipse.sirius.diagram.description.IntegerLayoutOption; import org.eclipse.sirius.diagram.description.Layer; @@ -552,6 +554,9 @@ public class DescriptionSwitch<T> { EnumLayoutOption enumLayoutOption = (EnumLayoutOption) theEObject; T result = caseEnumLayoutOption(enumLayoutOption); if (result == null) { + result = caseEnumOption(enumLayoutOption); + } + if (result == null) { result = caseLayoutOption(enumLayoutOption); } if (result == null) { @@ -559,6 +564,31 @@ public class DescriptionSwitch<T> { } return result; } + case DescriptionPackage.ENUM_SET_LAYOUT_OPTION: { + EnumSetLayoutOption enumSetLayoutOption = (EnumSetLayoutOption) theEObject; + T result = caseEnumSetLayoutOption(enumSetLayoutOption); + if (result == null) { + result = caseEnumOption(enumSetLayoutOption); + } + if (result == null) { + result = caseLayoutOption(enumSetLayoutOption); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } + case DescriptionPackage.ENUM_OPTION: { + EnumOption enumOption = (EnumOption) theEObject; + T result = caseEnumOption(enumOption); + if (result == null) { + result = caseLayoutOption(enumOption); + } + if (result == null) { + result = defaultCase(theEObject); + } + return result; + } case DescriptionPackage.ENUM_LAYOUT_VALUE: { EnumLayoutValue enumLayoutValue = (EnumLayoutValue) theEObject; T result = caseEnumLayoutValue(enumLayoutValue); @@ -1000,6 +1030,35 @@ public class DescriptionSwitch<T> { } /** + * Returns the result of interpreting the object as an instance of '<em>Enum Set Layout Option</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>Enum Set Layout Option</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEnumSetLayoutOption(EnumSetLayoutOption object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of '<em>Enum Option</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>Enum Option</em>'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseEnumOption(EnumOption object) { + return null; + } + + /** * Returns the result of interpreting the object as an instance of '<em>Enum Layout Value</em>'. <!-- begin-user-doc * --> This implementation returns null; returning a non-null result will terminate the switch. <!-- end-user-doc * --> |
