CREATING REQIF SPECHIERARCHY AND SPECIFICATIONS PROGRAMMATICALLY [message #1706502] |
Thu, 27 August 2015 12:23 |
Anil Ozturk Messages: 6 Registered: July 2015 |
Junior Member |
|
|
Hi everyone,
I m developing some tools with using RMF. My problem is very clear. I want to add child (specifications or spechiearchies) depend on my select on tree programmatically. I can create specs and spechierarchies using ReqIF10Factory instance but i cannot add them for my selected item's children on tree. Let me show related part of my code to you. Sorry for my English. Any help would be so grateful to me.
private ArrayList<SpecHierarchy> listOfSpecs;
EObject eObject = (EObject) CreatingReqifSpecPage.markTreeViewer.getCheckedElements()[0];
if (eObject instanceof SpecHierarchy) {
SpecHierarchy specHier = (SpecHierarchy) eObject;
EcoreEditor eEditor = (EcoreEditor) Activator.getEditor();
Resource myResource =
eEditor.getEditingDomain().getResourceSet().getResource(EcoreUtil.getURI(eObject), true);
EList<EObject> list = myResource.getContents();
if (list.get(0) instanceof ReqIFImpl) {
ReqIFImpl reqIFimpl = (ReqIFImpl) list.get(0);
EList<Specification> listOfSpecsFake = reqIFimpl.getCoreContent().getSpecifications();
for (Specification specification : listOfSpecsFake) {
EList<SpecHierarchy> listOfSpecHier = specification.getChildren();
for (SpecHierarchy specHierarchy : listOfSpecHier) {
if (specHierarchy.getIdentifier().equals(specHier.getIdentifier())) {
specHierarchy.getChildren().addAll(listOfSpecs);
break;
}
}
}
}
try {
myResource.save(null);
} catch (IOException e) {
e.printStackTrace();
}
[Updated on: Fri, 28 August 2015 13:00] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03959 seconds