Once a requirements model was exported to ReqIF, the Annotation if the ReqIF file cannot be deleted from the context menu as for other requirements management tools, for which the connection can be closed.
A script was created to release the annotation so that it is not displayed in the model browser anymore and also deleted from the model.
Java Script:
if (!bind) {
throw "This script requires extended API";
}
// bind UI utility (NOT OFFICIAL API YET)
var UI = bind("de.ikv.medini.util.eclipse", "de.ikv.medini.util.eclipse.MediniUIUtil", false);
var EcoreUtil = bind("org.eclipse.emf.ecore", "org.eclipse.emf.ecore.util.EcoreUtil", false);
// @see annotation.js
var Annotation = {
set : EcoreUtil.setAnnotation,
get : EcoreUtil.getAnnotation,
};
function isReqIFproxy(proxy) {
return Annotation.get(proxy, "analyzeSourceTag", "linkedTo") == "ReqIF/RIF";
}
function main() {
var model = selection[0];
//Check that selection is a requirements model
if (model.prototype != Metamodel.safetygoals.SafetyRequirementsModel){
alert("Please select a requirements model");
return;
}
// get all proximodels (including requirements models
var toFix = finder.findByType(Metamodel.projectmodel.PJProxyModel).asList();
// go through the proximodels and check which one is the requirements model in scope (originalModel) and set the annotation to null
for (var i=0;i<toFix.size();i++){
if (toFix.get(i).originalModel==selection[0]){
console.log("found {0}",selection[0].name);
Annotation.set(toFix.get(i), "analyzeSourceTag", "linkedTo", null);
Annotation.set(toFix.get(i), "analyzeSourceTag", "ReqIFSpecID", null);
Annotation.set(toFix.get(i), "analyzeSourceTag", "ReqIFFile", null);
Annotation.set(toFix.get(i), "analyzeSourceTag", "ReqIFUseNameAsID", null);
}
}
}
main();