Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Properties list doesn't update values
Properties list doesn't update values [message #641591] Fri, 26 November 2010 09:02 Go to next message
Luca Gherardi is currently offline Luca GherardiFriend
Messages: 62
Registered: November 2010
Member
Hi all,

I have a model with a class Port that contains a reference to another class named Transform.
I edited the getPropertyDescriptors in the class PortItemProvider in the following way, in order to display the properties of the transorm when I select a port.

@Override
	public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
		if (itemPropertyDescriptors == null) {
			super.getPropertyDescriptors(object);

			addIdPropertyDescriptor(object);
			addTypePropertyDescriptor(object);
			
// edited
			addTransformPropertyDescriptor(((Star.Port)object).getTransform(), 
					getString("_UI_TransformPropertyCategory"));
		}
		return itemPropertyDescriptors;
	}
	
	public void addTransformPropertyDescriptor(Transform trans, final String transformFeature){
		TransformItemProvider transIP 
		= (TransformItemProvider)adapterFactory.adapt(trans,
				IItemPropertySource.class);
		List<IItemPropertyDescriptor> descriptors = transIP.getPropertyDescriptors(trans);
		for(Iterator<IItemPropertyDescriptor> it = descriptors.iterator(); it.hasNext();){
			ItemPropertyDescriptor descriptor = (ItemPropertyDescriptor)it.next();
			itemPropertyDescriptors.add(new ItemPropertyDescriptorDecorator(trans, descriptor)
			{
				public String getCategory(Object thisObject){
					return transformFeature;
				}
				public String getId(Object thisObject){
					return transformFeature + getDisplayName(thisObject);
				}
			});

		}
	}


By the way, whene I select a port only the properties Id and type change their values whereas the transform properties keep the values of the first element that i selected.

How can I solve the problem?
Regards
Luca
Re: Properties list doesn't update values [message #641600 is a reply to message #641591] Fri, 26 November 2010 09:20 Go to previous messageGo to next message
Asiri Rathnayake is currently offline Asiri RathnayakeFriend
Messages: 80
Registered: September 2010
Location: Colombo, Sri Lanka.
Member
Hi,

Can you try resetting itemPropertyDescriptors list like below:

if (itemPropertyDescriptors != null) {
	itemPropertyDescriptors.clear();
}
super.getPropertyDescriptors(object);

// Do your stuff..

Hope this helps!

- Asiri
Re: Properties list doesn't update values [message #641606 is a reply to message #641600] Fri, 26 November 2010 09:38 Go to previous messageGo to next message
Luca Gherardi is currently offline Luca GherardiFriend
Messages: 62
Registered: November 2010
Member
Thanks,

in this way it works.
Anyway when I select a port the method getProperty descriptor is called about 20 times.
Of course it not depends on your hint but I think it isn't very correct. Is it?

Thank you.
Luca
Re: Properties list doesn't update values [message #641610 is a reply to message #641606] Fri, 26 November 2010 09:55 Go to previous message
Asiri Rathnayake is currently offline Asiri RathnayakeFriend
Messages: 80
Registered: September 2010
Location: Colombo, Sri Lanka.
Member
Hi,

Luca wrote on Fri, 26 November 2010 15:08
Anyway when I select a port the method getProperty descriptor is called about 20 times. Of course it not depends on your hint but I think it isn't very correct. Is it?

I'm also not sure why this happens, it's possible that this is a result of request / command pattern but not sure of it. May be an expert can shed some light? Smile

- Asiri
Previous Topic:remove add note from the palette
Next Topic:Import containment feature from file
Goto Forum:
  


Current Time: Sat Apr 20 01:21:00 GMT 2024

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

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

Back to the top