Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » TableViewerImpl - edit element bug?
TableViewerImpl - edit element bug? [message #290002] Tue, 16 August 2005 22:57
Eclipse UserFriend
Originally posted by: bomadapusi75.yahoo.com

I am trying to add a traverse listener on a table. When a row is selected
and someone presses Enter key, then I want the cell editor in the first
column to be activated.

What I did was add a traverse listener to the table as follows

table.addTraverseListener(new TraverseListener(){
public void keyTraversed(TraverseEvent e) {
if(e.detail == SWT.TRAVERSE_RETURN){
e.doit=false;
TableItem tableItem =
table.getItem(table.getSelectionIndex());
tableViewer.editElement(new
StructuredSelection(tableItem.getData()), 1);
}
}
});

But the TableViewerImpl.editElement() returns without activating the cell
editor. Culprit seems to be getSelection(), it returns TabItem[0] (zero
length array) even though a table item is selected. Am I missing something
or is this some kind of bug in the Table.getSelection() method?

TableViewerImpl.editElement()

/**
* Start editing the given element.
*/
public void editElement(Object element, int column) {
if (cellEditor != null)
applyEditorValue();
setSelection(new StructuredSelection(element), true);
Item[] selection = getSelection();
if (selection.length != 1)
return;

tableItem = selection[0];

// Make sure selection is visible
showSelection();
columnNumber = column;
activateCellEditor();

}
Previous Topic:JFace cell editors
Next Topic:Problems when Exporting a Feature
Goto Forum:
  


Current Time: Thu Apr 25 20:51:35 GMT 2024

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

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

Back to the top