Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 248057 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java (-1 / +34 lines)
Lines 13-19 Link Here
13
package org.eclipse.mylyn.internal.tasks.ui.editors;
13
package org.eclipse.mylyn.internal.tasks.ui.editors;
14
14
15
import java.util.ArrayList;
15
import java.util.ArrayList;
16
import java.util.HashMap;
16
import java.util.List;
17
import java.util.List;
18
import java.util.Map;
17
19
18
import org.eclipse.jface.action.Action;
20
import org.eclipse.jface.action.Action;
19
import org.eclipse.jface.action.ToolBarManager;
21
import org.eclipse.jface.action.ToolBarManager;
Lines 73-78 Link Here
73
75
74
	private boolean expandAllInProgress;
76
	private boolean expandAllInProgress;
75
77
78
	private final Map<Section, CommentGroup> subToCommentGroup = new HashMap<Section, CommentGroup>();
79
80
	private FormToolkit expansionToolkit;
81
76
	public TaskEditorCommentPart() {
82
	public TaskEditorCommentPart() {
77
		setPartName("Comments");
83
		setPartName("Comments");
78
	}
84
	}
Lines 124-129 Link Here
124
130
125
	@Override
131
	@Override
126
	public void createControl(Composite parent, final FormToolkit toolkit) {
132
	public void createControl(Composite parent, final FormToolkit toolkit) {
133
		expansionToolkit = toolkit;
127
		initialize();
134
		initialize();
128
135
129
		section = createSection(parent, toolkit, hasIncoming);
136
		section = createSection(parent, toolkit, hasIncoming);
Lines 386-399 Link Here
386
					EditorUtil.toggleExpandableComposite(true, section);
393
					EditorUtil.toggleExpandableComposite(true, section);
387
				}
394
				}
388
395
396
				//get number of sections that are expanded
397
				int numberOfSectionsExpanded = getNumberOfExpandedSections();
398
				//expand that number +1, from the bottom up
399
				int count = subSections.size();
389
				for (Section subSection : subSections) {
400
				for (Section subSection : subSections) {
390
					if (subSection.isDisposed()) {
401
					if (subSection.isDisposed()) {
402
						count--;
391
						continue;
403
						continue;
392
					}
404
					}
393
					EditorUtil.toggleExpandableComposite(true, subSection);
405
					if (count - numberOfSectionsExpanded < 1) {
406
						EditorUtil.toggleExpandableComposite(true, subSection);
407
					}
408
					count--;
394
				}
409
				}
395
			}
410
			}
396
411
412
			//expand all of the individual comments 			
397
			for (ExpandableComposite composite : commentComposites) {
413
			for (ExpandableComposite composite : commentComposites) {
398
				if (composite.isDisposed()) {
414
				if (composite.isDisposed()) {
399
					continue;
415
					continue;
Lines 420-425 Link Here
420
//		}
436
//		}
421
//	}
437
//	}
422
438
439
	private int getNumberOfExpandedSections() {
440
		int count = 0;
441
		for (Section subSection : subSections) {
442
			if (subSection.isExpanded()) {
443
				count++;
444
			}
445
		}
446
		if (commentComposites.size() > 0) {
447
			if (commentComposites.get(commentComposites.size() - 1).isExpanded()) {
448
				count++;
449
			}
450
		}
451
		return count;
452
	}
453
423
	private TaskComment convertToTaskComment(TaskDataModel taskDataModel, TaskAttribute commentAttribute) {
454
	private TaskComment convertToTaskComment(TaskDataModel taskDataModel, TaskAttribute commentAttribute) {
424
		TaskComment taskComment = new TaskComment(taskDataModel.getTaskRepository(), taskDataModel.getTask(),
455
		TaskComment taskComment = new TaskComment(taskDataModel.getTaskRepository(), taskDataModel.getTask(),
425
				commentAttribute);
456
				commentAttribute);
Lines 517-522 Link Here
517
		}
548
		}
518
549
519
		subSections.add(groupSection);
550
		subSections.add(groupSection);
551
		//necessary for expansion
552
		subToCommentGroup.put(groupSection, commentGroup);
520
	}
553
	}
521
554
522
	private void expandSubSection(final FormToolkit toolkit, CommentGroup commentGroup, Section subSection) {
555
	private void expandSubSection(final FormToolkit toolkit, CommentGroup commentGroup, Section subSection) {

Return to bug 248057