Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2016-07-18 17:50:18 -0400
committerSam Davis2016-07-19 19:54:23 -0400
commitc0cb1e6329ea10ec11258fb63e2db344425591f7 (patch)
tree37b209ed52476f11658033fd4af8bb2ae1152bb3 /org.eclipse.mylyn.reviews.ui/src
parent5d9442d59cd4df387eb33232ae1463b6d369ff38 (diff)
downloadorg.eclipse.mylyn.reviews-c0cb1e6329ea10ec11258fb63e2db344425591f7.tar.gz
org.eclipse.mylyn.reviews-c0cb1e6329ea10ec11258fb63e2db344425591f7.tar.xz
org.eclipse.mylyn.reviews-c0cb1e6329ea10ec11258fb63e2db344425591f7.zip
498099: add branch to reviews table and use task list tooltip
Change-Id: I8ee1da38fc74e09401165d5d2e9e164225f69197 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=498099
Diffstat (limited to 'org.eclipse.mylyn.reviews.ui/src')
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/ReviewColumnLabelProvider.java33
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/Messages.java4
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TaskEditorReviewsPart.java30
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TaskReview.java18
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/messages.properties2
5 files changed, 50 insertions, 37 deletions
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/ReviewColumnLabelProvider.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/ReviewColumnLabelProvider.java
index e569c31e..c0432a6c 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/ReviewColumnLabelProvider.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/ReviewColumnLabelProvider.java
@@ -29,11 +29,13 @@ public class ReviewColumnLabelProvider extends ColumnLabelProvider {
private static final int DESCRIPTION_COLUMN = 0;
- private static final int CODE_REVIEW_COLUMN = 1;
+ private static final int BRANCH_COLUMN = 1;
- private static final int VERIFIED_COLUMN = 2;
+ private static final int CODE_REVIEW_COLUMN = 2;
- private static final int STATUS_COLUMN = 3;
+ private static final int VERIFIED_COLUMN = 3;
+
+ private static final int STATUS_COLUMN = 4;
private static final int MINUS_TWO = -2;
@@ -106,6 +108,8 @@ public class ReviewColumnLabelProvider extends ColumnLabelProvider {
switch (columnIndex) {
case DESCRIPTION_COLUMN:
return reviewContainer.getSummary();
+ case BRANCH_COLUMN:
+ return reviewContainer.getBranch();
case STATUS_COLUMN:
return reviewContainer.getStatus();
default:
@@ -127,29 +131,6 @@ public class ReviewColumnLabelProvider extends ColumnLabelProvider {
}
@Override
- public String getToolTipText(Object element) {
- TaskReview review = (TaskReview) element;
- StringBuilder sb = new StringBuilder();
-
- sb.append("Description: ");
- sb.append(review.getSummary());
-
- sb.append(System.getProperty("line.separator"));
- sb.append("Verified: ");
- if (review.getVerifiedScore() >= 1) {
- sb.append("YES");
- } else {
- sb.append("NO");
- }
-
- sb.append(System.getProperty("line.separator"));
- sb.append("Code Review: ");
- sb.append(review.getCodeReviewScore());
-
- return sb.toString();
- }
-
- @Override
public void update(ViewerCell cell) {
Object element = cell.getElement();
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/Messages.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/Messages.java
index f8265bef..908f502c 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/Messages.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/Messages.java
@@ -22,6 +22,8 @@ public class Messages extends NLS {
public static String AbstractCommentPart_Section_header;
+ public static String TaskEditorReviewsPart_Branch;
+
public static String TaskEditorReviewsPart_ReviewsString;
public static String TaskEditorReviewsPart_VerifiedString;
@@ -34,6 +36,8 @@ public class Messages extends NLS {
public static String TaskEditorReviewsPart_CodeReviewAttribute;
+ public static String TaskEditorReviewsPart_Status;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TaskEditorReviewsPart.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TaskEditorReviewsPart.java
index ed92c64e..ff1847e4 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TaskEditorReviewsPart.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TaskEditorReviewsPart.java
@@ -23,13 +23,13 @@ import org.eclipse.jface.viewers.OpenEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.window.ToolTip;
-import org.eclipse.mylyn.commons.ui.SelectionProviderAdapter;
import org.eclipse.mylyn.commons.ui.TableSorter;
import org.eclipse.mylyn.internal.reviews.ui.ReviewColumnLabelProvider;
import org.eclipse.mylyn.internal.reviews.ui.ReviewsUiPlugin;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
+import org.eclipse.mylyn.internal.tasks.ui.views.TaskListToolTip;
import org.eclipse.mylyn.reviews.internal.core.TaskReviewsMappingsStore;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.ITask;
@@ -49,6 +49,7 @@ import org.eclipse.ui.forms.widgets.Section;
* @author Blaine Lewis
* @author Landon Butterworth
*/
+@SuppressWarnings("restriction")
public class TaskEditorReviewsPart extends AbstractTaskEditorPart {
private static final class ReviewColumnSorter extends TableSorter {
@@ -83,20 +84,17 @@ public class TaskEditorReviewsPart extends AbstractTaskEditorPart {
}
}
- private static final String ID_TASK_EDITOR_REVIEWS_PART = "org.eclipse.mylyn.internal.reviews.ui.editor.parts.TaskEditorReviewsPart"; //$NON-NLS-1$
-
private Composite reviewsComposite;
protected Section section;
private Table reviewsTable;
- private final String[] REVIEWS_COLUMNS = { Messages.TaskEditorReviewsPart_DescriptionString,
- Messages.TaskEditorReviewsPart_CodeReviewString, Messages.TaskEditorReviewsPart_VerifiedString, "Status" };
-
- private SelectionProviderAdapter selectionProvider;
+ private static final String[] REVIEWS_COLUMNS = { Messages.TaskEditorReviewsPart_DescriptionString,
+ Messages.TaskEditorReviewsPart_Branch, Messages.TaskEditorReviewsPart_CodeReviewString,
+ Messages.TaskEditorReviewsPart_VerifiedString, Messages.TaskEditorReviewsPart_Status };
- private final int[] REVIEWS_COLUMNS_WIDTH = { 575, 30, 30, 90, 0 };
+ private static final int[] REVIEWS_COLUMNS_WIDTH = { 550, 90, 30, 30, 90, 0 };
private TableViewer reviewsViewer;
@@ -108,6 +106,8 @@ public class TaskEditorReviewsPart extends AbstractTaskEditorPart {
private final TaskList taskList = TasksUiPlugin.getTaskList();
+ private TaskListToolTip toolTip;
+
public TaskEditorReviewsPart() {
taskReviewStore = ReviewsUiPlugin.getDefault().getTaskReviewsMappingStore();
setPartName(Messages.TaskEditorReviewsPart_ReviewsString);
@@ -129,8 +129,6 @@ public class TaskEditorReviewsPart extends AbstractTaskEditorPart {
reviewContainers = new ArrayList<TaskReview>();
populateReviews(reviewContainers);
- selectionProvider = new SelectionProviderAdapter();
-
section = createSection(parent, toolkit, true);
section.setText(section.getText());
@@ -219,13 +217,17 @@ public class TaskEditorReviewsPart extends AbstractTaskEditorPart {
reviewsViewer.setComparator(new ReviewColumnSorter(labelProvider));
reviewsViewer.addOpenListener(new IOpenListener() {
+
public void open(OpenEvent event) {
openReview(event);
}
+
});
reviewsViewer.setInput(reviewContainers.toArray());
+ toolTip = new TaskListToolTip(reviewsTable);
+
getTaskEditorPage().reflow();
}
@@ -272,4 +274,12 @@ public class TaskEditorReviewsPart extends AbstractTaskEditorPart {
TasksUiUtil.openTask(openThis.getUrl());
}
}
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ if (toolTip != null) {
+ toolTip.dispose();
+ }
+ }
}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TaskReview.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TaskReview.java
index 253c7bce..d2d5e83e 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TaskReview.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TaskReview.java
@@ -11,11 +11,13 @@
package org.eclipse.mylyn.internal.reviews.ui.editors.parts;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.mylyn.reviews.internal.core.ReviewsCoreConstants;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-public class TaskReview {
+public class TaskReview implements IAdaptable {
private final ITask review;
@@ -62,4 +64,18 @@ public class TaskReview {
public String getStatus() {
return review.getAttribute(TaskAttribute.STATUS);
}
+
+ public String getBranch() {
+ return review.getAttribute(ReviewsCoreConstants.BRANCH);
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter.isAssignableFrom(review.getClass())) {
+ return (T) review;
+ }
+ return null;
+ }
+
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/messages.properties b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/messages.properties
index 6aed9ccd..e49d1eb3 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/messages.properties
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/messages.properties
@@ -12,9 +12,11 @@
AbstractCommentPart_Draft=DRAFT
AbstractCommentPart_No_author=(no author)
AbstractCommentPart_Section_header={0} {1}
+TaskEditorReviewsPart_Branch=Branch
TaskEditorReviewsPart_ReviewsString=Reviews
TaskEditorReviewsPart_VerifiedString=V
TaskEditorReviewsPart_CodeReviewString=CR
TaskEditorReviewsPart_DescriptionString=Description
TaskEditorReviewsPart_VerifiedAttribute=VERIFIED
TaskEditorReviewsPart_CodeReviewAttribute=CODE_REVIEW
+TaskEditorReviewsPart_Status=Status

Back to the top