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

Hello AurÃlie,

The given code looks correct. You can check it by printing owned stereotypes of Standard.profile.uml:
System.out.println(mod.getAllAppliedProfiles().get(0).getOwnedStereotypes());
Note, that I take the first, not second, profile here: #get(0).


Can it happen that there are no stereotypes in your profiles?

BTW, this is UML2 Tools newsgroup. Papyrus has its own newsgroup -- http://www.eclipse.org/newsportal/thread.php?group=eclipse.papyrus.

Best wishes,
Tanya.

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).getOwnedStereoty
pes());
} catch (WrappedException we) {
we.printStackTrace();
System.exit(1);
}
}

AurÃlie