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 237546
Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java (-12 / +14 lines)
Lines 312-318 Link Here
312
			getTaskData().getAttributeMapper().updateTaskComment(taskComment, commentAttribute);
312
			getTaskData().getAttributeMapper().updateTaskComment(taskComment, commentAttribute);
313
			int style = ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT
313
			int style = ExpandableComposite.TREE_NODE | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT
314
					| ExpandableComposite.COMPACT;
314
					| ExpandableComposite.COMPACT;
315
			if (hasIncomingChanges || expandAllInProgress) {
315
			if (hasIncomingChanges || (expandAllInProgress && !suppressExpandViewers)) {
316
				style |= ExpandableComposite.EXPANDED;
316
				style |= ExpandableComposite.EXPANDED;
317
			}
317
			}
318
			commentComposite = toolkit.createExpandableComposite(composite, style);
318
			commentComposite = toolkit.createExpandableComposite(composite, style);
Lines 571-576 Link Here
571
571
572
	private Font privateFont;
572
	private Font privateFont;
573
573
574
	private boolean suppressExpandViewers;
575
574
	public TaskEditorCommentPart() {
576
	public TaskEditorCommentPart() {
575
		this.commentGroupStrategy = new CommentGroupStrategy() {
577
		this.commentGroupStrategy = new CommentGroupStrategy() {
576
			@Override
578
			@Override
Lines 698-706 Link Here
698
		}
700
		}
699
	}
701
	}
700
702
701
	private void expandAllComments() {
703
	private void expandAllComments(boolean expandViewers) {
702
		try {
704
		try {
703
			expandAllInProgress = true;
705
			expandAllInProgress = true;
706
			suppressExpandViewers = !expandViewers;
704
			getTaskEditorPage().setReflow(false);
707
			getTaskEditorPage().setReflow(false);
705
708
706
			if (section != null) {
709
			if (section != null) {
Lines 710-728 Link Here
710
713
711
				CommonFormUtil.setExpanded(section, true);
714
				CommonFormUtil.setExpanded(section, true);
712
715
713
				//if (expandGroups) {
716
				if (expandViewers) {
714
				List<CommentGroupViewer> viewers = getCommentGroupViewers();
717
					List<CommentGroupViewer> viewers = getCommentGroupViewers();
715
				for (int i = viewers.size() - 1; i >= 0; i--) {
718
					for (int i = viewers.size() - 1; i >= 0; i--) {
716
					if (!viewers.get(i).isFullyExpanded()) {
719
						if (!viewers.get(i).isFullyExpanded()) {
717
						viewers.get(i).setExpanded(true);
720
							viewers.get(i).setExpanded(true);
718
						// bug 280152: expand all groups
721
						}
719
						//break;
720
					}
722
					}
721
				}
723
				}
722
				//}
723
			}
724
			}
724
		} finally {
725
		} finally {
725
			expandAllInProgress = false;
726
			expandAllInProgress = false;
727
			suppressExpandViewers = false;
726
			getTaskEditorPage().setReflow(true);
728
			getTaskEditorPage().setReflow(true);
727
		}
729
		}
728
		getTaskEditorPage().reflow();
730
		getTaskEditorPage().reflow();
Lines 760-766 Link Here
760
		Action expandAllAction = new Action("") { //$NON-NLS-1$
762
		Action expandAllAction = new Action("") { //$NON-NLS-1$
761
			@Override
763
			@Override
762
			public void run() {
764
			public void run() {
763
				expandAllComments();
765
				expandAllComments(true);
764
			}
766
			}
765
		};
767
		};
766
		expandAllAction.setImageDescriptor(CommonImages.EXPAND_ALL_SMALL);
768
		expandAllAction.setImageDescriptor(CommonImages.EXPAND_ALL_SMALL);
Lines 838-844 Link Here
838
		if (commentAttribute == null) {
840
		if (commentAttribute == null) {
839
			return null;
841
			return null;
840
		}
842
		}
841
		expandAllComments();
843
		expandAllComments(false);
842
		List<CommentGroupViewer> groupViewers = getCommentGroupViewers();
844
		List<CommentGroupViewer> groupViewers = getCommentGroupViewers();
843
		for (CommentGroupViewer groupViewer : groupViewers) {
845
		for (CommentGroupViewer groupViewer : groupViewers) {
844
			for (CommentViewer viewer : groupViewer.getCommentViewers()) {
846
			for (CommentViewer viewer : groupViewer.getCommentViewers()) {
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java (-2 / +31 lines)
Lines 188-195 Link Here
188
188
189
		private final boolean attachContext;
189
		private final boolean attachContext;
190
190
191
		public SubmitTaskJobListener(boolean attachContext) {
191
		private final boolean expandLastComment;
192
193
		public SubmitTaskJobListener(boolean attachContext, boolean expandLastComment) {
192
			this.attachContext = attachContext;
194
			this.attachContext = attachContext;
195
			this.expandLastComment = expandLastComment;
193
		}
196
		}
194
197
195
		@Override
198
		@Override
Lines 224-229 Link Here
224
										newTask, taskData));
227
										newTask, taskData));
225
								migrator.execute(newTask);
228
								migrator.execute(newTask);
226
							}
229
							}
230
							if (expandLastComment) {
231
								expandLastComment();
232
							}
227
						}
233
						}
228
						handleTaskSubmitted(new SubmitJobEvent(job));
234
						handleTaskSubmitted(new SubmitJobEvent(job));
229
					} finally {
235
					} finally {
Lines 979-988 Link Here
979
985
980
			doSave(new NullProgressMonitor());
986
			doSave(new NullProgressMonitor());
981
987
988
			TaskAttribute newCommentAttribute = getModel().getTaskData()
989
					.getRoot()
990
					.getMappedAttribute(TaskAttribute.COMMENT_NEW);
991
			boolean expandLastComment = newCommentAttribute != null
992
					&& getModel().getChangedAttributes().contains(newCommentAttribute);
993
982
			SubmitJob submitJob = TasksUiInternal.getJobFactory().createSubmitTaskJob(connector,
994
			SubmitJob submitJob = TasksUiInternal.getJobFactory().createSubmitTaskJob(connector,
983
					getModel().getTaskRepository(), task, getModel().getTaskData(),
995
					getModel().getTaskRepository(), task, getModel().getTaskData(),
984
					getModel().getChangedOldAttributes());
996
					getModel().getChangedOldAttributes());
985
			submitJob.addSubmitJobListener(new SubmitTaskJobListener(getAttachContext()));
997
			submitJob.addSubmitJobListener(new SubmitTaskJobListener(getAttachContext(), expandLastComment));
986
			submitJob.schedule();
998
			submitJob.schedule();
987
		} catch (RuntimeException e) {
999
		} catch (RuntimeException e) {
988
			showEditorBusy(false);
1000
			showEditorBusy(false);
Lines 1770-1773 Link Here
1770
		return super.selectReveal(object);
1782
		return super.selectReveal(object);
1771
	}
1783
	}
1772
1784
1785
	void expandLastComment() {
1786
		if (getManagedForm() == null || getManagedForm().getForm().isDisposed()) {
1787
			// editor possibly closed or page has not been initialized
1788
			return;
1789
		}
1790
1791
		if (taskData == null) {
1792
			return;
1793
		}
1794
1795
		List<TaskAttribute> commentAttributes = taskData.getAttributeMapper().getAttributesByType(taskData,
1796
				TaskAttribute.TYPE_COMMENT);
1797
		if (commentAttributes.size() > 0) {
1798
			selectReveal(commentAttributes.get(commentAttributes.size() - 1).getId());
1799
		}
1800
	}
1801
1773
}
1802
}

Return to bug 237546