1 11 package org.eclipse.ui.internal.dialogs; 12 13 import org.eclipse.jface.viewers.ITableLabelProvider; 14 import org.eclipse.jface.viewers.TableViewer; 15 import org.eclipse.swt.widgets.*; 16 17 24 public class IndentedTableViewer extends TableViewer { 25 31 public interface IIndentedTableLabelProvider extends ITableLabelProvider { 32 40 public int getIndent(Object element); 41 } 42 public IndentedTableViewer(Composite parent) { 43 super(parent); 44 } 45 public IndentedTableViewer(Composite parent, int style) { 46 super(parent, style); 47 } 48 public IndentedTableViewer(Table table) { 49 super(table); 50 } 51 public void doUpdateItem(Widget widget, Object element, boolean fullMap) { 52 if (widget instanceof TableItem) { 53 TableItem item = (TableItem) widget; 54 if (getLabelProvider() instanceof IIndentedTableLabelProvider) { 55 IIndentedTableLabelProvider provider = (IIndentedTableLabelProvider)getLabelProvider(); 56 item.setImageIndent(provider.getIndent(element)); 57 } 58 } 59 super.doUpdateItem(widget, element, fullMap); 60 } 61 } 62 | Popular Tags |