Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » TreeViewer with TableLayout(Add an icon for each scond-level item and implement the logic of clicking it.)
TreeViewer with TableLayout [message #539549] Fri, 11 June 2010 09:20 Go to next message
Ricky Ru is currently offline Ricky Ru
Messages: 14
Registered: February 2010
Junior Member
Hi friends,

I created a TreeViewer with TableLayout. The business model just has 2 level hierarchy. And I do not display the root element. So, you just can see the second-level items and their leaves. Each element has attributes like name, path, label and so on which are displayed in the table cell. My new requirement is to add a delete icon for each second-level, putting it in the last place(or column if it is) . Then if user click I will remove this element and its children.

But I am not familiar with the UI part. I just know adding an icon is easy(getColumnImage() in the LabelProvider). But I do not know how to listener the user clicking event. Any suggestion is welcome and appreciated.

Thanks,
Ricky
Re: TreeViewer with TableLayout [message #539927 is a reply to message #539549] Mon, 14 June 2010 09:20 Go to previous messageGo to next message
Madhu Samuel is currently offline Madhu Samuel
Messages: 199
Registered: July 2009
Senior Member
On 11-06-2010 14:50, Ricky Ru wrote:
> Hi friends,
>
> I created a TreeViewer with TableLayout. The business model just has 2
> level hierarchy. And I do not display the root element. So, you just can
> see the second-level items and their leaves. Each element has attributes
> like name, path, label and so on which are displayed in the table cell.
> My new requirement is to add a delete icon for each second-level,
> putting it in the last place(or column if it is) . Then if user click I
> will remove this element and its children.
>
> But I am not familiar with the UI part. I just know adding an icon is
> easy(getColumnImage() in the LabelProvider). But I do not know how to
> listener the user clicking event. Any suggestion is welcome and
> appreciated.
>
> Thanks,
> Ricky

You can track user clicks by adding a mouse listener to the tree viewer.
"treeViewer.getTree().addMouseListener(...)"

A better UI design will be provide the delete option inside a context
menu (rather than as an icon). Give the user the option to delete even
using the 'DEL' key. You can track selection changes using
"treeViewer.getTree().addSelectionListener(...)"


Re: TreeViewer with TableLayout [message #540702 is a reply to message #539927] Thu, 17 June 2010 06:47 Go to previous message
Ricky Ru is currently offline Ricky Ru
Messages: 14
Registered: February 2010
Junior Member
Thank you Madhu. Your suggestion is helpful for me.
Previous Topic:Start RCP Plugin without product
Next Topic:Two Masters in MasterDetails Page
Goto Forum:
  


Current Time: Thu Oct 02 12:28:50 GMT 2014

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

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