Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2011-05-30 03:56:00 +0000
committerfbecker2011-05-30 03:56:00 +0000
commit1ff7e0bd7ef8653133985473b4eef38a7ae3bbee (patch)
tree8959aff692496869c7c64f6e4d7fe8b256913e54 /org.eclipse.mylyn.tasks.ui
parent81be28de6992a80d43b12832d3f7d0fc6baad7d9 (diff)
downloadorg.eclipse.mylyn.tasks-1ff7e0bd7ef8653133985473b4eef38a7ae3bbee.tar.gz
org.eclipse.mylyn.tasks-1ff7e0bd7ef8653133985473b4eef38a7ae3bbee.tar.xz
org.eclipse.mylyn.tasks-1ff7e0bd7ef8653133985473b4eef38a7ae3bbee.zip
ASSIGNED - bug 345847: [patch][api] create UI for private comments and attachments
https://bugs.eclipse.org/bugs/show_bug.cgi?id=345847
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java35
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties1
3 files changed, 36 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java
index 48ee6eb78..88619558c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java
@@ -139,6 +139,8 @@ public class Messages extends NLS {
public static String TaskEditorCommentPart_Expand_Comments;
+ public static String TaskEditorCommentPart_Privat_Comment_ToolTip_Text;
+
public static String TaskEditorDescriptionPart_Description;
public static String TaskEditorDescriptionPart_Detector;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
index 2dce5f824..3e2479600 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorCommentPart.java
@@ -39,11 +39,14 @@ import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -51,6 +54,7 @@ import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.ui.actions.ActionContext;
import org.eclipse.ui.forms.IFormColors;
@@ -356,7 +360,6 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
titleComposite.setBackground(null);
ImageHyperlink expandCommentHyperlink = createTitleHyperLink(toolkit, titleComposite, taskComment);
- expandCommentHyperlink.setFont(commentComposite.getFont());
expandCommentHyperlink.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
@@ -399,10 +402,11 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
sb.append(taskComment.getNumber());
sb.append(": "); //$NON-NLS-1$
}
+ String toolTipText = ""; //$NON-NLS-1$;
if (author != null) {
if (author.getName() != null) {
sb.append(author.getName());
- formHyperlink.setToolTipText(author.getPersonId());
+ toolTipText = author.getPersonId();
} else {
sb.append(author.getPersonId());
}
@@ -411,6 +415,28 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
sb.append(", "); //$NON-NLS-1$
sb.append(EditorUtil.formatDateTime(taskComment.getCreationDate()));
}
+// We need the CommentID for change the value of private
+// this is only for an test included
+// Maybe we need this for bug# 284026
+// TaskAttribute commentID = taskComment.getTaskAttribute().getAttribute("commentid");
+// if (commentID != null) {
+// String value = commentID.getValue();
+// sb.append(" (ID " + value + ")");
+// }
+ if (taskComment.getIsPrivate() != null) {
+ if (taskComment.getIsPrivate()) {
+ if (privateFont == null) {
+ Font a = formHyperlink.getFont();
+ FontData[] fd = a.getFontData();
+ fd[0].setStyle(SWT.ITALIC | SWT.BOLD);
+ privateFont = new Font(Display.getCurrent(), fd[0]);
+ }
+ formHyperlink.setFont(privateFont);
+ toolTipText = NLS.bind(Messages.TaskEditorCommentPart_Privat_Comment_ToolTip_Text, toolTipText);
+ }
+ }
+ formHyperlink.setToolTipText(toolTipText);
+
formHyperlink.setText(sb.toString());
formHyperlink.setEnabled(true);
formHyperlink.setUnderlined(false);
@@ -542,6 +568,8 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
private CommentActionGroup actionGroup;
+ private Font privateFont;
+
public TaskEditorCommentPart() {
this.commentGroupStrategy = new CommentGroupStrategy() {
@Override
@@ -664,6 +692,9 @@ public class TaskEditorCommentPart extends AbstractTaskEditorPart {
if (actionGroup != null) {
actionGroup.dispose();
}
+ if (privateFont != null) {
+ privateFont.dispose();
+ }
}
private void expandAllComments() {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
index 271a4ac8d..91ba7f3f1 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
@@ -75,6 +75,7 @@ TaskEditorCommentPart_1=)
TaskEditorCommentPart_Collapse_Comments=Collapse Comments
TaskEditorCommentPart_Comments=Comments
TaskEditorCommentPart_Expand_Comments=Expand Comments
+TaskEditorCommentPart_Privat_Comment_ToolTip_Text=Private Comment from {0}
TaskEditorDescriptionPart_Description=Description
TaskEditorDescriptionPart_Detector=Detector:

Back to the top