// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/Task.java
// public interface Task {
// 
//   /**
//    * Return an id for this task. The id should be unique to any instance that
//    * behaves differently than another instance. Typically the id would be the
//    * fully qualified class name unless two task instances somehow manage to 
//    * behave differently. In this case they should each return a unique id.
//    */
//   public String getId();
// 
//   /**
//    * Returns a string suitable for display to the user providing a title for
//    * this Task. This is used in contexts where a short
//    * description is needed. Capitalization should follow the same rules as
//    * applied to book titles.
//    */
//   public String getTitle();
// 
//   /**
//    * Returns a string suitable for display to the user describing what action
//    * will be taken when the associated {@link RepairAction} is executed.
//    * <p/>
//    * The description should start with a 3rd person descriptive verb such as:
//    * <p/>
//    * "Customizes your java code templates with user information."
//    * "Configures a local extension location."
//    */
//   public String getDescription();
// 
//   /**
//    * Returns an Evaluator for this task. The Evaluator should return false
//    * if the associated RepairAction needs to be executed.
//    */
//   public Evaluator getEvaluator();
// 
//   /**
//    * Returns a {@link RepairAction} capable of bringing this {@link Task}
//    * into compliance.
//    */
//   public RepairAction getRepairAction();
// }


import com.google.eclipse.mechanic.Task;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CellLabelProvider;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.window.ToolTip;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.dialogs.ListDialog;
import java.util.Collection;
    tableViewer.setLabelProvider(new DefaultCellLabelProvider());
    ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE); 
    table.setHeaderVisible(true);
    newTableColumn(table, "Description", 200);
    newTableColumn(table, "ID", 200);
    newTableColumn(table, "Name", 200);
    tableViewer.refresh();
    return area;
  }

  private static class DefaultCellLabelProvider extends CellLabelProvider {
    @Override
    public void update(ViewerCell cell) {
      Object element = cell.getElement();
      int columnIndex = cell.getColumnIndex();
      cell.setText(getColumnText((Task) element, columnIndex));
    }

    @Override
    public String getToolTipText(Object element) {
      Task item = (Task) element;
      return item.getTitle() + "\n" + item.getDescription() + "\n\nID:" + item.getId();
    }

    public String getColumnText(Task item, int columnIndex) {
      switch(columnIndex) {
      case 0:
        return item.getTitle();
      case 1:
        return item.getId();
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/Task.java
// public interface Task {
// 
//   /**
//    * Return an id for this task. The id should be unique to any instance that
//    * behaves differently than another instance. Typically the id would be the
//    * fully qualified class name unless two task instances somehow manage to 
//    * behave differently. In this case they should each return a unique id.
//    */
//   public String getId();
// 
//   /**
//    * Returns a string suitable for display to the user providing a title for
//    * this Task. This is used in contexts where a short
//    * description is needed. Capitalization should follow the same rules as
//    * applied to book titles.
//    */
//   public String getTitle();
// 
//   /**
//    * Returns a string suitable for display to the user describing what action
//    * will be taken when the associated {@link RepairAction} is executed.
//    * <p/>
//    * The description should start with a 3rd person descriptive verb such as:
//    * <p/>
//    * "Customizes your java code templates with user information."
//    * "Configures a local extension location."
//    */
//   public String getDescription();
// 
//   /**
//    * Returns an Evaluator for this task. The Evaluator should return false
//    * if the associated RepairAction needs to be executed.
//    */
//   public Evaluator getEvaluator();
// 
//   /**
//    * Returns a {@link RepairAction} capable of bringing this {@link Task}
//    * into compliance.
//    */
//   public RepairAction getRepairAction();
// }


// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/plugin/ui/TaskSelectionDialog.java
import com.google.eclipse.mechanic.Task;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CellLabelProvider;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.window.ToolTip;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.dialogs.ListDialog;
import java.util.Collection;

    tableViewer.setLabelProvider(new DefaultCellLabelProvider());
    ColumnViewerToolTipSupport.enableFor(tableViewer, ToolTip.NO_RECREATE); 
    table.setHeaderVisible(true);
    newTableColumn(table, "Description", 200);
    newTableColumn(table, "ID", 200);
    newTableColumn(table, "Name", 200);
    tableViewer.refresh();
    return area;
  }

  private static class DefaultCellLabelProvider extends CellLabelProvider {
    @Override
    public void update(ViewerCell cell) {
      Object element = cell.getElement();
      int columnIndex = cell.getColumnIndex();
      cell.setText(getColumnText((Task) element, columnIndex));
    }

    @Override
    public String getToolTipText(Object element) {
      Task item = (Task) element;
      return item.getTitle() + "\n" + item.getDescription() + "\n\nID:" + item.getId();
    }

    public String getColumnText(Task item, int columnIndex) {
      switch(columnIndex) {
      case 0:
        return item.getTitle();
      case 1:
        return item.getId();
      case 2: