This chapter describes the Papyrus integration of Papyrus-Model2Doc.
For this step, you can check the plugin org.eclipse.papyrus.model2doc.integration.uml.architecture
which is used as an example here.
This plugin provides a generic DocumentTemplate for a UML model.
The following points deal about the contribution to existing Architecture Frameworks/Viewpoints defined by Papyrus UML. It is not necessary to define all contribution into a unique .architecture file, as you will see here.
Select the domain element, open the contextual menu and select New Child > Description Language. The field Element types must reference the ElementTypeSetConfiguration called DocumentTemplateContext. This element type allows that when the semantic object from your UML model is destroyed by the user, the associated DocumentTemplate are destroyed too. This element type to reference is provided by the file documenttemplate-context.elementtypesconfigurations inside the plugin org.eclipse.papyrus.model2doc.integration.emf.documentstructuretemplate.types.
Select the language element, open the contextual menu and select New Child > Viewpoint.
Select the language element, open the contextual menu and select New Child > Papyrus Document Prototype.
Notes:
Add a contribution to the extension point org.eclipse.papyrus.infra.architecture.models
, and reference your file in the
model field.
Select the model element (model or package), open the contextual menu and select New Document Template > Generic Text Document.
This code should be done in a plugin called org.eclipse.papyrus.integration.xxx to respect the naming convention. We advise you to manage the EMF property view, before embedding it in Papyrus (because there is shared code between them).
org.eclipse.papyrus.model2doc.integration.emf.documentstructuretemplate.properties
org.eclipse.ui.views.properties.tabbed.propertySections
and you should get something like this:<extension point="org.eclipse.ui.views.properties.tabbed.propertySections"> <propertySections contributorId="TreeOutlinePage"> <propertySection class="org.eclipse.papyrus.model2doc.integration.emf.documentstructuretemplate.properties.internal.DocumentStructureTemplatePropertySection" filter="org.eclipse.papyrus.model2doc.integration.emf.documentstructuretemplate.properties.internal.DocumentStructureTemplatePackageSectionFilter" id="org.eclipse.papyrus.model2doc.emf.documentstructuretemplate.properties.propertySection1" tab="advanced"> <input type="java.lang.Object"> </input> </propertySection> </propertySections> </extension>
org.eclipse.papyrus.model2doc.integration.emf.documentstructuretemplate.properties.sections.AbstractEObjectAdvancedPropertySection
. This class will provide a org.eclipse.emf.edit.ui.provider.PropertySource
, this PropertySource
will provide a custom org.eclipse.ui.views.properties.IPropertyDescriptor
.
org.eclipse.jface.viewers.IFilter
You just need to manage your new feature in the method PropertySource.createPropertyDescriptor(IItemPropertyDescriptor)
of the existing PropertySource