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

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.

Again, I'd advise you to send your requests also to the JWT mailing list at jwt-dev@xxxxxxxxxxx .

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