diff options
Diffstat (limited to 'gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java')
-rw-r--r-- | gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java | 55 |
1 files changed, 40 insertions, 15 deletions
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java index d914283c0f..200562a791 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java @@ -21,14 +21,17 @@ import com.google.gerrit.client.RpcStatus; import com.google.gerrit.client.changes.CommitMessageBlock; import com.google.gerrit.client.changes.PatchTable; import com.google.gerrit.client.changes.Util; +import com.google.gerrit.client.projects.ConfigInfoCache; +import com.google.gerrit.client.rpc.CallbackGroup; import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.rpc.ScreenLoadCallback; +import com.google.gerrit.client.ui.CommentLinkProcessor; import com.google.gerrit.client.ui.ListenableAccountDiffPreference; import com.google.gerrit.client.ui.Screen; import com.google.gerrit.common.data.PatchScript; import com.google.gerrit.common.data.PatchSetDetail; import com.google.gerrit.prettify.client.ClientSideFormatter; -import com.google.gerrit.prettify.common.PrettyFactory; +import com.google.gerrit.prettify.client.PrettyFactory; import com.google.gerrit.reviewdb.client.AccountDiffPreference; import com.google.gerrit.reviewdb.client.Patch; import com.google.gerrit.reviewdb.client.PatchSet; @@ -38,6 +41,7 @@ import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.event.logical.shared.ValueChangeHandler; import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwtexpui.globalkey.client.GlobalKey; import com.google.gwtexpui.globalkey.client.KeyCommand; @@ -97,6 +101,7 @@ public abstract class PatchScreen extends Screen implements protected PatchSet.Id idSideB; protected PatchScriptSettingsPanel settingsPanel; protected TopView topView; + protected CommentLinkProcessor commentLinkProcessor; private ReviewedPanels reviewedPanels; private HistoryTable historyTable; @@ -364,23 +369,40 @@ public abstract class PatchScreen extends Screen implements if (isFirst && fileList != null && fileList.isLoaded()) { fileList.movePointerTo(patchKey); } - PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, // - settingsPanel.getValue(), new ScreenLoadCallback<PatchScript>(this) { + + CallbackGroup cb = new CallbackGroup(); + ConfigInfoCache.get(patchSetDetail.getProject(), + cb.add(new AsyncCallback<ConfigInfoCache.Entry>() { @Override - protected void preDisplay(final PatchScript result) { - if (rpcSequence == rpcseq) { - onResult(result, isFirst); - } + public void onSuccess(ConfigInfoCache.Entry result) { + commentLinkProcessor = result.getCommentLinkProcessor(); + contentTable.setCommentLinkProcessor(commentLinkProcessor); + setTheme(result.getTheme()); } @Override - public void onFailure(final Throwable caught) { - if (rpcSequence == rpcseq) { - settingsPanel.setEnabled(true); - super.onFailure(caught); - } + public void onFailure(Throwable caught) { + // Handled by ScreenLoadCallback.onFailure. } - }); + })); + PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, + settingsPanel.getValue(), cb.addGwtjsonrpc( + new ScreenLoadCallback<PatchScript>(this) { + @Override + protected void preDisplay(final PatchScript result) { + if (rpcSequence == rpcseq) { + onResult(result, isFirst); + } + } + + @Override + public void onFailure(final Throwable caught) { + if (rpcSequence == rpcseq) { + settingsPanel.setEnabled(true); + super.onFailure(caught); + } + } + })); } private void onResult(final PatchScript script, final boolean isFirst) { @@ -396,7 +418,8 @@ public abstract class PatchScreen extends Screen implements if (idSideB.equals(patchSetDetail.getPatchSet().getId())) { commitMessageBlock.setVisible(true); - commitMessageBlock.display(patchSetDetail.getInfo().getMessage()); + commitMessageBlock.display(patchSetDetail.getInfo().getMessage(), + commentLinkProcessor); } else { commitMessageBlock.setVisible(false); Util.DETAIL_SVC.patchSetDetail(idSideB, @@ -404,7 +427,8 @@ public abstract class PatchScreen extends Screen implements @Override public void onSuccess(PatchSetDetail result) { commitMessageBlock.setVisible(true); - commitMessageBlock.display(result.getInfo().getMessage()); + commitMessageBlock.display(result.getInfo().getMessage(), + commentLinkProcessor); } }); } @@ -431,6 +455,7 @@ public abstract class PatchScreen extends Screen implements contentTable.removeFromParent(); contentTable = new UnifiedDiffTable(); contentTable.fileList = fileList; + contentTable.setCommentLinkProcessor(commentLinkProcessor); contentPanel.add(contentTable); setToken(Dispatcher.toPatchUnified(idSideA, patchKey)); } |