use of org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole in project che by eclipse.
the class FetchPresenter method onFetchClicked.
/** {@inheritDoc} */
@Override
public void onFetchClicked() {
final String remoteUrl = view.getRepositoryUrl();
final StatusNotification notification = notificationManager.notify(constant.fetchProcess(), PROGRESS, FLOAT_MODE);
final GitOutputConsole console = gitOutputConsoleFactory.create(FETCH_COMMAND_NAME);
service.fetch(appContext.getDevMachine(), project.getLocation(), view.getRepositoryName(), getRefs(), view.isRemoveDeletedRefs()).then(new Operation<Void>() {
@Override
public void apply(Void ignored) throws OperationException {
console.print(constant.fetchSuccess(remoteUrl));
processesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notification.setStatus(SUCCESS);
notification.setTitle(constant.fetchSuccess(remoteUrl));
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
handleError(error.getCause(), remoteUrl, notification, console);
processesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
}
});
view.close();
}
use of org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole in project che by eclipse.
the class AddToIndexAction method actionPerformed.
/** {@inheritDoc} */
@Override
public void actionPerformed(ActionEvent e) {
final Resource[] resources = appContext.getResources();
checkState(resources != null);
final DevMachine devMachine = appContext.getDevMachine();
final GitOutputConsole console = gitOutputConsoleFactory.create(constant.addToIndexCommandName());
consolesPanelPresenter.addCommandOutput(devMachine.getId(), console);
service.getStatus(devMachine, appContext.getRootProject().getLocation()).then(status -> {
if (containsInSelected(status.getUntracked())) {
presenter.showDialog();
} else if (containsInSelected(status.getModified()) || containsInSelected(status.getMissing())) {
addToIndex(console);
} else {
String message = resources.length > 1 ? constant.nothingAddToIndexMultiSelect() : constant.nothingAddToIndex();
console.print(message);
notificationManager.notify(message);
}
}).catchError(error -> {
console.printError(constant.statusFailed());
notificationManager.notify(constant.statusFailed(), FAIL, FLOAT_MODE);
});
}
use of org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole in project che by eclipse.
the class InitRepositoryPresenter method initRepository.
public void initRepository(final Project project) {
final GitOutputConsole console = gitOutputConsoleFactory.create(INIT_COMMAND_NAME);
service.init(appContext.getDevMachine(), project.getLocation(), false).then(new Operation<Void>() {
@Override
public void apply(Void ignored) throws OperationException {
console.print(constant.initSuccess());
consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notificationManager.notify(constant.initSuccess());
project.synchronize();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
handleError(error.getCause(), console);
consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
}
});
}
use of org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole in project che by eclipse.
the class MergePresenter method onMergeClicked.
/** {@inheritDoc} */
@Override
public void onMergeClicked() {
view.close();
final GitOutputConsole console = gitOutputConsoleFactory.create(MERGE_COMMAND_NAME);
service.merge(appContext.getDevMachine(), project.getLocation(), selectedReference.getDisplayName()).then(new Operation<MergeResult>() {
@Override
public void apply(MergeResult result) throws OperationException {
console.print(formMergeMessage(result));
consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notificationManager.notify(formMergeMessage(result));
project.synchronize();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
if (error.getCause() instanceof ServerException && ((ServerException) error.getCause()).getErrorCode() == ErrorCodes.NO_COMMITTER_NAME_OR_EMAIL_DEFINED) {
dialogFactory.createMessageDialog(constant.mergeTitle(), constant.committerIdentityInfoEmpty(), new ConfirmCallback() {
@Override
public void accepted() {
//do nothing
}
}).show();
return;
}
console.printError(error.getMessage());
consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notificationManager.notify(constant.mergeFailed(), FAIL, FLOAT_MODE);
}
});
}
use of org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole in project che by eclipse.
the class CommitPresenter method onCommitSuccess.
private void onCommitSuccess(@NotNull final Revision revision) {
String date = dateTimeFormatter.getFormattedDate(revision.getCommitTime());
String message = constant.commitMessage(revision.getId(), date);
if ((revision.getCommitter() != null && revision.getCommitter().getName() != null && !revision.getCommitter().getName().isEmpty())) {
message += " " + constant.commitUser(revision.getCommitter().getName());
}
GitOutputConsole console = gitOutputConsoleFactory.create(COMMIT_COMMAND_NAME);
console.print(message);
consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notificationManager.notify(message);
view.setMessage("");
}
Aggregations