Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 276755 - [DataBinding] Snippet to demonstrate data binding a ComboViewer to an enum
Summary: [DataBinding] Snippet to demonstrate data binding a ComboViewer to an enum
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.5 RC3   Edit
Assignee: Matthew Hall CLA
QA Contact: Matthew Hall CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-18 13:25 EDT by Eric Rizzo CLA
Modified: 2009-05-22 23:08 EDT (History)
1 user (show)

See Also:
bokowski: review+
qualidafial: review+


Attachments
Patch against HEAD of project org.eclipse.jface.examples.databinding (9.39 KB, patch)
2009-05-18 13:25 EDT, Eric Rizzo CLA
qualidafial: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Rizzo CLA 2009-05-18 13:25:03 EDT
Created attachment 136210 [details]
Patch against HEAD of project org.eclipse.jface.examples.databinding

Submitting a new JFace DataBinding snippet that demonstrates binding a ComboViewer to a Java enum. This patch changes the org.eclipse.jface.examples.databinding project to be Java 1.5 dependent.
Comment 1 Matthew Hall CLA 2009-05-22 01:37:36 EDT
This patch introduces a new dependency on J2SE 1.5, which in turn causes over 300 new compiler warnings due to generics.

The snippet itself is good, I'm just not sure we want to introduce a 1.5 dependency when none of the other snippets require it.  Maybe comment out the enum and put a Java 1.4-friendly equivalent in its place?  e.g.

  class Person {
    public static final Person Male = new Person("Male");
    public static final Person Female = new Person("Female");
    public static final Person Unknown = new Person("Unknown");
    
    private final String name;
    private Person(String name) {
      this.name = name;
    }
    public String toString() { return name; }
    public static Person[] values() { return new Person[] { Male, Female, Unknown }; }
  }
Comment 2 Matthew Hall CLA 2009-05-22 01:43:20 EDT
Not too late for RC3 since this patch is for non-production code.
Comment 3 Boris Bokowski CLA 2009-05-22 08:47:19 EDT
I would like to see us start using 1.5 in the snippets. I imagine how to bind using enum types is a common question that clients have. How about we move to 1.5 but turn off the warnings for now?
Comment 4 Eric Rizzo CLA 2009-05-22 09:02:29 EDT
Would you like a patch that eliminates the warnings? It's usually not too much work with Quick Fix, and I have some time on my hands thee days...
Comment 5 Matthew Hall CLA 2009-05-22 13:32:41 EDT
No need, I disabled two compiler options for generics and all the warnings went away.  I plan to commit that change along with the patch.

Boris, +1?
Comment 6 Matthew Hall CLA 2009-05-22 13:33:05 EDT
+1 from me.
Comment 7 Matthew Hall CLA 2009-05-22 14:02:43 EDT
Released to HEAD > 20090522
Comment 8 Matthew Hall CLA 2009-05-22 14:03:19 EDT
Thanks for the patch!
Comment 9 Eric Rizzo CLA 2009-05-22 23:08:12 EDT
I've updated http://wiki.eclipse.org/JFace_Data_Binding/Snippets#Viewers to include the new snippet.