diff options
| author | Vincent Lorenzo | 2019-10-07 14:15:12 +0000 |
|---|---|---|
| committer | Vincent Lorenzo | 2019-10-08 14:35:39 +0000 |
| commit | 79bff15a327864c74b7b07e351079942a11cbedb (patch) | |
| tree | 8da3f30098c07ca2d74cf149ae5fe1ee3c93668c | |
| parent | 327c493a01f37ce892bf5c66fe0d8bcda6411f4b (diff) | |
| download | org.eclipse.papyrus-model2doc-79bff15a327864c74b7b07e351079942a11cbedb.tar.gz org.eclipse.papyrus-model2doc-79bff15a327864c74b7b07e351079942a11cbedb.tar.xz org.eclipse.papyrus-model2doc-79bff15a327864c74b7b07e351079942a11cbedb.zip | |
Bug 551855: [Model2Doc] add a mapper for TableofFigures
Change-Id: I1b400eb35580f19c091766a8a280412a50a4b5d3
Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
2 files changed, 60 insertions, 0 deletions
diff --git a/plugins/emf/org.eclipse.papyrus.model2doc.emf.template2structure/plugin.xml b/plugins/emf/org.eclipse.papyrus.model2doc.emf.template2structure/plugin.xml index 11851ae4..d8a2c96e 100755 --- a/plugins/emf/org.eclipse.papyrus.model2doc.emf.template2structure/plugin.xml +++ b/plugins/emf/org.eclipse.papyrus.model2doc.emf.template2structure/plugin.xml @@ -105,5 +105,9 @@ class="org.eclipse.papyrus.model2doc.emf.template2structure.internal.mapping.InsertFileTemplateMapper" generatorId="TextDocumentStructureGenerator.default"> </mapper> + <mapper + class="org.eclipse.papyrus.model2doc.emf.template2structure.internal.mapping.TableOfFiguresMapper" + generatorId="TextDocumentStructureGenerator.default"> + </mapper> </extension> </plugin> diff --git a/plugins/emf/org.eclipse.papyrus.model2doc.emf.template2structure/src/org/eclipse/papyrus/model2doc/emf/template2structure/internal/mapping/TableOfFiguresMapper.java b/plugins/emf/org.eclipse.papyrus.model2doc.emf.template2structure/src/org/eclipse/papyrus/model2doc/emf/template2structure/internal/mapping/TableOfFiguresMapper.java new file mode 100755 index 00000000..65887357 --- /dev/null +++ b/plugins/emf/org.eclipse.papyrus.model2doc.emf.template2structure/src/org/eclipse/papyrus/model2doc/emf/template2structure/internal/mapping/TableOfFiguresMapper.java @@ -0,0 +1,56 @@ +/***************************************************************************** + * Copyright (c) 2019 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.model2doc.emf.template2structure.internal.mapping; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.model2doc.emf.documentstructure.BodyPart; +import org.eclipse.papyrus.model2doc.emf.documentstructure.DocumentStructureFactory; +import org.eclipse.papyrus.model2doc.emf.documentstructure.TableOfFigures; +import org.eclipse.papyrus.model2doc.emf.template2structure.mapping.IMappingService; + +/** + * This class ensures the transformation of the {@link org.eclipse.papyrus.model2doc.emf.documentstructuretemplate.TableOfFigures} into a {@link BodyPart} ({@link TableOfFigures}) + */ +public class TableOfFiguresMapper extends AbstractEMFTemplateToStructureMapper<org.eclipse.papyrus.model2doc.emf.documentstructuretemplate.TableOfFigures> { + + /** + * + * Constructor. + * + */ + public TableOfFiguresMapper() { + super(TEMPLATE_EPACKAGE.getTableOfFigures(), TableOfFigures.class); + } + + /** + * @param mappingService + * @param documentStructureElement + * @param modelElement + * @see org.eclipse.papyrus.model2doc.emf.template2structure.mapping.service.AbtractTemplateToStructureMapper#doMap(IMappingService, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject, Class<T>) + * + * @return + */ + @Override + protected <T> List<T> doMap(final IMappingService mappingService, final org.eclipse.papyrus.model2doc.emf.documentstructuretemplate.TableOfFigures documentStructureElement, final EObject modelElement, Class<T> expectedReturnedClass) { + final TableOfFigures tof = DocumentStructureFactory.eINSTANCE.createTableOfFigures(); + tof.setTofTitle(documentStructureElement.getTofTitle()); + return Collections.singletonList(expectedReturnedClass.cast(tof)); + } + +} |
