Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

RMF/Contributor Guide/Presentations

Tutorial

This is a brief Howto that describes the creation of a new Presentation Plug-In for ProR.

Headline Presentation Plugin: The Requirements

The requirements are:

  • The Presentation shows the configured attribute in a bigger font.
  • The Presentation does not support automatic line wrapping.
  • The font size can be configured.

Implementation

Step by step instructions.

Create a new Plug-In Project

  • Create a new "Empty EMF Project".
  • As a convention, start its name org.eclipse.rmf.pror.reqif10.presentation.xxx. We call it org.eclipse.rmf.pror.reqif10.presentation.headline.

Create the EMF Model Extension

Every Presenation must extend the ReqIF Model. This is fairly important to get right.

  • Create a new "Ecore Model"
  • Store it in the folder model (should already exist) and call it Headline.ecore.
  • Leave all the other Defaults and create the model. It should consist of a top-level element (starting with "platform:/...") and an empty package.
  • Select the package and configure it in the Properties-View as follows:
  • We need to refer to the ProR UI Model to extend it.
    • Make sure that the Project org.eclipse.rmf.pror.reqif10 is in your workspace and open.
    • In your model editor for Headline.ecore, right-click and select "Load Resource..."
    • Select configuration.ecore (platform:/resource/org.eclipse.rmf.pror.reqif10/model/configuration.ecore)
  • Now we create the required new Configuration Class
    • Right-Click on the "headline" package
    • Create a new Child of type "EClass"
    • Configure it in the Properties as follows:
      • ESuperTypes: ProRPresentationConfiguration
      • Name: HeadlineConfiguration
  • We may as well add the Attribute for Font Size at this time:
    • Right-Click on HeadlineConfiguration and create a new Child of type EAttribute
      • Name: size
      • EType: EInt
      • Lower Bound: 1 (required field)

Your model editor should look as follows:

Rmf dev pres1.png

Create the GenModel

Here, too, things can go wrong. Pay particular attention to how the referred Models are handled.

  • Create a new "EMF Generator Model"
    • Call it Headline.genmodel and put it into the same folder model where Headline.ecore is stored
    • Select the "Ecore Model" importer
    • Select the Model URI for Headline.ecore model (it it isn't preloaded already). You may have to hit the "Load" button before you can proceed.
    • Pay attention now as the references must be selected correctly. You should be in the "Package Selection". This Dialog has two panes. In the upper pane you should see the headline, configuration and several reqif packages.
    • Use the "Add" button to add the Genmodels for reqif. Therefore, select the reqif.genmodel file from the org.eclipse.rmf.pror.reqif10 plugin. They should now be visible in the lower pane.
    • Check the checkboxes for Configuration and XMLNamespace in the lower pane. As you do this, the packages should disappear from the upper pane.
      • Here is what happened: In the Ecore, we were referencing two models. When we created the Genmodel for Headline, the default would have been to create Genmodels for all three packages. But we only want a Genmodel for Headline. Thus, we have to provide references to existing Genmodels.
    • Last, check the checkbox for Headline in the upper pane. This should enable the "Finish" button
    • Click Finish: The new Genmodel should be open. It should show several package entries. For instance, the entries to Configuration and ReqIF10 should have little arrows, indicating that they are references.
  • We only need to generate the Model and Edit code. By default, the Edit code ends up in a new Plugin Project. This is overkill for such a small project. We will change the configuration to generate the Edit code in the Model Plugin (the one we're currently in).
    • Select the Top-Level element "Headline".
    • Expand the "Edit" section in the Property View. Change the Properties as follows:
        • Edit Plug-in ID: org.eclipse.rmf.pror.reqif10.presentation.headline (remove the training ".edit")
        • Edit Directory: /org.eclipse.rmf.pror.reqif10.presentation.headline/src
      • Now Select the Package "Headline" (just one element below the one you just worked on). Edit in the properties:
        • Base Package: org.eclipse.rmf.pror.presentation (Upon code generation, the package name will be appended. Thus the generated package will be org.eclipse.rmf.pror.presentation.headline)
  • Now we should test our settings.
    • Right-click on the top-level element and select "Generate Model Code"
    • Same with "Generate Edit Code"
    • Note: If you want to generate more, please be sure to configure the project accordingly, unless you want to create new Projects.
    • After the generation, make sure that no new Projects appear in your workspace. Check the source folder, there should be the following four packages:
      • org.eclipse.rmf.pror.presentation.headline (the model interfaces)
      • org.eclipse.rmf.pror.presentation.headline.impl (the model implementation)
      • org.eclipse.rmf.pror.presentation.headline.provider (the ItemProviders, from the Edit generation)
      • org.eclipse.rmf.pror.presentation.headline.util (helper code)
  • Congratulations! You're done with this step.

Extending the Extension Point

Now we will create an extension to tell ProR about the new Presentation:

  • Open the Plugin-Manifest (plugin.xml) or the MANIFEST.MF if no plugin.xml exists
  • Go to Dependencies and add org.eclipse.rmf.pror.reqif10.editor
  • Add a new Extension as follows:

Back to the top