summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2013-01-31 17:23:01 (EST)
committerGerrit Code Review @ Eclipse.org2013-02-01 14:45:41 (EST)
commit8eb5f2cb2ab8eedb685c19c2fa7438d74eabcfde (patch)
treef7cdfca7f6b1909d8e1506c6c7ea9e71a4d06b2d
parent04dd14d2c3e3c95bf99ee451a82b81600071ac36 (diff)
downloadorg.eclipse.mylyn.reviews-8eb5f2cb2ab8eedb685c19c2fa7438d74eabcfde.zip
org.eclipse.mylyn.reviews-8eb5f2cb2ab8eedb685c19c2fa7438d74eabcfde.tar.gz
org.eclipse.mylyn.reviews-8eb5f2cb2ab8eedb685c19c2fa7438d74eabcfde.tar.bz2
399685: PatchSetSection should not assume its page is arefs/changes/87/10087/2
GerritTaskEditorPage Change-Id: I5e167a08f4ad88a19adeee4e422dde9a389f7015 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=399685
-rw-r--r--org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java34
1 files changed, 22 insertions, 12 deletions
diff --git a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java
index 9a21460..3634e7d 100644
--- a/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java
+++ b/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java
@@ -380,24 +380,27 @@ public class PatchSetSection extends AbstractGerritSection {
public void run() {
if (getControl() != null && !getControl().isDisposed()) {
if (event.getResult().isOK()) {
- GerritTaskEditorPage editor = (GerritTaskEditorPage) getTaskEditorPage();
- IReview review = editor.getReview();
+ IReview review = getReview();
GerritPatchSetContent content = job.getPatchSetContent();
if (content != null && content.getPatchScriptByPatchKey() != null) {
IReviewItemSet reviewItem = GerritUtil.createInput(changeDetail, content, cache);
- IReviewItem replaceItem = null;
- for (IReviewItem item : review.getItems()) {
- if (item.getId().equals(reviewItem.getId())) {
- replaceItem = item;
- break;
+ if (review != null) {
+ IReviewItem replaceItem = null;
+ for (IReviewItem item : review.getItems()) {
+ if (item.getId().equals(reviewItem.getId())) {
+ replaceItem = item;
+ break;
+ }
}
+ if (replaceItem != null) {
+ review.getItems().remove(replaceItem);
+ }
+ review.getItems().add(reviewItem);
}
- if (replaceItem != null) {
- review.getItems().remove(replaceItem);
- }
- review.getItems().add(reviewItem);
viewer.setInput(reviewItem);
- editor.refreshExplorer();
+ if (getTaskEditorPage() instanceof GerritTaskEditorPage) {
+ ((GerritTaskEditorPage) getTaskEditorPage()).refreshExplorer();
+ }
}
}
@@ -683,4 +686,11 @@ public class PatchSetSection extends AbstractGerritSection {
CompareUI.openCompareEditor(new FileItemCompareEditorInput(configuration, item, behavior));
}
+ protected IReview getReview() {
+ if (getTaskEditorPage() instanceof GerritTaskEditorPage) {
+ return ((GerritTaskEditorPage) getTaskEditorPage()).getReview();
+ }
+ return null;
+ }
+
}