Merge branch 'stable-2.8'

* stable-2.8:
  Fix jdbc code: Both PreparedStatements must be closed in any case
  SideBySide2: Let CodeMirror handle "contextmenu" event
  SideBySide2: Restore some old keybindings and fix help popup
  Add --project and --branch parameters on the topic-changed hook
This commit is contained in:
Shawn Pearce
2013-11-07 11:26:10 -08:00
11 changed files with 93 additions and 63 deletions

View File

@@ -69,7 +69,6 @@ import com.google.gwtexpui.globalkey.client.KeyCommandSet;
import com.google.gwtexpui.globalkey.client.ShowHelpCommand;
import net.codemirror.lib.CodeMirror;
import net.codemirror.lib.CodeMirror.EventHandler;
import net.codemirror.lib.CodeMirror.GutterClickHandler;
import net.codemirror.lib.CodeMirror.LineClassWhere;
import net.codemirror.lib.CodeMirror.LineHandle;
@@ -111,7 +110,6 @@ public class SideBySide2 extends Screen {
private CodeMirror cmA;
private CodeMirror cmB;
private CodeMirror lastFocused;
private ScrollSynchronizer scrollingGlue;
private HandlerRegistration resizeHandler;
private JsArray<CommentInfo> publishedBase;
@@ -279,17 +277,9 @@ public class SideBySide2 extends Screen {
cm.on("focus", new Runnable() {
@Override
public void run() {
lastFocused = cm;
updateActiveLine(cm).run();
}
});
cm.on("contextmenu", new EventHandler() {
@Override
public void handle(CodeMirror instance, NativeEvent event) {
CodeMirror.setObjectProperty(event, "codemirrorIgnore", true);
lastFocused.focus();
}
});
cm.addKeyMap(KeyMap.create()
.on("'a'", upToChange(true))
.on("'u'", upToChange(false))
@@ -316,12 +306,30 @@ public class SideBySide2 extends Screen {
(header.hasNext() ? header.next : header.up).go();
}
})
.on("Shift-Alt-/", new Runnable() {
.on("Shift-/", new Runnable() {
@Override
public void run() {
new ShowHelpCommand().onKeyPress(null);
}
})
.on("Ctrl-F", new Runnable() {
@Override
public void run() {
CodeMirror.handleVimKey(cm, "/");
}
})
.on("Space", new Runnable() {
@Override
public void run() {
CodeMirror.handleVimKey(cm, "<PageDown>");
}
})
.on("Ctrl-A", new Runnable() {
@Override
public void run() {
cm.execCommand("selectAll");
}
})
.on("N", maybeNextVimSearch(cm))
.on("P", diffChunkNav(cm, true))
.on("Shift-O", openClosePublished(cm))
@@ -336,9 +344,13 @@ public class SideBySide2 extends Screen {
keysNavigation.add(new UpToChangeCommand2(revision, 0, 'u'));
keysNavigation.add(new NoOpKeyCommand(0, 'j', PatchUtil.C.lineNext()));
keysNavigation.add(new NoOpKeyCommand(0, 'k', PatchUtil.C.linePrev()));
keysNavigation.add(new NoOpKeyCommand(0, 'n', PatchUtil.C.chunkNext2()));
keysNavigation.add(new NoOpKeyCommand(0, 'p', PatchUtil.C.chunkPrev2()));
keysAction = new KeyCommandSet(Gerrit.C.sectionActions());
keysAction.add(new NoOpKeyCommand(0, 'o', PatchUtil.C.expandComment()));
keysAction.add(new NoOpKeyCommand(
KeyCommand.M_SHIFT, 'o', PatchUtil.C.expandAllCommentsOnCurrentLine()));
keysAction.add(new KeyCommand(0, 'r', PatchUtil.C.toggleReviewed()) {
@Override
public void onKeyPress(KeyPressEvent event) {

View File

@@ -45,10 +45,13 @@ public interface PatchConstants extends Constants {
String lineNext();
String chunkPrev();
String chunkNext();
String chunkPrev2();
String chunkNext2();
String commentPrev();
String commentNext();
String fileList();
String expandComment();
String expandAllCommentsOnCurrentLine();
String toggleReviewed();
String markAsReviewedAndGoToNext();

View File

@@ -27,10 +27,13 @@ linePrev = Previous line
lineNext = Next line
chunkPrev = Previous diff chunk or comment
chunkNext = Next diff chunk or comment
chunkPrev2 = Previous diff chunk
chunkNext2 = Next diff chunk or search result
commentPrev = Previous comment
commentNext = Next comment
fileList = Browse files in patch set
expandComment = Expand or collapse comment
expandAllCommentsOnCurrentLine = Expand or collapse all comments on current line
toggleReviewed = Toggle the reviewed flag
markAsReviewedAndGoToNext = Mark patch as reviewed and go to next unreviewed patch