Hi Kim
Great, you did it :)
You're right, you can add this code to your editor instead of to
actions.
I'll add it to the wiki.
Regards,
Marc
Kim Nguyen a écrit :
hi
Marc,
I found the solution now :)
Our editor is extended from JWT WEEditor, so its very easy to activate
the installed profile.
Here is the code
in your Editor class, you should add this code somewhere after the
model is initialized.
EObject model = (EObject) this.getModel();
ConfModel confModel = AspectManager.INSTANCE.getConfModel(model);
Profile profile =
""
"com.client.workflow.plugin.conf.profil");
AspectManager.INSTANCE.activateProfile(model, profile);
Thats all. And it works :)
THank you for helping
Best regard
Kim
Date: Tue, 7 Sep 2010 11:11:48 +0200
From: marc.dutoo@xxxxxxxxxxx
To: kimnguyen@xxxxxxxxxx
CC: jwt-dev@xxxxxxxxxxx
Subject: Re: Extends new attributes for an element
Hi Kim
Does the "autocreated" attribute & feature described at
http://wiki.eclipse.org/JWT_Metamodel_Extension#Additional_features
meet your needs ?
...
OK, I got what you mean. Good question.
I guess the best way is to do it programmatically : if you don't
already have one, create your own "New workflow" action that extends
JWT's, and see in
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jwt/we/jwt-we-conf-model.edit/src/org/eclipse/jwt/we/conf/edit/ui/ManageActivatedProfilesUI.java?view=markup&root=Technology_Project
how to write code that
* create a _conf file for a model that had none : ex.
see enableProfileButton.addListener(SWT.Selection,... =>
ConfModel newlyLoadedConfModel = ConfModelResourceManager.INSTANCE.loadConfModelOfModel(selectedModel, true);
* the profile you want to activate on all models has to be
"installed" in your JWT install (best way is to have a plugin with the
right .conf and extensions in its plugin.xml)
* then "activate" this installed profile so it'll be copied in your
model's _conf file : ex.
see activateInstalledProfileAction =>
AspectManager.INSTANCE.activateProfile(getSelectedModel(), installedProfile);
And it should be OK !
And how to activate a profile on all existing workflows ?
Same idea : customize the "Open" action with code that
* "activates" your installed profile so it'll be copied in your
model's _conf file : ex. see "activateInstalledProfileAction" :
AspectManager.INSTANCE.activateProfile(getSelectedModel(),
installedProfile);
& I've added it to the wiki.
Hope it'll help !
Regards,
Marc
Kim Nguyen a écrit :
Hi
Marc,
I have a question about extension with aspect.
I tried to extend an element with new attributes. So I defined EMF
model which extends AspectInstance. All work well, but if I want to use
new attributes, so I always have to activate the installed profile on
every open workflow (installed profiles (right click to enable)...)
After then is the new attributes active for the element.
Is it possible to config, that the profile always load without
activating profile from user?
Thank you in advance.
Best regards,
Kim
|