summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Muskalla2012-07-17 08:36:45 (EDT)
committerBenjamin Muskalla2012-07-17 08:36:45 (EDT)
commit6586fcf0bbd341af3cf5d34b4b3a2f44272456e4 (patch)
treec06d97956e578b7dd2ca46414d8079d0c9d4a940
parent38d3983fa7a1e5819bcc3419d4ac30db93d8c407 (diff)
downloadorg.eclipse.mylyn.tasks-6586fcf0bbd341af3cf5d34b4b3a2f44272456e4.zip
org.eclipse.mylyn.tasks-6586fcf0bbd341af3cf5d34b4b3a2f44272456e4.tar.gz
org.eclipse.mylyn.tasks-6586fcf0bbd341af3cf5d34b4b3a2f44272456e4.tar.bz2
NEW - bug 380876: pull up default implementation for getReplyText refs/changes/07/6307/3
https://bugs.eclipse.org/bugs/show_bug.cgi?id=380876 Change-Id: I188ef19ce831af8b98f63c16ff6afcc285ae036c
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java14
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java6
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties3
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java2
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/AbstractRepositoryConnectorUiTest.java80
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java18
8 files changed, 105 insertions, 27 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java
index cb98619..2cc13e6 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java
@@ -13,7 +13,6 @@
package org.eclipse.mylyn.internal.bugzilla.ui.tasklist;
-import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
@@ -36,7 +35,6 @@ import org.eclipse.mylyn.internal.bugzilla.ui.search.BugzillaSearchPage;
import org.eclipse.mylyn.internal.bugzilla.ui.wizard.NewBugzillaTaskWizard;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskComment;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttachmentModel;
@@ -89,18 +87,6 @@ public class BugzillaConnectorUi extends AbstractRepositoryConnectorUi {
}
@Override
- public String getReplyText(TaskRepository taskRepository, ITask task, ITaskComment taskComment, boolean includeTask) {
- if (taskComment == null) {
- return Messages.BugzillaConnectorUi__In_reply_to_comment_0_;
- } else if (includeTask) {
- return MessageFormat.format(Messages.BugzillaConnectorUi__In_reply_to_X_comment_X_, task.getTaskKey(),
- taskComment.getNumber());
- } else {
- return MessageFormat.format(Messages.BugzillaConnectorUi__In_reply_to_comment_X_, taskComment.getNumber());
- }
- }
-
- @Override
public List<LegendElement> getLegendElements() {
List<LegendElement> legendItems = new ArrayList<LegendElement>();
legendItems.add(LegendElement.createTask("blocker", BugzillaImages.OVERLAY_CRITICAL)); //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java
index 2f59363..f30aa00 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/Messages.java
@@ -25,12 +25,6 @@ public class Messages extends NLS {
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
- public static String BugzillaConnectorUi__In_reply_to_comment_X_;
-
- public static String BugzillaConnectorUi__In_reply_to_X_comment_X_;
-
- public static String BugzillaConnectorUi__In_reply_to_comment_0_;
-
public static String BugzillaCustomQueryDialog_Bugzilla_Query_Category_Name;
public static String BugzillaCustomQueryDialog_Max_Hits_Returned__1_means_all_;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties
index 01c7239..c547c84 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/messages.properties
@@ -8,9 +8,6 @@
# Contributors:
# Tasktop Technologies - initial API and implementation
###############################################################################
-BugzillaConnectorUi__In_reply_to_comment_X_=(In reply to comment \#{0})
-BugzillaConnectorUi__In_reply_to_X_comment_X_=(In reply to {0} comment \#{1})
-BugzillaConnectorUi__In_reply_to_comment_0_=(In reply to comment \#0)
BugzillaCustomQueryDialog_Bugzilla_Query_Category_Name=Bugzilla Query Category Name
BugzillaCustomQueryDialog_Max_Hits_Returned__1_means_all_=Max Hits Returned (-1 means all)
BugzillaCustomQueryDialog_Query_URL=Query URL
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
index 2c00a91..47c1b1f 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/AllTasksTests.java
@@ -25,6 +25,7 @@ import org.eclipse.mylyn.tasks.tests.core.TaskRepositoryTest;
import org.eclipse.mylyn.tasks.tests.data.TaskAttributeMapperTest;
import org.eclipse.mylyn.tasks.tests.data.TaskDataExternalizerTest;
import org.eclipse.mylyn.tasks.tests.data.Xml11InputStreamTest;
+import org.eclipse.mylyn.tasks.tests.ui.AbstractRepositoryConnectorUiTest;
import org.eclipse.mylyn.tasks.tests.ui.MultipleTaskHyperlinkDetectorTest;
import org.eclipse.mylyn.tasks.tests.ui.TaskAttachmentPropertyTesterTest;
import org.eclipse.mylyn.tasks.tests.ui.TaskHyperlinkDetectorTest;
@@ -128,6 +129,7 @@ public class AllTasksTests {
suite.addTestSuite(TaskAttributeMapperTest.class);
suite.addTestSuite(SupportHandlerManagerTest.class);
suite.addTestSuite(RepositoryClientManagerTest.class);
+ suite.addTestSuite(AbstractRepositoryConnectorUiTest.class);
return suite;
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/AbstractRepositoryConnectorUiTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/AbstractRepositoryConnectorUiTest.java
new file mode 100644
index 0000000..fb75222
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/ui/AbstractRepositoryConnectorUiTest.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.tests.ui;
+
+import junit.framework.TestCase;
+
+import org.eclipse.mylyn.internal.tasks.core.TaskComment;
+import org.eclipse.mylyn.internal.tasks.core.TaskTask;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.ITaskComment;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
+import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnector;
+import org.eclipse.mylyn.tasks.tests.connector.MockRepositoryConnectorUi;
+import org.eclipse.mylyn.tasks.tests.connector.MockTask;
+import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
+
+/**
+ * @author Benjamin Muskalla
+ */
+public class AbstractRepositoryConnectorUiTest extends TestCase {
+
+ private AbstractRepositoryConnectorUi connectorUi;
+
+ private TaskRepository repository;
+
+ private TaskAttribute commentAttribute;
+
+ private MockTask task;
+
+ @Override
+ protected void setUp() throws Exception {
+ connectorUi = new MockRepositoryConnectorUi();
+ repository = new TaskRepository(MockRepositoryConnector.CONNECTOR_KIND, MockRepositoryConnector.REPOSITORY_URL);
+ task = new MockTask("1");
+ TaskAttributeMapper mapper = new TaskAttributeMapper(repository);
+ TaskData taskData = new TaskData(mapper, MockRepositoryConnector.CONNECTOR_KIND,
+ MockRepositoryConnector.REPOSITORY_URL, "1");
+ commentAttribute = taskData.getRoot().createAttribute("comment");
+ }
+
+ public void testGetReplyTextDescription() throws Exception {
+ ITask task = new TaskTask("abc", "http://eclipse.org/mylyn", "1");
+ String replyText = connectorUi.getReplyText(null, task, null, false);
+ assertEquals("(In reply to comment #0)", replyText);
+ }
+
+ public void testGetReplyTextSpecificComment() throws Exception {
+ ITaskComment taskComment = new TaskComment(repository, task, commentAttribute) {
+ @Override
+ public int getNumber() {
+ return 13;
+ }
+ };
+ String replyText = connectorUi.getReplyText(null, task, taskComment, false);
+ assertEquals("(In reply to comment #13)", replyText);
+ }
+
+ public void testGetReplyTextSpecificCommentOnTask() throws Exception {
+ ITaskComment taskComment = new TaskComment(repository, task, commentAttribute) {
+ @Override
+ public int getNumber() {
+ return 13;
+ }
+ };
+ String replyText = connectorUi.getReplyText(null, task, taskComment, true);
+ assertEquals("(In reply to 1 comment #13)", replyText);
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java
index dfcb1a7..c91b043 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/Messages.java
@@ -135,6 +135,12 @@ public class Messages extends NLS {
public static String TaskTrimWidget__no_task_active_;
+ public static String AbstractRepositoryConnectorUi_InReplyToComment;
+
+ public static String AbstractRepositoryConnectorUi_InReplyToDescription;
+
+ public static String AbstractRepositoryConnectorUi_InReplyToTaskAndComment;
+
public static String AbstractRepositoryConnectorUi_Task;
public static String TaskElementLabelProvider__no_summary_available_;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties
index 8cf5fe4..787d353 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/messages.properties
@@ -82,6 +82,9 @@ TasksUiPlugin_New_Task=New Task...
TaskTrimWidget__no_active_task_=<no active task>
TaskTrimWidget__no_task_active_=<no task active>
+AbstractRepositoryConnectorUi_InReplyToComment=(In reply to comment \#{0})
+AbstractRepositoryConnectorUi_InReplyToDescription=(In reply to comment \#0)
+AbstractRepositoryConnectorUi_InReplyToTaskAndComment=(In reply to {0} comment \#{1})
AbstractRepositoryConnectorUi_Task=Task
TaskElementLabelProvider__no_summary_available_=: <no summary available>
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
index 3ceb233..8a310c8 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
@@ -13,6 +13,7 @@
package org.eclipse.mylyn.tasks.ui;
+import java.text.MessageFormat;
import java.util.Collections;
import java.util.List;
@@ -214,14 +215,23 @@ public abstract class AbstractRepositoryConnectorUi {
}
/**
- * Override to return a textual reference to a comment, e.g. for Bugzilla this method returns <code>#12</code> for
- * comment 12. This reference is used when generating replies to comments
+ * Override to return a specific textual reference to a comment, e.g. by default this method returns
+ * <code>In reply to comment #12</code> for a reply to comment 12. This text is used when generating replies to
+ * comments.
*
- * @return a reference to <code>comment</code>; null, if no reference is available
+ * @return the reply text with a reference to <code>taskComment</code>; null, if no reference is available
* @since 3.0
*/
public String getReplyText(TaskRepository taskRepository, ITask task, ITaskComment taskComment, boolean includeTask) {
- return null;
+ if (taskComment == null) {
+ return Messages.AbstractRepositoryConnectorUi_InReplyToDescription;
+ } else if (includeTask) {
+ return MessageFormat.format(Messages.AbstractRepositoryConnectorUi_InReplyToTaskAndComment,
+ task.getTaskKey(), taskComment.getNumber());
+ } else {
+ return MessageFormat.format(Messages.AbstractRepositoryConnectorUi_InReplyToComment,
+ taskComment.getNumber());
+ }
}
/**