org.eclipse.mylar.internal.tasks.ui.planner
Class TaskActivityEditorPart

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.EditorPart
              extended by org.eclipse.mylar.internal.tasks.ui.planner.TaskActivityEditorPart
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IEditorPart, org.eclipse.ui.ISaveablePart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.part.IWorkbenchPartOrientation

public class TaskActivityEditorPart
extends org.eclipse.ui.part.EditorPart

Note: Some methods have been generalized to remove duplicate code but the design still isn't right (long parameter lists, inflexible table creation). Needs refactoring. (Planned tasks section is currently disabled but should also use the new common methods)

Author:
Mik Kersten, Ken Sueda (original prototype), Wesley Coelho (added tasks in progress section, refactored-out similar code), Mik Kersten (rewrite)

Field Summary
private  java.lang.String[] activityColumnNames
           
private  int[] activityColumnWidths
           
private  TaskActivityContentProvider activityContentProvider
           
private  int[] activitySortConstants
           
private static java.lang.String BLANK_CELL
           
private  TaskActivityEditorInput editorInput
           
private static java.lang.String LABEL_DIALOG
           
private static java.lang.String LABEL_ESTIMATED
           
private static java.lang.String LABEL_PAST_ACTIVITY
           
private static java.lang.String LABEL_PLANNED_ACTIVITY
           
private static java.lang.String NO_TIME_ELAPSED
           
private  org.eclipse.swt.widgets.Label numberCompleted
           
private  org.eclipse.swt.widgets.Label numberInProgress
           
private  java.lang.String[] planColumnNames
           
private  int[] planColumnWidths
           
private  PlannedTasksContentProvider planContentProvider
           
private  int[] planSortConstants
           
private  org.eclipse.swt.widgets.Label totalEstimatedHoursLabel
           
private  org.eclipse.swt.widgets.Label totalEstimatedTime
           
private  org.eclipse.swt.widgets.Label totalTime
           
private  org.eclipse.swt.widgets.Label totalTimeOnCompleted
           
private  org.eclipse.swt.widgets.Label totalTimeOnIncomplete
           
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
TaskActivityEditorPart()
           
 
Method Summary
private  void addColumnSelectionListener(org.eclipse.jface.viewers.TableViewer tableViewer, org.eclipse.swt.widgets.TableColumn column, int sorterConstant, boolean plan)
           
private  void createButtons(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.forms.widgets.FormToolkit toolkit, org.eclipse.jface.viewers.TableViewer viewer, PlannedTasksContentProvider contentProvider)
           
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
           
private  void createSummarySection(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.forms.widgets.FormToolkit toolkit, java.util.Date startDate)
           
private  org.eclipse.jface.viewers.TableViewer createTable(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.forms.widgets.FormToolkit toolkit, java.lang.String[] columnNames, int[] columnWidths, int[] sortConstants)
           
private  org.eclipse.jface.viewers.TableViewer createTableSection(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.forms.widgets.FormToolkit toolkit, java.lang.String title, java.lang.String[] columnNames, int[] columnWidths, int[] sortConstants)
           
 void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void doSaveAs()
           
private  void exportActivitySection(java.io.BufferedWriter writer)
           
private  void exportPlanSection(java.io.BufferedWriter writer)
           
private  void exportSummarySection(java.io.BufferedWriter writer)
           
private  void exportToHtml()
           
private  void fillContextMenu(org.eclipse.jface.viewers.TableViewer viewer, org.eclipse.jface.action.IMenuManager manager)
           
private  java.lang.String getTotalTime()
           
 void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
           
 boolean isDirty()
           
 boolean isSaveAsAllowed()
           
 void setFocus()
           
private  void setSorters(java.lang.String[] columnNames, int[] sortConstants, org.eclipse.swt.widgets.Table table, org.eclipse.jface.viewers.TableViewer tableViewer, boolean plan)
           
private  void updateLabels()
           
private  void updateSummarySection()
           
 
Methods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setInput, setInputWithNotify, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, dispose, firePropertyChange, getAdapter, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, dispose, getSite, getTitle, getTitleImage, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

LABEL_PLANNED_ACTIVITY

private static final java.lang.String LABEL_PLANNED_ACTIVITY
See Also:
Constant Field Values

LABEL_DIALOG

private static final java.lang.String LABEL_DIALOG
See Also:
Constant Field Values

LABEL_PAST_ACTIVITY

private static final java.lang.String LABEL_PAST_ACTIVITY
See Also:
Constant Field Values

editorInput

private TaskActivityEditorInput editorInput

activityColumnNames

private java.lang.String[] activityColumnNames

activityColumnWidths

private int[] activityColumnWidths

activitySortConstants

private int[] activitySortConstants

planColumnNames

private java.lang.String[] planColumnNames

planSortConstants

private int[] planSortConstants

planColumnWidths

private int[] planColumnWidths

LABEL_ESTIMATED

private static final java.lang.String LABEL_ESTIMATED
See Also:
Constant Field Values

NO_TIME_ELAPSED

private static final java.lang.String NO_TIME_ELAPSED
See Also:
Constant Field Values

BLANK_CELL

private static final java.lang.String BLANK_CELL
See Also:
Constant Field Values

totalEstimatedHoursLabel

private org.eclipse.swt.widgets.Label totalEstimatedHoursLabel

numberCompleted

private org.eclipse.swt.widgets.Label numberCompleted

totalTimeOnCompleted

private org.eclipse.swt.widgets.Label totalTimeOnCompleted

numberInProgress

private org.eclipse.swt.widgets.Label numberInProgress

totalTimeOnIncomplete

private org.eclipse.swt.widgets.Label totalTimeOnIncomplete

totalEstimatedTime

private org.eclipse.swt.widgets.Label totalEstimatedTime

totalTime

private org.eclipse.swt.widgets.Label totalTime

activityContentProvider

private TaskActivityContentProvider activityContentProvider

planContentProvider

private PlannedTasksContentProvider planContentProvider
Constructor Detail

TaskActivityEditorPart

public TaskActivityEditorPart()
Method Detail

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
Specified by:
doSave in interface org.eclipse.ui.ISaveablePart
Specified by:
doSave in class org.eclipse.ui.part.EditorPart

doSaveAs

public void doSaveAs()
Specified by:
doSaveAs in interface org.eclipse.ui.ISaveablePart
Specified by:
doSaveAs in class org.eclipse.ui.part.EditorPart

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput input)
          throws org.eclipse.ui.PartInitException
Specified by:
init in interface org.eclipse.ui.IEditorPart
Specified by:
init in class org.eclipse.ui.part.EditorPart
Throws:
org.eclipse.ui.PartInitException

isDirty

public boolean isDirty()
Specified by:
isDirty in interface org.eclipse.ui.ISaveablePart
Specified by:
isDirty in class org.eclipse.ui.part.EditorPart

isSaveAsAllowed

public boolean isSaveAsAllowed()
Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart
Specified by:
isSaveAsAllowed in class org.eclipse.ui.part.EditorPart

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
Specified by:
createPartControl in class org.eclipse.ui.part.WorkbenchPart

fillContextMenu

private void fillContextMenu(org.eclipse.jface.viewers.TableViewer viewer,
                             org.eclipse.jface.action.IMenuManager manager)

setFocus

public void setFocus()
Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart
Specified by:
setFocus in class org.eclipse.ui.part.WorkbenchPart

createSummarySection

private void createSummarySection(org.eclipse.swt.widgets.Composite parent,
                                  org.eclipse.ui.forms.widgets.FormToolkit toolkit,
                                  java.util.Date startDate)

updateSummarySection

private void updateSummarySection()

getTotalTime

private java.lang.String getTotalTime()

createTableSection

private org.eclipse.jface.viewers.TableViewer createTableSection(org.eclipse.swt.widgets.Composite parent,
                                                                 org.eclipse.ui.forms.widgets.FormToolkit toolkit,
                                                                 java.lang.String title,
                                                                 java.lang.String[] columnNames,
                                                                 int[] columnWidths,
                                                                 int[] sortConstants)

createTable

private org.eclipse.jface.viewers.TableViewer createTable(org.eclipse.swt.widgets.Composite parent,
                                                          org.eclipse.ui.forms.widgets.FormToolkit toolkit,
                                                          java.lang.String[] columnNames,
                                                          int[] columnWidths,
                                                          int[] sortConstants)

setSorters

private void setSorters(java.lang.String[] columnNames,
                        int[] sortConstants,
                        org.eclipse.swt.widgets.Table table,
                        org.eclipse.jface.viewers.TableViewer tableViewer,
                        boolean plan)

addColumnSelectionListener

private void addColumnSelectionListener(org.eclipse.jface.viewers.TableViewer tableViewer,
                                        org.eclipse.swt.widgets.TableColumn column,
                                        int sorterConstant,
                                        boolean plan)

createButtons

private void createButtons(org.eclipse.swt.widgets.Composite parent,
                           org.eclipse.ui.forms.widgets.FormToolkit toolkit,
                           org.eclipse.jface.viewers.TableViewer viewer,
                           PlannedTasksContentProvider contentProvider)

updateLabels

private void updateLabels()

exportToHtml

private void exportToHtml()

exportPlanSection

private void exportPlanSection(java.io.BufferedWriter writer)
                        throws java.io.IOException
Throws:
java.io.IOException

exportActivitySection

private void exportActivitySection(java.io.BufferedWriter writer)
                            throws java.io.IOException
Throws:
java.io.IOException

exportSummarySection

private void exportSummarySection(java.io.BufferedWriter writer)
                           throws java.io.IOException
Throws:
java.io.IOException