Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jwt-dev] Re: pb using aspects example

Hi Benjamin

Benjamin Isnard a écrit :
Hi Marc,

Thanks a lot for your long answer :)
I got the fact that it would be better in my situation to use custom EMF Aspect Model and am working on it. Still some issues/questions about the examples... and the answers to your questions are in the text below. - About the logging example: it works well! :) Just one question: the user who creates a new workflow must activate the profile and the aspect manually. Is there a way to activate a profile by default for all workflows?

Relieved am I about the Logging sample :)

In order to activate a profile "by default", there are workarounds :
* either propose to your users a workflow template that has this profile activated, see http://wiki.eclipse.org/JWT_NewNoteworthy_0_6#Workflow_templates * or develop a new "New [custom] workflow" action and plug it in the action bar using plugin.xml * if you've got ideas on how it would work, I could even help you making the last one flexible and configurable, so it could be used by other people for their own profiles by only configuring the plugin.xml .


- About the dynamic aspect example: What is the difference with static? I tried to make the example plugin work but nothing appears in the 'Custom Properties' tab (for an Action object), after activating the profile/aspect in the 'Manage Workflow Profiles' sheet. I tried to modify the registereddynamicaspect.conf file (in the plugin) by adding to the aspect element the following attributes: autocreated="true" multiple="true". But this didn't change anything. I still don' have the 'New child' entry for aspects when right-clicking on an action.

"Dynamic" custom aspects are an attempt to use "dynamic" EMF, i.e. that is loaded by EMF's generic, reflective API rather than by genmodel-generated java code. Its benefits are that it doesn't require genmodel-configured generation, but to be really useful it would have to make the other plugin stuff easier, for instance by generating a plugin.xml...


- About the static aspect example: some errors at startup:
"The activator org.eclipse.jwt.sample.staticaspect.provider.StaticaspectEdi tPlugin$Implementation for bundle org.eclipse.jwt.sample.staticaspect.edit is invalid" "Section org.eclipse.jwt.sample.staticaspect.edit declares non-existing filter or section class." "Plug-in org.eclipse.jwt.sample.staticaspect.edit was unable to load class org.eclipse.jwt.we.modelext.editors.properties.tabbedPage.Sa mpleStaticAspectPropertySection. "

I guess we didn't test it on 0.7.0 . But if LoggingAspect works you won't miss it. I'll open a bug though.


- About making my own property sheet: if I understood well I should extend class AbstractSingleStaticAspectPropertySection by overriding createControls(..) to change the way my aspect is displayed (eg I want only its name and value). It seems to me I should replace the creation of a ModelPropertySourceProvider object by another one. Is it a good option?

Yep, even further, replace it by a custom wrapper. In order to do that, either extend it to customize it, or replace it by your own PropertySourceProvider implementation that follows the Wrapper pattern and calls ModelPropertySourceProvider for its implementation, except where you want it customized.


Best regards,
Benjamin

Best regards also, and good luck,
Marc



Marc Dutoo wrote:
Hello Benjamin

That's a long email :)

See notes in your text below.

& Could you provide us with your model ? Maybe we'd be able to better help you.

the model I am using is targeted at scientific applications (it derives from a research project: http://gwendia.polytech.unice.fr/doku.php). It uses data flows instead of control flows therefore has many differences with the one used in JWT. For ex. data flows are modeled by links connecting activity (actions) data ports. Each input or output port is typed and has got an additional integer attribute that represents the depth of the data tree (nested arrays of data) that is either produced or used by the port. The data link can be represented in JWT using data items and two reference links, one from the source action, one to the destination; but I don't know yet where to store the integer as there is no concept of port. If an attribute could be added to a reference link that could work.

Again, I'd advise you to send your requests also to the JWT mailing list at mailto:jwt-dev@xxxxxxxxxxx .
OK I'll copy it there.

Good luck !

Regards,
Marc

Benjamin Isnard a écrit :
Hello,

I have some difficulties trying to use the aspects extensions in order to add custom properties to the workflow elements (I'd like to add string properties to applications, guards, subprocesses and references to Data). The doc explains there are different ways to add metamodel extensions so I first tried the key-value option. If another option is better for my purpose (see below) I'd be glad you help me choose it.

Another option would be designing your own EMF Aspect model (see http://wiki.eclipse.org/JWT_Metamodel_Extension#For_developers_:_developing_complex_additional_model_extensions_using_EMF-generated_code ). So you have to have more knowledge of EMF, and develop it as an Eclipse plugin on its own. It is required if you need to have a custom Property UI, or if you need your custom values to be complex, beyond what mere custom Properties allow, ex.
   * an arbitrarily complex EMF subtree
* a Java Enumeration, which allows you to have a drop-down list of values in the editor. See the Loggin sample at http://wiki.eclipse.org/JWT_Metamodel_Extension#Logging_Aspect_sample

Otherwise, if the value types allowed by custom Properties is enough, you don't need it.

Usually, you can start using custom Properties since they require less EMF development, and then switch to designing a custom EMF Aspect model if custom Properties are not enough.

In the example 'activity_property_edited.workflow' of the jwt-conf-property-model plugin, the _conf file contains 3 aspects declarations where the 'Aspect Instance EType' value is either EBoolean, EString or EInt; so it seems it corresponds to the property's type. Conversely in the wiki page on Metamodel extensions, in the paragraph 'Setting up simple (key-value) additional model extensions' it is said the 'Aspect Instance Type' of the property aspect should be 'property:Property'. Both seem to work but this is a bit unclear.

I agree there's not much information about it on the wiki, but it's rather implementation information, which is documented in the source code.

How it works :
* an Aspects is instanciated, according to its Aspect information (and especially by Aspect Instance EType), by its AspectFactory * AspectFactories are registered in the AspectFactoryRegistry through plugin.xml
   * for now there are two AspectFactories :
* one that is used if the Aspect Instance EType is an EClass, that is able to instanciate EClasses. THAT is the one used for custom EMF Aspect models ! See http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jwt/we/jwt-we-conf-model/src/org/eclipse/jwt/we/conf/aspects/factory/internal/?root=Technology_Project * one that is used if Aspect Instance EType is a primitive type i.e. EDataType (like EInt), that is able to instanciate EDataTypes - THAT is the one used by custom Properties ! See http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jwt/we/jwt-we-conf-property-model/src/org/eclipse/jwt/we/conf/aspects/factory/?root=Technology_Project


When I test the example (using v0.7.0 of JWT), some properties appear in the 'Custom Properties' tab of the properties view but not the way I would wait for (property name on the left, value on the right): in the left column I get 3 aspect attribute names (Id, Target Model Element and Value) per aspect, and in the right column the corresponding values of these attributes.

What displays custom Properties in the Property view is the "PropertyTabbedPropertySheetPage" i.e. the custom Property specific property sheet, which is added in the jwt-we-conf-model plugin : http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jwt/we/jwt-we-conf-model.we/plugin.xml?root=Technology_Project&view=markup

Alas, this "PropertyTabbedPropertySheetPage" is a "hack" of some EMF.Edit code, so it does not display names on the left and values on the right, but lists all properties, each one their id (name), element and value in its own block. (name, value) would be better, but REALLY harder to do in a generic manner (for any kind of Aspect).

I think it would be far easier for you to design a custom Aspect and write your own property sheet in SWT than make the existing one work... There's a sample showing how to do it : http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jwt/we/jwt-we-plugins/jwt-we-sample-staticaspect/?root=Technology_Project

there are several ways, ex. you can base your Aspect Property Section on AbstractSingleStaticAspectPropertySection, and maybe hide the Id and Elements by adding a proxy PropertySource .

I've added 2 screenshots at http://wiki.eclipse.org/JWT_Metamodel_Extension .

One problem is that it is not possible to set the property for the new nodes I create (no 'Aspect' entry in the 'New Child' menu for Actions); only in the conf editor I can add new Property, but it is not possible to type in the Id and the Value.

If there's none yet and" "multiple" is at true in the Aspect definition, there should be a "New child" entry. Weird ? Works for me, but maybe I'll have to try that again on a fresh install...

NB. The conf editor is mainly here to help design Aspects, not instanciate them.

Is it possible to have a simpler property view i.e. only property name and value according to the column titles (so one row per property), and how to make it work so that this property appears automatically for all created model elements ?

As said above, either you're an EMF UI guru and you'll hack our "PropertyTabbedPropertySheetPage", or you'll design your own Aspect EMF and SWT UI in its own plugin.


Another problem is that the 'Custom Properties' tab is not refreshed when the selection changes. It keeps the values of the previously selected object.

Again, works for me, I'll have to try it on a fresh install. Events are handled in the AspectEventManager http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jwt/we/jwt-we-conf-model/src/org/eclipse/jwt/we/conf/aspects/event/AspectEventManager.java?root=Technology_Project&view=markup
you could try putting a breakpoint there.


Thanks a lot for your help,
Benjamin Isnard
Sysfera <www.sysfera.com>






Back to the top