View | Details | Raw Unified | Return to bug 234044 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/tasks/core/data/TaskAttribute.java (+2 lines)
Lines 101-106 Link Here
101
101
102
	public static final String KIND_PEOPLE = "task.common.kind.default";
102
	public static final String KIND_PEOPLE = "task.common.kind.default";
103
103
104
	public static final String KIND_PLANNING = "task.common.kind.planning";
105
104
	//public static final String META_SHOW_IN_ATTRIBUTES_SECTION = "task.meta.showInTaskEditorAttributesSection";
106
	//public static final String META_SHOW_IN_ATTRIBUTES_SECTION = "task.meta.showInTaskEditorAttributesSection";
105
107
106
	public static final String META_ASSOCIATED_ATTRIBUTE_ID = "task.meta.associated.attribute";
108
	public static final String META_ASSOCIATED_ATTRIBUTE_ID = "task.meta.associated.attribute";
(-)src/org/eclipse/mylyn/internal/jira/core/JiraAttribute.java (-1 / +6 lines)
Lines 153-159 Link Here
153
	}
153
	}
154
154
155
	public String getKind() {
155
	public String getKind() {
156
		return (isHidden) ? null : TaskAttribute.KIND_DEFAULT;
156
		switch (this) {
157
		case DUE_DATE:
158
			return TaskAttribute.KIND_PLANNING;
159
		default:
160
			return (isHidden) ? null : TaskAttribute.KIND_DEFAULT;
161
		}
157
	}
162
	}
158
163
159
}
164
}
(-)src/org/eclipse/mylyn/internal/jira/core/JiraTaskDataHandler.java (+5 lines)
Lines 510-515 Link Here
510
					|| !JiraAttribute.valueById(attribute.getId()).isHidden())) {
510
					|| !JiraAttribute.valueById(attribute.getId()).isHidden())) {
511
				properties.setKind(TaskAttribute.KIND_DEFAULT);
511
				properties.setKind(TaskAttribute.KIND_DEFAULT);
512
			}
512
			}
513
			if (JiraAttribute.DUE_DATE.id().equals(attribute.getId())
514
					|| JiraAttribute.ACTUAL.id().equals(attribute.getId())
515
					|| JiraAttribute.ESTIMATE.id().equals(attribute.getId())) {
516
				properties.setKind(TaskAttribute.KIND_PLANNING);
517
			}
513
518
514
			if (TaskAttribute.COMMENT_NEW.equals(attribute.getId())
519
			if (TaskAttribute.COMMENT_NEW.equals(attribute.getId())
515
					|| TaskAttribute.RESOLUTION.equals(attribute.getId())) {
520
					|| TaskAttribute.RESOLUTION.equals(attribute.getId())) {
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java (-9 / +25 lines)
Lines 63-68 Link Here
63
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorOutlinePage;
63
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorOutlinePage;
64
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPeoplePart;
64
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPeoplePart;
65
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart;
65
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart;
66
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorRepositoryPlanningPart;
66
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorRichTextPart;
67
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorRichTextPart;
67
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorSummaryPart;
68
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorSummaryPart;
68
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
69
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
Lines 292-297 Link Here
292
293
293
	public static final String ID_PART_PLANNING = "org.eclipse.mylyn.tasks.ui.editors.part.planning";
294
	public static final String ID_PART_PLANNING = "org.eclipse.mylyn.tasks.ui.editors.part.planning";
294
295
296
	public static final String ID_PART_REPOSITORY_PLANNING = "org.eclipse.mylyn.tasks.ui.editors.part.repositoryPlanning";
297
295
	public static final String ID_PART_SUMMARY = "org.eclipse.mylyn.tasks.ui.editors.part.summary";
298
	public static final String ID_PART_SUMMARY = "org.eclipse.mylyn.tasks.ui.editors.part.summary";
296
299
297
	public static final String PATH_ACTIONS = "actions";
300
	public static final String PATH_ACTIONS = "actions";
Lines 308-313 Link Here
308
311
309
	public static final String PATH_PLANNING = "planning";
312
	public static final String PATH_PLANNING = "planning";
310
313
314
	public static final String PATH_REPOSITORY_PLANNING = "repositoryPlanning";
315
311
//	private static final String ID_POPUP_MENU = "org.eclipse.mylyn.tasks.ui.editor.menu.page";
316
//	private static final String ID_POPUP_MENU = "org.eclipse.mylyn.tasks.ui.editor.menu.page";
312
317
313
	private AttributeEditorFactory attributeEditorFactory;
318
	private AttributeEditorFactory attributeEditorFactory;
Lines 513-518 Link Here
513
				return new TaskEditorSummaryPart();
518
				return new TaskEditorSummaryPart();
514
			}
519
			}
515
		}.setPath(PATH_HEADER));
520
		}.setPath(PATH_HEADER));
521
		descriptors.add(new TaskEditorPartDescriptor(ID_PART_PLANNING) {
522
			@Override
523
			public AbstractTaskEditorPart createPart() {
524
				return new TaskEditorPlanningPart();
525
			}
526
		}.setPath(PATH_PLANNING));
527
		descriptors.add(new TaskEditorPartDescriptor(ID_PART_REPOSITORY_PLANNING) {
528
			@Override
529
			public AbstractTaskEditorPart createPart() {
530
				return new TaskEditorRepositoryPlanningPart();
531
			}
532
		}.setPath(PATH_PLANNING));
533
516
		descriptors.add(new TaskEditorPartDescriptor(ID_PART_ATTRIBUTES) {
534
		descriptors.add(new TaskEditorPartDescriptor(ID_PART_ATTRIBUTES) {
517
			@Override
535
			@Override
518
			public AbstractTaskEditorPart createPart() {
536
			public AbstractTaskEditorPart createPart() {
Lines 552-565 Link Here
552
				return new TaskEditorNewCommentPart();
570
				return new TaskEditorNewCommentPart();
553
			}
571
			}
554
		}.setPath(PATH_COMMENTS));
572
		}.setPath(PATH_COMMENTS));
555
		if (taskData.isNew()) {
556
			descriptors.add(new TaskEditorPartDescriptor(ID_PART_PLANNING) {
557
				@Override
558
				public AbstractTaskEditorPart createPart() {
559
					return new TaskEditorPlanningPart();
560
				}
561
			}.setPath(PATH_PLANNING));
562
		}
563
		descriptors.add(new TaskEditorPartDescriptor(ID_PART_ACTIONS) {
573
		descriptors.add(new TaskEditorPartDescriptor(ID_PART_ACTIONS) {
564
			@Override
574
			@Override
565
			public AbstractTaskEditorPart createPart() {
575
			public AbstractTaskEditorPart createPart() {
Lines 579-588 Link Here
579
		List<TaskEditorPartDescriptor> descriptors = new LinkedList<TaskEditorPartDescriptor>(createPartDescriptors());
589
		List<TaskEditorPartDescriptor> descriptors = new LinkedList<TaskEditorPartDescriptor>(createPartDescriptors());
580
		// single column
590
		// single column
581
		createParts(PATH_HEADER, editorComposite, descriptors);
591
		createParts(PATH_HEADER, editorComposite, descriptors);
592
		// two column
593
		Composite planningComposite = toolkit.createComposite(editorComposite);
594
		planningComposite.setLayout(new GridLayout(2, false));
595
		GridDataFactory.fillDefaults().grab(true, false).applyTo(planningComposite);
596
		createParts(PATH_PLANNING, planningComposite, descriptors);
597
		createParts(PATH_REPOSITORY_PLANNING, planningComposite, descriptors);
598
		// single column
582
		createParts(PATH_ATTRIBUTES, editorComposite, descriptors);
599
		createParts(PATH_ATTRIBUTES, editorComposite, descriptors);
583
		createParts(PATH_ATTACHMENTS, editorComposite, descriptors);
600
		createParts(PATH_ATTACHMENTS, editorComposite, descriptors);
584
		createParts(PATH_COMMENTS, editorComposite, descriptors);
601
		createParts(PATH_COMMENTS, editorComposite, descriptors);
585
		createParts(PATH_PLANNING, editorComposite, descriptors);
586
		// two column
602
		// two column
587
		Composite bottomComposite = toolkit.createComposite(editorComposite);
603
		Composite bottomComposite = toolkit.createComposite(editorComposite);
588
		bottomComposite.setLayout(new GridLayout(2, false));
604
		bottomComposite.setLayout(new GridLayout(2, false));
(-).refactorings/2008/6/24/refactorings.index (+3 lines)
Lines 5-7 Link Here
5
1213201699417	Extract superclass 'ScalingHyperlink'
5
1213201699417	Extract superclass 'ScalingHyperlink'
6
1213201895713	Move compilation unit
6
1213201895713	Move compilation unit
7
1213220621176	Change method 'createPage'
7
1213220621176	Change method 'createPage'
8
1213223492423	Extract method 'createScheduledDatePicker'
9
1213223509735	Extract method 'createDueDatePicker'
10
1213223626268	Extract method 'createEstimatedTime'
(-).refactorings/2008/6/24/refactorings.history (-1 / +1 lines)
Lines 1-3 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<session version="1.0">&#x0A;<refactoring comment="Extract local variable &apos;priority&apos; from expression &apos;mapping.getPriority()&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0A;- Variable name: &apos;priority&apos;&#x0A;- Destination method: &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorSummaryPart.createHeaderLayout()&apos;&#x0A;- Variable expression: &apos;mapping.getPriority()&apos;&#x0A;- Replace occurrences of expression with variable" description="Extract local variable &apos;priority&apos;" final="false" id="org.eclipse.jdt.ui.extract.temp" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui.editors{TaskEditorSummaryPart.java" name="priority" replace="true" selection="4203 21" stamp="1213069082794" version="1.0"/>&#x0A;<refactoring comment="Extract local variable &apos;resolution&apos; from expression &apos;mapping.getResolution()&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0A;- Variable name: &apos;resolution&apos;&#x0A;- Destination method: &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorSummaryPart.createHeaderLayout()&apos;&#x0A;- Variable expression: &apos;mapping.getResolution()&apos;&#x0A;- Replace occurrences of expression with variable" description="Extract local variable &apos;resolution&apos;" final="false" id="org.eclipse.jdt.ui.extract.temp" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui.editors{TaskEditorSummaryPart.java" name="resolution" replace="true" selection="4274 23" stamp="1213069906470" version="1.0"/>&#x0A;<refactoring comment="Rename field &apos;DESCRIPTION&apos; in &apos;org.eclipse.mylyn.internal.tasks.ui.wizards.TaskDataImportWizardPage&apos; to &apos;MESSAGE_WARNING&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.tasks.ui.wizards.TaskDataImportWizardPage.DESCRIPTION&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.tasks.ui.wizards.TaskDataImportWizardPage.MESSAGE_WARNING&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update textual occurrences in comments and strings&#x0D;&#x0A;- Rename getter method for field&#x0D;&#x0A;- Rename setter method for field" delegate="false" deprecate="false" description="Rename field &apos;DESCRIPTION&apos;" flags="589826" getter="true" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui.wizards{TaskDataImportWizardPage.java[TaskDataImportWizardPage^DESCRIPTION" name="MESSAGE_WARNING" references="true" setter="true" stamp="1213199983077" textual="false" version="1.0"/>&#x0A;<refactoring comment="Rename type &apos;org.eclipse.mylyn.internal.tasks.ui.TaskListHyperlink&apos; to &apos;TaskHyperlink&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.tasks.ui.TaskListHyperlink&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update fully qualified names in &apos;*.xml, *.properties, *.exsd, *.mf&apos; files&#x0D;&#x0A;- Update textual occurrences in comments and strings" description="Rename type &apos;TaskListHyperlink&apos;" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskListHyperlink.java[TaskListHyperlink" matchStrategy="1" name="TaskHyperlink" patterns="*.xml, *.properties, *.exsd, *.mf" qualified="true" references="true" similarDeclarations="false" stamp="1213201590042" textual="false" version="1.0"/>&#x0A;<refactoring abstract="0" comment="Extract superclass &apos;org.eclipse.mylyn.internal.tasks.ui.ScalingHyperlink&apos; from &apos;org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink&apos;&#x0D;&#x0A;- Sub types:&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink&#x0D;&#x0A;- Extracted class: &apos;org.eclipse.mylyn.internal.tasks.ui.ScalingHyperlink&apos;&#x0D;&#x0A;- Extracted members:&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.strikeThrough&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.MOUSE_TRACK_LISTENER&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.dispose()&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.isStrikeThrough()&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.paintText(...)&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.setStrikeThrough(...)&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.shortenText(...)&#x0D;&#x0A;- Use super type where possible&#x0D;&#x0A;- Use super type in &apos;instanceof&apos; expressions" delete="5" description="Extract superclass &apos;ScalingHyperlink&apos;" element1="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink^strikeThrough" element10="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~paintText~QGC;~QRectangle;" element11="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~setStrikeThrough~Z" element12="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~shortenText~QGC;~QString;~I" element13="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink" element2="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink^MOUSE_TRACK_LISTENER" element3="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~isStrik" element4="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~isStrikeThrough" element5="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~setStrikeThrough~Zctangle;" element6="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~setStrikeThrough~Z" element7="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~disposeText~QGC;~QString;~I" element8="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~dispose" element9="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~isStrikeThrough" extract="7" flags="589830" id="org.eclipse.jdt.ui.extract.superclass" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink" instanceof="true" name="ScalingHyperlink" replace="true" stamp="1213201699417" stubs="true" types="1" version="1.0"/>&#x0A;<refactoring comment="Move 1 elements(s) to &apos;org.eclipse.mylyn.commons.ui/src/org.eclipse.mylyn.internal.provisional.commons.ui&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0D;&#x0A;- Destination element: &apos;org.eclipse.mylyn.commons.ui/src/org.eclipse.mylyn.internal.provisional.commons.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.tasks.ui.ScalingHyperlink.java&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update fully qualified names in &apos;*.xml, *.mf&apos; files" description="Move compilation unit" destination="=org.eclipse.mylyn.commons.ui/src&lt;org.eclipse.mylyn.internal.provisional.commons.ui" element1="/src&lt;org.eclipse.mylyn.internal.tasks.ui{ScalingHyperlink.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" patterns="*.xml, *.mf" policy="org.eclipse.jdt.ui.moveResources" qualified="true" references="true" stamp="1213201895713" units="1" version="1.0"/>&#x0A;<refactoring comment="Change method &apos;public FormPage org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory.createPage(TaskEditor parentEditor)&apos; to &apos;public IFormPage createPage(TaskEditor parentEditor)&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0A;- Original element: &apos;org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory.createPage(...)&apos;&#x0A;- New return type: &apos;IFormPage&apos;" delegate="false" deprecate="true" description="Change method &apos;createPage&apos;" flags="589830" id="org.eclipse.jdt.ui.change.method.signature" input="/src&lt;org.eclipse.mylyn.tasks.ui.editors{AbstractTaskEditorPageFactory.java[AbstractTaskEditorPageFactory~createPage~QTaskEditor;" name="createPage" parameter1="TaskEditor parentEditor 0 TaskEditor parentEditor false" return="IFormPage" stamp="1213220621176" version="1.0"/>
2
<session version="1.0">&#x0A;<refactoring comment="Extract local variable &apos;priority&apos; from expression &apos;mapping.getPriority()&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0A;- Variable name: &apos;priority&apos;&#x0A;- Destination method: &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorSummaryPart.createHeaderLayout()&apos;&#x0A;- Variable expression: &apos;mapping.getPriority()&apos;&#x0A;- Replace occurrences of expression with variable" description="Extract local variable &apos;priority&apos;" final="false" id="org.eclipse.jdt.ui.extract.temp" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui.editors{TaskEditorSummaryPart.java" name="priority" replace="true" selection="4203 21" stamp="1213069082794" version="1.0"/>&#x0A;<refactoring comment="Extract local variable &apos;resolution&apos; from expression &apos;mapping.getResolution()&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0A;- Variable name: &apos;resolution&apos;&#x0A;- Destination method: &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorSummaryPart.createHeaderLayout()&apos;&#x0A;- Variable expression: &apos;mapping.getResolution()&apos;&#x0A;- Replace occurrences of expression with variable" description="Extract local variable &apos;resolution&apos;" final="false" id="org.eclipse.jdt.ui.extract.temp" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui.editors{TaskEditorSummaryPart.java" name="resolution" replace="true" selection="4274 23" stamp="1213069906470" version="1.0"/>&#x0A;<refactoring comment="Rename field &apos;DESCRIPTION&apos; in &apos;org.eclipse.mylyn.internal.tasks.ui.wizards.TaskDataImportWizardPage&apos; to &apos;MESSAGE_WARNING&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.tasks.ui.wizards.TaskDataImportWizardPage.DESCRIPTION&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.tasks.ui.wizards.TaskDataImportWizardPage.MESSAGE_WARNING&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update textual occurrences in comments and strings&#x0D;&#x0A;- Rename getter method for field&#x0D;&#x0A;- Rename setter method for field" delegate="false" deprecate="false" description="Rename field &apos;DESCRIPTION&apos;" flags="589826" getter="true" id="org.eclipse.jdt.ui.rename.field" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui.wizards{TaskDataImportWizardPage.java[TaskDataImportWizardPage^DESCRIPTION" name="MESSAGE_WARNING" references="true" setter="true" stamp="1213199983077" textual="false" version="1.0"/>&#x0A;<refactoring comment="Rename type &apos;org.eclipse.mylyn.internal.tasks.ui.TaskListHyperlink&apos; to &apos;TaskHyperlink&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.tasks.ui.TaskListHyperlink&apos;&#x0D;&#x0A;- Renamed element: &apos;org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update fully qualified names in &apos;*.xml, *.properties, *.exsd, *.mf&apos; files&#x0D;&#x0A;- Update textual occurrences in comments and strings" description="Rename type &apos;TaskListHyperlink&apos;" flags="589830" id="org.eclipse.jdt.ui.rename.type" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskListHyperlink.java[TaskListHyperlink" matchStrategy="1" name="TaskHyperlink" patterns="*.xml, *.properties, *.exsd, *.mf" qualified="true" references="true" similarDeclarations="false" stamp="1213201590042" textual="false" version="1.0"/>&#x0A;<refactoring abstract="0" comment="Extract superclass &apos;org.eclipse.mylyn.internal.tasks.ui.ScalingHyperlink&apos; from &apos;org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink&apos;&#x0D;&#x0A;- Sub types:&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink&#x0D;&#x0A;- Extracted class: &apos;org.eclipse.mylyn.internal.tasks.ui.ScalingHyperlink&apos;&#x0D;&#x0A;- Extracted members:&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.strikeThrough&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.MOUSE_TRACK_LISTENER&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.dispose()&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.isStrikeThrough()&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.paintText(...)&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.setStrikeThrough(...)&#x0D;&#x0A;     org.eclipse.mylyn.internal.tasks.ui.TaskHyperlink.shortenText(...)&#x0D;&#x0A;- Use super type where possible&#x0D;&#x0A;- Use super type in &apos;instanceof&apos; expressions" delete="5" description="Extract superclass &apos;ScalingHyperlink&apos;" element1="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink^strikeThrough" element10="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~paintText~QGC;~QRectangle;" element11="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~setStrikeThrough~Z" element12="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~shortenText~QGC;~QString;~I" element13="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink" element2="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink^MOUSE_TRACK_LISTENER" element3="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~isStrik" element4="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~isStrikeThrough" element5="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~setStrikeThrough~Zctangle;" element6="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~setStrikeThrough~Z" element7="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~disposeText~QGC;~QString;~I" element8="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~dispose" element9="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink~isStrikeThrough" extract="7" flags="589830" id="org.eclipse.jdt.ui.extract.superclass" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui{TaskHyperlink.java[TaskHyperlink" instanceof="true" name="ScalingHyperlink" replace="true" stamp="1213201699417" stubs="true" types="1" version="1.0"/>&#x0A;<refactoring comment="Move 1 elements(s) to &apos;org.eclipse.mylyn.commons.ui/src/org.eclipse.mylyn.internal.provisional.commons.ui&apos;&#x0D;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0D;&#x0A;- Destination element: &apos;org.eclipse.mylyn.commons.ui/src/org.eclipse.mylyn.internal.provisional.commons.ui&apos;&#x0D;&#x0A;- Original element: &apos;org.eclipse.mylyn.internal.tasks.ui.ScalingHyperlink.java&apos;&#x0D;&#x0A;- Update references to refactored element&#x0D;&#x0A;- Update fully qualified names in &apos;*.xml, *.mf&apos; files" description="Move compilation unit" destination="=org.eclipse.mylyn.commons.ui/src&lt;org.eclipse.mylyn.internal.provisional.commons.ui" element1="/src&lt;org.eclipse.mylyn.internal.tasks.ui{ScalingHyperlink.java" files="0" flags="589830" folders="0" id="org.eclipse.jdt.ui.move" patterns="*.xml, *.mf" policy="org.eclipse.jdt.ui.moveResources" qualified="true" references="true" stamp="1213201895713" units="1" version="1.0"/>&#x0A;<refactoring comment="Change method &apos;public FormPage org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory.createPage(TaskEditor parentEditor)&apos; to &apos;public IFormPage createPage(TaskEditor parentEditor)&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0A;- Original element: &apos;org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPageFactory.createPage(...)&apos;&#x0A;- New return type: &apos;IFormPage&apos;" delegate="false" deprecate="true" description="Change method &apos;createPage&apos;" flags="589830" id="org.eclipse.jdt.ui.change.method.signature" input="/src&lt;org.eclipse.mylyn.tasks.ui.editors{AbstractTaskEditorPageFactory.java[AbstractTaskEditorPageFactory~createPage~QTaskEditor;" name="createPage" parameter1="TaskEditor parentEditor 0 TaskEditor parentEditor false" return="IFormPage" stamp="1213220621176" version="1.0"/>&#x0A;<refactoring comment="Extract method &apos;private void createScheduledDatePicker(FormToolkit toolkit,Composite sectionClient)&apos; from &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart.createControl()&apos; to &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0A;- Method name: &apos;createScheduledDatePicker&apos;&#x0A;- Destination type: &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart&apos;&#x0A;- Declared visibility: &apos;private&apos;" comments="false" description="Extract method &apos;createScheduledDatePicker&apos;" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui.editors{TaskEditorPlanningPart.java" name="createScheduledDatePicker" replace="false" selection="3961 1261" stamp="1213223492423" version="1.0" visibility="2"/>&#x0A;<refactoring comment="Extract method &apos;private void createDueDatePicker(FormToolkit toolkit,Composite sectionClient)&apos; from &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart.createControl()&apos; to &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0A;- Method name: &apos;createDueDatePicker&apos;&#x0A;- Destination type: &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart&apos;&#x0A;- Declared visibility: &apos;private&apos;" comments="false" description="Extract method &apos;createDueDatePicker&apos;" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui.editors{TaskEditorPlanningPart.java" name="createDueDatePicker" replace="false" selection="4057 2118" stamp="1213223509735" version="1.0" visibility="2"/>&#x0A;<refactoring comment="Extract method &apos;private void createEstimatedTime(Composite sectionClient)&apos; from &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart.createControl()&apos; to &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart&apos;&#x0A;- Original project: &apos;org.eclipse.mylyn.tasks.ui&apos;&#x0A;- Method name: &apos;createEstimatedTime&apos;&#x0A;- Destination type: &apos;org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorPlanningPart&apos;&#x0A;- Declared visibility: &apos;private&apos;" comments="false" description="Extract method &apos;createEstimatedTime&apos;" destination="0" exceptions="false" flags="786434" id="org.eclipse.jdt.ui.extract.method" input="/src&lt;org.eclipse.mylyn.internal.tasks.ui.editors{TaskEditorPlanningPart.java" name="createEstimatedTime" replace="false" selection="4547 1231" stamp="1213223626268" version="1.0" visibility="2"/>
3
</session>
3
</session>
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorPlanningPart.java (-100 / +292 lines)
Lines 8-26 Link Here
8
8
9
package org.eclipse.mylyn.internal.tasks.ui.editors;
9
package org.eclipse.mylyn.internal.tasks.ui.editors;
10
10
11
import java.util.Calendar;
12
import java.util.Set;
13
11
import org.eclipse.core.runtime.Assert;
14
import org.eclipse.core.runtime.Assert;
15
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.core.runtime.Status;
17
import org.eclipse.jface.dialogs.MessageDialog;
18
import org.eclipse.jface.layout.GridDataFactory;
19
import org.eclipse.mylyn.commons.core.DateUtil;
20
import org.eclipse.mylyn.commons.core.StatusHandler;
12
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
21
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
22
import org.eclipse.mylyn.internal.provisional.commons.ui.DatePicker;
13
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
23
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
14
import org.eclipse.mylyn.internal.tasks.core.DateRange;
24
import org.eclipse.mylyn.internal.tasks.core.ITaskListChangeListener;
25
import org.eclipse.mylyn.internal.tasks.core.TaskActivityUtil;
26
import org.eclipse.mylyn.internal.tasks.core.TaskContainerDelta;
15
import org.eclipse.mylyn.internal.tasks.ui.ScheduleDatePicker;
27
import org.eclipse.mylyn.internal.tasks.ui.ScheduleDatePicker;
16
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
28
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
29
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
30
import org.eclipse.mylyn.monitor.ui.MonitorUi;
31
import org.eclipse.mylyn.tasks.core.ITask;
32
import org.eclipse.mylyn.tasks.core.ITaskActivityListener;
33
import org.eclipse.mylyn.tasks.core.TaskActivityAdapter;
17
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
34
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
18
import org.eclipse.swt.SWT;
35
import org.eclipse.swt.SWT;
36
import org.eclipse.swt.events.SelectionAdapter;
37
import org.eclipse.swt.events.SelectionEvent;
38
import org.eclipse.swt.events.SelectionListener;
19
import org.eclipse.swt.layout.GridData;
39
import org.eclipse.swt.layout.GridData;
20
import org.eclipse.swt.layout.GridLayout;
40
import org.eclipse.swt.layout.GridLayout;
21
import org.eclipse.swt.widgets.Composite;
41
import org.eclipse.swt.widgets.Composite;
42
import org.eclipse.swt.widgets.Display;
22
import org.eclipse.swt.widgets.Label;
43
import org.eclipse.swt.widgets.Label;
23
import org.eclipse.swt.widgets.Spinner;
44
import org.eclipse.swt.widgets.Spinner;
45
import org.eclipse.swt.widgets.Text;
46
import org.eclipse.ui.PlatformUI;
47
import org.eclipse.ui.forms.IFormColors;
24
import org.eclipse.ui.forms.events.HyperlinkAdapter;
48
import org.eclipse.ui.forms.events.HyperlinkAdapter;
25
import org.eclipse.ui.forms.events.HyperlinkEvent;
49
import org.eclipse.ui.forms.events.HyperlinkEvent;
26
import org.eclipse.ui.forms.widgets.FormToolkit;
50
import org.eclipse.ui.forms.widgets.FormToolkit;
Lines 32-43 Link Here
32
 */
56
 */
33
public class TaskEditorPlanningPart extends AbstractTaskEditorPart {
57
public class TaskEditorPlanningPart extends AbstractTaskEditorPart {
34
58
59
	private static final String CLEAR = "Clear";
60
35
	private static final int DEFAULT_ESTIMATED_TIME = 1;
61
	private static final int DEFAULT_ESTIMATED_TIME = 1;
36
62
37
	private ScheduleDatePicker scheduledForDate;
63
	private static final String NO_TIME_ELAPSED = "0 seconds";
64
65
	private static final String RESET = "Reset";
66
67
	private static final int LABEL_WIDTH = 80;
68
69
	private static final int CONTROL_WIDTH = 100;
70
71
	private DatePicker dueDatePicker;
72
73
	private Text elapsedTimeText;
38
74
39
	private Spinner estimatedTime;
75
	private Spinner estimatedTime;
40
76
77
	private ScheduleDatePicker scheduleDatePicker;
78
79
	private AbstractTask task;
80
81
	private final ITaskListChangeListener TASK_LIST_LISTENER = new TaskListChangeAdapter() {
82
83
		@Override
84
		public void containersChanged(Set<TaskContainerDelta> containers) {
85
			for (TaskContainerDelta taskContainerDelta : containers) {
86
				if (taskContainerDelta.getElement() instanceof ITask) {
87
					final AbstractTask updateTask = (AbstractTask) taskContainerDelta.getElement();
88
					if (updateTask != null && task != null
89
							&& updateTask.getHandleIdentifier().equals(task.getHandleIdentifier())) {
90
						if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().isClosing()) {
91
							PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
92
								public void run() {
93
									updateFromTask(updateTask);
94
								}
95
							});
96
						}
97
					}
98
				}
99
			}
100
		}
101
102
	};
103
104
	private final ITaskActivityListener timingListener = new TaskActivityAdapter() {
105
106
		@Override
107
		public void elapsedTimeUpdated(ITask task, long newElapsedTime) {
108
			if (task.equals(TaskEditorPlanningPart.this.task)) {
109
				String elapsedTimeString = NO_TIME_ELAPSED;
110
				try {
111
					elapsedTimeString = DateUtil.getFormattedDuration(newElapsedTime, false);
112
					if (elapsedTimeString.equals("")) {
113
						elapsedTimeString = NO_TIME_ELAPSED;
114
					}
115
116
				} catch (RuntimeException e) {
117
					StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
118
							"Could not format elapsed time", e));
119
				}
120
				final String elapsedString = elapsedTimeString;
121
				PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
122
123
					public void run() {
124
						if (elapsedTimeText != null && !elapsedTimeText.isDisposed()) {
125
							elapsedTimeText.setText(elapsedString);
126
						}
127
					}
128
				});
129
130
			}
131
		}
132
	};
133
41
	public TaskEditorPlanningPart() {
134
	public TaskEditorPlanningPart() {
42
		setPartName("Personal Planning");
135
		setPartName("Personal Planning");
43
	}
136
	}
Lines 47-171 Link Here
47
		AbstractTask task = (AbstractTask) getTaskEditorPage().getTask();
140
		AbstractTask task = (AbstractTask) getTaskEditorPage().getTask();
48
		Assert.isNotNull(task);
141
		Assert.isNotNull(task);
49
142
50
		DateRange selectedDate = null;
143
		if (scheduleDatePicker != null && scheduleDatePicker.getScheduledDate() != null) {
51
		if (scheduledForDate != null) {
144
			if (task.getScheduledForDate() == null
52
			selectedDate = scheduledForDate.getScheduledDate();
145
					|| (task.getScheduledForDate() != null && !scheduleDatePicker.getScheduledDate().equals(
53
		}
146
							task.getScheduledForDate())) || (task).getScheduledForDate().isDay()) {
54
		if (selectedDate != null) {
147
				TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, scheduleDatePicker.getScheduledDate());
55
			TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, selectedDate);
148
				(task).setReminded(false);
149
			}
150
		} else {
151
			TasksUiPlugin.getTaskActivityManager().setScheduledFor(task, null);
152
			(task).setReminded(false);
56
		}
153
		}
57
154
58
		if (estimatedTime != null) {
155
		if (estimatedTime != null) {
59
			task.setEstimatedTimeHours(estimatedTime.getSelection());
156
			task.setEstimatedTimeHours(estimatedTime.getSelection());
60
		}
157
		}
61
158
159
		if (dueDatePicker != null && dueDatePicker.getDate() != null) {
160
			TasksUiPlugin.getTaskActivityManager().setDueDate(task, dueDatePicker.getDate().getTime());
161
		} else {
162
			TasksUiPlugin.getTaskActivityManager().setDueDate(task, null);
163
		}
164
62
		super.commit(onSave);
165
		super.commit(onSave);
63
	}
166
	}
64
167
168
	private void createActualTime(FormToolkit toolkit, Composite composite) {
169
		Composite nameValueComp = createComposite(composite, 3, toolkit);
170
171
		Label label = toolkit.createLabel(nameValueComp, "Active:");
172
		label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
173
		label.setToolTipText("Time working on this task");
174
175
		String elapsedTimeString = NO_TIME_ELAPSED;
176
		try {
177
			elapsedTimeString = DateUtil.getFormattedDuration(TasksUiPlugin.getTaskActivityManager().getElapsedTime(
178
					task), false);
179
			if (elapsedTimeString.equals("")) {
180
				elapsedTimeString = NO_TIME_ELAPSED;
181
			}
182
		} catch (RuntimeException e) {
183
			// FIXME what exception is caught here?
184
			StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not format elapsed time", e));
185
		}
186
187
		elapsedTimeText = toolkit.createText(nameValueComp, elapsedTimeString);
188
		elapsedTimeText.setText(elapsedTimeString);
189
190
		GridData td = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
191
		td.grabExcessHorizontalSpace = true;
192
		elapsedTimeText.setLayoutData(td);
193
		elapsedTimeText.setEditable(false);
194
195
		ImageHyperlink resetActivityTimeButton = toolkit.createImageHyperlink(nameValueComp, SWT.NONE);
196
		resetActivityTimeButton.setImage(CommonImages.getImage(CommonImages.REMOVE));
197
		resetActivityTimeButton.setToolTipText(RESET);
198
		resetActivityTimeButton.addHyperlinkListener(new HyperlinkAdapter() {
199
200
			@Override
201
			public void linkActivated(HyperlinkEvent e) {
202
				if (MessageDialog.openConfirm(getControl().getShell(), "Confirm Activity Time Deletion",
203
						"Do you wish to reset your activity time on this task?\n\nThis will take immediate affect and can not be undone.")) {
204
					MonitorUi.getActivityContextManager().removeActivityTime(task.getHandleIdentifier(), 0l,
205
							System.currentTimeMillis());
206
				}
207
			}
208
		});
209
	}
210
211
	private Composite createComposite(Composite parent, int col, FormToolkit toolkit) {
212
		Composite nameValueComp = toolkit.createComposite(parent);
213
		GridLayout layout = new GridLayout(3, false);
214
		layout.marginHeight = 3;
215
		nameValueComp.setLayout(layout);
216
		return nameValueComp;
217
	}
218
65
	@Override
219
	@Override
66
	public void createControl(Composite parent, FormToolkit toolkit) {
220
	public void createControl(Composite parent, FormToolkit toolkit) {
221
		task = (AbstractTask) getTaskEditorPage().getTask();
222
67
		Section section = createSection(parent, toolkit, true);
223
		Section section = createSection(parent, toolkit, true);
68
224
69
		Composite sectionClient = getManagedForm().getToolkit().createComposite(section);
225
		Composite composite = getManagedForm().getToolkit().createComposite(section);
70
		GridLayout layout = new GridLayout();
226
		composite.setLayout(new GridLayout(2, false));
71
		layout.numColumns = 7;
227
72
		layout.makeColumnsEqualWidth = false;
228
		createScheduledDatePicker(toolkit, composite);
73
		sectionClient.setLayout(layout);
229
74
		GridData clientDataLayout = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
230
		// disable due date picker if it's a repository due date
75
		sectionClient.setLayoutData(clientDataLayout);
231
		if (!getTaskEditorPage().getConnector().hasRepositoryDueDate(getTaskEditorPage().getTaskRepository(), task,
76
232
				getTaskData())) {
77
		// Reminder
233
			createDueDatePicker(toolkit, composite);
78
//		getManagedForm().getToolkit().createLabel(sectionClient, "Scheduled for:");
234
		} else {
79
//		// label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
235
			// dummy placeholder
80
//		scheduledForDate = new ScheduleDatePicker(sectionClient, SWT.FLAT, DatePicker.LABEL_CHOOSE, true,
236
			toolkit.createLabel(composite, "");
81
//				TasksUiPlugin.getDefault().getPreferenceStore().getInt(TasksUiPreferenceConstants.PLANNING_ENDHOUR));
237
		}
82
//		scheduledForDate.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
83
//		scheduledForDate.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
84
//		Calendar newTaskSchedule = Calendar.getInstance();
85
//		int scheduledEndHour = TasksUiPlugin.getDefault().getPreferenceStore().getInt(
86
//				TasksUiPreferenceConstants.PLANNING_ENDHOUR);
87
//		// If past scheduledEndHour set for following day
88
//		if (newTaskSchedule.get(Calendar.HOUR_OF_DAY) >= scheduledEndHour) {
89
//			TaskActivityUtil.snapForwardNumDays(newTaskSchedule, 1);
90
//		} else {
91
//			TaskActivityUtil.snapEndOfWorkDay(newTaskSchedule);
92
//		}
93
//		scheduledForDate.setDate(newTaskSchedule);
94
////		Button removeReminder = getManagedForm().getToolkit().createButton(sectionClient, "Clear",
95
////				SWT.PUSH | SWT.CENTER);
96
////		removeReminder.addSelectionListener(new SelectionAdapter() {
97
////			@Override
98
////			public void widgetSelected(SelectionEvent e) {
99
////				scheduledForDate.setDate(null);
100
////			}
101
////		});
102
//
103
//		ImageHyperlink clearReminder = getManagedForm().getToolkit().createImageHyperlink(sectionClient, SWT.NONE);
104
//		clearReminder.setImage(CommonImages.getImage(CommonImages.REMOVE));
105
//		clearReminder.setToolTipText("Clear");
106
//		clearReminder.addHyperlinkListener(new HyperlinkAdapter() {
107
//			@Override
108
//			public void linkActivated(HyperlinkEvent e) {
109
//				scheduledForDate.setDate(null);
110
//			}
111
//		});
112
113
		///NEW
114
//		ITask task = getTaskEditorPage().getTask();
115
//		scheduledForDate = new ScheduleDatePicker(sectionClient, task, SWT.FLAT);
116
//		scheduledForDate.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
117
//		toolkit.adapt(scheduledForDate, true, true);
118
//		toolkit.paintBordersFor(sectionClient);
119
//
120
//		scheduledForDate.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
121
//		scheduledForDate.addPickerSelectionListener(new SelectionListener() {
122
//			public void widgetSelected(SelectionEvent arg0) {
123
//				getTaskEditorPage().getModel().attributeChanged(attribute);
124
//			}
125
//
126
//			public void widgetDefaultSelected(SelectionEvent arg0) {
127
//				// ignore
128
//			}
129
//		});
130
//
131
//		ImageHyperlink clearScheduledDate = toolkit.createImageHyperlink(sectionClient, SWT.NONE);
132
//		clearScheduledDate.setImage(CommonImages.getImage(CommonImages.REMOVE));
133
//		clearScheduledDate.setToolTipText(CLEAR);
134
//		clearScheduledDate.addHyperlinkListener(new HyperlinkAdapter() {
135
//
136
//			@Override
137
//			public void linkActivated(HyperlinkEvent e) {
138
//				scheduledForDate.setScheduledDate(null);
139
//				((AbstractTask) task).setReminded(false);
140
//				TaskPlanningEditor.this.markDirty(true);
141
//			}
142
//		});
143
238
144
		// 1 Blank column after Reminder clear button
239
		// 1 Blank column after Reminder clear button
145
		Label dummy = getManagedForm().getToolkit().createLabel(sectionClient, "");
240
//		Label dummy = getManagedForm().getToolkit().createLabel(composite, "");
146
		GridData dummyLabelDataLayout = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
241
//		GridData dummyLabelDataLayout = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
147
		dummyLabelDataLayout.horizontalSpan = 1;
242
//		dummyLabelDataLayout.horizontalSpan = 1;
148
		dummyLabelDataLayout.widthHint = 30;
243
//		dummyLabelDataLayout.widthHint = 30;
149
		dummy.setLayoutData(dummyLabelDataLayout);
244
//		dummy.setLayoutData(dummyLabelDataLayout);
245
246
		createEstimatedTime(toolkit, composite);
247
248
		createActualTime(toolkit, composite);
249
250
		TasksUiInternal.getTaskList().addChangeListener(TASK_LIST_LISTENER);
251
		TasksUiPlugin.getTaskActivityManager().addActivityListener(timingListener);
252
253
		toolkit.paintBordersFor(composite);
254
		section.setClient(composite);
255
		setSection(toolkit, section);
256
	}
257
258
	private void createDueDatePicker(FormToolkit toolkit, Composite parent) {
259
		Composite composite = createComposite(parent, 3, toolkit);
260
		Label label = toolkit.createLabel(composite, "Due:");
261
		label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
262
		GridDataFactory.fillDefaults().hint(LABEL_WIDTH, SWT.DEFAULT).align(SWT.BEGINNING, SWT.CENTER).applyTo(label);
263
264
		dueDatePicker = new DatePicker(composite, SWT.FLAT, DatePicker.LABEL_CHOOSE, true, 0);
265
		GridDataFactory.fillDefaults().hint(CONTROL_WIDTH, SWT.DEFAULT).applyTo(dueDatePicker);
266
		dueDatePicker.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
267
		dueDatePicker.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
268
		if (task.getDueDate() != null) {
269
			Calendar calendar = TaskActivityUtil.getCalendar();
270
			calendar.setTime(task.getDueDate());
271
			dueDatePicker.setDate(calendar);
272
		}
273
		dueDatePicker.addPickerSelectionListener(new SelectionAdapter() {
274
			@Override
275
			public void widgetSelected(SelectionEvent arg0) {
276
				markDirty();
277
			}
278
		});
279
		toolkit.adapt(dueDatePicker, true, false);
280
		toolkit.paintBordersFor(composite);
281
282
		ImageHyperlink clearDueDate = toolkit.createImageHyperlink(composite, SWT.NONE);
283
		clearDueDate.setImage(CommonImages.getImage(CommonImages.REMOVE));
284
		clearDueDate.setToolTipText(CLEAR);
285
		clearDueDate.addHyperlinkListener(new HyperlinkAdapter() {
286
			@Override
287
			public void linkActivated(HyperlinkEvent e) {
288
				dueDatePicker.setDate(null);
289
				markDirty();
290
			}
291
		});
292
	}
293
294
	private void createEstimatedTime(FormToolkit toolkit, Composite parent) {
295
		Composite nameValueComp = createComposite(parent, 3, toolkit);
296
		Label label = toolkit.createLabel(nameValueComp, "Estimated:");
297
		label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
298
		GridDataFactory.fillDefaults().hint(LABEL_WIDTH, SWT.DEFAULT).align(SWT.BEGINNING, SWT.CENTER).applyTo(label);
150
299
151
		// Estimated time
300
		// Estimated time
152
		getManagedForm().getToolkit().createLabel(sectionClient, "Estimated hours:");
301
		estimatedTime = new Spinner(nameValueComp, SWT.FLAT);
153
		// label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
154
		// estimatedTime = new Spinner(sectionClient, SWT.FLAT);
155
		estimatedTime = new Spinner(sectionClient, SWT.FLAT);
156
		estimatedTime.setDigits(0);
302
		estimatedTime.setDigits(0);
157
		estimatedTime.setMaximum(100);
303
		estimatedTime.setMaximum(100);
158
		estimatedTime.setMinimum(0);
304
		estimatedTime.setMinimum(0);
159
		estimatedTime.setIncrement(1);
305
		estimatedTime.setIncrement(1);
160
		estimatedTime.setSelection(DEFAULT_ESTIMATED_TIME);
306
		estimatedTime.setSelection(DEFAULT_ESTIMATED_TIME);
161
		estimatedTime.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
307
		estimatedTime.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
162
		GridData estimatedDataLayout = new GridData();
163
		estimatedDataLayout.widthHint = 30;
164
		estimatedTime.setLayoutData(estimatedDataLayout);
165
		// getManagedForm().getToolkit().createLabel(sectionClient, "hours ");
166
		// label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
167
308
168
		ImageHyperlink clearEstimated = getManagedForm().getToolkit().createImageHyperlink(sectionClient, SWT.NONE);
309
		ImageHyperlink clearEstimated = toolkit.createImageHyperlink(nameValueComp, SWT.NONE);
169
		clearEstimated.setImage(CommonImages.getImage(CommonImages.REMOVE));
310
		clearEstimated.setImage(CommonImages.getImage(CommonImages.REMOVE));
170
		clearEstimated.setToolTipText("Clear");
311
		clearEstimated.setToolTipText("Clear");
171
		clearEstimated.addHyperlinkListener(new HyperlinkAdapter() {
312
		clearEstimated.addHyperlinkListener(new HyperlinkAdapter() {
Lines 174-182 Link Here
174
				estimatedTime.setSelection(0);
315
				estimatedTime.setSelection(0);
175
			}
316
			}
176
		});
317
		});
318
		toolkit.paintBordersFor(nameValueComp);
319
	}
177
320
178
		getManagedForm().getToolkit().paintBordersFor(sectionClient);
321
	private void createScheduledDatePicker(FormToolkit toolkit, Composite parent) {
179
		section.setClient(sectionClient);
322
		Composite composite = createComposite(parent, 3, toolkit);
180
		setSection(toolkit, section);
323
		Label label = toolkit.createLabel(composite, "Scheduled:");
324
		label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
325
		GridDataFactory.fillDefaults().hint(LABEL_WIDTH, SWT.DEFAULT).align(SWT.BEGINNING, SWT.CENTER).applyTo(label);
326
327
		scheduleDatePicker = new ScheduleDatePicker(composite, task, SWT.FLAT);
328
		GridDataFactory.fillDefaults().hint(CONTROL_WIDTH, SWT.DEFAULT).applyTo(scheduleDatePicker);
329
		scheduleDatePicker.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
330
		toolkit.adapt(scheduleDatePicker, true, false);
331
		toolkit.paintBordersFor(composite);
332
333
		scheduleDatePicker.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
334
		scheduleDatePicker.addPickerSelectionListener(new SelectionListener() {
335
			public void widgetDefaultSelected(SelectionEvent arg0) {
336
				// ignore
337
			}
338
339
			public void widgetSelected(SelectionEvent arg0) {
340
				markDirty();
341
			}
342
		});
343
344
		ImageHyperlink clearScheduledDate = toolkit.createImageHyperlink(composite, SWT.NONE);
345
		clearScheduledDate.setImage(CommonImages.getImage(CommonImages.REMOVE));
346
		clearScheduledDate.setToolTipText(CLEAR);
347
		clearScheduledDate.addHyperlinkListener(new HyperlinkAdapter() {
348
			@Override
349
			public void linkActivated(HyperlinkEvent e) {
350
				scheduleDatePicker.setScheduledDate(null);
351
				// XXX why is this set here?
352
				task.setReminded(false);
353
				markDirty();
354
			}
355
		});
181
	}
356
	}
357
358
	@Override
359
	public void dispose() {
360
		TasksUiPlugin.getTaskActivityManager().removeActivityListener(timingListener);
361
		TasksUiInternal.getTaskList().removeChangeListener(TASK_LIST_LISTENER);
362
	}
363
364
	private void updateFromTask(AbstractTask updateTask) {
365
		if (scheduleDatePicker != null && !scheduleDatePicker.isDisposed()) {
366
			if (updateTask.getScheduledForDate() != null) {
367
				scheduleDatePicker.setScheduledDate(updateTask.getScheduledForDate());
368
			} else {
369
				scheduleDatePicker.setScheduledDate(null);
370
			}
371
		}
372
	}
373
182
}
374
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskPlanningEditor.java (+3 lines)
Lines 615-620 Link Here
615
		label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
615
		label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
616
616
617
		scheduleDatePicker = new ScheduleDatePicker(nameValueComp, task, SWT.FLAT);
617
		scheduleDatePicker = new ScheduleDatePicker(nameValueComp, task, SWT.FLAT);
618
		GridData gd = new GridData();
619
		gd.widthHint = 135;
620
		scheduleDatePicker.setLayoutData(gd);
618
		scheduleDatePicker.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
621
		scheduleDatePicker.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
619
		toolkit.adapt(scheduleDatePicker, true, false);
622
		toolkit.adapt(scheduleDatePicker, true, false);
620
		toolkit.paintBordersFor(nameValueComp);
623
		toolkit.paintBordersFor(nameValueComp);
(-)src/org/eclipse/mylyn/internal/tasks/ui/ScheduleDatePicker.java (-1 / +2 lines)
Lines 101-107 Link Here
101
		scheduledDateText = new Text(this, style);
101
		scheduledDateText = new Text(this, style);
102
		scheduledDateText.setEditable(false);
102
		scheduledDateText.setEditable(false);
103
		GridData dateTextGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
103
		GridData dateTextGridData = new GridData(SWT.FILL, SWT.FILL, false, false);
104
		dateTextGridData.widthHint = 135;
104
		dateTextGridData.grabExcessHorizontalSpace = true;
105
		dateTextGridData.widthHint = SWT.FILL;
105
		dateTextGridData.verticalIndent = 0;
106
		dateTextGridData.verticalIndent = 0;
106
107
107
		scheduledDateText.setLayoutData(dateTextGridData);
108
		scheduledDateText.setLayoutData(dateTextGridData);
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorRepositoryPlanningPart.java (+119 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.tasks.ui.editors;
10
11
import java.util.ArrayList;
12
import java.util.Collections;
13
import java.util.Comparator;
14
import java.util.Map;
15
16
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
17
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData;
18
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
19
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
20
import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
21
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.layout.GridData;
23
import org.eclipse.swt.layout.GridLayout;
24
import org.eclipse.swt.widgets.Composite;
25
import org.eclipse.swt.widgets.Control;
26
import org.eclipse.swt.widgets.Event;
27
import org.eclipse.swt.widgets.Listener;
28
import org.eclipse.swt.widgets.Text;
29
import org.eclipse.ui.forms.widgets.FormToolkit;
30
import org.eclipse.ui.forms.widgets.Section;
31
32
/**
33
 * @author Steffen Pingel
34
 */
35
public class TaskEditorRepositoryPlanningPart extends AbstractTaskEditorPart {
36
37
	private ArrayList<AbstractAttributeEditor> attributeEditors;
38
39
	private Composite attributesComposite;
40
41
	public TaskEditorRepositoryPlanningPart() {
42
		setPartName("Team Planning");
43
	}
44
45
	@Override
46
	public void createControl(Composite parent, final FormToolkit toolkit) {
47
		initialize();
48
		if (attributeEditors.isEmpty()) {
49
			return;
50
		}
51
52
		final Section section = createSection(parent, toolkit, true);
53
54
		attributesComposite = toolkit.createComposite(section);
55
		attributesComposite.addListener(SWT.MouseDown, new Listener() {
56
			public void handleEvent(Event event) {
57
				Control focus = event.display.getFocusControl();
58
				if (focus instanceof Text && ((Text) focus).getEditable() == false) {
59
					getManagedForm().getForm().setFocus();
60
				}
61
			}
62
		});
63
64
		GridLayout attributesLayout = new GridLayout();
65
		attributesLayout.numColumns = 2;
66
		attributesLayout.horizontalSpacing = 5;
67
		attributesLayout.verticalSpacing = 6;
68
		attributesComposite.setLayout(attributesLayout);
69
70
		GridData attributesData = new GridData(GridData.FILL_BOTH);
71
		attributesData.horizontalSpan = 1;
72
		attributesData.grabExcessVerticalSpace = false;
73
		attributesComposite.setLayoutData(attributesData);
74
75
		createAttributeControls(attributesComposite, toolkit, attributesLayout.numColumns);
76
		toolkit.paintBordersFor(attributesComposite);
77
78
		section.setClient(attributesComposite);
79
		setSection(toolkit, section);
80
	}
81
82
	private void createAttributeControls(Composite composite, FormToolkit toolkit, int numColumns) {
83
		for (AbstractAttributeEditor editor : attributeEditors) {
84
			editor.createLabelControl(composite, toolkit);
85
			editor.createControl(composite, toolkit);
86
			getTaskEditorPage().getAttributeEditorToolkit().adapt(editor);
87
		}
88
89
	}
90
91
	private void initialize() {
92
		attributeEditors = new ArrayList<AbstractAttributeEditor>();
93
94
		Map<String, TaskAttribute> attributes = getTaskData().getRoot().getAttributes();
95
		for (TaskAttribute attribute : attributes.values()) {
96
			TaskAttributeMetaData properties = attribute.getMetaData();
97
			if (!TaskAttribute.KIND_PLANNING.equals(properties.getKind())) {
98
				continue;
99
			}
100
101
			AbstractAttributeEditor attributeEditor = createAttributeEditor(attribute);
102
			if (attributeEditor != null) {
103
				attributeEditors.add(attributeEditor);
104
//				if (getModel().hasIncomingChanges(attribute)) {
105
//					hasIncoming = true;
106
//				}
107
			}
108
		}
109
110
		Collections.sort(attributeEditors, new Comparator<AbstractAttributeEditor>() {
111
			public int compare(AbstractAttributeEditor o1, AbstractAttributeEditor o2) {
112
				int p1 = (o1.getLayoutHint() != null) ? o1.getLayoutHint().getPriority() : LayoutHint.DEFAULT_PRIORITY;
113
				int p2 = (o2.getLayoutHint() != null) ? o2.getLayoutHint().getPriority() : LayoutHint.DEFAULT_PRIORITY;
114
				return p1 - p2;
115
			}
116
		});
117
	}
118
119
}

Return to bug 234044