globalDisplay_.showYesNoMessage(
GlobalDisplay.MSG_WARNING,
"Revert Changes",
"Changes to the selected " + noun + " will be lost, including " +
"staged changes.\n\nAre you sure you want to continue?",
new Operation()
{
@Override
public void execute()
{
view_.getChangelistTable().selectNextUnselectedItem();
server_.gitRevert(
paths,
new SimpleRequestCallback<Void>("Revert Changes"));
view_.getChangelistTable().focus();
}
},
false);
}
});
view_.getIgnoreButton().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event)
{
gitPresenterCore_.onVcsIgnore(
view_.getChangelistTable().getSelectedItems());
}
});
view_.getCommitIsAmend().addValueChangeHandler(new ValueChangeHandler<Boolean>()
{
@Override
public void onValueChange(ValueChangeEvent<Boolean> booleanValueChangeEvent)
{
server_.gitHistory("", null, 0, 1, null, new ServerRequestCallback<RpcObjectList<CommitInfo>>() {
@Override
public void onResponseReceived(RpcObjectList<CommitInfo> response)
{
if (response.length() == 1)
{
String description = response.get(0).getDescription();
if (view_.getCommitIsAmend().getValue())
{
if (view_.getCommitMessage().getText().length() == 0)
view_.getCommitMessage().setText(description);
}
else
{
if (view_.getCommitMessage().getText().equals(description))
view_.getCommitMessage().setText("");
}
}
}
@Override
public void onError(ServerError error)
{
Debug.logError(error);
}
});
}
});
view_.getStageAllButton().addClickHandler(
new ApplyPatchClickHandler(PatchMode.Stage, false));
view_.getDiscardAllButton().addClickHandler(new ClickHandler()
{
@Override
public void onClick(ClickEvent event)
{
String which = view_.getLineTableDisplay().getSelectedLines().size() == 0
? "All unstaged"
: "The selected";
globalDisplay.showYesNoMessage(
GlobalDisplay.MSG_WARNING,
"Discard All",
which + " changes in this file will be " +
"lost.\n\nAre you sure you want to continue?",
new Operation() {
@Override
public void execute() {
new ApplyPatchClickHandler(PatchMode.Working, true).execute();
}
},