Introduction

This chapter describes the Papyrus integration of Papyrus-Model2Doc.

How to register a DocumentTemplatePrototype into an existing Architecture file?

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.

1. Set domain

2. Set language

Select the domain element, open the contextual menu and select New Child > Description Language.

3. Set viewpoints

Select the language element, open the contextual menu and select New Child > Viewpoint.

3.1 Add Software Analysis viewpoint

3.2 Add Software Design viewpoint

4. Reference your DocumentTemplatePrototype

Select the language element, open the contextual menu and select New Child > Papyrus Document Prototype.

4.1 Define DocumentPrototype Representation

Notes:

4.2 Define Root

4.3 Define Owner

5. Contribute this architecture file in the plugin.xml

Add a contribution to the extension point org.eclipse.papyrus.infra.architecture.models, and reference your file in the model field.

Result

Select the model element (model or package), open the contextual menu and select New Document Template > Generic Text Document.

How to contribute to the EMF property view embedded in Papyrus (Advanced Tab)?

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).

In case of new DocumentStructureTemplate metamodel

  1. As an example, you can look at the plugin org.eclipse.papyrus.model2doc.integration.emf.documentstructuretemplate.properties
  2. Contribute to the extension point 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>

  1. class: we advise you to extends 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.
  2. filter: a class implementing org.eclipse.jface.viewers.IFilter

In case of new property in an existing metamodel

You just need to manage your new feature in the method PropertySource.createPropertyDescriptor(IItemPropertyDescriptor) of the existing PropertySource