453957: show status in the dashboard

Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=453957
Change-Id: I5fda23d58f761aec465c615945e69e95945807f6
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
diff --git a/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/Messages.java b/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/Messages.java
index b6d03c1..52df6f2 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/Messages.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/Messages.java
@@ -1,11 +1,11 @@
 /*******************************************************************************
  * Copyright (c) 2014 Ericsson
- * 
+ *
  * 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:
  *   Jacques Bouthillier - Initial implementation
  *   Marc-Andre Laperle - Add Topic to dashboard
@@ -39,6 +39,8 @@
 
 	public static String GerritTask_subject;
 
+	public static String GerritTask_status;
+
 	public static String GerritTask_taskID;
 
 	public static String GerritTask_updated;
diff --git a/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/core/GerritTask.java b/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/core/GerritTask.java
index b1d91f0..a8ea71c 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/core/GerritTask.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/core/GerritTask.java
@@ -9,6 +9,7 @@
  * Contributors:
  *   Francois Chouinard - Initial implementation
  *   Marc-Andre Laperle - Add Topic to dashboard
+ *   Marc-Andre Laperle - Add Status to dashboard
  ******************************************************************************/
 
 package org.eclipse.mylyn.gerrit.dashboard.core;
@@ -60,6 +61,11 @@
 	public static final String SUBJECT = TaskAttribute.SUMMARY;
 
 	/**
+	 * Gerrit Review status
+	 */
+	public static final String STATUS = GerritTaskSchema.getDefault().STATUS.getKey();
+
+	/**
 	 * Gerrit Review owner
 	 */
 	public static final String OWNER = GerritTaskSchema.getDefault().OWNER.getKey();
@@ -144,6 +150,7 @@
 		setAttribute(SHORT_CHANGE_ID, getValue(attributes.get(SHORT_CHANGE_ID)));
 		setAttribute(CHANGE_ID, getValue(attributes.get(CHANGE_ID)));
 		setAttribute(SUBJECT, getValue(attributes.get(SUBJECT)));
+		setAttribute(STATUS, getValue(attributes.get(STATUS)));
 
 		setAttribute(OWNER, getValue(attributes.get(OWNER)));
 		setAttribute(PROJECT, getValue(attributes.get(PROJECT)));
@@ -274,6 +281,7 @@
 		buffer.append(Messages.GerritTask_shortID).append(getAttribute(GerritTask.SHORT_CHANGE_ID)).append('\n');
 		buffer.append(Messages.GerritTask_changeID).append(getAttribute(GerritTask.CHANGE_ID)).append('\n');
 		buffer.append(Messages.GerritTask_subject).append(getAttribute(GerritTask.SUBJECT)).append('\n');
+		buffer.append(Messages.GerritTask_status).append(getAttribute(GerritTask.STATUS)).append('\n');
 		buffer.append(Messages.GerritTask_owner).append(getAttribute(GerritTask.OWNER)).append('\n');
 		buffer.append(Messages.GerritTask_project).append(getAttribute(GerritTask.PROJECT)).append('\n');
 		buffer.append(Messages.GerritTask_branch).append(getAttribute(GerritTask.BRANCH)).append('\n');
diff --git a/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/messages.properties b/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/messages.properties
index 19d1e06..ddbc013 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/messages.properties
+++ b/org.eclipse.mylyn.gerrit.dashboard.core/src/org/eclipse/mylyn/gerrit/dashboard/messages.properties
@@ -9,6 +9,7 @@
 # Contributors:
 #   Jacques Bouthillier - Initial implementation
 #   Marc-Andre Laperle - Add Topic to dashboard
+#   Marc-Andre Laperle - Add Status to dashboard
 ###############################################################################
 GerritPlugin_started=plugin started
 GerritPlugin_stopped=plugin stopped
@@ -21,6 +22,7 @@
 GerritTask_shortID=ShortID = 
 GerritTask_star=STAR = 
 GerritTask_subject=Subject = 
+GerritTask_subject=Status = 
 GerritTask_taskID=TaskID  = 
 GerritTask_updated=Updated = 
 Tracer_consoleLog=/consoleLog
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/Messages.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/Messages.java
index 48daad7..1dbdd29 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/Messages.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/Messages.java
@@ -8,6 +8,7 @@
  *
  * Contributors:
  *     Jacques Bouthillier - initial API and implementation
+ *     Marc-Andre Laperle - Add Status to dashboard
  *******************************************************************************/
 
 package org.eclipse.mylyn.gerrit.dashboard.ui.internal.model;
@@ -29,6 +30,8 @@
 
 	public static String ReviewTableDefinition_subject;
 
+	public static String ReviewTableDefinition_status;
+
 	public static String ReviewTableDefinition_updated;
 
 	public static String ReviewTableDefinition_verify;
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableDefinition.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableDefinition.java
index 7a552d5..21783e1 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableDefinition.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableDefinition.java
@@ -11,6 +11,7 @@
  * 
  * Contributors:
  *   Jacques Bouthillier - Initial Implementation of the table view information
+ *   Marc-Andre Laperle - Add Status to dashboard
  ******************************************************************************/
 
 package org.eclipse.mylyn.gerrit.dashboard.ui.internal.model;
@@ -33,6 +34,7 @@
 	STARRED("", 20, false, true, SWT.LEFT), //$NON-NLS-1$
 	ID(Messages.ReviewTableDefinition_id, 80, false, true, SWT.LEFT), //
 	SUBJECT(Messages.ReviewTableDefinition_subject, 200, true, true, SWT.LEFT), //
+	STATUS(Messages.ReviewTableDefinition_status, 100, true, true, SWT.LEFT),
 	OWNER(Messages.ReviewTableDefinition_owner, 140, true, true, SWT.LEFT), //
 	PROJECT(Messages.ReviewTableDefinition_project, 200, true, true, SWT.LEFT), //
 	BRANCH(Messages.ReviewTableDefinition_branch, 100, true, true, SWT.LEFT), //
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableLabelProvider.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableLabelProvider.java
index 649aa49..eb060e8 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableLabelProvider.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableLabelProvider.java
@@ -9,6 +9,7 @@
  * Contributors:
  *   Jacques Bouthillier - Initial Implementation of the label provider
  *   Marc-Andre Laperle - Add Topic to dashboard
+ *   Marc-Andre Laperle - Add Status to dashboard
  ******************************************************************************/
 
 package org.eclipse.mylyn.gerrit.dashboard.ui.internal.model;
@@ -199,30 +200,33 @@
 			case 2:
 				return reviewSummary.getAttribute(GerritTask.SUBJECT);
 			case 3:
-				return reviewSummary.getAttribute(GerritTask.OWNER);
+				String attribute = reviewSummary.getAttribute(GerritTask.STATUS);
+				return attribute;
 			case 4:
-				return reviewSummary.getAttribute(GerritTask.PROJECT);
+				return reviewSummary.getAttribute(GerritTask.OWNER);
 			case 5:
+				return reviewSummary.getAttribute(GerritTask.PROJECT);
+			case 6:
 				String branch = reviewSummary.getAttribute(GerritTask.BRANCH);
 				String topic = reviewSummary.getAttribute(GerritTask.TOPIC);
 				if (topic != null && !topic.isEmpty()) {
 					branch += " (" + reviewSummary.getAttribute(GerritTask.TOPIC) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
 				}
 				return branch;
-			case 6:
+			case 7:
 				return reviewSummary.getAttributeAsDate(GerritTask.DATE_MODIFICATION);
-//			case 7:
+//			case 8:
 //				value = reviewSummary.getAttribute(GerritTask.REVIEW_STATE);
 //				if (null != value && !value.equals(EMPTY_STRING)) {
 //					return formatValue (value);
 //				}
-//			case 8:
+//			case 9:
 //				value = reviewSummary.getAttribute(GerritTask.IS_IPCLEAN);
 //				if (null != value && !value.equals(EMPTY_STRING)) {
 //					return formatValue (value);
 //				}
 //                return EMPTY_STRING;
-//			case 9:
+//			case 10:
 //				value = reviewSummary.getAttribute(GerritTask.VERIFY_STATE);
 //				if (null != value && !value.equals(EMPTY_STRING)) {
 //					return formatValue (value);
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableSorter.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableSorter.java
index 1078b66..d983a79 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableSorter.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableSorter.java
@@ -12,6 +12,7 @@
  * Contributors:
  *   Jacques Bouthillier - Initial Implementation of the view sorter
  *   Francois Chouinard - Refined the sorting of 1) dates and 2) flags 
+ *   Marc-Andre Laperle - Add Status to dashboard
  ******************************************************************************/
 package org.eclipse.mylyn.gerrit.dashboard.ui.internal.model;
 
@@ -87,14 +88,14 @@
 					result = val1.compareTo(val2);
 				}
 				break;
-			case 6: // Updated
+			case 7: // Updated
 				val1 = task1.getAttribute(GerritTask.DATE_MODIFICATION);
 				val2 = task2.getAttribute(GerritTask.DATE_MODIFICATION);
 				if (val1 != null && val2 != null) {
 					result = val1.compareTo(val2);
 				}
 				break;
-			case 7: // Code Review
+			case 8: // Code Review
 				val1 = task1.getAttribute(GerritTask.REVIEW_STATE);
 				val2 = task2.getAttribute(GerritTask.REVIEW_STATE);
 				if (val1 != null && val2 != null) {
@@ -103,7 +104,7 @@
 					result = v2 - v1;
 				}
 				break;
-			case 8: // Verify
+			case 9: // Verify
 				val1 = task1.getAttribute(GerritTask.VERIFY_STATE);
 				val2 = task2.getAttribute(GerritTask.VERIFY_STATE);
 				if (val1 != null && val2 != null) {
@@ -112,7 +113,7 @@
 					result = v2 - v1;
 				}
 				break;
-			case 9: // IPLog Clean
+			case 10: // IPLog Clean
 			default:
 				result = defaultCompare(viewer, item1, item2);
 				break;
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/UIReviewTable.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/UIReviewTable.java
index 18aa572..6788b0c 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/UIReviewTable.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/UIReviewTable.java
@@ -95,7 +95,7 @@
 		ReviewTableLabelProvider tableProvider = new ReviewTableLabelProvider();
 		fViewer.setLabelProvider(tableProvider);
 		ReviewTableSorter.bind(fViewer);
-		fViewer.setComparator(new ReviewTableSorter(6)); // sort by Updated, descending
+		fViewer.setComparator(new ReviewTableSorter(7)); // sort by Updated, descending
 
 		// Create the help context id for the viewer's control
 		// PlatformUI
@@ -182,7 +182,7 @@
 				//Subject column
 				table.getColumn(2).setWidth(newSubjectWidth);
 				//Project column
-				table.getColumn(4).setWidth(newProjectWidth);
+				table.getColumn(5).setWidth(newProjectWidth);
 
 				table.setSize(parentSize.x - 10, tableSize.y);
 				table.setRedraw(true);
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/messages.properties b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/messages.properties
index f83a8df..f7a7c54 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/messages.properties
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/messages.properties
@@ -8,6 +8,7 @@
 #
 # Contributors:
 #   Jacques Bouthillier - Initial implementation
+#   Marc-Andre Laperle - Add Status to dashboard
 ###############################################################################
 ReviewTableDefinition_branch=Branch
 ReviewTableDefinition_codeReview=CR
@@ -15,5 +16,6 @@
 ReviewTableDefinition_owner=Owner
 ReviewTableDefinition_project=Project
 ReviewTableDefinition_subject=Subject
+ReviewTableDefinition_status=Status
 ReviewTableDefinition_updated=Updated
 ReviewTableDefinition_verify=V