CREATING REQIF SPECHIERARCHY AND SPECIFICATIONS PROGRAMMATICALLY [message #1706502] |
Thu, 27 August 2015 08:23  |
Eclipse User |
|
|
|
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 09:00] by Moderator
|
|
|
|
|
|
Re: CREATING REQIF SPECHIERARCHY AND SPECIFICATIONS PROGRAMMATICALLY [message #1706657 is a reply to message #1706631] |
Fri, 28 August 2015 08:59  |
Eclipse User |
|
|
|
Would you give me some detail about this command ? When i search what you say i found CreateChildCommand but i didnt understand actually how to use it.
When I try use CreateChildCommand.create command, it takes some parameters like these
(EditingDomain domain, Object owner, Object newChildDescriptor, Collection <?> selection)
. I did not understand.
I 've got editing domain from editor, but the others don't make any sense for me.
Especially to put newChildDescriptor I tried use to
CommandParameter(Object owner, Object feature, Object value, Collection<?> collection) . And also I did not understand it.
Please give me more info.
Regards.
Anil.
|
|
|
Powered by
FUDForum. Page generated in 0.03793 seconds