Source:
<code>private void onResult(final PatchScript script, final boolean isFirst) { final Change.Key cid = script.getChangeId(); final String path = patchKey.get(); String fileName = path; final int last = fileName.lastIndexOf('/'); if (last >= 0) { fileName = fileName.substring(last + 1); } setWindowTitle(PatchUtil.M.patchWindowTitle(cid.abbreviate(), fileName)); setPageTitle(PatchUtil.M.patchPageTitle(cid.abbreviate(), path)); <START> Util.DETAIL_SVC.changeDetail(currentChangeId, <END> new GerritCallback<ChangeDetail>() { @Override public void onSuccess(ChangeDetail detail) { commitMessageBlock.display(detail.getCurrentPatchSetDetail().getInfo()); } }); historyTable.display(script.getHistory()); historyPanel.setVisible(true); boolean hasEdits = !script.getEdits().isEmpty(); boolean hasMeta = !script.getPatchHeader().isEmpty(); boolean hasDifferences = hasEdits || hasMeta; boolean pureMetaChange = !hasEdits && hasMeta; if (contentTable instanceof SideBySideTable && pureMetaChange) { contentTable.removeFromParent(); contentTable = new UnifiedDiffTable(); contentTable.fileList = fileList; contentPanel.add(contentTable); setToken(Dispatcher.toPatchUnified(patchKey)); } if (hasDifferences) { contentTable.display(patchKey, idSideA, idSideB, script); contentTable.display(script.getCommentDetail()); contentTable.finishDisplay(); } showPatch(hasDifferences); settingsPanel.setEnableSmallFileFeatures(!script.isHugeFile()); settingsPanel.setEnableIntralineDifference(script.hasIntralineDifference()); settingsPanel.setEnabled(true); lastScript = script; if (Gerrit.isSignedIn() && isFirst) { settingsPanel.getReviewedCheckBox().setValue(true); setReviewedByCurrentUser(true ); } }</code><technical_language>stick message in a static member of some class. :-) message is unique for a PatchSet.Id, store things: PatchSet.Id of message, String of message text. If id matches id of file, reuse string. If match, need fetch server, cache it. static members browser tab/window, nicely cache message for browsing activity a single change. ChangeScreen loads, set message static field files</technical_language>

Target:
private void onResult(final PatchScript script, final boolean isFirst) { final Change.Key cid = script.getChangeId(); final String path = patchKey.get(); String fileName = path; final int last = fileName.lastIndexOf('/'); if (last >= 0) { fileName = fileName.substring(last + 1); } setWindowTitle(PatchUtil.M.patchWindowTitle(cid.abbreviate(), fileName)); setPageTitle(PatchUtil.M.patchPageTitle(cid.abbreviate(), path)); if (idSideB != null) { if (idSideB.equals(cachedPatchSetId)) { commitMessageBlock.display(cachedCommitMessage); } else { fetchCommitMessage(idSideB); } } historyTable.display(script.getHistory()); historyPanel.setVisible(true); boolean hasEdits = !script.getEdits().isEmpty(); boolean hasMeta = !script.getPatchHeader().isEmpty(); boolean hasDifferences = hasEdits || hasMeta; boolean pureMetaChange = !hasEdits && hasMeta; if (contentTable instanceof SideBySideTable && pureMetaChange) { contentTable.removeFromParent(); contentTable = new UnifiedDiffTable(); contentTable.fileList = fileList; contentPanel.add(contentTable); setToken(Dispatcher.toPatchUnified(patchKey)); } if (hasDifferences) { contentTable.display(patchKey, idSideA, idSideB, script); contentTable.display(script.getCommentDetail()); contentTable.finishDisplay(); } showPatch(hasDifferences); settingsPanel.setEnableSmallFileFeatures(!script.isHugeFile()); settingsPanel.setEnableIntralineDifference(script.hasIntralineDifference()); settingsPanel.setEnabled(true); lastScript = script; if (Gerrit.isSignedIn() && isFirst) { settingsPanel.getReviewedCheckBox().setValue(true); setReviewedByCurrentUser(true ); } }