use of com.google.gerrit.client.diff.DisplaySide in project gerrit by GerritCodeReview.
the class Dispatcher method change.
private static void change(final String token) {
String rest = skip(token);
int c = rest.lastIndexOf(',');
String panel = null;
if (0 <= c) {
panel = rest.substring(c + 1);
rest = rest.substring(0, c);
int at = panel.lastIndexOf('@');
if (at > 0) {
rest += panel.substring(at);
panel = panel.substring(0, at);
}
}
Change.Id id;
int s = rest.indexOf('/');
if (0 <= s) {
id = Change.Id.parse(rest.substring(0, s));
rest = rest.substring(s + 1);
} else {
id = Change.Id.parse(rest);
rest = "";
}
if (rest.isEmpty()) {
FileTable.Mode mode = FileTable.Mode.REVIEW;
if (panel != null && (panel.equals("edit") || panel.startsWith("edit/"))) {
mode = FileTable.Mode.EDIT;
panel = null;
}
Gerrit.display(token, panel == null ? new ChangeScreen(id, DiffObject.base(), null, false, mode) : new NotFoundScreen());
return;
}
String psIdStr;
s = rest.indexOf('/');
if (0 <= s) {
psIdStr = rest.substring(0, s);
rest = rest.substring(s + 1);
} else {
psIdStr = rest;
rest = "";
}
DiffObject base = DiffObject.base();
PatchSet.Id ps;
int dotdot = psIdStr.indexOf("..");
if (1 <= dotdot) {
base = DiffObject.parse(id, psIdStr.substring(0, dotdot));
if (base == null) {
Gerrit.display(token, new NotFoundScreen());
}
psIdStr = psIdStr.substring(dotdot + 2);
}
ps = toPsId(id, psIdStr);
if (!rest.isEmpty()) {
DisplaySide side = DisplaySide.B;
int line = 0;
int at = rest.lastIndexOf('@');
if (at > 0) {
String l = rest.substring(at + 1);
if (l.startsWith("a")) {
side = DisplaySide.A;
l = l.substring(1);
}
line = Integer.parseInt(l);
rest = rest.substring(0, at);
}
Patch.Key p = new Patch.Key(ps, KeyUtil.decode(rest));
patch(token, base, p, side, line, panel);
} else {
if (panel == null) {
Gerrit.display(token, new ChangeScreen(id, base, String.valueOf(ps.get()), false, FileTable.Mode.REVIEW));
} else {
Gerrit.display(token, new NotFoundScreen());
}
}
}
Aggregations