[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: TableTree Navigation

The ComboBoxCellEditor is ReadOnly (the style)

"Ohad Atia" <ohad@xxxxxxxxxxxxxx> wrote in message
news:bg375b$86n$1@xxxxxxxxxxxxxx
> I have a table tree viewer and i've added navigation abilities to it,
there
> are 5 columns with 4 cell editors:
> null[0], ComboBoxCellEditor[1], TextCellEditor[2-4].
> The problem is: the navigation works well as long as i'm moving from Text
to
> Text or from Text to Combo, when i try to move from Combo to Text the cell
> editor is disabled but the new cell editor doesn't gain focus (the
selection
> seems to be on the entire row again).
> What am i doing wrong? (here is my traverse code, it's called on
setEditors
> method of the viewer)
>
> // Add editors navigation abilities
>
> for (int i = 0; i < editors.length; ++i) {
>
>         if (editors[i] == null)
>
>             continue;
>
>         editors[i].getControl().addTraverseListener(new TraverseListener()
{
>
>                 public void keyTraversed(TraverseEvent e) {
>
>                             int selectionColumn = -1;
>
>                            // Finding Active Cell Editor (find the column
> currently being edited)
>
>                             for (int i = 0; i < getCellEditors().length;
> ++i) {
>
>                                     if (getCellEditors()[i] != null &&
> getCellEditors()[i].isActivated()) {
>
>                                             selectionColumn = i;
>
>                                             break;
>
>                                     }
>
>                             }
>
>                             if (selectionColumn == -1) {
>
>                                     e.doit = false;
>
>                                     return;
>
>                             }
>
>                             Object selectedElem = ((IStructuredSelection)
> getSelection()).getFirstElement();
>
>                             switch (e.detail) {
>
>                             case SWT.TRAVERSE_TAB_NEXT :
>
>                             {
>
>                                 // Find the next editble cell (if there is
> any)
>
>                                 for (int i = selectionColumn;  i <
> getCellEditors().length - 1; ++i) {
>
>                                     // Check the next cell
>
>                                     String columnName =
> getTable().getColumn(i + 1).getText();
>
>                                     if
> (getCellModifier().canModify(selectedElem, columnName)) {
>
>                                         if
> (getCellEditors()[selectionColumn]!= null)
>
>
> getCellEditors()[selectionColumn].deactivate();
>
>                                         editElement(selectedElem, (i +
1));
>
>                                         break;
>
>                                 }
>
>                                 }
>
>                                 break;
>
>                             }
>
>                             case SWT.TRAVERSE_TAB_PREVIOUS :
>
>                             {
>
>                                  // Find the previous editble cell (if
there
> is any)
>
>                                  for (int i = selectionColumn; i > 0; --i)
{
>
>                                     // Check the next cell
>
>                                     String columnName =
> getTable().getColumn(i - 1).getText();
>
>                                     if
> (getCellModifier().canModify(selectedElem, columnName)) {
>
>                                             if
> (getCellEditors()[selectionColumn] != null)
>
>
> getCellEditors()[selectionColumn].deactivate();
>
>                                             editElement(selectedElem, (i -
> 1));
>
>                                             break;
>
>                                     }
>
>                                 }
>
>                                 break;
>
>                                 }
>
>                                 case SWT.TRAVERSE_ARROW_PREVIOUS :
>
>                                 case SWT.TRAVERSE_ARROW_NEXT :
>
>                                 case SWT.TRAVERSE_RETURN :
>
>                                         e.doit = false;
>
>                                         return;
>
>                         }
>
>             e.doit = true;
>
>             }
>
>     });
>
> }
>
>