Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaxsun McCarthy Huggan2016-10-28 00:41:40 -0400
committerAlexei Trebounskikh2018-11-30 16:45:33 -0500
commit0df605985bb87ffeeb842632fa207d61e713fc71 (patch)
tree02556cf093857038e35e2418dcd11c73286ee60d
parent84dabea847998d58591390db2a4b9b1f9fe82c4f (diff)
downloadorg.eclipse.mylyn.reviews-0df605985bb87ffeeb842632fa207d61e713fc71.tar.gz
org.eclipse.mylyn.reviews-0df605985bb87ffeeb842632fa207d61e713fc71.tar.xz
org.eclipse.mylyn.reviews-0df605985bb87ffeeb842632fa207d61e713fc71.zip
394733: Gerrit task list tooltip shows review branch
Change-Id: I6307b35fd64703c9401318c825b3a166a32443ad Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=394733 Signed-off-by: Jaxsun McCarthy Huggan <jaxsun.mccarthy@tasktop.com>
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConnector.java24
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/Messages.java2
-rw-r--r--org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/messages.properties5
3 files changed, 20 insertions, 11 deletions
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConnector.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConnector.java
index b4879b34..b4e4afbb 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConnector.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConnector.java
@@ -67,6 +67,7 @@ import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
import org.eclipse.osgi.util.NLS;
import com.google.common.base.Joiner;
+import com.google.common.base.Strings;
import com.google.gwtorm.client.KeyUtil;
import com.google.gwtorm.server.StandardKeyEncoder;
@@ -348,28 +349,33 @@ public class GerritConnector extends ReviewsConnector {
@SuppressWarnings("restriction")
private void addExtendedTooltip(ITask task) {
+ String branchValue = task.getAttribute(ReviewsCoreConstants.BRANCH);
String codeReviewValue = task.getAttribute(ReviewsCoreConstants.CODE_REVIEW);
String verifiedValue = task.getAttribute(ReviewsCoreConstants.VERIFIED);
- String reviewTooltip = createTooltipText(Messages.GerritConnector_CodeReviewTooltip, codeReviewValue);
- String verifiedTooltip = createTooltipText(Messages.GerritConnector_VerifiedTooltip, verifiedValue);
+ String branchTooltip = null;
+ if (!Strings.isNullOrEmpty(branchValue)) {
+ branchTooltip = NLS.bind(Messages.GerritConnector_BranchTooltip, branchValue);
+ }
+ String reviewTooltip = createVoteTooltipText(Messages.GerritConnector_CodeReviewTooltip, codeReviewValue);
+ String verifiedTooltip = createVoteTooltipText(Messages.GerritConnector_VerifiedTooltip, verifiedValue);
- String tooltip = Joiner.on("\n").skipNulls().join(reviewTooltip, verifiedTooltip); //$NON-NLS-1$
+ String tooltip = Joiner.on("\n").skipNulls().join(branchTooltip, reviewTooltip, verifiedTooltip); //$NON-NLS-1$
if (!tooltip.isEmpty()) {
task.setAttribute(ITasksCoreConstants.ATTRIBUTE_TASK_EXTENDED_TOOLTIP, tooltip);
}
}
- private String createTooltipText(String label, String integerString) {
+ private String createVoteTooltipText(String format, String integerString) {
int value = tryParseInt(integerString);
if (value != 0) {
- StringBuilder builder = new StringBuilder();
- builder.append(label);
+ String sign;
if (value > 0) {
- builder.append("+"); //$NON-NLS-1$
+ sign = "+"; //$NON-NLS-1$
+ } else {
+ sign = ""; //$NON-NLS-1$
}
- builder.append(value);
- return builder.toString();
+ return NLS.bind(format, sign, value);
}
return null;
}
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/Messages.java b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/Messages.java
index 21d3cb5e..e5da2475 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/Messages.java
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/Messages.java
@@ -17,6 +17,8 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.mylyn.internal.gerrit.core.messages"; //$NON-NLS-1$
+ public static String GerritConnector_BranchTooltip;
+
public static String GerritConnector_CodeReviewTooltip;
public static String GerritConnector_Executing_query;
diff --git a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/messages.properties b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/messages.properties
index aa719e1c..606a7afd 100644
--- a/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/messages.properties
+++ b/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/messages.properties
@@ -9,10 +9,11 @@
# Tasktop Technologies - initial API and implementation
# Marc-Andre Laperle (Ericsson) - Add topic
###############################################################################
-GerritConnector_CodeReviewTooltip=Code Review:
+GerritConnector_BranchTooltip=Branch: {0}
+GerritConnector_CodeReviewTooltip=Code Review: {0}{1}
GerritConnector_Executing_query=Executing query
GerritConnector_Label=Gerrit Code Review (supports {0} to {1})
-GerritConnector_VerifiedTooltip=Verified:
+GerritConnector_VerifiedTooltip=Verified: {0}{1}
GerritQueryResultSchema_Branch=Branch
GerritQueryResultSchema_ChangeId=Change-Id
GerritQueryResultSchema_Project=Project

Back to the top