1 /*******************************************************************************
2 * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9 package org
.eclipse
.egit
.ui
.internal
.components
;
11 import org
.eclipse
.jface
.viewers
.CellEditor
;
12 import org
.eclipse
.jface
.viewers
.ColumnViewerEditorActivationEvent
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.widgets
.Composite
;
15 import org
.eclipse
.swt
.widgets
.Control
;
16 import org
.eclipse
.swt
.widgets
.Table
;
19 * Workaround class allowing usage of clickable element as a TableViewer cell,
22 * setValue method of EditingSupport is called on cell click, with this cell
26 public class ClickableCellEditor
extends CellEditor
{
29 * Create cell editor for provided table.
34 public ClickableCellEditor(final Table table
) {
35 super(table
, SWT
.NONE
);
39 protected Control
createControl(Composite parent
) {
44 protected Object
doGetValue() {
49 protected void doSetFocus() {
54 protected void doSetValue(Object value
) {
59 public void activate() {
60 // just force setValue on editing support
61 fireApplyEditorValue();
64 public void activate(ColumnViewerEditorActivationEvent activationEvent
) {
65 if (activationEvent
.eventType
!= ColumnViewerEditorActivationEvent
.TRAVERSAL
) {
66 super.activate(activationEvent
);