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

Difference between revisions of "Capra/CustomTraceabilityMetaModel"

(Added Capra category)
m
 
Line 4: Line 4:
  
 
* Create a Java project and name it <code>org.eclipse.capra.MyTraceabilityMetaModel</code>
 
* Create a Java project and name it <code>org.eclipse.capra.MyTraceabilityMetaModel</code>
* Create a new folder and name it model
+
* Create a new folder in your new project and name it <code>model</code>
* In the model folder create a new file and name it <code>MyTraceabilityMetaModel.xcore</code>. A pop up window will appear asking if you want to add the Xtext nature to the project. Click “Yes”.
+
* In the <code>model</code> folder create a new file and name it <code>MyTraceabilityMetaModel.xcore</code>. 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 “<code>implements</code>” and “<code>tests</code>”
 
* Define your traceability metamodel as required. In our example, we add two types of traceability links i.e “<code>implements</code>” and “<code>tests</code>”
  
 
[[File:traceMetamodelDefinition.png]]
 
[[File:traceMetamodelDefinition.png]]
  
* Open the plugin.xml file of the new project and click on the “Extension Points” tab
+
* Open the <code>plugin.xml</code> 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”
 
* 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 <code>org.eclipse.capra.configuration.traceabilityMetaModel</code>
+
* In the text box for the “Extension point filter” type “traceability” and select <code>org.eclipse.capra.configuration.traceabilityMetaModel</code>
 
* Click Finish.
 
* Click Finish.
 
   
 
   
Line 23: Line 24:
  
 
* Click on the newly created <code>TraceabilityMetaModelAdapter</code>. 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 the newly created <code>TraceabilityMetaModelAdapter</code>. 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
+
* Click on “Class” and a pop up window for creating a new class will appear. Make sure the folder is <code>src</code> and name your class.
  
 
[[File:SelectTraceabilityMetaModelExtensionPointClass.png]]
 
[[File:SelectTraceabilityMetaModelExtensionPointClass.png]]
Line 29: Line 30:
 
[[File:addNewTraceAdapterClass.png]]
 
[[File:addNewTraceAdapterClass.png]]
  
* Click Finish and a class will be created with the methods to be implemented in it.
+
* Click Finish and a class will be created. This class will contain stub implementations of the methods defined in <code>org.eclipse.capra.core.adapters.TraceMetaModelAdapter</code>.
* 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.
+
* 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 <code>org.eclipse.capra.core.adapters.TraceMetaModelAdapter</code>.
  
 
[[Category:Capra]]
 
[[Category:Capra]]

Latest revision as of 06:06, 29 January 2021

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