tuleap #622 Editor hover should indicate draft comments
Change-Id: If8a2046fe0d799e8b9f49148152fb9f2be83e347
Signed-off-by: Jacques Bouthillier <lmcbout@gmail.com>
diff --git a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/Messages.java b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/Messages.java
index 7e59feb..2d277a7 100644
--- a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/Messages.java
+++ b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/Messages.java
@@ -362,11 +362,11 @@
public static String UIUtils_0;
- public static String UIUtils_1;
+ public static String UIUtils_lineDeleted;
- public static String UIUtils_2;
+ public static String UIUtils_draft;
- public static String UIUtils_3;
+ public static String UIUtils_comment;
public static String FileTabView_EGerriTipValue;
diff --git a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/UIUtils.java b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/UIUtils.java
index 4d7c6a7..d7ce312 100644
--- a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/UIUtils.java
+++ b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/UIUtils.java
@@ -215,13 +215,23 @@
}
public static String formatMessageForMarkerView(CommentInfo commentInfo, int newPosition) {
- String patchSet = ModelHelpers.getRevision(commentInfo).get_number() + "/" //$NON-NLS-1$
- + ModelHelpers.getHighestRevisionNumber(
- ModelHelpers.getRevision(commentInfo).getChangeInfo().getRevisions().values());
- String author = commentInfo.getAuthor() != null ? commentInfo.getAuthor().getName() : Messages.UIUtils_1;
- return commentInfo.getMessage() + (newPosition < 0 ? NLS.bind(Messages.UIUtils_3, commentInfo.getLine()) : "") //$NON-NLS-1$
- + NLS.bind(Messages.UIUtils_2,
- new String[] { author, CommentPrettyPrinter.printDate(commentInfo), patchSet });
+ String psString = getPatchSetString(commentInfo);
+ String author = commentInfo.getAuthor() != null ? commentInfo.getAuthor().getName() : null;
+ String message = commentInfo.getMessage();
+ boolean lineDeleted = newPosition < 0;
+ String formattedMessage;
+ if (author == null) {
+ //This is a draft
+ formattedMessage = NLS.bind(Messages.UIUtils_draft,
+ new String[] { message, CommentPrettyPrinter.printDate(commentInfo), psString });
+ } else {
+ formattedMessage = NLS.bind(Messages.UIUtils_comment,
+ new String[] { message, author, CommentPrettyPrinter.printDate(commentInfo), psString });
+ }
+ if (lineDeleted) {
+ return formattedMessage + NLS.bind(Messages.UIUtils_lineDeleted, commentInfo.getLine());
+ }
+ return formattedMessage;
}
public static String formatMessageForQuickFix(CommentInfo commentInfo) {
diff --git a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/messages.properties b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/messages.properties
index a259bb0..787c161 100644
--- a/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/messages.properties
+++ b/org.eclipse.egerrit.ui/src/org/eclipse/egerrit/internal/ui/utils/messages.properties
@@ -185,9 +185,9 @@
UIFilesTable_clearReviewedFlag=Clear all reviewed flags
UIUtils_EGerriTipShowAgain=Don't show this message again
UIUtils_0=\ (draft)
-UIUtils_1=Me
-UIUtils_2=\nWritten by {0} at {1} for patchset {2}.\n
-UIUtils_3=\nThe line {0} associated with this comment has been deleted.
+UIUtils_lineDeleted=\nThe line {0} associated with this comment has been deleted.
+UIUtils_draft=Draft: {0} \nWritten at {1} for patchset {2}.
+UIUtils_comment={0} \nWritten by {1} at {2} for patchset {3}.
FileTabView_EGerriTipValue=You may write comments by entering text in the editor
DeleteDraft_Text=Delete Revision
DeleteDraft_Tip=Delete Draft Revision