|
Lines 16-32
Link Here
|
| 16 |
|
16 |
|
| 17 |
import org.eclipse.core.runtime.Assert; |
17 |
import org.eclipse.core.runtime.Assert; |
| 18 |
import org.eclipse.jface.action.ToolBarManager; |
18 |
import org.eclipse.jface.action.ToolBarManager; |
| 19 |
import org.eclipse.jface.dialogs.MessageDialog; |
|
|
| 20 |
import org.eclipse.jface.layout.GridDataFactory; |
19 |
import org.eclipse.jface.layout.GridDataFactory; |
| 21 |
import org.eclipse.jface.text.ITextListener; |
20 |
import org.eclipse.jface.text.ITextListener; |
| 22 |
import org.eclipse.jface.text.TextEvent; |
21 |
import org.eclipse.jface.text.TextEvent; |
|
|
22 |
import org.eclipse.jface.util.IPropertyChangeListener; |
| 23 |
import org.eclipse.mylyn.commons.core.DateUtil; |
23 |
import org.eclipse.mylyn.commons.core.DateUtil; |
| 24 |
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; |
24 |
import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin; |
| 25 |
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport; |
25 |
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport; |
| 26 |
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonUiUtil; |
26 |
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonUiUtil; |
| 27 |
import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker; |
27 |
import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker; |
| 28 |
import org.eclipse.mylyn.internal.tasks.core.AbstractTask; |
28 |
import org.eclipse.mylyn.internal.tasks.core.AbstractTask; |
| 29 |
import org.eclipse.mylyn.internal.tasks.core.DateRange; |
|
|
| 30 |
import org.eclipse.mylyn.internal.tasks.core.DayDateRange; |
29 |
import org.eclipse.mylyn.internal.tasks.core.DayDateRange; |
| 31 |
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener; |
30 |
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener; |
| 32 |
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil; |
31 |
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil; |
|
Lines 35-41
Link Here
|
| 35 |
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; |
34 |
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; |
| 36 |
import org.eclipse.mylyn.internal.tasks.ui.util.PlatformUtil; |
35 |
import org.eclipse.mylyn.internal.tasks.ui.util.PlatformUtil; |
| 37 |
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal; |
36 |
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal; |
| 38 |
import org.eclipse.mylyn.monitor.ui.MonitorUi; |
|
|
| 39 |
import org.eclipse.mylyn.tasks.core.ITask; |
37 |
import org.eclipse.mylyn.tasks.core.ITask; |
| 40 |
import org.eclipse.mylyn.tasks.core.ITaskActivityListener; |
38 |
import org.eclipse.mylyn.tasks.core.ITaskActivityListener; |
| 41 |
import org.eclipse.mylyn.tasks.core.TaskActivityAdapter; |
39 |
import org.eclipse.mylyn.tasks.core.TaskActivityAdapter; |
|
Lines 65-74
Link Here
|
| 65 |
import org.eclipse.ui.forms.IManagedForm; |
63 |
import org.eclipse.ui.forms.IManagedForm; |
| 66 |
import org.eclipse.ui.forms.events.ExpansionAdapter; |
64 |
import org.eclipse.ui.forms.events.ExpansionAdapter; |
| 67 |
import org.eclipse.ui.forms.events.ExpansionEvent; |
65 |
import org.eclipse.ui.forms.events.ExpansionEvent; |
| 68 |
import org.eclipse.ui.forms.events.HyperlinkAdapter; |
|
|
| 69 |
import org.eclipse.ui.forms.events.HyperlinkEvent; |
| 70 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
66 |
import org.eclipse.ui.forms.widgets.FormToolkit; |
| 71 |
import org.eclipse.ui.forms.widgets.ImageHyperlink; |
|
|
| 72 |
import org.eclipse.ui.forms.widgets.Section; |
67 |
import org.eclipse.ui.forms.widgets.Section; |
| 73 |
|
68 |
|
| 74 |
/** |
69 |
/** |
|
Lines 86-99
Link Here
|
| 86 |
|
81 |
|
| 87 |
private DatePicker dueDatePicker; |
82 |
private DatePicker dueDatePicker; |
| 88 |
|
83 |
|
| 89 |
private Text elapsedTimeText; |
84 |
private Text activeTimeText; |
| 90 |
|
85 |
|
| 91 |
private Spinner estimatedTime; |
86 |
private Spinner estimatedTimeSpinner; |
| 92 |
|
87 |
|
| 93 |
private ScheduleDatePicker scheduleDatePicker; |
88 |
private ScheduleDatePicker scheduleDatePicker; |
| 94 |
|
89 |
|
| 95 |
private Label scheduledText; |
|
|
| 96 |
|
| 97 |
private static final String PERSONAL_NOTES = Messages.PlanningPart_Personal_Notes; |
90 |
private static final String PERSONAL_NOTES = Messages.PlanningPart_Personal_Notes; |
| 98 |
|
91 |
|
| 99 |
private final ITaskListChangeListener TASK_LIST_LISTENER = new TaskListChangeAdapter() { |
92 |
private final ITaskListChangeListener TASK_LIST_LISTENER = new TaskListChangeAdapter() { |
|
Lines 126-146
Link Here
|
| 126 |
if (task.equals(PlanningPart.this.getTask())) { |
119 |
if (task.equals(PlanningPart.this.getTask())) { |
| 127 |
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { |
120 |
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { |
| 128 |
public void run() { |
121 |
public void run() { |
| 129 |
if (elapsedTimeText != null && !elapsedTimeText.isDisposed()) { |
122 |
if (activeTimeText != null && !activeTimeText.isDisposed()) { |
| 130 |
updateElapsedTime(); |
123 |
updateActiveTime(); |
| 131 |
} |
124 |
} |
| 132 |
} |
125 |
} |
| 133 |
}); |
126 |
}); |
|
|
127 |
} |
| 128 |
} |
| 129 |
}; |
| 134 |
|
130 |
|
|
|
131 |
private final IPropertyChangeListener ACTIVITY_PROPERTY_LISTENER = new org.eclipse.jface.util.IPropertyChangeListener() { |
| 132 |
|
| 133 |
public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) { |
| 134 |
if (event.getProperty().equals(MonitorUiPlugin.ACTIVITY_TRACKING_ENABLED)) { |
| 135 |
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { |
| 136 |
public void run() { |
| 137 |
if (activeTimeText != null && !activeTimeText.isDisposed()) { |
| 138 |
updateActiveTime(); |
| 139 |
} |
| 140 |
} |
| 141 |
}); |
| 135 |
} |
142 |
} |
| 136 |
} |
143 |
} |
|
|
144 |
|
| 137 |
}; |
145 |
}; |
| 138 |
|
146 |
|
| 139 |
private CommonTextSupport textSupport; |
147 |
private CommonTextSupport textSupport; |
| 140 |
|
148 |
|
| 141 |
private TaskFormPage page; |
149 |
private TaskFormPage page; |
| 142 |
|
150 |
|
| 143 |
private Composite actualTimeComposite; |
151 |
private Composite activeTimeComposite; |
| 144 |
|
152 |
|
| 145 |
private ToolBarManager toolBarManager; |
153 |
private ToolBarManager toolBarManager; |
| 146 |
|
154 |
|
|
Lines 150-159
Link Here
|
| 150 |
|
158 |
|
| 151 |
private Composite sectionClient; |
159 |
private Composite sectionClient; |
| 152 |
|
160 |
|
| 153 |
private Composite toolbarComposite; |
161 |
private boolean activeTimeEnabled; |
| 154 |
|
162 |
|
| 155 |
public PlanningPart(int sectionStyle) { |
163 |
public PlanningPart(int sectionStyle) { |
| 156 |
super(sectionStyle, Messages.PersonalPart_Personal_Planning); |
164 |
super(sectionStyle, Messages.PersonalPart_Personal_Planning); |
|
|
165 |
this.activeTimeEnabled = true; |
| 157 |
this.needsNotes = true; |
166 |
this.needsNotes = true; |
| 158 |
} |
167 |
} |
| 159 |
|
168 |
|
|
Lines 199-206
Link Here
|
| 199 |
getTask().setReminded(false); |
208 |
getTask().setReminded(false); |
| 200 |
} |
209 |
} |
| 201 |
|
210 |
|
| 202 |
if (estimatedTime != null) { |
211 |
if (estimatedTimeSpinner != null) { |
| 203 |
getTask().setEstimatedTimeHours(estimatedTime.getSelection()); |
212 |
getTask().setEstimatedTimeHours(estimatedTimeSpinner.getSelection()); |
| 204 |
} |
213 |
} |
| 205 |
|
214 |
|
| 206 |
if (dueDatePicker != null && dueDatePicker.getDate() != null) { |
215 |
if (dueDatePicker != null && dueDatePicker.getDate() != null) { |
|
Lines 239-244
Link Here
|
| 239 |
|
248 |
|
| 240 |
TasksUiInternal.getTaskList().addChangeListener(TASK_LIST_LISTENER); |
249 |
TasksUiInternal.getTaskList().addChangeListener(TASK_LIST_LISTENER); |
| 241 |
TasksUiPlugin.getTaskActivityManager().addActivityListener(timingListener); |
250 |
TasksUiPlugin.getTaskActivityManager().addActivityListener(timingListener); |
|
|
251 |
MonitorUiPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(ACTIVITY_PROPERTY_LISTENER); |
| 242 |
|
252 |
|
| 243 |
setSection(toolkit, section); |
253 |
setSection(toolkit, section); |
| 244 |
return section; |
254 |
return section; |
|
Lines 247-253
Link Here
|
| 247 |
private void expandSection(FormToolkit toolkit, Section section) { |
257 |
private void expandSection(FormToolkit toolkit, Section section) { |
| 248 |
sectionClient = toolkit.createComposite(section); |
258 |
sectionClient = toolkit.createComposite(section); |
| 249 |
GridLayout layout = EditorUtil.createSectionClientLayout(); |
259 |
GridLayout layout = EditorUtil.createSectionClientLayout(); |
| 250 |
layout.numColumns = (needsDueDate) ? 8 : 6; |
260 |
layout.numColumns = (needsDueDate) ? 6 : 4; |
| 251 |
sectionClient.setLayout(layout); |
261 |
sectionClient.setLayout(layout); |
| 252 |
|
262 |
|
| 253 |
createScheduledDatePicker(toolkit, sectionClient); |
263 |
createScheduledDatePicker(toolkit, sectionClient); |
|
Lines 259-265
Link Here
|
| 259 |
|
269 |
|
| 260 |
createEstimatedTime(toolkit, sectionClient); |
270 |
createEstimatedTime(toolkit, sectionClient); |
| 261 |
|
271 |
|
| 262 |
createActualTime(toolkit, sectionClient); |
272 |
// createActualTime(toolkit, composite); |
| 263 |
|
273 |
|
| 264 |
if (needsNotes()) { |
274 |
if (needsNotes()) { |
| 265 |
createNotesArea(toolkit, sectionClient, layout.numColumns); |
275 |
createNotesArea(toolkit, sectionClient, layout.numColumns); |
|
Lines 352-417
Link Here
|
| 352 |
|
362 |
|
| 353 |
} |
363 |
} |
| 354 |
|
364 |
|
| 355 |
private void createActualTime(FormToolkit toolkit, Composite toolbarComposite) { |
365 |
private void createActiveTimeControl(FormToolkit toolkit, Composite toolbarComposite) { |
| 356 |
actualTimeComposite = toolkit.createComposite(toolbarComposite); |
366 |
activeTimeComposite = toolkit.createComposite(toolbarComposite); |
| 357 |
actualTimeComposite.setBackground(null); |
367 |
activeTimeComposite.setBackground(null); |
| 358 |
actualTimeComposite.setBackgroundMode(SWT.INHERIT_FORCE); |
368 |
activeTimeComposite.setBackgroundMode(SWT.INHERIT_FORCE); |
| 359 |
RowLayout rowLayout = new RowLayout(); |
369 |
RowLayout rowLayout = new RowLayout(); |
| 360 |
rowLayout.center = true; |
370 |
rowLayout.center = true; |
| 361 |
rowLayout.marginTop = 0; |
371 |
rowLayout.marginTop = 0; |
| 362 |
rowLayout.marginBottom = 0; |
372 |
rowLayout.marginBottom = 0; |
| 363 |
rowLayout.marginLeft = 0; |
373 |
rowLayout.marginLeft = 0; |
| 364 |
rowLayout.marginRight = 0; |
374 |
rowLayout.marginRight = 0; |
| 365 |
actualTimeComposite.setLayout(rowLayout); |
375 |
activeTimeComposite.setLayout(rowLayout); |
| 366 |
|
376 |
|
| 367 |
Label label = toolkit.createLabel(actualTimeComposite, Messages.TaskEditorPlanningPart_Active); |
377 |
Label label = toolkit.createLabel(activeTimeComposite, Messages.TaskEditorPlanningPart_Active); |
| 368 |
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); |
378 |
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); |
| 369 |
label.setToolTipText(Messages.TaskEditorPlanningPart_Time_working_on_this_task); |
379 |
label.setToolTipText(Messages.TaskEditorPlanningPart_Time_working_on_this_task); |
| 370 |
label.setBackground(null); |
380 |
label.setBackground(null); |
| 371 |
|
381 |
|
| 372 |
elapsedTimeText = new Text(actualTimeComposite, SWT.FLAT | SWT.READ_ONLY); |
382 |
activeTimeText = new Text(activeTimeComposite, SWT.FLAT | SWT.READ_ONLY); |
| 373 |
elapsedTimeText.setFont(EditorUtil.TEXT_FONT); |
383 |
activeTimeText.setFont(EditorUtil.TEXT_FONT); |
| 374 |
elapsedTimeText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE); |
384 |
activeTimeText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE); |
| 375 |
toolkit.adapt(elapsedTimeText, true, false); |
385 |
toolkit.adapt(activeTimeText, true, false); |
| 376 |
elapsedTimeText.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); |
386 |
activeTimeText.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); |
| 377 |
elapsedTimeText.setBackground(null); |
387 |
activeTimeText.setBackground(null); |
| 378 |
updateElapsedTime(); |
388 |
updateActiveTime(); |
| 379 |
elapsedTimeText.setEditable(false); |
389 |
activeTimeText.setEditable(false); |
| 380 |
|
390 |
|
| 381 |
ImageHyperlink resetActivityTimeButton = toolkit.createImageHyperlink(actualTimeComposite, SWT.NONE); |
391 |
// ImageHyperlink resetActivityTimeButton = toolkit.createImageHyperlink(activeTimeComposite, SWT.NONE); |
| 382 |
resetActivityTimeButton.setBackground(null); |
392 |
// resetActivityTimeButton.setBackground(null); |
| 383 |
resetActivityTimeButton.setImage(CommonImages.getImage(CommonImages.FIND_CLEAR_DISABLED)); |
393 |
// resetActivityTimeButton.setImage(CommonImages.getImage(CommonImages.FIND_CLEAR_DISABLED)); |
| 384 |
resetActivityTimeButton.setHoverImage(CommonImages.getImage(CommonImages.FIND_CLEAR)); |
394 |
// resetActivityTimeButton.setHoverImage(CommonImages.getImage(CommonImages.FIND_CLEAR)); |
| 385 |
resetActivityTimeButton.setToolTipText(Messages.TaskEditorPlanningPart_Reset); |
395 |
// resetActivityTimeButton.setToolTipText(Messages.TaskEditorPlanningPart_Reset); |
| 386 |
resetActivityTimeButton.addHyperlinkListener(new HyperlinkAdapter() { |
396 |
// resetActivityTimeButton.addHyperlinkListener(new HyperlinkAdapter() { |
| 387 |
@Override |
397 |
// @Override |
| 388 |
public void linkActivated(HyperlinkEvent e) { |
398 |
// public void linkActivated(HyperlinkEvent e) { |
| 389 |
if (MessageDialog.openConfirm(getControl().getShell(), |
399 |
// if (MessageDialog.openConfirm(getControl().getShell(), |
| 390 |
Messages.TaskEditorPlanningPart_Confirm_Activity_Time_Deletion, |
400 |
// Messages.TaskEditorPlanningPart_Confirm_Activity_Time_Deletion, |
| 391 |
Messages.TaskEditorPlanningPart_Do_you_wish_to_reset_your_activity_time_on_this_task_)) { |
401 |
// Messages.TaskEditorPlanningPart_Do_you_wish_to_reset_your_activity_time_on_this_task_)) { |
| 392 |
MonitorUi.getActivityContextManager().removeActivityTime(getTask().getHandleIdentifier(), 0l, |
402 |
// MonitorUi.getActivityContextManager().removeActivityTime(getTask().getHandleIdentifier(), 0l, |
| 393 |
System.currentTimeMillis()); |
403 |
// System.currentTimeMillis()); |
| 394 |
} |
404 |
// } |
| 395 |
} |
405 |
// } |
| 396 |
}); |
406 |
// }); |
| 397 |
} |
407 |
} |
|
|
408 |
|
| 409 |
private void updateActiveTime() { |
| 410 |
long elapsedTime = 0; |
| 411 |
if (isActiveTimeEnabled() && MonitorUiPlugin.getDefault().isActivityTrackingEnabled()) { |
| 412 |
elapsedTime = TasksUiPlugin.getTaskActivityManager().getElapsedTime(getTask()); |
| 413 |
} |
| 398 |
|
414 |
|
| 399 |
private void updateElapsedTime() { |
|
|
| 400 |
long elapsedTime = TasksUiPlugin.getTaskActivityManager().getElapsedTime(getTask()); |
| 401 |
if (elapsedTime > 0) { |
415 |
if (elapsedTime > 0) { |
| 402 |
if (actualTimeComposite != null && !actualTimeComposite.isVisible()) { |
416 |
if (activeTimeComposite != null && !activeTimeComposite.isVisible()) { |
| 403 |
actualTimeComposite.setVisible(true); |
417 |
activeTimeComposite.setVisible(true); |
| 404 |
} |
418 |
} |
| 405 |
} else { |
419 |
} else { |
| 406 |
if (actualTimeComposite != null) { |
420 |
if (activeTimeComposite != null) { |
| 407 |
actualTimeComposite.setVisible(false); |
421 |
activeTimeComposite.setVisible(false); |
| 408 |
} |
422 |
} |
| 409 |
} |
423 |
} |
| 410 |
String elapsedTimeString = DateUtil.getFormattedDurationShort(elapsedTime); |
424 |
String elapsedTimeString = DateUtil.getFormattedDurationShort(elapsedTime); |
| 411 |
if (elapsedTimeString.equals("")) { //$NON-NLS-1$ |
425 |
if (elapsedTimeString.equals("")) { //$NON-NLS-1$ |
| 412 |
elapsedTimeString = Messages.TaskEditorPlanningPart_0_SECOUNDS; |
426 |
elapsedTimeString = Messages.TaskEditorPlanningPart_0_SECOUNDS; |
| 413 |
} |
427 |
} |
| 414 |
elapsedTimeText.setText(elapsedTimeString); |
428 |
activeTimeText.setText(elapsedTimeString); |
| 415 |
|
429 |
|
| 416 |
} |
430 |
} |
| 417 |
|
431 |
|
|
Lines 450-477
Link Here
|
| 450 |
|
464 |
|
| 451 |
private void createEstimatedTime(FormToolkit toolkit, Composite parent) { |
465 |
private void createEstimatedTime(FormToolkit toolkit, Composite parent) { |
| 452 |
Label label = toolkit.createLabel(parent, Messages.TaskEditorPlanningPart_Estimated); |
466 |
Label label = toolkit.createLabel(parent, Messages.TaskEditorPlanningPart_Estimated); |
| 453 |
label.setToolTipText(Messages.PlanningPart_Estimated_Time_Hours); |
|
|
| 454 |
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); |
467 |
label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); |
| 455 |
|
468 |
|
| 456 |
Composite composite = createComposite(parent, 2, toolkit); |
469 |
Composite composite = createComposite(parent, 2, toolkit); |
| 457 |
|
470 |
|
| 458 |
// Estimated time |
471 |
// Estimated time |
| 459 |
estimatedTime = new Spinner(composite, SWT.FLAT); |
472 |
estimatedTimeSpinner = new Spinner(composite, SWT.FLAT); |
| 460 |
estimatedTime.setDigits(0); |
473 |
estimatedTimeSpinner.setDigits(0); |
| 461 |
estimatedTime.setMaximum(9999); |
474 |
estimatedTimeSpinner.setMaximum(10000); |
| 462 |
estimatedTime.setMinimum(0); |
475 |
estimatedTimeSpinner.setMinimum(0); |
| 463 |
estimatedTime.setIncrement(1); |
476 |
estimatedTimeSpinner.setIncrement(1); |
| 464 |
estimatedTime.setSelection(getTask().getEstimatedTimeHours()); |
477 |
estimatedTimeSpinner.setSelection(getTask().getEstimatedTimeHours()); |
| 465 |
if (!PlatformUtil.spinnerHasNativeBorder()) { |
478 |
if (!PlatformUtil.spinnerHasNativeBorder()) { |
| 466 |
estimatedTime.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); |
479 |
estimatedTimeSpinner.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); |
| 467 |
} |
480 |
} |
| 468 |
estimatedTime.addModifyListener(new ModifyListener() { |
481 |
estimatedTimeSpinner.addModifyListener(new ModifyListener() { |
| 469 |
public void modifyText(ModifyEvent e) { |
482 |
public void modifyText(ModifyEvent e) { |
| 470 |
if (getTask().getEstimatedTimeHours() != estimatedTime.getSelection()) { |
483 |
if (getTask().getEstimatedTimeHours() != estimatedTimeSpinner.getSelection()) { |
| 471 |
markDirty(); |
484 |
markDirty(); |
| 472 |
} |
485 |
} |
| 473 |
} |
486 |
} |
| 474 |
}); |
487 |
}); |
|
|
488 |
|
| 489 |
// ImageHyperlink clearEstimated = toolkit.createImageHyperlink(composite, SWT.NONE); |
| 490 |
// clearEstimated.setImage(CommonImages.getImage(CommonImages.FIND_CLEAR_DISABLED)); |
| 491 |
// clearEstimated.setHoverImage(CommonImages.getImage(CommonImages.FIND_CLEAR)); |
| 492 |
// clearEstimated.setToolTipText(Messages.TaskEditorPlanningPart_Clear); |
| 493 |
// clearEstimated.addHyperlinkListener(new HyperlinkAdapter() { |
| 494 |
// @Override |
| 495 |
// public void linkActivated(HyperlinkEvent e) { |
| 496 |
// estimatedTime.setSelection(0); |
| 497 |
// markDirty(); |
| 498 |
// } |
| 499 |
// }); |
| 475 |
toolkit.paintBordersFor(composite); |
500 |
toolkit.paintBordersFor(composite); |
| 476 |
} |
501 |
} |
| 477 |
|
502 |
|
|
Lines 503-508
Link Here
|
| 503 |
public void dispose() { |
528 |
public void dispose() { |
| 504 |
TasksUiPlugin.getTaskActivityManager().removeActivityListener(timingListener); |
529 |
TasksUiPlugin.getTaskActivityManager().removeActivityListener(timingListener); |
| 505 |
TasksUiInternal.getTaskList().removeChangeListener(TASK_LIST_LISTENER); |
530 |
TasksUiInternal.getTaskList().removeChangeListener(TASK_LIST_LISTENER); |
|
|
531 |
MonitorUiPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(ACTIVITY_PROPERTY_LISTENER); |
| 506 |
|
532 |
|
| 507 |
if (toolBarManager != null) { |
533 |
if (toolBarManager != null) { |
| 508 |
toolBarManager.dispose(); |
534 |
toolBarManager.dispose(); |
|
Lines 512-518
Link Here
|
| 512 |
@Override |
538 |
@Override |
| 513 |
protected void setSection(FormToolkit toolkit, Section section) { |
539 |
protected void setSection(FormToolkit toolkit, Section section) { |
| 514 |
if (section.getTextClient() == null) { |
540 |
if (section.getTextClient() == null) { |
| 515 |
toolbarComposite = toolkit.createComposite(section); |
541 |
Composite toolbarComposite = toolkit.createComposite(section); |
| 516 |
toolbarComposite.setBackground(null); |
542 |
toolbarComposite.setBackground(null); |
| 517 |
RowLayout rowLayout = new RowLayout(); |
543 |
RowLayout rowLayout = new RowLayout(); |
| 518 |
rowLayout.marginLeft = 0; |
544 |
rowLayout.marginLeft = 0; |
|
Lines 522-529
Link Here
|
| 522 |
rowLayout.center = true; |
548 |
rowLayout.center = true; |
| 523 |
toolbarComposite.setLayout(rowLayout); |
549 |
toolbarComposite.setLayout(rowLayout); |
| 524 |
|
550 |
|
| 525 |
//createActualTime(toolkit, toolbarComposite); |
551 |
createActiveTimeControl(toolkit, toolbarComposite); |
| 526 |
createScheduledText(toolkit, toolbarComposite); |
|
|
| 527 |
|
552 |
|
| 528 |
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); |
553 |
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); |
| 529 |
fillToolBar(toolBarManager); |
554 |
fillToolBar(toolBarManager); |
|
Lines 542-558
Link Here
|
| 542 |
super.setSection(toolkit, section); |
567 |
super.setSection(toolkit, section); |
| 543 |
} |
568 |
} |
| 544 |
|
569 |
|
| 545 |
private void createScheduledText(FormToolkit toolkit, Composite toolbarComposite) { |
|
|
| 546 |
DateRange scheduledForDate = getTask().getScheduledForDate(); |
| 547 |
String scheduledString = Messages.TaskEditorPlanningPart_No_scheduled_date; |
| 548 |
if (scheduledForDate != null) { |
| 549 |
scheduledString = scheduledForDate.toString(); |
| 550 |
} |
| 551 |
scheduledText = toolkit.createLabel(toolbarComposite, scheduledString, SWT.READ_ONLY); |
| 552 |
scheduledText.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); |
| 553 |
scheduledText.setBackground(null); |
| 554 |
} |
| 555 |
|
| 556 |
protected void fillToolBar(ToolBarManager toolBarManager) { |
570 |
protected void fillToolBar(ToolBarManager toolBarManager) { |
| 557 |
} |
571 |
} |
| 558 |
|
572 |
|
|
Lines 574-603
Link Here
|
| 574 |
|
588 |
|
| 575 |
@Override |
589 |
@Override |
| 576 |
protected void refresh(boolean discardChanges) { |
590 |
protected void refresh(boolean discardChanges) { |
| 577 |
if (getTask().getScheduledForDate() != null) { |
591 |
if (scheduleDatePicker != null && !scheduleDatePicker.isDisposed()) { |
| 578 |
if (scheduleDatePicker != null && !scheduleDatePicker.isDisposed()) { |
592 |
if (getTask().getScheduledForDate() != null) { |
| 579 |
scheduleDatePicker.setScheduledDate(getTask().getScheduledForDate()); |
593 |
scheduleDatePicker.setScheduledDate(getTask().getScheduledForDate()); |
| 580 |
} |
594 |
} else { |
| 581 |
if (scheduledText != null && !scheduledText.isDisposed()) { |
|
|
| 582 |
scheduledText.setText(getTask().getScheduledForDate().toString()); |
| 583 |
toolbarComposite.getParent().layout(true); |
| 584 |
|
| 585 |
} |
| 586 |
} else { |
| 587 |
if (scheduleDatePicker != null && !scheduleDatePicker.isDisposed()) { |
| 588 |
scheduleDatePicker.setScheduledDate(null); |
595 |
scheduleDatePicker.setScheduledDate(null); |
| 589 |
} |
596 |
} |
| 590 |
if (scheduledText != null && !scheduledText.isDisposed()) { |
|
|
| 591 |
scheduledText.setText(Messages.TaskEditorPlanningPart_No_scheduled_date); |
| 592 |
toolbarComposite.getParent().layout(true); |
| 593 |
} |
| 594 |
} |
597 |
} |
| 595 |
|
598 |
|
| 596 |
if (estimatedTime != null && !estimatedTime.isDisposed()) { |
599 |
if (estimatedTimeSpinner != null && !estimatedTimeSpinner.isDisposed()) { |
| 597 |
estimatedTime.setSelection(getTask().getEstimatedTimeHours()); |
600 |
estimatedTimeSpinner.setSelection(getTask().getEstimatedTimeHours()); |
| 598 |
} |
601 |
} |
| 599 |
|
602 |
|
| 600 |
// TODO refresh notes |
603 |
// TODO refresh notes |
| 601 |
} |
604 |
} |
| 602 |
|
605 |
|
|
|
606 |
public boolean isActiveTimeEnabled() { |
| 607 |
return activeTimeEnabled; |
| 608 |
} |
| 609 |
|
| 610 |
public void setActiveTimeEnabled(boolean activeTimeEnabled) { |
| 611 |
this.activeTimeEnabled = activeTimeEnabled; |
| 612 |
if (activeTimeComposite != null && !activeTimeComposite.isDisposed()) { |
| 613 |
updateActiveTime(); |
| 614 |
} |
| 615 |
} |
| 616 |
|
| 603 |
} |
617 |
} |