|Re: how to make cell editable programmatically [message #633771 is a reply to message #633568]
||Tue, 19 October 2010 11:28
| Daniel KrÃ¼gler
Registered: July 2009
On 18.10.2010 14:38, MohanVaradharajan wrote:|
> hi prasad,
> thanks. i have gone thru those links. but my issue is,
> based on user button selection, i need to enable / disable the cells.
> [Edit button, Apply button]
> for example, when user press edit button, table cells should be
> editable, when user press apply button, the table cells become
As Prasad already explained you need to implement the canModify method
of your ICellModifier implementation. The snippet
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.s nippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippet s/viewers/Snippet009CellEditors.java?view=markup
shows how to use this Eclipse 3.2 Viewer editing API.
If you are using the new Eclipse 3.3. Viewer API you probably will use
EditingSupport implementations. In this case you have to implement its
canEdit method as shown in
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.s nippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippet s/viewers/Snippet024TableViewerExploreNewAPI.java?view=marku p
In principle both approaches are equivalent, but I would use the new
API whenever possible, because it is much more flexible.
It is *your* decision how to bind the button-click event to the return
value of either of these methods. You could use jface databinding or
you could simple do that manually by listening to the selection change
event of the button, changing a corresponding state variable that is
read in the method. It would also be possible to directly read the
button states for radio buttons, check buttons, or toggle buttons.
HTH & Greetings from Bremen,
Powered by FUDForum
. Page generated in 0.02442 seconds