Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Question to:Recipe:_Create_an_Eclipse_Forms_editor_with_widgets_for_your_propert
Question to:Recipe:_Create_an_Eclipse_Forms_editor_with_widgets_for_your_propert [message #418780] Tue, 29 April 2008 14:08 Go to next message
Jan Kohnert is currently offline Jan KohnertFriend
Messages: 196
Registered: July 2009
Senior Member
Hello,

I've read the voolowing recipe:
http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_an_Eclips e_Forms_editor_with_widgets_for_your_properties

In which the following code snipped is shown:

if (value instanceof String) {
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
for (IItemPropertyDescriptor descriptor2 :
variablePropertyDescriptors) {
if (descriptor2.getId(formula).equals(descriptor.getId(formula) )) {
String newValueText = ((Text) event.widget).getText();
descriptor2.setPropertyValue(formula, newValueText);
}
}
}
});
}

I've parsed my generic editor generated by EMF but did not finde an
variablePropertyDescriptors list in it. Since that list seems to be quite
important I wonder how to acquire it. Or alternatively how to create it
and care for it properly.

Any hints?

Thanks,
Jan
Re: Question to:Recipe:_Create_an_Eclipse_Forms_editor_with_widgets_for_your_propert [message #418782 is a reply to message #418780] Tue, 29 April 2008 14:24 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Jan,

AdapterFactoryItemDelegator has a getPropertyDescriptors method.


Jan Kohnert wrote:
> Hello,
>
> I've read the voolowing recipe:
> http://wiki.eclipse.org/EMF/Recipes#Recipe:_Create_an_Eclips e_Forms_editor_with_widgets_for_your_properties
>
>
> In which the following code snipped is shown:
>
> if (value instanceof String) {
> text.addModifyListener(new ModifyListener() {
> public void modifyText(ModifyEvent event) {
> for (IItemPropertyDescriptor descriptor2 :
> variablePropertyDescriptors) {
> if
> (descriptor2.getId(formula).equals(descriptor.getId(formula) )) {
> String newValueText = ((Text) event.widget).getText();
> descriptor2.setPropertyValue(formula, newValueText);
> }
> }
> }
> });
> }
>
> I've parsed my generic editor generated by EMF but did not finde an
> variablePropertyDescriptors list in it. Since that list seems to be
> quite important I wonder how to acquire it. Or alternatively how to
> create it and care for it properly.
>
> Any hints?
>
> Thanks,
> Jan
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Question to:Recipe:_Create_an_Eclipse_Forms_editor_with_widgets_for_your_pro [message #418863 is a reply to message #418782] Wed, 30 April 2008 08:29 Go to previous messageGo to next message
Jan Kohnert is currently offline Jan KohnertFriend
Messages: 196
Registered: July 2009
Senior Member
Thank you Ed!

When calling 'getPropertyDescriptor()' I've to pass a pbject and a
propertyId. Since the API documentation keeps shtum about what a
propertyId exactly has to be I'd to try around a bit.
I've tried 'ObjectsPackage.Literals.SAMPLE__VOLUME' ,
'ObjectsPackage.Literals.SAMPLE__VOLUME.getFeatureID()' and
'ObjectsPackage.SAMPLE__VOLUME', but each of that solutions always made
getPropertyDescriptor return 'null' :(

What do I have to pass as propertyId?

Thanks!
Re: Question to:Recipe:_Create_an_Eclipse_Forms_editor_with_widgets_for_your_pro [message #418866 is a reply to message #418863] Wed, 30 April 2008 11:38 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Jan,

The property ID is kind of unfortunately just a string, and worse than
that, it's the translated string. :-( I did looked at changing the
getPropertyDescriptor method so it could use either the feature instance
or the string value (returned by
IItemPropertyDescriptor.getId(Object)). That worked nicely, but the
folks asking about it never responded to my proposal, probably because
since IPropertySource itself only has a getDescriptors method, it
doesn't completely eliminate the need to know the ID used for a given
feature (such as when using JFace's new PropertyColumnLabelProvider to
show a table column based on a property descriptor). Maybe what we
ought to provide is a utility that given a feature and a resource
locator, returns the display name and hence the ID for that feature.
I'll talk to Dave about that later today... For now, you could write
your own utility that iterates over all the descriptors and calls
getFeature for each one to match the feature you want...


Jan Kohnert wrote:
> Thank you Ed!
>
> When calling 'getPropertyDescriptor()' I've to pass a pbject and a
> propertyId. Since the API documentation keeps shtum about what a
> propertyId exactly has to be I'd to try around a bit. I've tried
> 'ObjectsPackage.Literals.SAMPLE__VOLUME' ,
> 'ObjectsPackage.Literals.SAMPLE__VOLUME.getFeatureID()' and
> 'ObjectsPackage.SAMPLE__VOLUME', but each of that solutions always
> made getPropertyDescriptor return 'null' :(
>
> What do I have to pass as propertyId?
>
> Thanks!
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Handling multiple root elements with EMF generated editor
Next Topic:Java SDO DataObject does not support java.util.GregorianCalendar ?
Goto Forum:
  


Current Time: Thu Apr 25 23:08:31 GMT 2024

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

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

Back to the top