Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345671 - Use checkbox list as default enum list presentation
Summary: Use checkbox list as default enum list presentation
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2011-05-12 16:57 EDT by Konstantin Komissarchik CLA
Modified: 2021-11-19 09:21 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Komissarchik CLA 2011-05-12 16:57:01 EDT
The existing checkbox list property editor should be the default presentation for enum lists. An enum list is defined as follows:

1. A list property with exactly one possible child element type. 
2. The child element type has exactly one property and it is a value property. 
3. The value property is of enum type and has @NoDuplicates annotation. 

Example:

public enum DispatcherEvent
{
    FORWARD,
    INCLUDE,
    REQUEST,
    ERROR
}

public interface IDispatcherEventRef extends IModelElement
{
    ModelElementType TYPE = new ModelElementType( IDispatcherEventRef.class );
    
    // *** DispatcherEvent ***
    
    @Type( base = DispatcherEvent.class )
    @Required
    @NoDuplicates
    
    ValueProperty PROP_DISPATCHER_EVENT = new ValueProperty( TYPE, "DispatcherEvent" );
    
    Value<DispatcherEvent> getDispatcherEvent();
    void setDispatcherEvent( String value );
    void setDispatcherEvent( DispatcherEvent value );
}

public interface IFilterMapping extends IModelElement
{
    ModelElementType TYPE = new ModelElementType( IFilterMapping .class );

    // *** DispatcherEvents ***
    
    @Type( base = IDispatcherEventRef.class )
    
    ListProperty PROP_DISPATCHER_EVENTS = new ListProperty( TYPE, "DispatcherEvents" );
    
    ModelElementList<IDispatcherEventRef> getDispatcherEvents();

    ...

}
Comment 1 Konstantin Komissarchik CLA 2011-05-12 17:05:55 EDT
Enhancement implemented. Content added to the what's new doc.
Comment 2 Ling Hao CLA 2011-06-09 17:47:28 EDT
Verify that this works as stated in the bug. But this bug is not consistent with the multi-select list (in sapphire-gallery.xml) in which the default presentation is a slush bucket.
Comment 3 Konstantin Komissarchik CLA 2011-06-09 18:06:14 EDT
The difference is warranted in this case. The slush-bucket presentation works better in cases where number of items can be large. The checkbox list works better when the number of items is small. Enums by definition aren't going to have that many items. For an arbitrary value provider scenario, we have no way of knowing the number of items ahead of time, so at least today we default a more general solution.

Closing.
Comment 4 Konstantin Komissarchik CLA 2011-06-10 19:41:33 EDT
This needs to be re-verified due to work on Bug 345672.
Comment 5 Ling Hao CLA 2011-06-10 20:35:30 EDT
Verified in gallery sample.