Example usage for org.eclipse.jface.viewers ColumnViewerEditorActivationEvent ColumnViewerEditorActivationEvent

List of usage examples for org.eclipse.jface.viewers ColumnViewerEditorActivationEvent ColumnViewerEditorActivationEvent

Introduction

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

Prototype

public ColumnViewerEditorActivationEvent(ViewerCell cell, TraverseEvent event) 

Source Link

Document

This constructor is used to mark the activation triggered by a traversal

Usage

From source file:com.rcpcompany.uibindings.grid.internal.GridBindingCellInformationImpl.java

License:Open Source License

@Override
public void handleEvent(Event event) {
    // LogUtils.debug(this, "event=" + ToStringUtils.toString(event));

    if (!isChangeable())
        return;//www .j  av  a  2 s.c o  m

    final IObservableValue v = getObjectValue();
    final Object modelType = v.getValueType();

    switch (event.type) {
    case SWT.Selection:
        if (event.detail == SWT.CHECK) {
            // TODO: changeable
            final boolean checkable = modelType == Boolean.class || modelType == Boolean.TYPE;
            if (checkable) {
                v.setValue(v.getValue() != Boolean.TRUE);
            }
        }
        break;
    case SWT.MouseDown:
        getGrid().editCell(this,
                new ColumnViewerEditorActivationEvent(myActivationEventViewerCell, new MouseEvent(event)));
        break;
    case SWT.MouseDoubleClick:
        getGrid().editCell(this,
                new ColumnViewerEditorActivationEvent(myActivationEventViewerCell, new MouseEvent(event)));
        break;
    case SWT.KeyDown:
        final KeyEvent keyEvent = new KeyEvent(event);
        getGrid().editCell(this, new ColumnViewerEditorActivationEvent(myActivationEventViewerCell, keyEvent));
        event.doit = keyEvent.doit;
        break;
    default:
        break;
    }
}

From source file:net.yatomiya.nicherry.ui.views.bbsfilter.BBSFilterViewer.java

License:Open Source License

@Override
protected void hookEditingSupport(Control control) {
    if (getColumnViewerEditor() != null) {
        MouseListener mouseListener = new MouseAdapter() {
            @Override/*from   w ww .  j a v  a 2  s.  co  m*/
            public void mouseDown(MouseEvent e) {
                e.count = 1;

                handleMouseDown(e);
            }

            @Override
            public void mouseDoubleClick(MouseEvent e) {
                handleMouseDown(e);
            }

            private void handleMouseDown(MouseEvent e) {
                ViewerCell cell = getCell(new Point(e.x, e.y));

                if (cell != null) {
                    triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell, e));
                }
            }
        };
        control.addMouseListener(mouseListener);
    }
}

From source file:org.bonitasoft.studio.contract.ui.property.CharriageColumnViewerEditorActivationStrategyTest.java

License:Open Source License

@Test
public void should_isEditorActivationEvent_returns_true_if_pressed_enter_on_a_cell() throws Exception {
    final Event e = new Event();
    e.widget = tree;//from   w  ww .ja  v a  2  s .  c  o  m
    final KeyEvent event = new KeyEvent(e);
    event.keyCode = SWT.CR;
    final ColumnViewerEditorActivationEvent activationEvent = new ColumnViewerEditorActivationEvent(cell,
            event);
    activationEvent.eventType = ColumnViewerEditorActivationEvent.KEY_PRESSED;
    assertThat(contractInputColumnViewerEditorActivationStrategy.isEditorActivationEvent(activationEvent))
            .isTrue();
}

From source file:org.bonitasoft.studio.contract.ui.property.CharriageColumnViewerEditorActivationStrategyTest.java

License:Open Source License

@Test
public void should_isEditorActivationEvent_returns_false_if_pressed_another_key() throws Exception {
    final Event e = new Event();
    e.widget = tree;/*from ww w. java  2  s. c  om*/
    final KeyEvent event = new KeyEvent(e);
    event.keyCode = SWT.ARROW_DOWN;
    final ColumnViewerEditorActivationEvent activationEvent = new ColumnViewerEditorActivationEvent(cell,
            event);
    activationEvent.eventType = ColumnViewerEditorActivationEvent.KEY_PRESSED;
    assertThat(contractInputColumnViewerEditorActivationStrategy.isEditorActivationEvent(activationEvent))
            .isFalse();
}

From source file:org.eclipse.datatools.sqltools.sqlbuilder.views.select.SelectGridViewer.java

License:Open Source License

private void handleMouseUp(MouseEvent e) {
    ViewerCell cell = getCell(new Point(e.x, e.y));

    if (cell != null) {
        triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent(cell, e));
    }// w  w  w.j  a va 2s.  co m
}

From source file:org.robotframework.ide.eclipse.main.plugin.tableeditor.CellsActivationStrategyTest.java

License:Apache License

private static ColumnViewerEditorActivationEvent createEditorActivationEvent(final KeyEvent keyEvent) {
    return new ColumnViewerEditorActivationEvent(mock(ViewerCell.class), keyEvent);
}