Results 1 to 2 of 2
  1. #1
    amine2610 is offline Member
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Default table selection in SWT/Jface

    Hi,
    I'm using SWT/Jface, and I created a table viewer, and I set the input to an ArrayList where I have my object
    How can I do to retrieve the selected object in the table.

    thank you very much

  2. #2
    amine2610 is offline Member
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Default

    I found it

    ISelection selection = view.getSite().getSelectionProvider()
    .getSelection();
    List<Person> personList = new ArrayList<Person>();
    if (selection != null && selection instanceof IStructuredSelection) {
    IStructuredSelection sel = (IStructuredSelection) selection;
    for (Iterator<Person> iterator = sel.iterator(); iterator.hasNext();) {
    Person person = (Person) iterator.next();
    personList.add(person);
    }
    }


    thanks

Similar Threads

  1. Jface Viewer help
    By JohnTayler in forum SWT / JFace
    Replies: 2
    Last Post: 04-23-2009, 12:28 AM
  2. SWT JFace bug using context menu
    By xcallmejudasx in forum SWT / JFace
    Replies: 0
    Last Post: 11-14-2008, 05:04 PM
  3. First JFace application
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 09:13 PM
  4. JFace Window
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 09:12 PM
  5. Jface + Gef
    By Eric in forum Advanced Java
    Replies: 1
    Last Post: 07-05-2007, 09:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •