Turn on many more Eclipse warnings, and fix them
- Warn on empty statements, e.g. "for (;;);". These may be
typos and are easily replaced by "for (;;) {}" which is more
explicit.
- Warn on field hiding. This allows cleanup of many acceptance test
members, at the cost of a couple of renames and the occasional
suppression (when the field is in a public nested enum that shadows
a public constant).
- Warn on unnecessary casts.
- Warn on unused declared thrown exceptions. In addition to reducing
method signature length and number of imports, this also eliminated
some impossible catch blocks.
- Warn on missing @Override annotations.
- Warn on unused parameters. This is likely the most controversial,
as a few relatively common patterns require unused parameters in a
way that Eclipse can't ignore. However, it also resulted in cleanup
of a lot of unnecessary injections and method parameters, so I
think the cost was worth it.
Change-Id: I7224be8b1c798613a127c88507e8cce400679e5d
This commit is contained in:
@@ -240,7 +240,7 @@ public class Dispatcher {
|
||||
if (defaultScreenToken != null && !MINE.equals(defaultScreenToken)) {
|
||||
select(defaultScreenToken);
|
||||
} else {
|
||||
Gerrit.display(token, mine(token));
|
||||
Gerrit.display(token, mine());
|
||||
}
|
||||
|
||||
} else if (matchPrefix("/dashboard/", token)) {
|
||||
@@ -433,7 +433,7 @@ public class Dispatcher {
|
||||
Gerrit.display(token, screen);
|
||||
}
|
||||
|
||||
private static Screen mine(final String token) {
|
||||
private static Screen mine() {
|
||||
if (Gerrit.isSignedIn()) {
|
||||
return new AccountDashboardScreen(Gerrit.getUserAccount().getId());
|
||||
|
||||
@@ -644,6 +644,7 @@ public class Dispatcher {
|
||||
private static void publish(final PatchSet.Id ps) {
|
||||
String token = toPublish(ps);
|
||||
new AsyncSplit(token) {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Gerrit.display(token, select());
|
||||
}
|
||||
@@ -670,6 +671,7 @@ public class Dispatcher {
|
||||
Gerrit.getPatchScreenTopView() : topView;
|
||||
|
||||
GWT.runAsync(new AsyncSplit(token) {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Gerrit.display(token, select());
|
||||
}
|
||||
@@ -743,6 +745,7 @@ public class Dispatcher {
|
||||
|
||||
private static void settings(String token) {
|
||||
GWT.runAsync(new AsyncSplit(token) {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Gerrit.display(token, select());
|
||||
}
|
||||
@@ -810,6 +813,7 @@ public class Dispatcher {
|
||||
|
||||
private static void admin(String token) {
|
||||
GWT.runAsync(new AsyncSplit(token) {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (matchExact(ADMIN_GROUPS, token)
|
||||
|| matchExact("/admin/groups", token)) {
|
||||
@@ -983,6 +987,7 @@ public class Dispatcher {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onFailure(Throwable reason) {
|
||||
if (!isReloadUi
|
||||
&& "HTTP download failed with status 404".equals(reason.getMessage())) {
|
||||
@@ -999,6 +1004,7 @@ public class Dispatcher {
|
||||
|
||||
private static void docSearch(final String token) {
|
||||
GWT.runAsync(new AsyncSplit(token) {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Gerrit.display(token, new DocScreen(skip(token)));
|
||||
}
|
||||
|
||||
@@ -657,6 +657,7 @@ public class Gerrit implements EntryPoint {
|
||||
final LinkMenuItem dashboardsMenuItem =
|
||||
new ProjectLinkMenuItem(C.menuProjectsDashboards(),
|
||||
ProjectScreen.DASHBOARDS) {
|
||||
@Override
|
||||
protected boolean match(String token) {
|
||||
return super.match(token) ||
|
||||
(!getTargetHistoryToken().isEmpty() && ("/admin" + token).startsWith(getTargetHistoryToken()));
|
||||
@@ -718,6 +719,7 @@ public class Gerrit implements EntryPoint {
|
||||
|
||||
case OPENID:
|
||||
menuRight.addItem(C.menuRegister(), new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
String t = History.getToken();
|
||||
if (t == null) {
|
||||
@@ -727,6 +729,7 @@ public class Gerrit implements EntryPoint {
|
||||
}
|
||||
});
|
||||
menuRight.addItem(C.menuSignIn(), new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
doSignIn(History.getToken());
|
||||
}
|
||||
@@ -735,6 +738,7 @@ public class Gerrit implements EntryPoint {
|
||||
|
||||
case OPENID_SSO:
|
||||
menuRight.addItem(C.menuSignIn(), new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
doSignIn(History.getToken());
|
||||
}
|
||||
@@ -757,6 +761,7 @@ public class Gerrit implements EntryPoint {
|
||||
menuRight.add(anchor(registerText, cfg.getRegisterUrl()));
|
||||
}
|
||||
menuRight.addItem(C.menuSignIn(), new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
doSignIn(History.getToken());
|
||||
}
|
||||
@@ -769,6 +774,7 @@ public class Gerrit implements EntryPoint {
|
||||
}
|
||||
}
|
||||
ConfigServerApi.topMenus(new GerritCallback<TopMenuList>() {
|
||||
@Override
|
||||
public void onSuccess(TopMenuList result) {
|
||||
List<TopMenu> topMenuExtensions = Natives.asList(result);
|
||||
for (TopMenu menu : topMenuExtensions) {
|
||||
|
||||
@@ -194,6 +194,7 @@ class ContactPanelShort extends Composite {
|
||||
haveEmails = false;
|
||||
|
||||
Util.ACCOUNT_SVC.myAccount(new GerritCallback<Account>() {
|
||||
@Override
|
||||
public void onSuccess(final Account result) {
|
||||
if (!isAttached()) {
|
||||
return;
|
||||
@@ -359,6 +360,7 @@ class ContactPanelShort extends Composite {
|
||||
|
||||
Util.ACCOUNT_SEC.updateContact(newName, newEmail, info,
|
||||
new GerritCallback<Account>() {
|
||||
@Override
|
||||
public void onSuccess(final Account result) {
|
||||
registerNewEmail.setEnabled(true);
|
||||
onSaveSuccess(result);
|
||||
|
||||
@@ -40,6 +40,7 @@ public class MyAgreementsScreen extends SettingsScreen {
|
||||
protected void onLoad() {
|
||||
super.onLoad();
|
||||
Util.ACCOUNT_SVC.myAgreements(new ScreenLoadCallback<AgreementInfo>(this) {
|
||||
@Override
|
||||
public void preDisplay(final AgreementInfo result) {
|
||||
agreements.display(result);
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ public class MyIdentitiesScreen extends SettingsScreen {
|
||||
super.onLoad();
|
||||
Util.ACCOUNT_SEC
|
||||
.myExternalIds(new ScreenLoadCallback<List<AccountExternalId>>(this) {
|
||||
@Override
|
||||
public void preDisplay(final List<AccountExternalId> result) {
|
||||
identites.display(result);
|
||||
}
|
||||
@@ -126,6 +127,7 @@ public class MyIdentitiesScreen extends SettingsScreen {
|
||||
deleteIdentity.setEnabled(false);
|
||||
Util.ACCOUNT_SEC.deleteExternalIds(keys,
|
||||
new GerritCallback<Set<AccountExternalId.Key>>() {
|
||||
@Override
|
||||
public void onSuccess(final Set<AccountExternalId.Key> removed) {
|
||||
for (int row = 1; row < table.getRowCount();) {
|
||||
final AccountExternalId k = getRowItem(row);
|
||||
|
||||
@@ -213,6 +213,7 @@ public class MyWatchedProjectsScreen extends SettingsScreen {
|
||||
|
||||
Util.ACCOUNT_SVC.addProjectWatch(projectName, filter,
|
||||
new GerritCallback<AccountProjectWatchInfo>() {
|
||||
@Override
|
||||
public void onSuccess(final AccountProjectWatchInfo result) {
|
||||
addNew.setEnabled(true);
|
||||
nameBox.setEnabled(true);
|
||||
|
||||
@@ -67,6 +67,7 @@ public class MyWatchesTable extends FancyFlexTable<AccountProjectWatchInfo> {
|
||||
if (!ids.isEmpty()) {
|
||||
Util.ACCOUNT_SVC.deleteProjectWatches(ids,
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(final VoidResult result) {
|
||||
remove(ids);
|
||||
}
|
||||
@@ -165,6 +166,7 @@ public class MyWatchesTable extends FancyFlexTable<AccountProjectWatchInfo> {
|
||||
cbox.setEnabled(false);
|
||||
Util.ACCOUNT_SVC.updateProjectWatch(info.getWatch(),
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(final VoidResult result) {
|
||||
cbox.setEnabled(true);
|
||||
}
|
||||
|
||||
@@ -79,6 +79,7 @@ public class NewAgreementScreen extends AccountScreen {
|
||||
protected void onLoad() {
|
||||
super.onLoad();
|
||||
Util.ACCOUNT_SVC.myAgreements(new GerritCallback<AgreementInfo>() {
|
||||
@Override
|
||||
public void onSuccess(AgreementInfo result) {
|
||||
if (isAttached()) {
|
||||
mySigned = new HashSet<>(result.accepted);
|
||||
@@ -88,6 +89,7 @@ public class NewAgreementScreen extends AccountScreen {
|
||||
});
|
||||
Gerrit.SYSTEM_SVC
|
||||
.contributorAgreements(new GerritCallback<List<ContributorAgreement>>() {
|
||||
@Override
|
||||
public void onSuccess(final List<ContributorAgreement> result) {
|
||||
if (isAttached()) {
|
||||
available = result;
|
||||
@@ -224,6 +226,7 @@ public class NewAgreementScreen extends AccountScreen {
|
||||
private void doEnterAgreement() {
|
||||
Util.ACCOUNT_SEC.enterAgreement(current.getName(),
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(final VoidResult result) {
|
||||
Gerrit.display(nextToken);
|
||||
}
|
||||
@@ -247,10 +250,12 @@ public class NewAgreementScreen extends AccountScreen {
|
||||
}
|
||||
final RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url);
|
||||
rb.setCallback(new RequestCallback() {
|
||||
@Override
|
||||
public void onError(Request request, Throwable exception) {
|
||||
new ErrorDialog(exception).center();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponseReceived(Request request, Response response) {
|
||||
final String ct = response.getHeader("Content-Type");
|
||||
if (response.getStatusCode() == 200 && ct != null
|
||||
|
||||
@@ -159,6 +159,7 @@ class SshPanel extends Composite {
|
||||
if (txt != null && txt.length() > 0) {
|
||||
addNew.setEnabled(false);
|
||||
AccountApi.addSshKey("self", txt, new GerritCallback<SshKeyInfo>() {
|
||||
@Override
|
||||
public void onSuccess(final SshKeyInfo k) {
|
||||
addNew.setEnabled(true);
|
||||
addTxt.setText("");
|
||||
@@ -198,6 +199,7 @@ class SshPanel extends Composite {
|
||||
super.onLoad();
|
||||
refreshSshKeys();
|
||||
Gerrit.SYSTEM_SVC.daemonHostKeys(new GerritCallback<List<SshHostKey>>() {
|
||||
@Override
|
||||
public void onSuccess(final List<SshHostKey> result) {
|
||||
serverKeys.clear();
|
||||
for (final SshHostKey keyInfo : result) {
|
||||
@@ -272,6 +274,7 @@ class SshPanel extends Composite {
|
||||
deleteKey.setEnabled(false);
|
||||
AccountApi.deleteSshKeys("self", sequenceNumbers,
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(VoidResult result) {
|
||||
for (int row = 1; row < table.getRowCount();) {
|
||||
final SshKeyInfo k = getRowItem(row);
|
||||
|
||||
@@ -116,6 +116,7 @@ class UsernameField extends Composite {
|
||||
|
||||
Util.ACCOUNT_SEC.changeUserName(newUserName,
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(final VoidResult result) {
|
||||
Gerrit.getUserAccount().setUserName(newUserName);
|
||||
userNameLbl.setText(newUserName);
|
||||
|
||||
@@ -96,6 +96,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
|
||||
final String newName = groupNameTxt.getText().trim();
|
||||
GroupApi.renameGroup(getGroupUUID(), newName,
|
||||
new GerritCallback<com.google.gerrit.client.VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(final com.google.gerrit.client.VoidResult result) {
|
||||
saveName.setEnabled(false);
|
||||
setPageTitle(Util.M.group(newName));
|
||||
@@ -135,6 +136,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
|
||||
String ownerId = ownerUuid != null ? ownerUuid.get() : newOwner;
|
||||
GroupApi.setGroupOwner(getGroupUUID(), ownerId,
|
||||
new GerritCallback<GroupInfo>() {
|
||||
@Override
|
||||
public void onSuccess(final GroupInfo result) {
|
||||
updateOwnerGroup(result);
|
||||
saveOwner.setEnabled(false);
|
||||
@@ -165,6 +167,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
|
||||
final String txt = descTxt.getText().trim();
|
||||
GroupApi.setGroupDescription(getGroupUUID(), txt,
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(final VoidResult result) {
|
||||
saveDesc.setEnabled(false);
|
||||
}
|
||||
@@ -193,6 +196,7 @@ public class AccountGroupInfoScreen extends AccountGroupScreen {
|
||||
public void onClick(final ClickEvent event) {
|
||||
GroupApi.setGroupOptions(getGroupUUID(),
|
||||
visibleToAllCheckBox.getValue(), new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(final VoidResult result) {
|
||||
saveGroupOptions.setEnabled(false);
|
||||
}
|
||||
|
||||
@@ -172,6 +172,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
|
||||
addMemberBox.setEnabled(false);
|
||||
GroupApi.addMember(getGroupUUID(), nameEmail,
|
||||
new GerritCallback<AccountInfo>() {
|
||||
@Override
|
||||
public void onSuccess(final AccountInfo memberInfo) {
|
||||
addMemberBox.setEnabled(true);
|
||||
addMemberBox.setText("");
|
||||
@@ -200,6 +201,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
|
||||
addIncludeBox.setEnabled(false);
|
||||
GroupApi.addIncludedGroup(getGroupUUID(), uuid.get(),
|
||||
new GerritCallback<GroupInfo>() {
|
||||
@Override
|
||||
public void onSuccess(final GroupInfo result) {
|
||||
addIncludeBox.setEnabled(true);
|
||||
addIncludeBox.setText("");
|
||||
@@ -248,6 +250,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
|
||||
if (!ids.isEmpty()) {
|
||||
GroupApi.removeMembers(getGroupUUID(), ids,
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(final VoidResult result) {
|
||||
for (int row = 1; row < table.getRowCount();) {
|
||||
final AccountInfo i = getRowItem(row);
|
||||
@@ -353,6 +356,7 @@ public class AccountGroupMembersScreen extends AccountGroupScreen {
|
||||
if (!ids.isEmpty()) {
|
||||
GroupApi.removeIncludedGroups(getGroupUUID(), ids,
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(final VoidResult result) {
|
||||
for (int row = 1; row < table.getRowCount();) {
|
||||
final GroupInfo i = getRowItem(row);
|
||||
|
||||
@@ -128,6 +128,7 @@ public class CreateGroupScreen extends Screen {
|
||||
|
||||
addNew.setEnabled(false);
|
||||
GroupApi.createGroup(newName, new GerritCallback<GroupInfo>() {
|
||||
@Override
|
||||
public void onSuccess(final GroupInfo result) {
|
||||
History.newItem(Dispatcher.toGroup(result.getGroupId(),
|
||||
AccountGroupScreen.MEMBERS));
|
||||
|
||||
@@ -133,6 +133,7 @@ public class GroupReferenceBox extends Composite implements
|
||||
suggestBox.setTabIndex(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocus(boolean focused) {
|
||||
suggestBox.setFocus(focused);
|
||||
}
|
||||
|
||||
@@ -316,6 +316,7 @@ public class ProjectBranchesScreen extends ProjectScreen {
|
||||
private void deleteBranches(final Set<String> branches) {
|
||||
ProjectApi.deleteBranches(getProjectKey(), branches,
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(VoidResult result) {
|
||||
for (int row = 1; row < table.getRowCount();) {
|
||||
BranchInfo k = getRowItem(row);
|
||||
|
||||
@@ -27,16 +27,19 @@ import java.text.ParseException;
|
||||
|
||||
public class RefPatternBox extends ValueBox<String> {
|
||||
private static final Renderer<String> RENDERER = new Renderer<String>() {
|
||||
@Override
|
||||
public String render(String ref) {
|
||||
return ref;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(String ref, Appendable dst) throws IOException {
|
||||
dst.append(render(ref));
|
||||
}
|
||||
};
|
||||
|
||||
private static final Parser<String> PARSER = new Parser<String>() {
|
||||
@Override
|
||||
public String parse(CharSequence text) throws ParseException {
|
||||
String ref = text.toString();
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ public class ValueEditor<T> extends Composite implements HasEditorErrors<T>,
|
||||
editPanel.setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ValueBoxEditor<T> asEditor() {
|
||||
if (editProxy == null) {
|
||||
editProxy = new EditorProxy();
|
||||
@@ -133,6 +134,7 @@ public class ValueEditor<T> extends Composite implements HasEditorErrors<T>,
|
||||
startHandlers.enabled = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showErrors(List<EditorError> errors) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
for (EditorError error : errors) {
|
||||
|
||||
@@ -81,6 +81,7 @@ class PluginName {
|
||||
|
||||
/** Extracts URL from the stack frame. */
|
||||
static class PluginNameMoz extends PluginName {
|
||||
@Override
|
||||
String findCallerUrl() {
|
||||
return getUrl(makeException());
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ class AbandonAction extends ActionMessageBox {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
void send(String message) {
|
||||
ChangeApi.abandon(id.get(), message, new GerritCallback<ChangeInfo>() {
|
||||
@Override
|
||||
|
||||
@@ -256,7 +256,7 @@ class Actions extends Composite {
|
||||
|
||||
@UiHandler("revert")
|
||||
void onRevert(ClickEvent e) {
|
||||
RevertAction.call(revert, changeId, revision, project, subject);
|
||||
RevertAction.call(revert, changeId, revision, subject);
|
||||
}
|
||||
|
||||
private static void a2b(NativeMap<ActionInfo> actions, String a, Button b) {
|
||||
|
||||
@@ -1077,6 +1077,7 @@ public class ChangeScreen2 extends Screen {
|
||||
Gerrit.display(PageLinks.toChange(changeId));
|
||||
}
|
||||
|
||||
@Override
|
||||
void onIgnore(Timestamp newTime) {
|
||||
lastDisplayedUpdate = newTime;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ class DownloadAction extends RightSidePopdownAction {
|
||||
info.revision(revision)._number()));
|
||||
}
|
||||
|
||||
@Override
|
||||
Widget getWidget() {
|
||||
return downloadBox;
|
||||
}
|
||||
|
||||
@@ -40,10 +40,12 @@ public class DraftActions {
|
||||
public static GerritCallback<JavaScriptObject> cs(
|
||||
final Change.Id id) {
|
||||
return new GerritCallback<JavaScriptObject>() {
|
||||
@Override
|
||||
public void onSuccess(JavaScriptObject result) {
|
||||
Gerrit.display(PageLinks.toChange(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable err) {
|
||||
if (SubmitFailureDialog.isConflict(err)) {
|
||||
new SubmitFailureDialog(err.getMessage()).center();
|
||||
@@ -57,10 +59,12 @@ public class DraftActions {
|
||||
|
||||
private static AsyncCallback<JavaScriptObject> mine() {
|
||||
return new GerritCallback<JavaScriptObject>() {
|
||||
@Override
|
||||
public void onSuccess(JavaScriptObject result) {
|
||||
Gerrit.display(PageLinks.MINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable err) {
|
||||
if (SubmitFailureDialog.isConflict(err)) {
|
||||
new SubmitFailureDialog(err.getMessage()).center();
|
||||
|
||||
@@ -39,10 +39,12 @@ public class EditActions {
|
||||
public static GerritCallback<JavaScriptObject> cs(
|
||||
final Change.Id id) {
|
||||
return new GerritCallback<JavaScriptObject>() {
|
||||
@Override
|
||||
public void onSuccess(JavaScriptObject result) {
|
||||
Gerrit.display(PageLinks.toChange(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable err) {
|
||||
if (SubmitFailureDialog.isConflict(err)) {
|
||||
new SubmitFailureDialog(err.getMessage()).center();
|
||||
|
||||
@@ -58,6 +58,7 @@ class EditMessageBox extends Composite {
|
||||
message.getElement().setAttribute("wrap", "off");
|
||||
message.setText("");
|
||||
new TextBoxChangeListener(message) {
|
||||
@Override
|
||||
public void onTextChanged(String newText) {
|
||||
save.setEnabled(!newText.trim()
|
||||
.equals(originalMessage));
|
||||
|
||||
@@ -93,6 +93,7 @@ public class FileTable extends FlowPanel {
|
||||
|
||||
public static enum Mode {
|
||||
REVIEW,
|
||||
@SuppressWarnings("hiding")
|
||||
EDIT
|
||||
}
|
||||
|
||||
@@ -460,7 +461,7 @@ public class FileTable extends FlowPanel {
|
||||
|
||||
private final class DisplayCommand implements RepeatingCommand {
|
||||
private final SafeHtmlBuilder sb = new SafeHtmlBuilder();
|
||||
private final MyTable table;
|
||||
private final MyTable myTable;
|
||||
private final JsArray<FileInfo> list;
|
||||
private final Timestamp myLastReply;
|
||||
private final NativeMap<JsArray<CommentInfo>> comments;
|
||||
@@ -482,16 +483,17 @@ public class FileTable extends FlowPanel {
|
||||
NativeMap<JsArray<CommentInfo>> comments,
|
||||
NativeMap<JsArray<CommentInfo>> drafts,
|
||||
Mode mode) {
|
||||
this.table = new MyTable(map, list);
|
||||
this.myTable = new MyTable(map, list);
|
||||
this.list = list;
|
||||
this.myLastReply = myLastReply;
|
||||
this.comments = comments;
|
||||
this.drafts = drafts;
|
||||
this.hasUser = Gerrit.isSignedIn();
|
||||
this.mode = mode;
|
||||
table.addStyleName(R.css().table());
|
||||
myTable.addStyleName(R.css().table());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute() {
|
||||
boolean attachedNow = isAttached();
|
||||
if (!attached && attachedNow) {
|
||||
@@ -519,9 +521,9 @@ public class FileTable extends FlowPanel {
|
||||
}
|
||||
}
|
||||
footer(sb);
|
||||
table.resetHtml(sb);
|
||||
table.finishDisplay();
|
||||
setTable(table);
|
||||
myTable.resetHtml(sb);
|
||||
myTable.finishDisplay();
|
||||
setTable(myTable);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ class FollowUpAction extends ActionMessageBox {
|
||||
this.base = project + "~" + branch + "~" + key;
|
||||
}
|
||||
|
||||
@Override
|
||||
void send(String message) {
|
||||
ChangeApi.createChange(project, branch, message, base,
|
||||
new GerritCallback<ChangeInfo>() {
|
||||
|
||||
@@ -200,6 +200,7 @@ public class Hashtags extends Composite {
|
||||
ChangeApi.hashtags(changeId.get()).post(
|
||||
PostInput.create(hashtags, null),
|
||||
new GerritCallback<JsArrayString>() {
|
||||
@Override
|
||||
public void onSuccess(JsArrayString result) {
|
||||
hashtagTextBox.setEnabled(true);
|
||||
UIObject.setVisible(error, false);
|
||||
|
||||
@@ -30,6 +30,7 @@ class IncludedInAction extends RightSidePopdownAction {
|
||||
this.includedInBox = new IncludedInBox(changeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
Widget getWidget() {
|
||||
return includedInBox;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ class PatchSetsAction extends RightSidePopdownAction {
|
||||
this.revisionBox = new PatchSetsBox(changeId, revision);
|
||||
}
|
||||
|
||||
@Override
|
||||
Widget getWidget() {
|
||||
return revisionBox;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ class RebaseAction {
|
||||
static void call(final Change.Id id, String revision) {
|
||||
ChangeApi.rebase(id.get(), revision,
|
||||
new GerritCallback<ChangeInfo>() {
|
||||
@Override
|
||||
public void onSuccess(ChangeInfo result) {
|
||||
Gerrit.display(PageLinks.toChange(id));
|
||||
}
|
||||
|
||||
@@ -200,6 +200,7 @@ class RelatedChangesTab implements IsWidget {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute() {
|
||||
if (navList != view || !panel.isAttached()) {
|
||||
// If the user navigated away, we aren't in the DOM anymore.
|
||||
|
||||
@@ -62,6 +62,7 @@ public class RestReviewerSuggestOracle extends SuggestAfterTypingNCharsOracle {
|
||||
this.reviewer = reviewer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayString() {
|
||||
if (reviewer.account() != null) {
|
||||
return FormatUtil.nameEmail(reviewer.account());
|
||||
@@ -72,6 +73,7 @@ public class RestReviewerSuggestOracle extends SuggestAfterTypingNCharsOracle {
|
||||
+ ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReplacementString() {
|
||||
if (reviewer.account() != null) {
|
||||
return FormatUtil.nameEmail(reviewer.account());
|
||||
|
||||
@@ -30,6 +30,7 @@ class RestoreAction extends ActionMessageBox {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
void send(String message) {
|
||||
ChangeApi.restore(id.get(), message, new GerritCallback<ChangeInfo>() {
|
||||
@Override
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.google.gwt.user.client.ui.Button;
|
||||
|
||||
class RevertAction {
|
||||
static void call(Button b, final Change.Id id, final String revision,
|
||||
String project, final String commitSubject) {
|
||||
final String commitSubject) {
|
||||
// TODO Replace ActionDialog with a nicer looking display.
|
||||
b.setEnabled(false);
|
||||
new ActionDialog(b, false,
|
||||
|
||||
@@ -163,6 +163,7 @@ public class Reviewers extends Composite {
|
||||
ChangeApi.reviewers(changeId.get()).post(
|
||||
PostInput.create(reviewer, confirmed),
|
||||
new GerritCallback<PostResult>() {
|
||||
@Override
|
||||
public void onSuccess(PostResult result) {
|
||||
nameTxtBox.setEnabled(true);
|
||||
|
||||
|
||||
@@ -32,10 +32,12 @@ class SubmitAction {
|
||||
ChangeApi.submit(
|
||||
changeId.get(), revisionInfo.name(),
|
||||
new GerritCallback<SubmitInfo>() {
|
||||
@Override
|
||||
public void onSuccess(SubmitInfo result) {
|
||||
redisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable err) {
|
||||
if (SubmitFailureDialog.isConflict(err)) {
|
||||
new SubmitFailureDialog(err.getMessage()).center();
|
||||
|
||||
@@ -254,6 +254,7 @@ public class ApprovalTable extends Composite {
|
||||
ChangeApi.reviewers(lastChange.legacy_id().get()).post(
|
||||
PostInput.create(reviewer, confirmed),
|
||||
new GerritCallback<PostResult>() {
|
||||
@Override
|
||||
public void onSuccess(PostResult result) {
|
||||
addMemberBox.setEnabled(true);
|
||||
addMemberBox.setText("");
|
||||
|
||||
@@ -313,6 +313,7 @@ public class ChangeScreen extends Screen
|
||||
event.getValue().setSubmitTypeRecord(SubmitTypeRecord.OK(
|
||||
SubmitType.valueOf(result.asString())));
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
}));
|
||||
}
|
||||
@@ -388,7 +389,9 @@ public class ChangeScreen extends Screen
|
||||
ListChangesOption.CURRENT_REVISION));
|
||||
call.get(cbs2.add(new AsyncCallback<
|
||||
com.google.gerrit.client.changes.ChangeInfo>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
@Override
|
||||
public void onSuccess(
|
||||
com.google.gerrit.client.changes.ChangeInfo result) {
|
||||
i.set(ChangeDetailCache.toChange(result),
|
||||
@@ -398,6 +401,7 @@ public class ChangeScreen extends Screen
|
||||
.merge(ChangeDetailCache.users(result));
|
||||
}}));
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
}));
|
||||
ChangeApi.revision(changeId.get(), revId)
|
||||
@@ -416,6 +420,7 @@ public class ChangeScreen extends Screen
|
||||
p.setReviewedByCurrentUser(true);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
}));
|
||||
final Set<PatchSet.Id> withDrafts = new HashSet<>();
|
||||
@@ -432,6 +437,7 @@ public class ChangeScreen extends Screen
|
||||
withDrafts.add(id);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
}));
|
||||
}
|
||||
@@ -453,6 +459,7 @@ public class ChangeScreen extends Screen
|
||||
withDrafts.add(psId);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
}));
|
||||
}
|
||||
@@ -470,6 +477,7 @@ public class ChangeScreen extends Screen
|
||||
p.setCommentCount(result.get(path).length());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
}));
|
||||
DiffApi.list(changeId.get(), null, revId,
|
||||
@@ -497,6 +505,7 @@ public class ChangeScreen extends Screen
|
||||
}
|
||||
event.getValue().getCurrentPatchSetDetail().setPatches(list);
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
});
|
||||
ConfigInfoCache.get(
|
||||
@@ -524,6 +533,7 @@ public class ChangeScreen extends Screen
|
||||
public void onSuccess(Void result) {
|
||||
display(event.getValue());
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
}).onSuccess(null);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ public class CommitMessageBlock extends Composite {
|
||||
sendButton.setEnabled(false);
|
||||
|
||||
new TextBoxChangeListener(message) {
|
||||
@Override
|
||||
public void onTextChanged(String newText) {
|
||||
// Trim the new text so we don't consider trailing
|
||||
// newlines as changes
|
||||
@@ -95,6 +96,7 @@ public class CommitMessageBlock extends Composite {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessageText() {
|
||||
// As we rely on commit message lines ending in LF, we convert CRLF to
|
||||
// LF. Additionally, the commit message should be trimmed to remove any
|
||||
|
||||
@@ -96,6 +96,7 @@ public class DashboardTable extends ChangeTable2 {
|
||||
return unlimitedQuery.toString().trim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@@ -319,10 +319,12 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
|
||||
patchSet.getId().getParentKey().get(),
|
||||
patchSet.getRevision().get(),
|
||||
new GerritCallback<SubmitInfo>() {
|
||||
@Override
|
||||
public void onSuccess(SubmitInfo result) {
|
||||
redisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable err) {
|
||||
if (SubmitFailureDialog.isConflict(err)) {
|
||||
new SubmitFailureDialog(err.getMessage()).center();
|
||||
@@ -480,10 +482,12 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
|
||||
b.setEnabled(false);
|
||||
ChangeApi.deleteChange(patchSet.getId().getParentKey().get(),
|
||||
new GerritCallback<JavaScriptObject>() {
|
||||
@Override
|
||||
public void onSuccess(JavaScriptObject result) {
|
||||
Gerrit.display(PageLinks.MINE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable err) {
|
||||
if (SubmitFailureDialog.isConflict(err)) {
|
||||
new SubmitFailureDialog(err.getMessage()).center();
|
||||
@@ -545,6 +549,7 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
|
||||
final Change.Id id = patchSet.getId().getParentKey();
|
||||
ChangeApi.rebase(id.get(), patchSet.getRevision().get(),
|
||||
new GerritCallback<ChangeInfo>() {
|
||||
@Override
|
||||
public void onSuccess(ChangeInfo result) {
|
||||
Gerrit.display(PageLinks.toChange(id));
|
||||
}
|
||||
@@ -691,6 +696,7 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
|
||||
|
||||
Util.DETAIL_SVC.patchSetDetail2(diffBaseId, patchSet.getId(), diffPrefs,
|
||||
new GerritCallback<PatchSetDetail>() {
|
||||
@Override
|
||||
public void onSuccess(final PatchSetDetail result) {
|
||||
loadInfoTable(result);
|
||||
loadActionPanel(result);
|
||||
|
||||
@@ -455,6 +455,7 @@ public class PatchTable extends Composite {
|
||||
int C_UNIFIED = C_SIDEBYSIDE - 2 + 1;
|
||||
Anchor unified = new Anchor(Util.C.diffAllUnified());
|
||||
unified.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
for (Patch p : detail.getPatches()) {
|
||||
openWindow(Dispatcher.toPatchUnified(base, p.getKey()));
|
||||
@@ -742,6 +743,7 @@ public class PatchTable extends Composite {
|
||||
/**
|
||||
* Add the files contained in the list of patches to the table, one per row.
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("fallthrough")
|
||||
public boolean execute() {
|
||||
final boolean attachedNow = isAttached();
|
||||
|
||||
@@ -171,6 +171,7 @@ public class PublishCommentScreen extends AccountScreen implements
|
||||
submitTypeRecord = SubmitTypeRecord.OK(
|
||||
SubmitType.valueOf(result.asString()));
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
}));
|
||||
ChangeApi.revision(patchSetId.getParentKey().get(), "" + patchSetId.get())
|
||||
@@ -180,6 +181,7 @@ public class PublishCommentScreen extends AccountScreen implements
|
||||
public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
|
||||
drafts = result;
|
||||
}
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {}
|
||||
}));
|
||||
ChangeApi.revision(patchSetId).view("review")
|
||||
@@ -445,6 +447,7 @@ public class PublishCommentScreen extends AccountScreen implements
|
||||
patchSetId.getParentKey().get(),
|
||||
"" + patchSetId.get(),
|
||||
new GerritCallback<SubmitInfo>() {
|
||||
@Override
|
||||
public void onSuccess(SubmitInfo result) {
|
||||
saveStateOnUnload = false;
|
||||
goChange();
|
||||
|
||||
@@ -65,7 +65,7 @@ class ChunkManager {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static void focusOnClick(Element e, DisplaySide side) {
|
||||
onClick(e, side == A ? focusA : focusB);
|
||||
@@ -165,10 +165,10 @@ class ChunkManager {
|
||||
int endA = mapper.getLineA() - 1;
|
||||
int endB = mapper.getLineB() - 1;
|
||||
if (aLen > 0) {
|
||||
addDiffChunk(cmB, endB, endA, aLen, bLen > 0);
|
||||
addDiffChunk(cmB, endA, aLen, bLen > 0);
|
||||
}
|
||||
if (bLen > 0) {
|
||||
addDiffChunk(cmA, endA, endB, bLen, aLen > 0);
|
||||
addDiffChunk(cmA, endB, bLen, aLen > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,8 +264,8 @@ class ChunkManager {
|
||||
}
|
||||
}
|
||||
|
||||
private void addDiffChunk(CodeMirror cmToPad, int lineToPad,
|
||||
int lineOnOther, int chunkSize, boolean edit) {
|
||||
private void addDiffChunk(CodeMirror cmToPad, int lineOnOther,
|
||||
int chunkSize, boolean edit) {
|
||||
chunks.add(new DiffChunkInfo(host.otherCm(cmToPad).side(),
|
||||
lineOnOther - chunkSize + 1, lineOnOther, edit));
|
||||
}
|
||||
|
||||
@@ -295,6 +295,7 @@ class CommentManager {
|
||||
|
||||
Runnable toggleOpenBox(final CodeMirror cm) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cm.hasActiveLine()) {
|
||||
CommentGroup w = map(cm.side()).get(
|
||||
@@ -339,6 +340,7 @@ class CommentManager {
|
||||
}
|
||||
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cm.hasActiveLine()) {
|
||||
newDraft(cm);
|
||||
|
||||
@@ -281,6 +281,7 @@ class Header extends Composite {
|
||||
|
||||
Runnable toggleReviewed() {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
reviewed.setValue(!reviewed.getValue(), true);
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@ class PublishedBox extends CommentBox {
|
||||
return UIObject.isVisible(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
void setOpen(boolean open) {
|
||||
UIObject.setVisible(summary, !open);
|
||||
UIObject.setVisible(message, open);
|
||||
|
||||
@@ -363,6 +363,7 @@ public class SideBySide2 extends Screen {
|
||||
.on("Shift-Left", moveCursorToSide(cm, DisplaySide.A))
|
||||
.on("Shift-Right", moveCursorToSide(cm, DisplaySide.B))
|
||||
.on("I", new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
switch (getIntraLineStatus()) {
|
||||
case OFF:
|
||||
@@ -594,6 +595,7 @@ public class SideBySide2 extends Screen {
|
||||
}
|
||||
|
||||
operation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// Estimate initial CM3 height, fixed up in onShowView.
|
||||
int height = Window.getClientHeight()
|
||||
@@ -783,6 +785,7 @@ public class SideBySide2 extends Screen {
|
||||
private Runnable updateActiveLine(final CodeMirror cm) {
|
||||
final CodeMirror other = otherCm(cm);
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// The rendering of active lines has to be deferred. Reflow
|
||||
// caused by adding and removing styles chokes Firefox when arrow
|
||||
@@ -793,6 +796,7 @@ public class SideBySide2 extends Screen {
|
||||
@Override
|
||||
public void execute() {
|
||||
operation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LineHandle handle = cm.getLineHandleVisualStart(
|
||||
cm.getCursor("end").getLine());
|
||||
@@ -848,6 +852,7 @@ public class SideBySide2 extends Screen {
|
||||
|
||||
private Runnable upToChange(final boolean openReplyBox) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallbackGroup group = new CallbackGroup();
|
||||
commentManager.saveAllDrafts(group);
|
||||
@@ -879,6 +884,7 @@ public class SideBySide2 extends Screen {
|
||||
|
||||
final DisplaySide sideSrc = cmSrc.side();
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (cmSrc.hasActiveLine()) {
|
||||
cmDst.setCursor(LineCharacter.create(lineOnOther(
|
||||
|
||||
@@ -541,6 +541,11 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update cursor after selecting a comment.
|
||||
*
|
||||
* @param newComment comment that was selected.
|
||||
*/
|
||||
protected void updateCursor(final PatchLineComment newComment) {
|
||||
}
|
||||
|
||||
@@ -724,7 +729,7 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
|
||||
}
|
||||
|
||||
protected void bindComment(final int row, final int col,
|
||||
final PatchLineComment line, final boolean isLast, boolean expandComment) {
|
||||
final PatchLineComment line, boolean expandComment) {
|
||||
if (line.getStatus() == PatchLineComment.Status.DRAFT) {
|
||||
final CommentEditorPanel plc =
|
||||
new CommentEditorPanel(line, commentLinkProcessor);
|
||||
|
||||
@@ -245,6 +245,7 @@ public class CommentEditorPanel extends CommentPanel implements ClickHandler,
|
||||
final PatchSet.Id psId = comment.getKey().getParentKey().getParentKey();
|
||||
final boolean wasNew = isNew();
|
||||
GerritCallback<CommentInfo> cb = new GerritCallback<CommentInfo>() {
|
||||
@Override
|
||||
public void onSuccess(CommentInfo result) {
|
||||
notifyDraftDelta(wasNew ? 1 : 0);
|
||||
comment = toComment(psId, comment.getKey().getParentKey().get(), result);
|
||||
@@ -300,6 +301,7 @@ public class CommentEditorPanel extends CommentPanel implements ClickHandler,
|
||||
comment.getKey().getParentKey().getParentKey(),
|
||||
comment.getKey().get(),
|
||||
new GerritCallback<JavaScriptObject>() {
|
||||
@Override
|
||||
public void onSuccess(JavaScriptObject result) {
|
||||
notifyDraftDelta(-1);
|
||||
removeUI();
|
||||
|
||||
@@ -564,6 +564,7 @@ public abstract class PatchScreen extends Screen implements
|
||||
fileList.setSavePointerId("PatchTable " + psid);
|
||||
Util.DETAIL_SVC.patchSetDetail(psid,
|
||||
new GerritCallback<PatchSetDetail>() {
|
||||
@Override
|
||||
public void onSuccess(final PatchSetDetail result) {
|
||||
fileList.display(idSideA, result);
|
||||
}
|
||||
|
||||
@@ -135,6 +135,7 @@ public class ReviewedPanels {
|
||||
private InlineHyperlink createReviewedLink(final int patchIndex,
|
||||
final PatchScreen.Type patchScreenType) {
|
||||
final PatchValidator unreviewedValidator = new PatchValidator() {
|
||||
@Override
|
||||
public boolean isValid(Patch patch) {
|
||||
return !patch.isReviewedByCurrentUser();
|
||||
}
|
||||
|
||||
@@ -57,10 +57,12 @@ public class SideBySideTable extends AbstractPatchContentTable {
|
||||
private boolean isHugeFile;
|
||||
protected boolean isFileCommentBorderRowExist;
|
||||
|
||||
@Override
|
||||
protected void createFileCommentEditorOnSideA() {
|
||||
createCommentEditor(R_HEAD + 1, A, R_HEAD, FILE_SIDE_A);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFileCommentEditorOnSideB() {
|
||||
createCommentEditor(R_HEAD + 1, B, R_HEAD, FILE_SIDE_B);
|
||||
}
|
||||
@@ -96,7 +98,7 @@ public class SideBySideTable extends AbstractPatchContentTable {
|
||||
final ArrayList<Object> lines = new ArrayList<>();
|
||||
final SafeHtmlBuilder nc = new SafeHtmlBuilder();
|
||||
isHugeFile = script.isHugeFile();
|
||||
allocateTableHeader(script, nc);
|
||||
allocateTableHeader(nc);
|
||||
lines.add(null);
|
||||
if (!isDisplayBinary) {
|
||||
if (script.getFileModeA() != FileMode.FILE
|
||||
@@ -119,7 +121,7 @@ public class SideBySideTable extends AbstractPatchContentTable {
|
||||
&& script.hasIntralineDifference();
|
||||
for (final EditList.Hunk hunk : script.getHunks()) {
|
||||
if (!hunk.isStartOfFile()) {
|
||||
appendSkipLine(nc, hunk.getCurB() - lastB);
|
||||
appendSkipLine(nc);
|
||||
lines.add(new SkippedLine(lastA, lastB, hunk.getCurB() - lastB));
|
||||
}
|
||||
|
||||
@@ -185,7 +187,7 @@ public class SideBySideTable extends AbstractPatchContentTable {
|
||||
lastB = hunk.getCurB();
|
||||
}
|
||||
if (lastB != b.size()) {
|
||||
appendSkipLine(nc, b.size() - lastB);
|
||||
appendSkipLine(nc);
|
||||
lines.add(new SkippedLine(lastA, lastB, b.size() - lastB));
|
||||
}
|
||||
}
|
||||
@@ -329,13 +331,13 @@ public class SideBySideTable extends AbstractPatchContentTable {
|
||||
} else {
|
||||
insertRow(row);
|
||||
}
|
||||
bindComment(row, A, ac, !ai.hasNext(), expandComments);
|
||||
bindComment(row, B, bc, !bi.hasNext(), expandComments);
|
||||
bindComment(row, A, ac, !ai.hasNext());
|
||||
bindComment(row, B, bc, !bi.hasNext());
|
||||
row++;
|
||||
}
|
||||
|
||||
row = finish(ai, row, A, expandComments);
|
||||
row = finish(bi, row, B, expandComments);
|
||||
row = finish(ai, row, A);
|
||||
row = finish(bi, row, B);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,7 +392,7 @@ public class SideBySideTable extends AbstractPatchContentTable {
|
||||
}
|
||||
}
|
||||
|
||||
private int finish(final Iterator<PatchLineComment> i, int row, final int col, boolean expandComment) {
|
||||
private int finish(final Iterator<PatchLineComment> i, int row, final int col) {
|
||||
while (i.hasNext()) {
|
||||
final PatchLineComment c = i.next();
|
||||
if (c.getLine() == R_HEAD) {
|
||||
@@ -398,13 +400,13 @@ public class SideBySideTable extends AbstractPatchContentTable {
|
||||
} else {
|
||||
insertRow(row);
|
||||
}
|
||||
bindComment(row, col, c, !i.hasNext(), expandComment);
|
||||
bindComment(row, col, c, !i.hasNext());
|
||||
row++;
|
||||
}
|
||||
return row;
|
||||
}
|
||||
|
||||
private void allocateTableHeader(PatchScript script, final SafeHtmlBuilder m) {
|
||||
private void allocateTableHeader(final SafeHtmlBuilder m) {
|
||||
m.openTr();
|
||||
|
||||
m.openTd();
|
||||
@@ -457,7 +459,7 @@ public class SideBySideTable extends AbstractPatchContentTable {
|
||||
m.closeTr();
|
||||
}
|
||||
|
||||
private void appendSkipLine(final SafeHtmlBuilder m, final int skipCnt) {
|
||||
private void appendSkipLine(final SafeHtmlBuilder m) {
|
||||
m.openTr();
|
||||
|
||||
m.openTd();
|
||||
|
||||
@@ -46,6 +46,7 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
|
||||
private static final int PC = 3;
|
||||
private static final Comparator<PatchLineComment> BY_DATE =
|
||||
new Comparator<PatchLineComment>() {
|
||||
@Override
|
||||
public int compare(final PatchLineComment o1, final PatchLineComment o2) {
|
||||
return o1.getWrittenOn().compareTo(o2.getWrittenOn());
|
||||
}
|
||||
@@ -164,10 +165,12 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
|
||||
nc.closeElement("img");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFileCommentEditorOnSideA() {
|
||||
createCommentEditor(R_HEAD + 1, PC, R_HEAD, FILE_SIDE_A);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFileCommentEditorOnSideB() {
|
||||
createCommentEditor(rowOfTableHeaderB + 1, PC, R_HEAD, FILE_SIDE_B);
|
||||
createFileCommentBorderRow();
|
||||
@@ -367,13 +370,13 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
|
||||
row++;
|
||||
|
||||
if (!fora.isEmpty()) {
|
||||
row = insert(fora, row, expandComments);
|
||||
row = insert(fora, row);
|
||||
}
|
||||
rowOfTableHeaderB = row;
|
||||
borderRowOfFileComment = row + 1;
|
||||
if (!forb.isEmpty()) {
|
||||
row++;// Skip the Header of sideB.
|
||||
row = insert(forb, row, expandComments);
|
||||
row = insert(forb, row);
|
||||
borderRowOfFileComment = row;
|
||||
createFileCommentBorderRow();
|
||||
}
|
||||
@@ -388,13 +391,13 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
|
||||
all.addAll(fora);
|
||||
all.addAll(forb);
|
||||
Collections.sort(all, BY_DATE);
|
||||
row = insert(all, row, expandComments);
|
||||
row = insert(all, row);
|
||||
|
||||
} else if (!fora.isEmpty()) {
|
||||
row = insert(fora, row, expandComments);
|
||||
row = insert(fora, row);
|
||||
|
||||
} else if (!forb.isEmpty()) {
|
||||
row = insert(forb, row, expandComments);
|
||||
row = insert(forb, row);
|
||||
}
|
||||
} else {
|
||||
row++;
|
||||
@@ -422,7 +425,7 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
|
||||
return PatchScreen.Type.UNIFIED;
|
||||
}
|
||||
|
||||
private int insert(final List<PatchLineComment> in, int row, boolean expandComment) {
|
||||
private int insert(final List<PatchLineComment> in, int row) {
|
||||
for (Iterator<PatchLineComment> ci = in.iterator(); ci.hasNext();) {
|
||||
final PatchLineComment c = ci.next();
|
||||
if (c.getLine() == R_HEAD) {
|
||||
@@ -430,7 +433,7 @@ public class UnifiedDiffTable extends AbstractPatchContentTable {
|
||||
} else {
|
||||
insertRow(row);
|
||||
}
|
||||
bindComment(row, PC, c, !ci.hasNext(), expandComment);
|
||||
bindComment(row, PC, c, !ci.hasNext());
|
||||
row++;
|
||||
}
|
||||
return row;
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.google.gwtjsonrpc.common.JsonConstants;
|
||||
public abstract class GerritCallback<T> implements
|
||||
com.google.gwtjsonrpc.common.AsyncCallback<T>,
|
||||
com.google.gwt.user.client.rpc.AsyncCallback<T> {
|
||||
@Override
|
||||
public void onFailure(final Throwable caught) {
|
||||
if (isNotSignedIn(caught) || isInvalidXSRF(caught)) {
|
||||
new NotSignedInDialog().center();
|
||||
|
||||
@@ -28,6 +28,7 @@ public abstract class ScreenLoadCallback<T> extends GerritCallback<T> {
|
||||
screen = s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void onSuccess(final T result) {
|
||||
if (screen.isAttached()) {
|
||||
preDisplay(result);
|
||||
|
||||
@@ -35,10 +35,12 @@ public class AccountGroupSuggestOracle extends SuggestAfterTypingNCharsOracle {
|
||||
@Override
|
||||
public void _onRequestSuggestions(final Request req, final Callback callback) {
|
||||
RpcStatus.hide(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SuggestUtil.SVC.suggestAccountGroupForProject(
|
||||
projectName, req.getQuery(), req.getLimit(),
|
||||
new GerritCallback<List<GroupReference>>() {
|
||||
@Override
|
||||
public void onSuccess(final List<GroupReference> result) {
|
||||
priorResults.clear();
|
||||
final ArrayList<AccountGroupSuggestion> r =
|
||||
@@ -66,10 +68,12 @@ public class AccountGroupSuggestOracle extends SuggestAfterTypingNCharsOracle {
|
||||
info = k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayString() {
|
||||
return info.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReplacementString() {
|
||||
return info.getName();
|
||||
}
|
||||
|
||||
@@ -28,10 +28,12 @@ public class AccountSuggestOracle extends SuggestAfterTypingNCharsOracle {
|
||||
@Override
|
||||
public void _onRequestSuggestions(final Request req, final Callback callback) {
|
||||
RpcStatus.hide(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SuggestUtil.SVC.suggestAccount(req.getQuery(), Boolean.TRUE,
|
||||
req.getLimit(),
|
||||
new GerritCallback<List<AccountInfo>>() {
|
||||
@Override
|
||||
public void onSuccess(final List<AccountInfo> result) {
|
||||
final ArrayList<AccountSuggestion> r =
|
||||
new ArrayList<>(result.size());
|
||||
@@ -52,10 +54,12 @@ public class AccountSuggestOracle extends SuggestAfterTypingNCharsOracle {
|
||||
info = k;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayString() {
|
||||
return FormatUtil.nameEmail(FormatUtil.asInfo(info));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReplacementString() {
|
||||
return FormatUtil.nameEmail(FormatUtil.asInfo(info));
|
||||
}
|
||||
|
||||
@@ -257,6 +257,7 @@ public class CommentPanel extends Composite implements HasDoubleClickHandlers,
|
||||
|
||||
private static class DoubleClickHTML extends HTML implements
|
||||
HasDoubleClickHandlers {
|
||||
@Override
|
||||
public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler) {
|
||||
return addDomHandler(handler, DoubleClickEvent.getType());
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public class ExpandAllCommand implements Command {
|
||||
open = isOpen;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
for (final Widget w : panel) {
|
||||
if (w instanceof CommentPanel) {
|
||||
|
||||
@@ -43,6 +43,7 @@ public class HintTextBox extends NpTextBox {
|
||||
private boolean isFocused;
|
||||
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
if (hintOn) {
|
||||
return "";
|
||||
@@ -50,6 +51,7 @@ public class HintTextBox extends NpTextBox {
|
||||
return super.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setText(String text) {
|
||||
focusHint();
|
||||
|
||||
@@ -196,6 +198,7 @@ public class HintTextBox extends NpTextBox {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocus(boolean focus) {
|
||||
super.setFocus(focus);
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ public class LinkMenuBar extends Composite implements ScreenLoadHandler {
|
||||
return body.getWidgetIndex(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScreenLoad(ScreenLoadEvent event) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ public class LinkMenuItem extends InlineHyperlink implements ScreenLoadHandler {
|
||||
this.bar = bar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScreenLoad(ScreenLoadEvent event) {
|
||||
if (match(event.getScreen().getToken())) {
|
||||
Gerrit.selectMenu(bar);
|
||||
|
||||
@@ -22,6 +22,7 @@ public class ListenableOldValue<T> extends ListenableValue<T> {
|
||||
return oldValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(final T value) {
|
||||
try {
|
||||
oldValue = get();
|
||||
|
||||
@@ -37,10 +37,12 @@ public class ListenableValue<T> implements HasValueChangeHandlers<T> {
|
||||
fireEvent(new ValueChangeEvent<T>(value) {});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireEvent(GwtEvent<?> event) {
|
||||
manager.fireEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerRegistration addValueChangeHandler(
|
||||
ValueChangeHandler<T> handler) {
|
||||
return manager.addHandler(ValueChangeEvent.getType(), handler);
|
||||
|
||||
@@ -139,12 +139,23 @@ public abstract class NavigationTable<RowItem> extends FancyFlexTable<RowItem> {
|
||||
}
|
||||
}
|
||||
|
||||
/** Invoked when the user double clicks on a table cell. */
|
||||
/**
|
||||
* Invoked when the user double clicks on a table cell.
|
||||
*
|
||||
* @param row row number.
|
||||
* @param column column number.
|
||||
*/
|
||||
protected void onCellDoubleClick(int row, int column) {
|
||||
onOpenRow(row);
|
||||
}
|
||||
|
||||
/** Invoked when the user clicks on a table cell. */
|
||||
/**
|
||||
* Invoked when the user clicks on a table cell.
|
||||
*
|
||||
* @param event click event.
|
||||
* @param row row number.
|
||||
* @param column column number.
|
||||
*/
|
||||
protected void onCellSingleClick(Event event, int row, int column) {
|
||||
movePointerTo(row);
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ public class ParentProjectBox extends Composite {
|
||||
@Override
|
||||
public void _onRequestSuggestions(Request req, final Callback callback) {
|
||||
super._onRequestSuggestions(req, new Callback() {
|
||||
@Override
|
||||
public void onSuggestionsReady(Request request, Response response) {
|
||||
if (exclude.size() > 0) {
|
||||
Set<Suggestion> filteredSuggestions =
|
||||
|
||||
@@ -88,9 +88,19 @@ public class ProjectListPopup implements FilteredUserInterface {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked after moving pointer to a project.
|
||||
*
|
||||
* @param projectName project name.
|
||||
*/
|
||||
protected void onMovePointerTo(String projectName) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked after opening a project row.
|
||||
*
|
||||
* @param projectName project name.
|
||||
*/
|
||||
protected void openRow(String projectName) {
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ public class RPCSuggestOracle extends SuggestOracle {
|
||||
private SuggestOracle.Request request;
|
||||
private SuggestOracle.Callback callback;
|
||||
private SuggestOracle.Callback myCallback = new SuggestOracle.Callback() {
|
||||
@Override
|
||||
public void onSuggestionsReady(SuggestOracle.Request req,
|
||||
SuggestOracle.Response response) {
|
||||
if (request == req) {
|
||||
@@ -43,6 +44,7 @@ public class RPCSuggestOracle extends SuggestOracle {
|
||||
oracle = ora;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestSuggestions(SuggestOracle.Request req,
|
||||
SuggestOracle.Callback cb) {
|
||||
request = req;
|
||||
@@ -50,6 +52,7 @@ public class RPCSuggestOracle extends SuggestOracle {
|
||||
oracle.requestSuggestions(req, myCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDisplayStringHTML() {
|
||||
return oracle.isDisplayStringHTML();
|
||||
}
|
||||
|
||||
@@ -34,9 +34,11 @@ public class ReviewerSuggestOracle extends SuggestAfterTypingNCharsOracle {
|
||||
@Override
|
||||
protected void _onRequestSuggestions(final Request req, final Callback callback) {
|
||||
RpcStatus.hide(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SuggestUtil.SVC.suggestChangeReviewer(changeId, req.getQuery(),
|
||||
req.getLimit(), new GerritCallback<List<ReviewerInfo>>() {
|
||||
@Override
|
||||
public void onSuccess(final List<ReviewerInfo> result) {
|
||||
final List<ReviewerSuggestion> r =
|
||||
new ArrayList<>(result.size());
|
||||
@@ -61,6 +63,7 @@ public class ReviewerSuggestOracle extends SuggestAfterTypingNCharsOracle {
|
||||
this.reviewerInfo = reviewerInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayString() {
|
||||
final AccountInfo accountInfo = reviewerInfo.getAccountInfo();
|
||||
if (accountInfo != null) {
|
||||
@@ -70,6 +73,7 @@ public class ReviewerSuggestOracle extends SuggestAfterTypingNCharsOracle {
|
||||
+ Util.C.suggestedGroupLabel() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReplacementString() {
|
||||
final AccountInfo accountInfo = reviewerInfo.getAccountInfo();
|
||||
if (accountInfo != null) {
|
||||
|
||||
Reference in New Issue
Block a user