[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.mdt.uml2tools] getAllAppliedProfile

Hi,

I want to get the profile applied to my model with the function "getAllAppliedProfiles" I obtain the list here under but when I use the function "getOwnedStereotypes()" on these profiles I obtain an empty list.I work with papyrus and my code to load my model is also here under.

getAllAppliedProfiles :

[org.eclipse.uml2.uml.internal.impl.ProfileImpl@2f0d54 (eProxyURI: pathmap://UML_PROFILES/Standard.profile.uml#_0), org.eclipse.uml2.uml.internal.impl.ProfileImpl@1961581 (eProxyURI: resources/MARTE.profile.uml#_EIfnABJeEdy3Td9UhuLFPg), org.eclipse.uml2.uml.internal.impl.ProfileImpl@113beb5 (eProxyURI: resources/MARTE.profile.uml#_5ZCOIAPMEdyuUt-4qHuVvQ), org.eclipse.uml2.uml.internal.impl.ProfileImpl@193f6e2 (eProxyURI: resources/MARTE.profile.uml#_yNSZIAPMEdyuUt-4qHuVvQ), org.eclipse.uml2.uml.internal.impl.ProfileImpl@1e13e07 (eProxyURI: resources/MARTE.profile.uml#_A_vtYBJeEdy3Td9UhuLFPg)]


my code:

public static void main(String[] args) {
URI uri = URI.createURI("essai2/essai2.uml");


try {
ResourceSetImpl resourceSet = new ResourceSetImpl();
// Plug in UML model loader (package and file extension recognition)
resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI,
UMLPackage.eINSTANCE);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
.put(UMLResource.FILE_EXTENSION,
UMLResource.Factory.INSTANCE);
UMLResource resource = (UMLResource) resourceSet.getResource(uri, true);
Model mod=(Model)EcoreUtil.getObjectByType(((Resource) resource).getContents(), UMLPackage.eINSTANCE.getModel());
System.out.println(mod.getAllAppliedProfiles());
System.out.println(mod.getAllAppliedProfiles().get(1).getOwnedStereotypes());
} catch (WrappedException we) {
we.printStackTrace();
System.exit(1);
}



}

Aurélie