Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » How to see Reference's Attributes in Property View?
How to see Reference's Attributes in Property View? [message #144558] Fri, 27 July 2007 11:25 Go to next message
Eclipse UserFriend
Hi people, I'm in a problem that, months ago, Tobias posted here, but I
didn't understand the given solution, can someone help me?

The problem: is there a way to show a reference's or a child's
properties in an element's property view, like it's been in early GMF?

Example:
Class A
String name_a
B ref_b

Class B
String name_b

Property View of A:
name_a:
+ ref_b
name_b

Regards,
Alessander
Re: How to see Reference's Attributes in Property View? [message #149726 is a reply to message #144558] Mon, 10 September 2007 09:29 Go to previous message
Eclipse UserFriend
Originally posted by: tobk.gmx.de

Hello Alessander,

here's my solution. I wrote a new ItemProviderAdapter class overriding the
createItemPropertyDescriptor method that's used throughout the generated
ItemProviderAdapters. In this method the parameters are passed through to a
ItemPropertyDescriptor, which again is customized (in this case as an
anonymous inner class) to override createPropertyValueWrapper() such that
all EObjects are wrapped in a PropertyValueWrapper.

Now all you have to do is to have all your own ItemProviderAdapters extend
(transitively) this class. Unfortunately this means that you have to mark
the class as a whole as @generated NOT, which will prevent new
ItemPropertyDescriptors from being added...

Regards,
Tobias

Here's the code:
public class MyItemProviderAdapter extends ItemProviderAdapter {

public MyItemProviderAdapter(AdapterFactory adapterFactory) {
super(adapterFactory);
}

@Override
protected ItemPropertyDescriptor createItemPropertyDescriptor(
AdapterFactory adapterFactory,
ResourceLocator resourceLocator,
String displayName,
String description,
EStructuralFeature feature,
boolean isSettable,
boolean multiLine,
boolean sortChoices,
Object staticImage,
String category,
String[] filterFlags) {

return new ItemPropertyDescriptor(
adapterFactory,
resourceLocator,
displayName,
description,
feature,
isSettable,
multiLine,
sortChoices,
staticImage,
category,
filterFlags) {

@Override
protected Object createPropertyValueWrapper(Object object,
Object propertyValue) {
if (propertyValue instanceof EObject) {
return new PropertyValueWrapper(adapterFactory, object,
propertyValue, propertyValue);
}
return super.createPropertyValueWrapper(object,
propertyValue);
}
};
}
}



Alessander Botti Benevides wrote:
> Hi people, I'm in a problem that, months ago, Tobias posted here, but I
> didn't understand the given solution, can someone help me?
>
> The problem: is there a way to show a reference's or a child's
> properties in an element's property view, like it's been in early GMF?
>
> Example:
> Class A
> String name_a
> B ref_b
>
> Class B
> String name_b
>
> Property View of A:
> name_a:
> + ref_b
> name_b
>
> Regards,
> Alessander
Previous Topic:rearrange nodes in compartment
Next Topic:Connection between labels
Goto Forum:
  


Current Time: Sat Jul 19 20:23:41 EDT 2025

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

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

Back to the top