Example usage for org.eclipse.jface.viewers ColumnViewerEditor getFocusCell

List of usage examples for org.eclipse.jface.viewers ColumnViewerEditor getFocusCell

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers ColumnViewerEditor getFocusCell.

Prototype

public ViewerCell getFocusCell() 

Source Link

Usage

From source file:com.rcpcompany.uibindings.extests.cutCopyPaste.CopyPasteInViewerTest.java

License:Open Source License

/**
 * Tests the normal OK cases: number to number and number to string.
 *//*from w w w . ja v a 2s .c  o  m*/
@Test
public void testOK() {
    final ColumnViewerEditor columnViewerEditor = myTableViewer.getColumnViewerEditor();
    final EList<IBinding> bindings = myContext.getBindings();
    final Clipboard clipboard = IManager.Factory.getManager().getClipboard();

    /*
     * Check initial state
     */
    yield();
    assertEquals("" + myItem1.getName(), myViewerBinding.getCell(0, 0, true).getDisplayText());
    assertEquals(String.format("%,.2f", myItem1.getPrice()),
            myViewerBinding.getCell(1, 0, true).getDisplayText());
    assertEquals("" + myItem2.getName(), myViewerBinding.getCell(0, 1, true).getDisplayText());
    assertEquals(String.format("%,.2f", myItem2.getPrice()),
            myViewerBinding.getCell(1, 1, true).getDisplayText());

    /*
     * - focus on the table
     */
    assertTrue(myTable.setFocus());
    postMouse(myTable, 1 + myViewerBinding.getFirstTableColumnOffset(), 0);
    yield();
    assertEquals(0, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(1 + myViewerBinding.getFirstTableColumnOffset(),
            columnViewerEditor.getFocusCell().getColumnIndex());

    /*
     * Copy the the price from item 1 to item 2
     */
    postKeyStroke(myTable, "M1+C", myView.getSite(), ViewerCopyHandler.class);
    yield();
    assertEquals(0, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(1 + myViewerBinding.getFirstTableColumnOffset(),
            columnViewerEditor.getFocusCell().getColumnIndex());
    // assertEquals("" + myShopItem1.getPrice(),
    // clipboard.getContents(TextTransfer.getInstance()));
    postKeyStroke(myTable, "ARROW_DOWN");
    yield();
    assertEquals(1, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(1 + myViewerBinding.getFirstTableColumnOffset(),
            columnViewerEditor.getFocusCell().getColumnIndex());
    postKeyStroke(myTable, "M1+V", myView.getSite(), ViewerPasteHandler.class);
    yield();
    assertEquals(1, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(1 + myViewerBinding.getFirstTableColumnOffset(),
            columnViewerEditor.getFocusCell().getColumnIndex());

    assertEquals(myItem1.getPrice(), myItem2.getPrice(), 0.001);

    assertEquals("" + myItem1.getName(), myViewerBinding.getCell(0, 0, true).getDisplayText());
    assertEquals(String.format("%,.2f", myItem1.getPrice()),
            myViewerBinding.getCell(1, 0, true).getDisplayText());
    assertEquals("" + myItem2.getName(), myViewerBinding.getCell(0, 1, true).getDisplayText());
    assertEquals(String.format("%,.2f", myItem2.getPrice()),
            myViewerBinding.getCell(1, 1, true).getDisplayText());

    /*
     * Copy the the price from item 2 to the name of item 2
     */
    postKeyStroke(myTable, "M1+C", myView.getSite(), ViewerCopyHandler.class);
    assertEquals(String.format("%,.2f", myItem2.getPrice()), clipboard.getContents(TextTransfer.getInstance()));
    postKeyStroke(myTable, "ARROW_LEFT");
    yield();
    assertEquals(1, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(0 + myViewerBinding.getFirstTableColumnOffset(),
            columnViewerEditor.getFocusCell().getColumnIndex());
    postKeyStroke(myTable, "M1+V", myView.getSite(), ViewerPasteHandler.class);
    assertEquals(1, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());

    assertEquals(String.format("%,.2f", myItem2.getPrice()), myItem2.getName());

    assertEquals("" + myItem1.getName(), myViewerBinding.getCell(0, 0, true).getDisplayText());
    assertEquals(String.format("%,.2f", myItem1.getPrice()),
            myViewerBinding.getCell(0, 1, true).getDisplayText());
    assertEquals("" + myItem2.getName(), myViewerBinding.getCell(1, 0, true).getDisplayText());
    assertEquals(String.format("%,.2f", myItem2.getPrice()),
            myViewerBinding.getCell(1, 1, true).getDisplayText());
}

From source file:com.rcpcompany.uibindings.extests.cutCopyPaste.CopyPasteInViewerTest.java

License:Open Source License

protected void copyToRelation(String name, ShopItemGroup expectedGroup) {
    final ColumnViewerEditor columnViewerEditor = myTableViewer.getColumnViewerEditor();
    final EList<IBinding> bindings = myContext.getBindings();
    final Clipboard clipboard = IManager.Factory.getManager().getClipboard();

    myItem1.setName(name);/*  www . j a  va2  s. c o m*/
    /*
     * Check initial state
     */
    yield();
    // TODO: does not work any more!
    assertEquals(name, myViewerBinding.getCell(0, 0, true).getDisplayText());

    /*
     * - focus on the table
     */
    assertTrue(myTable.setFocus());
    postMouse(myTable, 0 + myViewerBinding.getFirstTableColumnOffset(), 0);
    yield();
    assertEquals(0, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(0 + myViewerBinding.getFirstTableColumnOffset(),
            columnViewerEditor.getFocusCell().getColumnIndex());

    /*
     * Copy the name to the group for item 1 Should be OK.
     */
    postKeyStroke(myTable, "M1+C", myView.getSite(), ViewerCopyHandler.class);
    yield();
    assertEquals(0, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(0 + myViewerBinding.getFirstTableColumnOffset(),
            columnViewerEditor.getFocusCell().getColumnIndex());
    Object contents = clipboard.getContents(TextTransfer.getInstance());
    if (contents == null) {
        contents = "";
    }
    assertEquals(name, contents);
    postKeyStroke(myTable, "ARROW_RIGHT");
    yield();
    postKeyStroke(myTable, "ARROW_RIGHT");
    yield();
    assertEquals(0, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(2 + myViewerBinding.getFirstTableColumnOffset(),
            columnViewerEditor.getFocusCell().getColumnIndex());
    postKeyStroke(myTable, "M1+V", myView.getSite(), ViewerPasteHandler.class);
    yield();
    assertEquals(0, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(2 + myViewerBinding.getFirstTableColumnOffset(),
            columnViewerEditor.getFocusCell().getColumnIndex());

    assertEquals(expectedGroup, myItem1.getGroup());
}

From source file:com.rcpcompany.uibindings.extests.issues.SIMO182BugInUIBindingForTableCellEditor.java

License:Open Source License

@Test
public void testIssue() {
    final IObservableList list = myViewerBinding.getList();
    assertNotNull(list);/*from   w w w  .ja va  2 s. c  om*/
    final EList<IBinding> bindings = myContext.getBindings();
    assertNotNull(bindings);
    final ColumnViewerEditor columnViewerEditor = myViewer.getColumnViewerEditor();
    assertNotNull(columnViewerEditor);

    assertEquals(0, list.size());
    assertEquals(2, bindings.size());

    sleep(200);

    /*
     * - open Catenary model
     * 
     * - go to line types in the navigator
     * 
     * - double click old line type, and get line type editor for that type
     */
    myView.getSite().getPage().activate(myView);
    myTable.setFocus();
    assertTrue(myTable.isFocusControl());

    myCurrentCountry.add(myShop.getCountries().get(0));
    assertEquals(1, list.size());
    assertEquals(3, bindings.size());
    myBody.layout();
    yield();
    myViewer.setSelection(new StructuredSelection(myShop.getCountries().get(0)));
    yield();
    assertEquals(0, myTable.getSelectionIndex());

    // Click on the item to get the focus cell
    postMouse(myTable, 0 + myViewerBinding.getFirstTableColumnOffset(), 0);
    yield();
    assertTrue(myTable.isFocusControl());
    assertNotNull(columnViewerEditor.getFocusCell());

    /*
     * - create new line type
     */
    final Country country = ShopFactory.eINSTANCE.createCountry();
    country.setName("xxx");
    myShop.getCountries().add(country);
    assertEquals(country, myCountries.get(myCountries.size() - 1));
    yield();
    // set the country of the viewer
    myCurrentCountry.set(0, country);
    yield();
    assertEquals(1, list.size());
    assertNotNull(columnViewerEditor.getFocusCell());

    /*
     * - in line type editor
     * 
     * - go to name field
     */
    assertTrue(myTable.isFocusControl());
    assertEquals(0, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());

    final IColumnBindingCellInformation ci = myNameBinding.getCellInformation(country);
    assertNotNull(ci);
    // Check the text is correct in non-edit mode
    assertEquals(country.getName(), ci.getDisplayText());
    assertTrue(ci.isChangeable());
    // TODO: does not work any more!
    assertEquals(country.getName(), myViewerBinding.getCell(0, 0, true).getDisplayText());

    /*
     * - press return to edit
     */
    assertTrue(myTable.isFocusControl());
    assertEquals(0, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    postKeyStroke(myTable, "ENTER");
    yield();
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(true, myViewer.isCellEditorActive());

    final IValueBinding editBinding = (IValueBinding) bindings.get(bindings.size() - 1);

    final Text t = (Text) editBinding.getControl();
    assertNotNull("edit controll null", t);

    assertEquals(country.getName(), t.getText());// !!!!

    postKeyStroke(myTable, "ESCAPE");
    sleep(100);
    assertEquals(false, myViewer.isCellEditorActive());
}

From source file:com.rcpcompany.uibindings.extests.observables.getset.BasicSetTestViewer.java

License:Open Source License

@Test
public void testValues() {
    final ColumnViewerEditor columnViewerEditor = myTableViewer.getColumnViewerEditor();
    final EList<IBinding> bindings = myContext.getBindings();

    yield();/*from   w w w  .j ava  2s. co  m*/
    // TODO: does not work any more!
    assertEquals(String.format("%,.2f", myShopItem.getPrice()),
            myTable.getItem(0).getText(0 + myViewerBinding.getFirstTableColumnOffset()));

    /*
     * Change the price and check that the cell is also changed
     */
    myShopItem.setPrice(20f);
    yield();
    // TODO: does not work any more!
    assertEquals(String.format("%,.2f", myShopItem.getPrice()),
            myTable.getItem(0).getText(0 + myViewerBinding.getFirstTableColumnOffset()));

    /*
     * - focus on the table
     */
    assertTrue(myTable.setFocus());
    postMouse(myTable, 0 + myViewerBinding.getFirstTableColumnOffset(), 0);
    yield();
    assertEquals(0, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());

    /*
     * - press return to edit
     */
    postKeyStroke(myTable, "ENTER");
    yield();
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(true, myTableViewer.isCellEditorActive());

    IValueBinding editBinding = (IValueBinding) bindings.get(bindings.size() - 1);

    Text t = (Text) editBinding.getControl();
    assertNotNull("edit controll null", t);

    assertEquals(String.format("%,.2f", myShopItem.getPrice()), t.getText());

    /*
     * - Enter new number
     */
    t.setText("30");
    yield();
    assertEquals(30f, myShopItem.getPrice(), 0.001);
    // TODO: does not work any more!
    assertEquals(String.format("%,.2f", myShopItem.getPrice()),
            myTable.getItem(0).getText(0 + myViewerBinding.getFirstTableColumnOffset()));

    /*
     * - cancel edit
     */
    postKeyStroke(myTable, "ESCAPE");
    yield();
    assertEquals(false, myTableViewer.isCellEditorActive());
    assertEquals(20f, myShopItem.getPrice(), 0.001);
    // TODO: does not work any more!
    assertEquals(String.format("%,.2f", myShopItem.getPrice()),
            myTable.getItem(0).getText(0 + myViewerBinding.getFirstTableColumnOffset()));

    /*
     * - press return AGAIN to edit
     */
    assertTrue(myTable.setFocus());
    assertEquals(0, myTable.getSelectionIndex());
    assertNotNull(columnViewerEditor.getFocusCell());
    postKeyStroke(myTable, "ENTER");
    yield();
    assertNotNull(columnViewerEditor.getFocusCell());
    assertEquals(true, myTableViewer.isCellEditorActive());

    editBinding = (IValueBinding) bindings.get(bindings.size() - 1);

    t = (Text) editBinding.getControl();
    assertNotNull("edit controll null", t);

    assertEquals(String.format("%,.2f", myShopItem.getPrice()), t.getText());// !!!!

    /*
     * - Enter new number
     */
    t.setText("40");
    yield();
    assertEquals(40f, myShopItem.getPrice(), 0.001);
    // TODO: does not work any more!
    assertEquals(String.format("%,.2f", myShopItem.getPrice()),
            myTable.getItem(0).getText(0 + myViewerBinding.getFirstTableColumnOffset()));

    /*
     * - commit edit
     */
    postKeyStroke(myTable, "ENTER");
    yield();
    assertEquals(false, myTableViewer.isCellEditorActive());
    assertEquals(40f, myShopItem.getPrice(), 0.001);
    // TODO: does not work any more!
    assertEquals(String.format("%,.2f", myShopItem.getPrice()),
            myTable.getItem(0).getText(0 + myViewerBinding.getFirstTableColumnOffset()));
}

From source file:com.rcpcompany.uibindings.extests.viewerBindings.ViewerCellNavigationStrategyTest.java

License:Open Source License

private void testOne(String stroke, int columnNo, ShopItem si) {
    final ColumnViewerEditor editor = myTable.getBinding().getViewer().getColumnViewerEditor();

    if (stroke != null) {
        final Table t = (Table) myTable.getBinding().getControl();
        postKeyStroke(t, stroke);/*  www. ja v a  2 s  .  co  m*/
    }
    yield();
    assertEquals(myTable.getBinding().getFirstTableColumnOffset() + columnNo,
            editor.getFocusCell().getColumnIndex());
    assertEquals(si, editor.getFocusCell().getElement());
}

From source file:com.rcpcompany.uibindings.extests.viewerBindings.ViewerSingleSelectionTest.java

License:Open Source License

/**
 * @param c the expected selected country
 * @param runnable a {@link Runnable} that will perform the selection
 *///  www . j a  v a2  s . c o m
protected void checkSelection(Country c, Runnable runnable) {
    yield();
    if (runnable != null) {
        final boolean[] selectionChangedSeen = new boolean[] { false };
        final ISelectionChangedListener listener = new ISelectionChangedListener() {
            @Override
            public void selectionChanged(SelectionChangedEvent event) {
                // LogUtils.debug(this, "");
                selectionChangedSeen[0] = true;
            }
        };
        myTableViewer.addSelectionChangedListener(listener);
        assertNoLog(runnable);
        yield();
        myTableViewer.removeSelectionChangedListener(listener);
        assertTrue("no selection change seen", selectionChangedSeen[0]);
    }
    final int i = myShop.getCountries().indexOf(c);
    assertEquals(i, myTable.getSelectionIndex());
    assertArrayEquals(new Object[] { c }, ((IStructuredSelection) myTableViewer.getSelection()).toArray());

    assertEquals(c.getName(), myNameText.getText());

    final ColumnViewerEditor columnViewerEditor = myTableViewer.getColumnViewerEditor();
    assertNotNull(columnViewerEditor);
    final ViewerCell focusCell = columnViewerEditor.getFocusCell();
    assertNotNull(focusCell);
    final ViewerRow viewerRow = focusCell.getViewerRow();
    assertNotNull(viewerRow);
    assertEquals(c, viewerRow.getElement());
}

From source file:com.rcpcompany.uibindings.internal.utils.UIHandlerUtils.java

License:Open Source License

/**
 * Moves the specified element in the viewer of the binding.
 * //from w w  w .  j a va  2  s .com
 * @param vb the viewer binding
 * @param element the element to move
 * @param delta the amount to move
 * @param testOnly <code>true</code> if the move should only be tested for, but not performed
 * @return <code>true</code> if the element could be moved
 */
public static boolean moveElement(IViewerBinding vb, EObject element, int delta, boolean testOnly) {
    if (Activator.getDefault().TRACE_NAVIGATION_VIEWER) {
        LogUtils.debug(vb, "delta=" + delta + ", testOnly=" + testOnly + ", element=" + element);
    }

    Assert.isNotNull(vb);
    if (element == null)
        return false;

    final ColumnViewer viewer = vb.getViewer();
    /*
     * Don't move if there are any sorter or filters installed as these negates the visual
     * effect.
     */
    if (viewer.getComparator() != null || viewer.getFilters().length > 0)
        return false;

    // The list of objects
    final IObservableList list = vb.getList();

    // Old position
    final int oldPosition = list.indexOf(element);
    if (oldPosition == -1)
        return false;

    // New position
    int newPosition = oldPosition + delta;
    if (newPosition < 0) {
        newPosition = 0;
    }
    if (newPosition >= list.size()) {
        newPosition = list.size() - 1;
    }

    // Can not be moved?
    if (oldPosition == newPosition)
        return false;

    // Move it
    if (!testOnly) {
        final ColumnViewerEditor editor = viewer.getColumnViewerEditor();
        final ViewerCell oldFocusCell = editor.getFocusCell();

        list.move(newPosition, oldPosition);

        vb.setFocus(oldFocusCell.getColumnIndex(), element);
        // ((Table) viewer.getControl()).setSelection(newPosition);
    }
    return true;
}

From source file:org.eclipse.rcptt.tesla.internal.ui.processors.CellEditorSupport.java

License:Open Source License

protected Response handleActivateCellEditor(final ActivateCellEditor command) {
    final Element element = command.getElement();
    final SWTUIElement uiElement = getMapper().get(element);
    // Check for already activated
    if (uiElement != null) {
        final int column = command.getColumn();
        if (uiElement.isTree()) {
            final Tree tree = (Tree) unwrapWidget(uiElement);
            final String[] path = uiElement.getPathSelection();
            final Object current = Viewers.getTreeItem(tree, path);
            if (current != null) {
                getPlayer().exec("Run cell editor", new Runnable() {

                    public void run() {
                        final TreeViewer viewer = TeslaSWTAccess.getTreeViewer(tree);

                        if (current instanceof TreeItem && viewer != null) {
                            final TreeItem ti = (TreeItem) current;
                            if (!edit(uiElement, column, viewer, ti))
                                edit(uiElement, column, viewer, ti);

                        }// w ww . j  av a  2 s .co m
                        // Try to check for property pages
                        final Object vv = TeslaSWTAccess.getPropertySheet(tree);
                        final TeslaCellEditorManager instance = TeslaCellEditorManager.getInstance();
                        if (vv != null) {
                            final TreeItem[] selection = tree.getSelection();
                            if (selection.length == 1) {
                                instance.makeNewAsForced(true);
                                TeslaSWTAccess.callHandleSelect(vv, selection);
                                cellEditorActivations.put(uiElement.widget, instance.getLastActivated());
                                instance.makeNewAsForced(false);
                            }
                        }
                    }

                    private boolean edit(final SWTUIElement uiElement, final int column,
                            final TreeViewer viewer, final TreeItem ti) {
                        final TeslaCellEditorManager instance = TeslaCellEditorManager.getInstance();

                        if (viewer.isCellEditorActive()) {
                            CellEditor[] editors = viewer.getCellEditors();
                            if (editors != null && editors.length == 1) {
                                cellEditorActivations.put(uiElement.widget, editors[0]);
                                return true;
                            }
                            ColumnViewerEditor cve = viewer.getColumnViewerEditor();
                            if (cve != null) {
                                if (cve.getFocusCell() != null
                                        && cve.getFocusCell().getColumnIndex() == column) {
                                    CellEditor editor = TeslaSWTAccess.getCellEditorFromColumnEditor(cve);
                                    if (editor != null) {
                                        cellEditorActivations.put(uiElement.widget, editor);
                                        return true;
                                    }
                                } else {
                                    viewer.cancelEditing();
                                }
                            }
                            // viewer.cancelEditing();
                        }
                        try {
                            instance.makeNewAsForced(true);
                            Object toEdit = ti.getData();
                            if (toEdit == null)
                                // TODO: Need a way to activate cell
                                // editor from TableItem without data
                                toEdit = ti;
                            viewer.editElement(toEdit, column);
                            if (instance.getLastActivated() != null) {
                                cellEditorActivations.put(uiElement.widget, instance.getLastActivated());
                            } else {
                                return false;
                            }
                        } finally {
                            instance.makeNewAsForced(false);
                        }
                        return true;
                    }
                });
            }
        } else if (uiElement.isTable()) {
            final Table table = (Table) unwrapWidget(uiElement);
            final String[] path = uiElement.getPathSelection();
            String curPath = "";
            if (path != null && path.length > 0) {
                curPath = path[0];
            }
            final Object current = Viewers.getTableItem(table, curPath);
            if (current != null) {
                final TableViewer viewer = TeslaSWTAccess.getTableViewer(table);
                final TeslaCellEditorManager instance = TeslaCellEditorManager.getInstance();
                if (viewer != null) {
                    getPlayer().exec("Run cell editor", new Runnable() {

                        public void run() {
                            boolean done = false;
                            if (current instanceof TableItem) {
                                final TableItem ti = (TableItem) current;
                                if (ti.getData() != null) {
                                    done = true;
                                    if (viewer.isCellEditorActive()) {
                                        CellEditor[] editors = viewer.getCellEditors();
                                        if (editors != null && editors.length == 1) {
                                            cellEditorActivations.put(uiElement.widget, editors[0]);
                                            return;
                                        }
                                        ColumnViewerEditor cve = viewer.getColumnViewerEditor();
                                        if (cve != null) {
                                            if (cve.getFocusCell() != null
                                                    && cve.getFocusCell().getColumnIndex() == column) {
                                                CellEditor editor = TeslaSWTAccess
                                                        .getCellEditorFromColumnEditor(cve);
                                                if (editor != null) {
                                                    cellEditorActivations.put(uiElement.widget, editor);
                                                    return;
                                                }
                                            } else {
                                                viewer.cancelEditing();
                                            }
                                        }
                                    }
                                    instance.makeNewAsForced(true);
                                    try {
                                        viewer.editElement(ti.getData(), column);
                                        cellEditorActivations.put(uiElement.widget,
                                                instance.getLastActivated());
                                    } finally {
                                        instance.makeNewAsForced(false);
                                    }
                                }
                            }
                            if (!done) {
                                if (viewer.isCellEditorActive()) {
                                    viewer.cancelEditing();
                                }
                                try {
                                    instance.makeNewAsForced(true);
                                    if (current instanceof TableItem
                                            && ((TableItem) current).getData() != null) {
                                        viewer.editElement(((TableItem) current).getData(), column);
                                    } else {
                                        // TODO: Need a way to activate cell
                                        // editor from TableItem without
                                        // data
                                        viewer.editElement(current, column);
                                    }
                                    cellEditorActivations.put(uiElement.widget, instance.getLastActivated());
                                } finally {
                                    instance.makeNewAsForced(false);
                                }
                            }
                        }
                    });
                } else {
                    // Try to check for property pages
                    final Object vv = TeslaSWTAccess.getPropertySheet(table);
                    if (vv != null) {
                        final TableItem[] selection = table.getSelection();
                        if (selection.length == 1) {
                            instance.makeNewAsForced(true);
                            TeslaSWTAccess.callHandleSelect(vv, selection);
                            cellEditorActivations.put(uiElement.widget, instance.getLastActivated());
                            instance.makeNewAsForced(false);
                        }
                    }
                }
            }
        }
    }

    return ProtocolFactory.eINSTANCE.createBooleanResponse();
}

From source file:org.eclipse.rcptt.tesla.recording.core.swt.rap.SWTWidgetLocator.java

License:Open Source License

public int getColumnFromCellEditor(Object cellEditorObj, ControlEditor editor, CellEditor cellEditor) {
    if (editor instanceof TreeEditor) {
        int col = ((TreeEditor) editor).getColumn();
        if (col != -1) {
            return col;
        }//from ww  w.  ja  v  a  2  s .c  o m
    } else if (editor instanceof TableEditor) {
        int col = ((TableEditor) editor).getColumn();
        if (col != -1) {
            return col;
        }
    }
    ColumnViewerEditor cve = null;
    if (cellEditorObj instanceof ColumnViewerEditor) {
        cve = (ColumnViewerEditor) cellEditorObj;
    }
    if (cve == null) {
        cve = getColumnViewerEditor(cellEditor);
    }
    if (cve != null) {
        ViewerCell cell = cve.getFocusCell();
        if (cell != null) {
            return cell.getColumnIndex();
        }
    }
    return -1;
}