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 286294 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java (+4 lines)
Lines 139-146 public class Messages extends NLS { Link Here
139
139
140
	public static String TaskEditorCommentPart_Expand_Comments;
140
	public static String TaskEditorCommentPart_Expand_Comments;
141
141
142
	public static String TaskEditorCommentPart_Expand_Starred;
143
142
	public static String TaskEditorCommentPart_Privat_Comment_ToolTip_Text;
144
	public static String TaskEditorCommentPart_Privat_Comment_ToolTip_Text;
143
145
146
	public static String TaskEditorCommentPart_Star_this_comment;
147
144
	public static String TaskEditorDescriptionPart_Description;
148
	public static String TaskEditorDescriptionPart_Description;
145
149
146
	public static String TaskEditorDescriptionPart_Detector;
150
	public static String TaskEditorDescriptionPart_Detector;
(-)a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java (-2 / +86 lines)
Lines 250-255 public class TaskEditorCommentPart extends AbstractTaskEditorPart { Link Here
250
			}
250
			}
251
		}
251
		}
252
252
253
		/**
254
		 * Expands this group and all starred comments in it.
255
		 */
256
		public void setStarredExpanded(boolean expanded) {
257
			if (groupSection != null && groupSection.isExpanded() != expanded) {
258
				CommonFormUtil.setExpanded(groupSection, expanded);
259
			}
260
261
			if (commentViewers != null) {
262
				for (CommentViewer commentViewer : commentViewers) {
263
					if (commentViewer.isStarred()) {
264
						commentViewer.setExpanded(expanded);
265
					}
266
				}
267
			}
268
		}
269
253
		public void setRenderedInSubSection(boolean renderedInSubSection) {
270
		public void setRenderedInSubSection(boolean renderedInSubSection) {
254
			this.renderedInSubSection = renderedInSubSection;
271
			this.renderedInSubSection = renderedInSubSection;
255
		}
272
		}
Lines 298-303 public class TaskEditorCommentPart extends AbstractTaskEditorPart { Link Here
298
315
299
	private class CommentViewer {
316
	private class CommentViewer {
300
317
318
		protected static final String COMMENT_STARRED = "org.eclipse.mylyn.internal.tasks.ui.editors.comment.starred"; //$NON-NLS-1$
319
301
		private Composite buttonComposite;
320
		private Composite buttonComposite;
302
321
303
		private final TaskAttribute commentAttribute;
322
		private final TaskAttribute commentAttribute;
Lines 364-369 public class TaskEditorCommentPart extends AbstractTaskEditorPart { Link Here
364
			titleComposite.setLayout(rowLayout);
383
			titleComposite.setLayout(rowLayout);
365
			titleComposite.setBackground(null);
384
			titleComposite.setBackground(null);
366
385
386
			final ImageHyperlink starButton = toolkit.createImageHyperlink(titleComposite, SWT.NONE);
387
			starButton.setToolTipText(Messages.TaskEditorCommentPart_Star_this_comment);
388
			starButton.setImage(isStarred()
389
					? CommonImages.getImage(CommonImages.CHECKBOX_SELECTED)
390
					: CommonImages.getImage(CommonImages.CHECKBOX_CLEARED));
391
			starButton.addHyperlinkListener(new HyperlinkAdapter() {
392
				@Override
393
				public void linkActivated(HyperlinkEvent e) {
394
					boolean starred = !isStarred();
395
					setStarred(starred);
396
					starButton.setImage(starred
397
							? CommonImages.getImage(CommonImages.CHECKBOX_SELECTED)
398
							: CommonImages.getImage(CommonImages.CHECKBOX_CLEARED));
399
				}
400
			});
401
367
			ImageHyperlink expandCommentHyperlink = createTitleHyperLink(toolkit, titleComposite, taskComment);
402
			ImageHyperlink expandCommentHyperlink = createTitleHyperLink(toolkit, titleComposite, taskComment);
368
			expandCommentHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
403
			expandCommentHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
369
				@Override
404
				@Override
Lines 513-518 public class TaskEditorCommentPart extends AbstractTaskEditorPart { Link Here
513
			return commentComposite;
548
			return commentComposite;
514
		}
549
		}
515
550
551
		public boolean isStarred() {
552
			String key = COMMENT_STARRED + taskComment.getNumber();
553
			return Boolean.parseBoolean(getTaskEditorPage().getTask().getAttribute(key));
554
		}
555
556
		public void setStarred(boolean starred) {
557
			getTaskEditorPage().getTask().setAttribute(COMMENT_STARRED + taskComment.getNumber(),
558
					Boolean.toString(starred));
559
		}
560
516
	}
561
	}
517
562
518
	private class ReplyToCommentAction extends AbstractReplyToCommentAction implements IMenuCreator {
563
	private class ReplyToCommentAction extends AbstractReplyToCommentAction implements IMenuCreator {
Lines 546-552 public class TaskEditorCommentPart extends AbstractTaskEditorPart { Link Here
546
			selectionProvider.setSelection(new StructuredSelection(taskComment));
591
			selectionProvider.setSelection(new StructuredSelection(taskComment));
547
			return commentMenu;
592
			return commentMenu;
548
		}
593
		}
549
550
	}
594
	}
551
595
552
	/** Expandable composites are indented by 6 pixels by default. */
596
	/** Expandable composites are indented by 6 pixels by default. */
Lines 736-741 public class TaskEditorCommentPart extends AbstractTaskEditorPart { Link Here
736
		getTaskEditorPage().reflow();
780
		getTaskEditorPage().reflow();
737
	}
781
	}
738
782
783
	private void expandStarredComments(boolean expandViewers) {
784
		try {
785
			expandAllInProgress = true;
786
			suppressExpandViewers = !expandViewers;
787
			getTaskEditorPage().setReflow(false);
788
789
			if (section != null) {
790
				// the expandAllInProgress flag will ensure that comments in top-level groups have been 
791
				// expanded, no need to expand groups explicitly
792
				//boolean expandGroups = section.getClient() != null;
793
794
				CommonFormUtil.setExpanded(section, true);
795
796
				if (expandViewers) {
797
					List<CommentGroupViewer> groupViewers = getCommentGroupViewers();
798
					for (int i = groupViewers.size() - 1; i >= 0; i--) {
799
						if (!groupViewers.get(i).isFullyExpanded()) {
800
							groupViewers.get(i).setStarredExpanded(true);
801
						}
802
					}
803
				}
804
			}
805
		} finally {
806
			expandAllInProgress = false;
807
			suppressExpandViewers = false;
808
			getTaskEditorPage().setReflow(true);
809
		}
810
		getTaskEditorPage().reflow();
811
	}
812
739
	private void expandSection(final FormToolkit toolkit, final Section section) {
813
	private void expandSection(final FormToolkit toolkit, final Section section) {
740
		Composite composite = toolkit.createComposite(section);
814
		Composite composite = toolkit.createComposite(section);
741
		section.setClient(composite);
815
		section.setClient(composite);
Lines 775-783 public class TaskEditorCommentPart extends AbstractTaskEditorPart { Link Here
775
		expandAllAction.setToolTipText(Messages.TaskEditorCommentPart_Expand_Comments);
849
		expandAllAction.setToolTipText(Messages.TaskEditorCommentPart_Expand_Comments);
776
		barManager.add(expandAllAction);
850
		barManager.add(expandAllAction);
777
851
852
		Action expandStarredAction = new Action("") { //$NON-NLS-1$
853
			@Override
854
			public void run() {
855
				expandStarredComments(true);
856
			}
857
		};
858
		expandStarredAction.setImageDescriptor(CommonImages.CHECKBOX_SELECTED);
859
		expandStarredAction.setToolTipText(Messages.TaskEditorCommentPart_Expand_Starred);
860
		barManager.add(expandStarredAction);
861
778
		if (commentAttributes.isEmpty()) {
862
		if (commentAttributes.isEmpty()) {
779
			collapseAllAction.setEnabled(false);
863
			collapseAllAction.setEnabled(false);
780
			expandAllAction.setEnabled(false);
864
			expandStarredAction.setEnabled(false);
781
		}
865
		}
782
	}
866
	}
783
867
(-)a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties (+2 lines)
Lines 75-81 TaskEditorCommentPart_1=) Link Here
75
TaskEditorCommentPart_Collapse_Comments=Collapse Comments
75
TaskEditorCommentPart_Collapse_Comments=Collapse Comments
76
TaskEditorCommentPart_Comments=Comments
76
TaskEditorCommentPart_Comments=Comments
77
TaskEditorCommentPart_Expand_Comments=Expand Comments
77
TaskEditorCommentPart_Expand_Comments=Expand Comments
78
TaskEditorCommentPart_Expand_Starred=Expand Starred
78
TaskEditorCommentPart_Privat_Comment_ToolTip_Text=Private Comment from {0}
79
TaskEditorCommentPart_Privat_Comment_ToolTip_Text=Private Comment from {0}
80
TaskEditorCommentPart_Star_this_comment=Star this comment.
79
81
80
TaskEditorDescriptionPart_Description=Description
82
TaskEditorDescriptionPart_Description=Description
81
TaskEditorDescriptionPart_Detector=Detector:
83
TaskEditorDescriptionPart_Detector=Detector:

Return to bug 286294