views:

636

answers:

0

I have set up the Following:

tv = new TableViewer(tableComposite, SWT.FULL_SELECTION | SWT.BORDER);
...//labelProvider, Properties, etc.

ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(tv) { protected boolean isEditorActivationEvent( ColumnViewerEditorActivationEvent event) { return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_CLICK_SELECTION || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR) || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC; }
};

TableViewerEditor.create(tv, actSupport, ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR| ColumnViewerEditor.KEYBOARD_ACTIVATION);

tv.getColumnViewerEditor().addEditorActivationListener(new ColumnViewerEditorActivationListener() {

  public void afterEditorActivated(
    ColumnViewerEditorActivationEvent event) {

  }

  public void afterEditorDeactivated(
    ColumnViewerEditorDeactivationEvent event) {

  }

  public void beforeEditorActivated(
    ColumnViewerEditorActivationEvent event) {
   ViewerCell cell = (ViewerCell) event.getSource();
   tv.getTable().showColumn(v.getTable().getColumn(cell.getColumnIndex()));
  }

  public void beforeEditorDeactivated(
    ColumnViewerEditorDeactivationEvent event) {

  }

 });

For editing Cells i use EditingSupport. After a set value the editor gets deactivated so : afterEditorDeactivated is triggered. I want now to Invoke the Editor of the next row with the same Column using this code:
tv.editElement(domainobj+1, currentCol);
But here i'm stuck:
1. this "works" only if the columnIndex is a diffrent value than the currentCol Value
2. this does not seem to be intended since when i try to use the Editor invoked it gives me a NPE on ColumnViewerEditor tabeditingListener

So my question is:
Is my apporach to editElement wrong? Wrong Palce or wrong method? Am i using ColumnViewerEditor the right way?
How or when should i trigger editElement (for jumping to the next line after finishing editing current value)

regards andreas