Hi,
I have to implement a plugin that selected a package inside a UML model creates its fragment (<name package>. uml).
public void save(org.eclipse.uml2.uml.Package pck, URI uri) throws IOException {
Resource resource = _resourceSet.createResource(uri);
resource.getContents().add(pck);
resource.save(null);
}
So we have the UML model and its fragments: MainModel.uml, package1.uml .... packageN.uml
Within MainModel.uml there are the references to other *.uml. For example:
<packagedElement xmi:type="uml:Package" href="package1.uml#_2FI4IDmsEeC4o_pnPrzWXg"/>
This plugin has been implemented with success.
I have to implement also a plugin which achieves the opposite operation: selected a package package1.uml this is inserted within the MainModel.uml
<packagedElement xmi:type="uml:Package" xmi:id="_8X8IYDmrEeC4o_pnPrzWXg" name="package1">
How can I realize this?
Thanks for the help...