001: /*******************************************************************************
002: * Copyright (c) 2000, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: * Tom Schindl <tom.schindl@bestsolution.at> - bug 153993
011: *******************************************************************************/package org.eclipse.jface.viewers;
012:
013: import java.util.List;
014:
015: import org.eclipse.swt.SWT;
016: import org.eclipse.swt.custom.TableTree;
017: import org.eclipse.swt.custom.TableTreeEditor;
018: import org.eclipse.swt.custom.TableTreeItem;
019: import org.eclipse.swt.events.FocusAdapter;
020: import org.eclipse.swt.events.FocusEvent;
021: import org.eclipse.swt.events.FocusListener;
022: import org.eclipse.swt.events.MouseAdapter;
023: import org.eclipse.swt.events.MouseEvent;
024: import org.eclipse.swt.events.MouseListener;
025: import org.eclipse.swt.events.TreeListener;
026: import org.eclipse.swt.graphics.Image;
027: import org.eclipse.swt.graphics.Point;
028: import org.eclipse.swt.graphics.Rectangle;
029: import org.eclipse.swt.widgets.Composite;
030: import org.eclipse.swt.widgets.Control;
031: import org.eclipse.swt.widgets.Display;
032: import org.eclipse.swt.widgets.Item;
033: import org.eclipse.swt.widgets.Widget;
034:
035: /**
036: * A concrete viewer based on a SWT <code>TableTree</code> control.
037: * <p>
038: * This class is not intended to be subclassed outside the viewer framework. It
039: * is designed to be instantiated with a pre-existing SWT table tree control and
040: * configured with a domain-specific content provider, label provider, element
041: * filter (optional), and element sorter (optional).
042: * </p>
043: * <p>
044: * Content providers for table tree viewers must implement the
045: * <code>ITreeContentProvider</code> interface.
046: * </p>
047: * <p>
048: * Label providers for table tree viewers must implement either the
049: * <code>ITableLabelProvider</code> or the <code>ILabelProvider</code>
050: * interface (see <code>TableTreeViewer.setLabelProvider</code> for more
051: * details).
052: * </p>
053: *
054: * @deprecated As of 3.1 use {@link TreeViewer} instead
055: */
056: public class TableTreeViewer extends AbstractTreeViewer {
057: /**
058: * Internal table viewer implementation.
059: */
060: private TableTreeEditorImpl tableEditorImpl;
061:
062: /**
063: * This viewer's table tree control.
064: */
065: private TableTree tableTree;
066:
067: /**
068: * This viewer's table tree editor.
069: */
070: private TableTreeEditor tableTreeEditor;
071:
072: /**
073: * Copied from original TableEditorImpl and moved here since refactoring
074: * completely wiped out the original implementation in 3.3
075: *
076: * @since 3.1
077: */
078: class TableTreeEditorImpl {
079:
080: private CellEditor cellEditor;
081:
082: private CellEditor[] cellEditors;
083:
084: private ICellModifier cellModifier;
085:
086: private String[] columnProperties;
087:
088: private Item tableItem;
089:
090: private int columnNumber;
091:
092: private ICellEditorListener cellEditorListener;
093:
094: private FocusListener focusListener;
095:
096: private MouseListener mouseListener;
097:
098: private int doubleClickExpirationTime;
099:
100: private ColumnViewer viewer;
101:
102: private TableTreeEditorImpl(ColumnViewer viewer) {
103: this .viewer = viewer;
104: initCellEditorListener();
105: }
106:
107: /**
108: * Returns this <code>TableViewerImpl</code> viewer
109: *
110: * @return the viewer
111: */
112: public ColumnViewer getViewer() {
113: return viewer;
114: }
115:
116: private void activateCellEditor() {
117: if (cellEditors != null) {
118: if (cellEditors[columnNumber] != null
119: && cellModifier != null) {
120: Object element = tableItem.getData();
121: String property = columnProperties[columnNumber];
122:
123: if (cellModifier.canModify(element, property)) {
124: cellEditor = cellEditors[columnNumber];
125:
126: cellEditor.addListener(cellEditorListener);
127:
128: Object value = cellModifier.getValue(element,
129: property);
130: cellEditor.setValue(value);
131: // Tricky flow of control here:
132: // activate() can trigger callback to cellEditorListener
133: // which will clear cellEditor
134: // so must get control first, but must still call activate()
135: // even if there is no control.
136: final Control control = cellEditor.getControl();
137: cellEditor.activate();
138: if (control == null) {
139: return;
140: }
141: setLayoutData(cellEditor.getLayoutData());
142: setEditor(control, tableItem, columnNumber);
143: cellEditor.setFocus();
144: if (focusListener == null) {
145: focusListener = new FocusAdapter() {
146: public void focusLost(FocusEvent e) {
147: applyEditorValue();
148: }
149: };
150: }
151: control.addFocusListener(focusListener);
152: mouseListener = new MouseAdapter() {
153: public void mouseDown(MouseEvent e) {
154: // time wrap?
155: // check for expiration of doubleClickTime
156: if (e.time <= doubleClickExpirationTime) {
157: control
158: .removeMouseListener(mouseListener);
159: cancelEditing();
160: handleDoubleClickEvent();
161: } else if (mouseListener != null) {
162: control
163: .removeMouseListener(mouseListener);
164: }
165: }
166: };
167: control.addMouseListener(mouseListener);
168: }
169: }
170: }
171: }
172:
173: /**
174: * Activate a cell editor for the given mouse position.
175: */
176: private void activateCellEditor(MouseEvent event) {
177: if (tableItem == null || tableItem.isDisposed()) {
178: // item no longer exists
179: return;
180: }
181: int columnToEdit;
182: int columns = getColumnCount();
183: if (columns == 0) {
184: // If no TableColumn, Table acts as if it has a single column
185: // which takes the whole width.
186: columnToEdit = 0;
187: } else {
188: columnToEdit = -1;
189: for (int i = 0; i < columns; i++) {
190: Rectangle bounds = getBounds(tableItem, i);
191: if (bounds.contains(event.x, event.y)) {
192: columnToEdit = i;
193: break;
194: }
195: }
196: if (columnToEdit == -1) {
197: return;
198: }
199: }
200:
201: columnNumber = columnToEdit;
202: activateCellEditor();
203: }
204:
205: /**
206: * Deactivates the currently active cell editor.
207: */
208: public void applyEditorValue() {
209: CellEditor c = this .cellEditor;
210: if (c != null) {
211: // null out cell editor before calling save
212: // in case save results in applyEditorValue being re-entered
213: // see 1GAHI8Z: ITPUI:ALL - How to code event notification when
214: // using cell editor ?
215: this .cellEditor = null;
216: Item t = this .tableItem;
217: // don't null out table item -- same item is still selected
218: if (t != null && !t.isDisposed()) {
219: saveEditorValue(c, t);
220: }
221: setEditor(null, null, 0);
222: c.removeListener(cellEditorListener);
223: Control control = c.getControl();
224: if (control != null) {
225: if (mouseListener != null) {
226: control.removeMouseListener(mouseListener);
227: }
228: if (focusListener != null) {
229: control.removeFocusListener(focusListener);
230: }
231: }
232: c.deactivate();
233: }
234: }
235:
236: /**
237: * Cancels the active cell editor, without saving the value back to the
238: * domain model.
239: */
240: public void cancelEditing() {
241: if (cellEditor != null) {
242: setEditor(null, null, 0);
243: cellEditor.removeListener(cellEditorListener);
244: CellEditor oldEditor = cellEditor;
245: cellEditor = null;
246: oldEditor.deactivate();
247: }
248: }
249:
250: /**
251: * Start editing the given element.
252: *
253: * @param element
254: * @param column
255: */
256: public void editElement(Object element, int column) {
257: if (cellEditor != null) {
258: applyEditorValue();
259: }
260:
261: setSelection(new StructuredSelection(element), true);
262: Item[] selection = getSelection();
263: if (selection.length != 1) {
264: return;
265: }
266:
267: tableItem = selection[0];
268:
269: // Make sure selection is visible
270: showSelection();
271: columnNumber = column;
272: activateCellEditor();
273:
274: }
275:
276: /**
277: * Return the array of CellEditors used in the viewer
278: *
279: * @return the cell editors
280: */
281: public CellEditor[] getCellEditors() {
282: return cellEditors;
283: }
284:
285: /**
286: * Get the cell modifier
287: *
288: * @return the cell modifier
289: */
290: public ICellModifier getCellModifier() {
291: return cellModifier;
292: }
293:
294: /**
295: * Return the properties for the column
296: *
297: * @return the array of column properties
298: */
299: public Object[] getColumnProperties() {
300: return columnProperties;
301: }
302:
303: /**
304: * Handles the mouse down event; activates the cell editor.
305: *
306: * @param event
307: * the mouse event that should be handled
308: */
309: public void handleMouseDown(MouseEvent event) {
310: if (event.button != 1) {
311: return;
312: }
313:
314: if (cellEditor != null) {
315: applyEditorValue();
316: }
317:
318: // activate the cell editor immediately. If a second mouseDown
319: // is received prior to the expiration of the doubleClick time then
320: // the cell editor will be deactivated and a doubleClick event will
321: // be processed.
322: //
323: doubleClickExpirationTime = event.time
324: + Display.getCurrent().getDoubleClickTime();
325:
326: Item[] items = getSelection();
327: // Do not edit if more than one row is selected.
328: if (items.length != 1) {
329: tableItem = null;
330: return;
331: }
332: tableItem = items[0];
333:
334: activateCellEditor(event);
335: }
336:
337: private void initCellEditorListener() {
338: cellEditorListener = new ICellEditorListener() {
339: public void editorValueChanged(boolean oldValidState,
340: boolean newValidState) {
341: // Ignore.
342: }
343:
344: public void cancelEditor() {
345: TableTreeEditorImpl.this .cancelEditing();
346: }
347:
348: public void applyEditorValue() {
349: TableTreeEditorImpl.this .applyEditorValue();
350: }
351: };
352: }
353:
354: /**
355: * Return whether there is an active cell editor.
356: *
357: * @return <code>true</code> if there is an active cell editor;
358: * otherwise <code>false</code> is returned.
359: */
360: public boolean isCellEditorActive() {
361: return cellEditor != null;
362: }
363:
364: /**
365: * Saves the value of the currently active cell editor, by delegating to
366: * the cell modifier.
367: */
368: private void saveEditorValue(CellEditor cellEditor,
369: Item tableItem) {
370: if (cellModifier != null) {
371: if (!cellEditor.isValueValid()) {
372: // Do what????
373: }
374: }
375: String property = null;
376:
377: if (columnProperties != null
378: && columnNumber < columnProperties.length) {
379: property = columnProperties[columnNumber];
380: }
381: cellModifier.modify(tableItem, property, cellEditor
382: .getValue());
383: }
384:
385: /**
386: * Set the cell editors
387: *
388: * @param editors
389: */
390: public void setCellEditors(CellEditor[] editors) {
391: this .cellEditors = editors;
392: }
393:
394: /**
395: * Set the cell modifier
396: *
397: * @param modifier
398: */
399: public void setCellModifier(ICellModifier modifier) {
400: this .cellModifier = modifier;
401: }
402:
403: /**
404: * Set the column properties
405: *
406: * @param columnProperties
407: */
408: public void setColumnProperties(String[] columnProperties) {
409: this .columnProperties = columnProperties;
410: }
411:
412: Rectangle getBounds(Item item, int columnNumber) {
413: return ((TableTreeItem) item).getBounds(columnNumber);
414: }
415:
416: int getColumnCount() {
417: // getColumnCount() should be a API in TableTree.
418: return getTableTree().getTable().getColumnCount();
419: }
420:
421: Item[] getSelection() {
422: return getTableTree().getSelection();
423: }
424:
425: void setEditor(Control w, Item item, int columnNumber) {
426: tableTreeEditor.setEditor(w, (TableTreeItem) item,
427: columnNumber);
428: }
429:
430: void setSelection(StructuredSelection selection, boolean b) {
431: TableTreeViewer.this .setSelection(selection, b);
432: }
433:
434: void showSelection() {
435: getTableTree().showSelection();
436: }
437:
438: void setLayoutData(CellEditor.LayoutData layoutData) {
439: tableTreeEditor.horizontalAlignment = layoutData.horizontalAlignment;
440: tableTreeEditor.grabHorizontal = layoutData.grabHorizontal;
441: tableTreeEditor.minimumWidth = layoutData.minimumWidth;
442: }
443:
444: void handleDoubleClickEvent() {
445: Viewer viewer = getViewer();
446: fireDoubleClick(new DoubleClickEvent(viewer, viewer
447: .getSelection()));
448: fireOpen(new OpenEvent(viewer, viewer.getSelection()));
449: }
450: }
451:
452: /**
453: * Creates a table tree viewer on the given table tree control. The viewer
454: * has no input, no content provider, a default label provider, no sorter,
455: * and no filters.
456: *
457: * @param tree
458: * the table tree control
459: */
460: public TableTreeViewer(TableTree tree) {
461: super ();
462: tableTree = tree;
463: hookControl(tree);
464: tableTreeEditor = new TableTreeEditor(tableTree);
465: tableEditorImpl = new TableTreeEditorImpl(this );
466: }
467:
468: /**
469: * Creates a table tree viewer on a newly-created table tree control under
470: * the given parent. The table tree control is created using the SWT style
471: * bits <code>MULTI, H_SCROLL, V_SCROLL, and BORDER</code>. The viewer
472: * has no input, no content provider, a default label provider, no sorter,
473: * and no filters.
474: *
475: * @param parent
476: * the parent control
477: */
478: public TableTreeViewer(Composite parent) {
479: this (parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL
480: | SWT.BORDER);
481: }
482:
483: /**
484: * Creates a table tree viewer on a newly-created table tree control under
485: * the given parent. The table tree control is created using the given SWT
486: * style bits. The viewer has no input, no content provider, a default label
487: * provider, no sorter, and no filters.
488: *
489: * @param parent
490: * the parent control
491: * @param style
492: * the SWT style bits
493: */
494: public TableTreeViewer(Composite parent, int style) {
495: this (new TableTree(parent, style));
496: }
497:
498: /*
499: * (non-Javadoc) Method declared on AbstractTreeViewer.
500: */
501: protected void addTreeListener(Control c, TreeListener listener) {
502: ((TableTree) c).addTreeListener(listener);
503: }
504:
505: /**
506: * Cancels a currently active cell editor. All changes already done in the
507: * cell editor are lost.
508: */
509: public void cancelEditing() {
510: tableEditorImpl.cancelEditing();
511: }
512:
513: /*
514: * (non-Javadoc) Method declared on AbstractTreeViewer.
515: */
516: protected void doUpdateItem(Item item, Object element) {
517: // update icon and label
518: // Similar code in TableTreeViewer.doUpdateItem()
519: IBaseLabelProvider prov = getLabelProvider();
520: ITableLabelProvider tprov = null;
521:
522: if (prov instanceof ITableLabelProvider) {
523: tprov = (ITableLabelProvider) prov;
524: }
525:
526: int columnCount = tableTree.getTable().getColumnCount();
527: TableTreeItem ti = (TableTreeItem) item;
528: // Also enter loop if no columns added. See 1G9WWGZ: JFUIF:WINNT -
529: // TableViewer with 0 columns does not work
530: for (int column = 0; column < columnCount || column == 0; column++) {
531: String text = "";//$NON-NLS-1$
532: Image image = null;
533: if (tprov != null) {
534: text = tprov.getColumnText(element, column);
535: image = tprov.getColumnImage(element, column);
536: } else {
537: if (column == 0) {
538: ViewerLabel updateLabel = new ViewerLabel(item
539: .getText(), item.getImage());
540: buildLabel(updateLabel, element);
541:
542: // As it is possible for user code to run the event
543: // loop check here.
544: if (item.isDisposed()) {
545: unmapElement(element, item);
546: return;
547: }
548:
549: text = updateLabel.getText();
550: image = updateLabel.getImage();
551: }
552: }
553:
554: // Avoid setting text to null
555: if (text == null) {
556: text = ""; //$NON-NLS-1$
557: }
558:
559: ti.setText(column, text);
560: // Apparently a problem to setImage to null if already null
561: if (ti.getImage(column) != image) {
562: ti.setImage(column, image);
563: }
564:
565: getColorAndFontCollector().setFontsAndColors(element);
566: getColorAndFontCollector().applyFontsAndColors(ti);
567: }
568:
569: }
570:
571: /**
572: * Starts editing the given element.
573: *
574: * @param element
575: * the element
576: * @param column
577: * the column number
578: */
579: public void editElement(Object element, int column) {
580: tableEditorImpl.editElement(element, column);
581: }
582:
583: /**
584: * Returns the cell editors of this viewer.
585: *
586: * @return the list of cell editors
587: */
588: public CellEditor[] getCellEditors() {
589: return tableEditorImpl.getCellEditors();
590: }
591:
592: /**
593: * Returns the cell modifier of this viewer.
594: *
595: * @return the cell modifier
596: */
597: public ICellModifier getCellModifier() {
598: return tableEditorImpl.getCellModifier();
599: }
600:
601: /*
602: * (non-Javadoc) Method declared on AbstractTreeViewer.
603: */
604: protected Item[] getChildren(Widget o) {
605: if (o instanceof TableTreeItem) {
606: return ((TableTreeItem) o).getItems();
607: }
608: if (o instanceof TableTree) {
609: return ((TableTree) o).getItems();
610: }
611: return null;
612: }
613:
614: /*
615: * (non-Javadoc)
616: *
617: * @see org.eclipse.jface.viewers.AbstractTreeViewer#getChild(org.eclipse.swt.widgets.Widget,
618: * int)
619: */
620: protected Item getChild(Widget widget, int index) {
621: if (widget instanceof TableTreeItem) {
622: return ((TableTreeItem) widget).getItem(index);
623: }
624: if (widget instanceof TableTree) {
625: return ((TableTree) widget).getItem(index);
626: }
627: return null;
628: }
629:
630: /**
631: * Returns the column properties of this viewer. The properties must
632: * correspond with the columns of the table control. They are used to
633: * identify the column in a cell modifier.
634: *
635: * @return the list of column properties
636: */
637: public Object[] getColumnProperties() {
638: return tableEditorImpl.getColumnProperties();
639: }
640:
641: /*
642: * (non-Javadoc) Method declared on Viewer.
643: */
644: public Control getControl() {
645: return tableTree;
646: }
647:
648: /**
649: * Returns the element with the given index from this viewer. Returns
650: * <code>null</code> if the index is out of range.
651: * <p>
652: * This method is internal to the framework.
653: * </p>
654: *
655: * @param index
656: * the zero-based index
657: * @return the element at the given index, or <code>null</code> if the
658: * index is out of range
659: */
660: public Object getElementAt(int index) {
661: // XXX: Workaround for 1GBCSB1: SWT:WIN2000 - TableTree should have
662: // getItem(int index)
663: TableTreeItem i = tableTree.getItems()[index];
664: if (i != null) {
665: return i.getData();
666: }
667: return null;
668: }
669:
670: /*
671: * (non-Javadoc) Method declared on AbstractTreeViewer.
672: */
673: protected boolean getExpanded(Item item) {
674: return ((TableTreeItem) item).getExpanded();
675: }
676:
677: /*
678: * (non-Javadoc)
679: *
680: * @see org.eclipse.jface.viewers.ColumnViewer#getItemAt(org.eclipse.swt.graphics.Point)
681: */
682: protected Item getItemAt(Point p) {
683: return getTableTree().getTable().getItem(p);
684: }
685:
686: /*
687: * (non-Javadoc) Method declared on AbstractTreeViewer.
688: */
689: protected int getItemCount(Control widget) {
690: return ((TableTree) widget).getItemCount();
691: }
692:
693: /*
694: * (non-Javadoc) Method declared on AbstractTreeViewer.
695: */
696: protected int getItemCount(Item item) {
697: return ((TableTreeItem) item).getItemCount();
698: }
699:
700: /*
701: * (non-Javadoc) Method declared on AbstractTreeViewer.
702: */
703: protected org.eclipse.swt.widgets.Item[] getItems(
704: org.eclipse.swt.widgets.Item item) {
705: return ((TableTreeItem) item).getItems();
706: }
707:
708: /**
709: * The table tree viewer implementation of this <code>Viewer</code>
710: * framework method returns the label provider, which in the case of table
711: * tree viewers will be an instance of either
712: * <code>ITableLabelProvider</code> or <code>ILabelProvider</code>. If
713: * it is an <code>ITableLabelProvider</code>, then it provides a separate
714: * label text and image for each column. If it is an
715: * <code>ILabelProvider</code>, then it provides only the label text and
716: * image for the first column, and any remaining columns are blank.
717: */
718: public IBaseLabelProvider getLabelProvider() {
719: return super .getLabelProvider();
720: }
721:
722: /*
723: * (non-Javadoc) Method declared on AbstractTreeViewer.
724: */
725: protected Item getParentItem(Item item) {
726: return ((TableTreeItem) item).getParentItem();
727: }
728:
729: /*
730: * (non-Javadoc) Method declared on AbstractTreeViewer.
731: */
732: protected Item[] getSelection(Control widget) {
733: return ((TableTree) widget).getSelection();
734: }
735:
736: /**
737: * Returns this table tree viewer's table tree control.
738: *
739: * @return the table tree control
740: */
741: public TableTree getTableTree() {
742: return tableTree;
743: }
744:
745: /*
746: * (non-Javadoc) Method declared on AbstractTreeViewer.
747: */
748: protected void hookControl(Control control) {
749: super .hookControl(control);
750: tableTree.getTable().addMouseListener(new MouseAdapter() {
751: public void mouseDown(MouseEvent e) {
752: /*
753: * If user clicked on the [+] or [-], do not activate
754: * CellEditor.
755: */
756: // XXX: This code should not be here. SWT should either have
757: // support to see
758: // if the user clicked on the [+]/[-] or manage the table editor
759: // activation
760: org.eclipse.swt.widgets.TableItem[] items = tableTree
761: .getTable().getItems();
762: for (int i = 0; i < items.length; i++) {
763: Rectangle rect = items[i].getImageBounds(0);
764: if (rect.contains(e.x, e.y)) {
765: return;
766: }
767: }
768:
769: tableEditorImpl.handleMouseDown(e);
770: }
771: });
772: }
773:
774: /**
775: * Returns whether there is an active cell editor.
776: *
777: * @return <code>true</code> if there is an active cell editor, and
778: * <code>false</code> otherwise
779: */
780: public boolean isCellEditorActive() {
781: return tableEditorImpl.isCellEditorActive();
782: }
783:
784: /*
785: * (non-Javadoc) Method declared in AbstractTreeViewer.
786: */
787: protected Item newItem(Widget parent, int flags, int ix) {
788: TableTreeItem item;
789: if (ix >= 0) {
790: if (parent instanceof TableTreeItem) {
791: item = new TableTreeItem((TableTreeItem) parent, flags,
792: ix);
793: } else {
794: item = new TableTreeItem((TableTree) parent, flags, ix);
795: }
796: } else {
797: if (parent instanceof TableTreeItem) {
798: item = new TableTreeItem((TableTreeItem) parent, flags);
799: } else {
800: item = new TableTreeItem((TableTree) parent, flags);
801: }
802: }
803: return item;
804: }
805:
806: /*
807: * (non-Javadoc) Method declared in AbstractTreeViewer.
808: */
809: protected void removeAll(Control widget) {
810: ((TableTree) widget).removeAll();
811: }
812:
813: /**
814: * Sets the cell editors of this table viewer.
815: *
816: * @param editors
817: * the list of cell editors
818: */
819: public void setCellEditors(CellEditor[] editors) {
820: tableEditorImpl.setCellEditors(editors);
821: }
822:
823: /**
824: * Sets the cell modifier of this table viewer.
825: *
826: * @param modifier
827: * the cell modifier
828: */
829: public void setCellModifier(ICellModifier modifier) {
830: tableEditorImpl.setCellModifier(modifier);
831: }
832:
833: /**
834: * Sets the column properties of this table viewer. The properties must
835: * correspond with the columns of the table control. They are used to
836: * identify the column in a cell modifier.
837: *
838: * @param columnProperties
839: * the list of column properties
840: */
841: public void setColumnProperties(String[] columnProperties) {
842: tableEditorImpl.setColumnProperties(columnProperties);
843: }
844:
845: /*
846: * (non-Javadoc) Method declared in AbstractTreeViewer.
847: */
848: protected void setExpanded(Item node, boolean expand) {
849: ((TableTreeItem) node).setExpanded(expand);
850: }
851:
852: /*
853: * (non-Javadoc) Method declared in AbstractTreeViewer.
854: */
855: protected void setSelection(List items) {
856: TableTreeItem[] newItems = new TableTreeItem[items.size()];
857: items.toArray(newItems);
858: getTableTree().setSelection(newItems);
859: }
860:
861: /*
862: * (non-Javadoc) Method declared in AbstractTreeViewer.
863: */
864: protected void showItem(Item item) {
865: getTableTree().showItem((TableTreeItem) item);
866: }
867: }
|