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

Capra/CustomTraceabilityMetaModel

Adding a custom Traceability Metamodel

To define your own traceability metamodel follow the steps below:

  • Create a Java project and name it org.eclipse.capra.MyTraceabilityMetaModel
  • Create a new folder in your new project and name it model
  • In the model folder create a new file and name it MyTraceabilityMetaModel.xcore. A pop up window will appear asking if you want to add the Xtext nature to the project. Click “Yes”.
  • Define your traceability metamodel as required. In our example, we add two types of traceability links i.e “implements” and “tests

TraceMetamodelDefinition.png

  • Open the plugin.xml file of the project you just created. This is where you need to register a new metamodel adapter for your traceability metamodel.
  • Click on the “Extension Points” tab.
  • Un-check the check box that says “Show only extension points from the required plugins”
  • In the text box for the “Extension point filter” type “traceability” and select org.eclipse.capra.configuration.traceabilityMetaModel
  • Click Finish.

AddTraceExtension.png

  • Another pop up window will appear asking if you want to add the project org.eclipse.capra.core to the list of plugin dependencies. Click Yes.
  • Right click on the newly added extension, and click on “New” then TraceabilityMetaModelAdapter. A new TraceabilityMetaModelAdapter will be created.

NewTMAdapter.png

  • Click on the newly created TraceabilityMetaModelAdapter. On the right hand side, we need to provide a class for this extension in which we will implement all the required interfaces.
  • Click on “Class” and a pop up window for creating a new class will appear. Make sure the folder is src and name your class.

SelectTraceabilityMetaModelExtensionPointClass.png

AddNewTraceAdapterClass.png

  • Click Finish and a class will be created. This class will contain stub implementations of the methods defined in org.eclipse.capra.core.adapters.TraceMetaModelAdapter.
  • Implement all the methods according to your new custom metamodel. Note that information about what each method does and its parameters can be obtained by hovering the mouse over the respective method name. This will show the JavaDoc of the methods as defined in org.eclipse.capra.core.adapters.TraceMetaModelAdapter.

Back to the top