Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRileyDavidson2016-11-03 18:49:50 -0400
committerSam Davis2016-11-30 14:48:03 -0500
commit59051fbcf87af0fb27d640d8b0d994ca6aa88644 (patch)
treea9d6377226276eb27e89a75e4565a386b6853a79 /org.eclipse.mylyn.reviews.ui/src
parent18959764c1e741bff66407eae236c91ef0a4f896 (diff)
downloadorg.eclipse.mylyn.reviews-59051fbcf87af0fb27d640d8b0d994ca6aa88644.tar.gz
org.eclipse.mylyn.reviews-59051fbcf87af0fb27d640d8b0d994ca6aa88644.tar.xz
org.eclipse.mylyn.reviews-59051fbcf87af0fb27d640d8b0d994ca6aa88644.zip
357234: Add UI buttons to remove reviewers from change
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=357234 Change-Id: Iac12676d3b4d817e81274cb8c2e2fc60dc967ae8 Signed-off-by: RileyDavidson <rd12hq@brocku.ca>
Diffstat (limited to 'org.eclipse.mylyn.reviews.ui/src')
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/ReviewDetailSection.java56
1 files changed, 45 insertions, 11 deletions
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/ReviewDetailSection.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/ReviewDetailSection.java
index 4cf41632..dcd103bc 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/ReviewDetailSection.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/ReviewDetailSection.java
@@ -48,7 +48,7 @@ import org.eclipse.ui.forms.widgets.Section;
/**
* Displays basic information about a given review corresponding to top sections of Gerrit web interface.
- *
+ *
* @author Steffen Pingel
* @author Miles Parker
*/
@@ -62,8 +62,10 @@ public abstract class ReviewDetailSection extends AbstractReviewSection {
protected Control createContent(FormToolkit toolkit, Composite parent) {
Control content = super.createContent(toolkit, parent);
createReviewersSubSection(composite);
- createDependenciesSubSection(toolkit, composite, Messages.ReviewDetailSection_Depends_On, getReview().getParents());
- createDependenciesSubSection(toolkit, composite, Messages.ReviewDetailSection_Needed_By, getReview().getChildren());
+ createDependenciesSubSection(toolkit, composite, Messages.ReviewDetailSection_Depends_On,
+ getReview().getParents());
+ createDependenciesSubSection(toolkit, composite, Messages.ReviewDetailSection_Needed_By,
+ getReview().getChildren());
return content;
}
@@ -142,11 +144,12 @@ public abstract class ReviewDetailSection extends AbstractReviewSection {
}
}
+ AbstractUiFactoryProvider<IUser> reviewerUiFactoryProvider = getReviewerUiFactoryProvider();
+
for (Entry<IUser, IReviewerEntry> entry : getReview().getReviewerApprovals().entrySet()) {
+ IUser currentUser = entry.getKey();
- Label reviewerRowLabel = new Label(composite, SWT.NONE);
- reviewerRowLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- reviewerRowLabel.setText(entry.getKey().getDisplayName());
+ createReviewerLabelAndControls(composite, reviewerUiFactoryProvider, currentUser);
for (IApprovalType approvalType : approvalTypesWithLabel) {
Integer value = entry.getValue().getApprovals().get(approvalType);
@@ -168,7 +171,7 @@ public abstract class ReviewDetailSection extends AbstractReviewSection {
if (names.length() > 0) {
names.append(", "); //$NON-NLS-1$
}
- names.append(entry.getKey().getDisplayName());
+ names.append(currentUser.getDisplayName());
}
String headerText = names.toString();
@@ -184,6 +187,31 @@ public abstract class ReviewDetailSection extends AbstractReviewSection {
getReview());
GridDataFactory.fillDefaults().span(2, 1).applyTo(actionComposite);
}
+
+ }
+
+ private void createReviewerLabelAndControls(Composite parent,
+ AbstractUiFactoryProvider<IUser> reviewerUiFactoryProvider, IUser user) {
+ Composite reviewerComp = toolkit.createComposite(parent, SWT.NONE);
+ GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(reviewerComp);
+
+ if (reviewerUiFactoryProvider != null) {
+ createReviewerControls(reviewerComp, user, reviewerUiFactoryProvider);
+ }
+ createReviewerLabel(reviewerComp, user);
+ }
+
+ private void createReviewerLabel(Composite reviewerComposite, IUser user) {
+ Label reviewerRowLabel = new Label(reviewerComposite, SWT.NONE);
+ reviewerRowLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ reviewerRowLabel.setText(user.getDisplayName());
+ }
+
+ private void createReviewerControls(Composite reviewerComposite, IUser user,
+ AbstractUiFactoryProvider<IUser> reviewerUiFactoryProvider) {
+ Composite controlComposite = reviewerUiFactoryProvider.createControls(this, reviewerComposite, getToolkit(),
+ user);
+ GridDataFactory.fillDefaults().applyTo(controlComposite);
}
protected boolean canAddReviewers() {
@@ -209,11 +237,13 @@ public abstract class ReviewDetailSection extends AbstractReviewSection {
for (final IChange change : changes) {
Link link = new Link(composite, SWT.NONE);
- String changeStatus = change.getState() != null ? NLS.bind(Messages.ReviewDetailSection_Bracket_X_bracket,
- String.valueOf(change.getState().getName())) : " "; //$NON-NLS-1$
+ String changeStatus = change.getState() != null
+ ? NLS.bind(Messages.ReviewDetailSection_Bracket_X_bracket,
+ String.valueOf(change.getState().getName()))
+ : " "; //$NON-NLS-1$
String ownerName = change.getOwner().getDisplayName();
- link.setText(NLS.bind(Messages.ReviewDetailSection_Link_W_X_Y_by_Z, new String[] { StringUtils.left(change.getKey(), 9),
- change.getSubject(), ownerName, changeStatus }));
+ link.setText(NLS.bind(Messages.ReviewDetailSection_Link_W_X_Y_by_Z, new String[] {
+ StringUtils.left(change.getKey(), 9), change.getSubject(), ownerName, changeStatus }));
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@@ -225,6 +255,10 @@ public abstract class ReviewDetailSection extends AbstractReviewSection {
protected abstract AbstractUiFactoryProvider<IReview> getUiFactoryProvider();
+ protected AbstractUiFactoryProvider<IUser> getReviewerUiFactoryProvider() {
+ return null;
+ };
+
@Override
protected boolean shouldExpandOnCreate() {
return true;

Back to the top