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