Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2011-06-20 15:28:59 -0400
committerfbecker2011-06-20 15:28:59 -0400
commit9431a09e16743d9db3135d7c14882f242d444655 (patch)
treebbf0c947fdd30099ef2dcfa7139dee4d3433e1a3
parent06debc8251f54f38094704c30b94b4e60a7901c2 (diff)
downloadorg.eclipse.mylyn.tasks-9431a09e16743d9db3135d7c14882f242d444655.tar.gz
org.eclipse.mylyn.tasks-9431a09e16743d9db3135d7c14882f242d444655.tar.xz
org.eclipse.mylyn.tasks-9431a09e16743d9db3135d7c14882f242d444655.zip
ASSIGNED - bug 349771: create UI for support adding private comments
https://bugs.eclipse.org/bugs/show_bug.cgi?id=349771
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorCommentPart.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorNewCommentPart.java74
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java15
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties4
5 files changed, 103 insertions, 2 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorCommentPart.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorCommentPart.java
index bf15d5abb..5380593c8 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorCommentPart.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorCommentPart.java
@@ -33,10 +33,10 @@ public class BugzillaTaskEditorCommentPart extends TaskEditorCommentPart {
if (taskComment.getIsPrivate() != null) {
if (taskComment.getIsPrivate()) {
this.setImageDescriptor(TasksUiImages.LOCK_CLOSE);
- this.setToolTipText("private Comment");
+ this.setToolTipText(Messages.BugzillaTaskEditorCommentPart_privateComment);
} else {
this.setImageDescriptor(TasksUiImages.LOCK_OPEN);
- this.setToolTipText("public Comment");
+ this.setToolTipText(Messages.BugzillaTaskEditorCommentPart_publicComment);
}
}
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorNewCommentPart.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorNewCommentPart.java
new file mode 100644
index 000000000..1579bf54c
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorNewCommentPart.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.bugzilla.ui.editor;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
+import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorNewCommentPart;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.ui.TasksUiImages;
+import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
+
+public class BugzillaTaskEditorNewCommentPart extends TaskEditorNewCommentPart {
+ private Action privateAction;
+
+ public BugzillaTaskEditorNewCommentPart() {
+ // ignore
+ }
+
+ @Override
+ protected void fillToolBar(ToolBarManager manager) {
+ String insidergroup = getModel().getTaskRepository().getProperty(IBugzillaConstants.BUGZILLA_INSIDER_GROUP);
+ if (Boolean.parseBoolean(insidergroup)) {
+
+ privateAction = new Action() {
+
+ private void updateActionState(String newValue) {
+ if (newValue.equals("1")) { //$NON-NLS-1$
+ this.setImageDescriptor(TasksUiImages.LOCK_CLOSE);
+ this.setToolTipText(Messages.BugzillaTaskEditorNewCommentPart_privateComment);
+ } else {
+ this.setImageDescriptor(TasksUiImages.LOCK_OPEN);
+ this.setToolTipText(Messages.BugzillaTaskEditorNewCommentPart_publicComment);
+ }
+
+ }
+
+ @Override
+ public void run() {
+ TaskAttribute isprivate = getAttribute().getParentAttribute().getAttribute("comment_is_private"); //$NON-NLS-1$
+ String value = isprivate.getValue();
+ String newValue = value.equals("1") ? "0" : "1"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ isprivate.setValue(newValue);
+ updateActionState(newValue);
+ }
+
+ };
+ privateAction.setImageDescriptor(TasksUiImages.LOCK_OPEN);
+ privateAction.setToolTipText(Messages.BugzillaTaskEditorNewCommentPart_publicComment);
+ manager.add(privateAction);
+ }
+ super.fillToolBar(manager);
+ }
+
+ @Override
+ public void initialize(AbstractTaskEditorPage taskEditorPage) {
+ super.initialize(taskEditorPage);
+ TaskAttribute isprivate = getAttribute().getParentAttribute().getAttribute("comment_is_private"); //$NON-NLS-1$
+ if (isprivate == null) {
+ isprivate = getAttribute().getParentAttribute().createAttribute("comment_is_private"); //$NON-NLS-1$
+ }
+ isprivate.setValue("0"); //$NON-NLS-1$
+ }
+
+}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
index ea588ae6e..7b2e6fece 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
@@ -112,6 +112,13 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
break;
}
}
+ for (TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) {
+ if (taskEditorPartDescriptor.getId().equals(ID_PART_NEW_COMMENT)) {
+ descriptors.remove(taskEditorPartDescriptor);
+ hasPartComments = true;
+ break;
+ }
+ }
// Add Bugzilla Planning part
try {
@@ -155,6 +162,14 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
// ignore
}
+ // Add the updated Bugzilla new comment part
+ descriptors.add(new TaskEditorPartDescriptor(ID_PART_NEW_COMMENT) {
+ @Override
+ public AbstractTaskEditorPart createPart() {
+ return new BugzillaTaskEditorNewCommentPart();
+ }
+ }.setPath(PATH_COMMENTS));
+
// Add the updated Bugzilla people part
descriptors.add(new TaskEditorPartDescriptor(ID_PART_PEOPLE) {
@Override
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java
index b245f2c4f..c4264c7f8 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java
@@ -59,6 +59,14 @@ public class Messages extends NLS {
public static String BugzillaResponseDetailDialog_Email_Line;
+ public static String BugzillaTaskEditorCommentPart_privateComment;
+
+ public static String BugzillaTaskEditorCommentPart_publicComment;
+
+ public static String BugzillaTaskEditorNewCommentPart_privateComment;
+
+ public static String BugzillaTaskEditorNewCommentPart_publicComment;
+
public static String BugzillaTaskEditorPage_Anonymous_can_not_submit_Tasks;
public static String BugzillaTaskEditorPage_Changes_Submitted_Message;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties
index 95b83a601..bc3ad6911 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties
@@ -27,6 +27,10 @@ BugzillaResponseDetailDialog_Titel=submitted Changes Details
BugzillaResponseDetailDialog_Bug_Line={0}\n
BugzillaResponseDetailDialog_Action_Line=\ \ \ \ \ \ \ \ {0}\n
BugzillaResponseDetailDialog_Email_Line=\ \ \ \ \ \ \ \ \ \ \ \ {0}\n
+BugzillaTaskEditorCommentPart_privateComment=private Comment
+BugzillaTaskEditorCommentPart_publicComment=public Comment
+BugzillaTaskEditorNewCommentPart_privateComment=private Comment
+BugzillaTaskEditorNewCommentPart_publicComment=public Comment
BugzillaTaskEditorPage_Anonymous_can_not_submit_Tasks=Anonymous can not submit Tasks\!
BugzillaTaskEditorPage_Changes_Submitted_Message=Changes submitted
BugzillaTaskEditorPage_Please_enter_a_description_before_submitting=Please enter a description before submitting

Back to the top