Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 Tools » apply stereotpe programmaticaly
apply stereotpe programmaticaly [message #646946] Mon, 03 January 2011 12:00 Go to next message
kamel  is currently offline kamel Friend
Messages: 21
Registered: July 2010
Junior Member
hi all member
in my project i have extend the palette of uml2tools (diagram class)
by a new nodes. but the problem is when i drop a tool from palette to the editor i went to apply stereotype to it immediatly.
please someone help me ?
Re: apply stereotpe programmaticaly [message #647228 is a reply to message #646946] Wed, 05 January 2011 08:49 Go to previous messageGo to next message
Peter Mising name is currently offline Peter Mising nameFriend
Messages: 95
Registered: July 2009
Member
Hi,
I solved it with some Code in the *.providers.ElementInitializers Class.
Simply add the Stereotype and check if the profile is applied.
For Example with this Code:
private static Stereotype getStereotypeFromProfile(Element
element,String profileURI,String stereotype) {
org.eclipse.uml2.uml.Package pack=element.getNearestPackage();
Resource resource =
element.eResource().getResourceSet().getResource(URI.createU RI(profileURI),
true);
Profile profile = (Profile) EcoreUtil.getObjectByType(
resource.getContents(), UMLPackage.eINSTANCE.getProfile());
if(profile!=null && !pack.getAllAppliedProfiles().contains(profile)){
pack.applyProfile(profile);
}
return (Stereotype) (profile!=null ?
profile.getPackagedElement(stereotype):null);
}

Am 03.01.2011 13:00, schrieb kamel:
> hi all member
> in my project i have extend the palette of uml2tools (diagram class)
> by a new nodes. but the problem is when i drop a tool from palette to
> the editor i went to apply stereotype to it immediatly.
> please someone help me ?
Re: apply stereotpe programmaticaly [message #647729 is a reply to message #647228] Sat, 08 January 2011 09:12 Go to previous messageGo to next message
kamel  is currently offline kamel Friend
Messages: 21
Registered: July 2010
Junior Member
Thanks peter for your reply
i understand the code but i need know what's the extension point that i can use to modify the ElementInitializers class
Re: apply stereotpe programmaticaly [message #647867 is a reply to message #647729] Mon, 10 January 2011 08:30 Go to previous message
Peter Mising name is currently offline Peter Mising nameFriend
Messages: 95
Registered: July 2009
Member
I've just edited manually. When you change the @generated tag to
@generated NOT it will be not overwrited by regeneration.

Am 08.01.2011 10:12, schrieb kamel:
> Thanks peter for your reply
> i understand the code but i need know what's the extension point that i
> can use to modify the ElementInitializers class
Previous Topic:[Papyrus] isComposite is true per default?
Next Topic:How to install it?
Goto Forum:
  


Current Time: Tue Apr 23 07:17:05 GMT 2024

Powered by FUDForum. Page generated in 0.03070 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top