My problem is that I'm not able to create a new Operation and add it to the
Class. The Factory requires an EClass for the Create method and an EDataType
for the CreateFromStringMethod.
private void initialiserElement() {
if (this._structuredSelection.size() == 1) {
Object selectedObject = this._structuredSelection.getFirstElement();
EObject selectedEObject =
(EObject)Platform.getAdapterManager().getAdapter(selectedObject,
EObject.class);
if (selectedEObject instanceof
com.borland.tg.emfapi.uml20.classes.Class) {
com.borland.tg.emfapi.uml20.classes.Class classe =
(com.borland.tg.emfapi.uml20.classes.Class)selectedEObject;
com.borland.tg.emfapi.uml20.Uml20Factory factory =
com.borland.tg.emfapi.uml20.Uml20Factory.REGISTRY.getFactory(classe.getIProject(),
classe.getSession());
// don't know what to do with the factory...
}
}
}
Can anyone help?
KernelFactory kFactory =
KernelFactory.REGISTRY.getFactory(classe.getIProject(),
classe.getSession());
TogetherFactory tgFactory =
TogetherFactory.REGISTRY.getFactory(classe.getIProject(),
classe.getSession());
FeaturesFactory fFactory =
FeaturesFactory.REGISTRY.getFactory(classe.getIProject(),
classe.getSession());
PrimitiveTypesRoot tRoot = tgFactory.createPrimitiveTypesRoot();
//create return parameter for operation
Parameter param = kFactory.createParameter();
param.setName("param");
param.setType(tRoot.getPrimitiveType(PrimitiveTypeEnum.get("STRING")));
//create operation
Operation opp = fFactory.createOperation();
opp.setName("myOperation");
opp.setReturnResult(param);
opp.setPropertyValue("stereotype", "bla_bla_bla");
//add this new operation to our class
classe.getFeatures().add(opp);
"Dave Couture" <dave_c...@dmr.ca> wrote in message
news:45c15479$1...@newsgroups.borland.com...
By the way, it is very complicated. I've to develop a plugin that initialize
diagram based on the Fujitsu's Macroscope development method stereotype.
Hard time to come...
Thanks,
Dave
"ElenaA" <Elena.A...@borland.com> a écrit dans le message de news:
45c2f8dd$1...@newsgroups.borland.com...