Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaxsun McCarthy Huggan2016-03-24 16:44:39 -0400
committerSam Davis2016-03-24 18:08:34 -0400
commit5aade2e3b526c831cd8282657313640c89723901 (patch)
treed4896e39e5834041057fe91478f266cce9018157 /org.eclipse.mylyn.reviews.ui/src
parent586d2fcfd6e3cfd81f3abf6fc1e21141584ce879 (diff)
downloadorg.eclipse.mylyn.reviews-5aade2e3b526c831cd8282657313640c89723901.tar.gz
org.eclipse.mylyn.reviews-5aade2e3b526c831cd8282657313640c89723901.tar.xz
org.eclipse.mylyn.reviews-5aade2e3b526c831cd8282657313640c89723901.zip
488164: opening a comment or thread opens the editor to the right placev2.10.0R_3_19_0e_4_5_m_3_19_x
Change-Id: I2111ad00401d1f91249aec5acf7bb4e8d5dba3bc Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=488164 Signed-off-by: Jaxsun McCarthy Huggan <jaxsun.mccarthy@tasktop.com>
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/ReviewSetContentSection.java29
1 files changed, 23 insertions, 6 deletions
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/ReviewSetContentSection.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/ReviewSetContentSection.java
index 5da4f523..bea459cc 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/ReviewSetContentSection.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/spi/editor/ReviewSetContentSection.java
@@ -39,6 +39,7 @@ import org.eclipse.mylyn.internal.tasks.ui.editors.EditorUtil;
import org.eclipse.mylyn.reviews.core.model.IComment;
import org.eclipse.mylyn.reviews.core.model.ICommit;
import org.eclipse.mylyn.reviews.core.model.IFileItem;
+import org.eclipse.mylyn.reviews.core.model.ILocation;
import org.eclipse.mylyn.reviews.core.model.IRepository;
import org.eclipse.mylyn.reviews.core.model.IReview;
import org.eclipse.mylyn.reviews.core.model.IReviewItemSet;
@@ -352,7 +353,8 @@ public class ReviewSetContentSection {
.hint(500, heightHint)
.applyTo(viewer.getControl());
- viewer.setContentProvider(new ReviewSetContentProvider());
+ final ReviewSetContentProvider contentProvider = new ReviewSetContentProvider();
+ viewer.setContentProvider(contentProvider);
ColumnViewerToolTipSupport.enableFor(viewer, ToolTip.NO_RECREATE);
@@ -367,19 +369,34 @@ public class ReviewSetContentSection {
viewer.setLabelProvider(styledLabelProvider);
viewer.addOpenListener(new IOpenListener() {
public void open(OpenEvent event) {
- // TODO: open to line of selected comment or thread
ITreeSelection selection = (ITreeSelection) event.getSelection();
TreePath[] paths = selection.getPaths();
for (TreePath path : paths) {
+ IFileItem file = null;
+ IComment comment = null;
for (int i = 0; i < path.getSegmentCount(); i++) {
Object o = path.getSegment(i);
if (o instanceof IFileItem) {
- IFileItem item = (IFileItem) o;
- getParentSection().getUiFactoryProvider()
- .getOpenFileFactory(ReviewSetContentSection.this.getParentSection(), set, item)
- .execute();
+ file = (IFileItem) o;
+ } else if (o instanceof ILocation) {
+ Object[] children = contentProvider.getChildren(o);
+ if (children.length > 0 && children[0] instanceof IComment) {
+ comment = (IComment) children[0];
+ }
+ } else if (o instanceof IComment) {
+ comment = (IComment) o;
}
}
+ if (file != null && comment != null) {
+ getParentSection().getUiFactoryProvider()
+ .getOpenFileToCommentFactory(ReviewSetContentSection.this.getParentSection(), set,
+ file, comment)
+ .execute();
+ } else if (file != null) {
+ getParentSection().getUiFactoryProvider()
+ .getOpenFileFactory(ReviewSetContentSection.this.getParentSection(), set, file)
+ .execute();
+ }
}
}
});

Back to the top