Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 355896

Summary: Enum property editor does not respond to changes in DefaultValueService
Product: z_Archived Reporter: Ling Hao <ling.hao>
Component: SapphireAssignee: Project Inbox <sapphire.ui-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: konstantin
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Apply the patch to org.eclipse.sapphire.samples.gallery project none

Description Ling Hao CLA 2011-08-25 17:31:27 EDT

    
Comment 1 Ling Hao CLA 2011-08-25 17:32:39 EDT
Created attachment 202181 [details]
Apply the patch to org.eclipse.sapphire.samples.gallery project
Comment 2 Konstantin Komissarchik CLA 2011-08-25 17:33:29 EDT
This bug is missing problem description...
Comment 3 Ling Hao CLA 2011-08-25 17:39:14 EDT
- Apply the attached patch
- sapphire-gallery.xml -> List Properties -> Hoterogeneous
- create a child element with integer
- String value: root
  Integer value: 1
  Enum value: yes
- create another child element with integer
- String value: child
  Reference: root
  Integer value: 2
  Enum value: maybe
- Go back to root node, and change the integer and enum values
- Go to child node, and notice the default value for integer has been updated,
but not enum. 

I was able to trace the difference to the TextFieldBinding's
DelayedTasksExecutor, but there nothing equivalent in AbstractEnumBinding.

BTW, sorry about the multiple updates.
Comment 4 Konstantin Komissarchik CLA 2011-08-25 17:52:37 EDT
You are still missing the problem statement. Is the issue that if default value is not static (custom DefaultValueService) that enum property editor does not react to changes?
Comment 5 Ling Hao CLA 2011-08-25 17:55:42 EDT
That's right, the enum property does not respond to changes in the DefautValueService.
Comment 6 Konstantin Komissarchik CLA 2011-09-09 13:31:02 EDT
The issue here is that the system needs to know when to re-calculate the default value. The fact that this works with integers is accidental. The repro shouldn't work as written for either one.

What's necessary are @DependsOn declarations on IntegerValue and EnumValue properties:

@DependsOn( { "Reference", "StringValue", "#/IntegerValue" } )
ValueProperty PROP_INTEGER_VALUE = new ValueProperty( TYPE, "IntegerValue" );

@DependsOn( { "Reference", "StringValue", "#/EnumValue" } )
ValueProperty PROP_ENUM_VALUE = new ValueProperty( TYPE, "EnumValue" );

Once I add these annotations, the repro scenario works as intended.

Note that there is weird bug with @DependsOn annotation that I fixed that is related to this. Make sure that you have the fix for Bug 357161 before you try the above resolution.