Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Treeviewer/-column, celleditor
Treeviewer/-column, celleditor [message #549730] Tue, 27 July 2010 14:16 Go to next message
MoJo is currently offline MoJo
Messages: 7
Registered: July 2010
Junior Member
Hi All,

still new in SWT and still some troubles. And I really hope for some help.

For my current project I use a treeviewer/-column to display a tree in a table. Now, I want to add in the table a button, to give the user the possibility, to delete one row / data record.

A long search through the web didn't result in anything. Can somebody give me a hint, how to do this?

Thanks
Re: Treeviewer/-column, celleditor [message #549857 is a reply to message #549730] Wed, 28 July 2010 04:50 Go to previous messageGo to next message
Eclipse User
Originally posted by: hillner.informatik.uni-leipzig.de

Am 7/27/2010 8:17 PM, schrieb Mark:
> Hi All,
> still new in SWT and still some troubles. And I really hope for some help.
>
> For my current project I use a treeviewer/-column to display a tree in a
> table. Now, I want to add in the table a button, to give the user the
> possibility, to delete one row / data record.
>
> A long search through the web didn't result in anything. Can somebody
> give me a hint, how to do this?
>
> Thanks

Hi,

so do you have a TreeViewer or a TableViewer?
Can you post some code? This would help a lot.
It sounds a bit like you put the TreeViewer into a TableViewer?
Re: Treeviewer/-column, celleditor [message #549914 is a reply to message #549730] Wed, 28 July 2010 08:58 Go to previous message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 27.07.2010 20:17, Mark wrote:
> Hi All,
> still new in SWT and still some troubles. And I really hope for some help.
>
> For my current project I use a treeviewer/-column to display a tree in a
> table. Now, I want to add in the table a button, to give the user the
> possibility, to delete one row / data record.
>
> A long search through the web didn't result in anything. Can somebody
> give me a hint, how to do this?

Check out

http://www.vogella.de/articles/EclipseJFaceTable/article.htm l

The general idea is:

a) Use a label provider that returns an image of the corresponding
image, in your case the image of normal (non-checkbox) button. Follow
PersonLabelProvider#getColumnImage for further reference (You probably
will use a CellLabelProvider, but the key point is, where to return the
image)

b) Provide an EditingSupport that acts on booleans (reflecting the
two diffent states (Search for PersonEditingSupport), here you need
to provide a reasonable CellEditor. I suggest to start with
TextCellEditor, but change the Text widget to a Button. Search for
BooleanCellEditor for a better approximation of that (You find
references to it in jface snippets), or just use

http://www.devdaily.com/java/jwarehouse/eclipse/org.eclipse. jface.snippets/Eclipse-JFace-Snippets/org/eclipse/jface/snip pets/viewers/BooleanCellEditor.java.shtml

With the setValue override of your EditingSupport class you will
finally need to remove the wanted data rows. I suggest to do this in
two steps:

a) Let your data model provide a remove method and call this function
which again sends a model change notification.

b) Let your data model provide registration for model changes and
register your content provider for that. Insider the handler call
viewer.refresh in the UI thread.

For not very advanced situations you can shorten (a) + (b) to:

a') Remove the data from your data model and invoke Viewer.refresh

HTH & Greetings from Bremen,

Daniel Krügler
Previous Topic:Invalid Thread Access on Display.readAndDispatch() (using SWT_AWT)
Next Topic:Auto scroll contents of SWT Browser
Goto Forum:
  


Current Time: Mon Jul 28 00:19:48 EDT 2014

Powered by FUDForum. Page generated in 0.01581 seconds