01: /*******************************************************************************
02: * Copyright (c) 2007 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: ******************************************************************************/package org.eclipse.jface.viewers;
11:
12: import org.eclipse.swt.widgets.Table;
13:
14: /**
15: * This class is responsible to provide the concept of cells for {@link Table}.
16: * This concept is needed to provide features like editor activation with the
17: * keyboard
18: *
19: * @since 3.3
20: *
21: */
22: public class TableViewerFocusCellManager extends SWTFocusCellManager {
23: private static final CellNavigationStrategy TABLE_NAVIGATE = new CellNavigationStrategy();
24:
25: /**
26: * Create a new manager
27: *
28: * @param viewer
29: * the viewer the manager is bound to
30: * @param focusDrawingDelegate
31: * the delegate responsible to highlight selected cell
32: */
33: public TableViewerFocusCellManager(TableViewer viewer,
34: FocusCellHighlighter focusDrawingDelegate) {
35: super (viewer, focusDrawingDelegate, TABLE_NAVIGATE);
36: }
37:
38: ViewerCell getInitialFocusCell() {
39: Table table = (Table) getViewer().getControl();
40:
41: if (table.getItemCount() > 0) {
42: return getViewer().getViewerRowFromItem(table.getItem(0))
43: .getCell(0);
44: }
45:
46: return null;
47: }
48:
49: }
|