use of org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole in project che by eclipse.
the class AddToIndexPresenter method onAddClicked.
/** {@inheritDoc} */
@Override
public void onAddClicked() {
DevMachine devMachine = appContext.getDevMachine();
Resource[] resources = appContext.getResources();
Path projectLocation = appContext.getRootProject().getLocation();
Path[] paths = new Path[resources.length];
for (int i = 0; i < resources.length; i++) {
Path path = resources[i].getLocation().removeFirstSegments(projectLocation.segmentCount());
paths[i] = path.segmentCount() == 0 ? Path.EMPTY : path;
}
final GitOutputConsole console = gitOutputConsoleFactory.create(constant.addToIndexCommandName());
consolesPanelPresenter.addCommandOutput(devMachine.getId(), console);
service.add(devMachine, projectLocation, view.isUpdated(), paths).then(new Operation<Void>() {
@Override
public void apply(Void arg) throws OperationException {
console.print(constant.addSuccess());
notificationManager.notify(constant.addSuccess());
view.close();
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError arg) throws OperationException {
console.printError(constant.addFailed());
notificationManager.notify(constant.addFailed(), FAIL, FLOAT_MODE);
view.close();
}
});
}
use of org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole in project che by eclipse.
the class BranchPresenter method handleError.
/**
* Handler some action whether some exception happened.
*
* @param exception
* exception what happened
* @param commandName
* name of the executed command
*/
void handleError(@NotNull Throwable exception, String commandName) {
if (getErrorCode(exception) == ErrorCodes.UNABLE_GET_PRIVATE_SSH_KEY) {
dialogFactory.createMessageDialog(commandName, constant.messagesUnableGetSshKey(), null).show();
return;
}
String errorMessage = exception.getMessage();
if (errorMessage == null) {
switch(commandName) {
case BRANCH_CREATE_COMMAND_NAME:
errorMessage = constant.branchCreateFailed();
break;
case BRANCH_DELETE_COMMAND_NAME:
errorMessage = constant.branchDeleteFailed();
break;
case BRANCH_LIST_COMMAND_NAME:
errorMessage = constant.branchesListFailed();
break;
case BRANCH_RENAME_COMMAND_NAME:
errorMessage = constant.branchRenameFailed();
break;
case BRANCH_CHECKOUT_COMMAND_NAME:
errorMessage = constant.branchCheckoutFailed();
break;
}
}
GitOutputConsole console = gitOutputConsoleFactory.create(commandName);
printGitMessage(errorMessage, console);
consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notificationManager.notify(errorMessage, FAIL, FLOAT_MODE);
}
use of org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole in project che by eclipse.
the class CommitPresenter method handleError.
private void handleError(@NotNull Throwable exception) {
if (exception instanceof ServerException && ((ServerException) exception).getErrorCode() == ErrorCodes.NO_COMMITTER_NAME_OR_EMAIL_DEFINED) {
dialogFactory.createMessageDialog(constant.commitTitle(), constant.committerIdentityInfoEmpty(), null).show();
return;
}
String exceptionMessage = exception.getMessage();
String errorMessage = (exceptionMessage != null && !exceptionMessage.isEmpty()) ? exceptionMessage : constant.commitFailed();
GitOutputConsole console = gitOutputConsoleFactory.create(COMMIT_COMMAND_NAME);
console.printError(errorMessage);
consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notificationManager.notify(constant.commitFailed(), errorMessage, FAIL, FLOAT_MODE);
}
use of org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole in project che by eclipse.
the class PushToRemotePresenter method onPushClicked.
/** {@inheritDoc} */
@Override
public void onPushClicked() {
final StatusNotification notification = notificationManager.notify(constant.pushProcess(), PROGRESS, FLOAT_MODE);
final String repository = view.getRepository();
final GitOutputConsole console = gitOutputConsoleFactory.create(PUSH_COMMAND_NAME);
service.push(appContext.getDevMachine(), project.getLocation(), getRefs(), repository, false).then(new Operation<PushResponse>() {
@Override
public void apply(PushResponse response) throws OperationException {
console.print(response.getCommandOutput());
processesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notification.setStatus(SUCCESS);
if (response.getCommandOutput().contains("Everything up-to-date")) {
notification.setTitle(constant.pushUpToDate());
} else {
notification.setTitle(constant.pushSuccess(repository));
}
}
}).catchError(new Operation<PromiseError>() {
@Override
public void apply(PromiseError error) throws OperationException {
handleError(error.getCause(), 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 RemotePresenter method handleError.
private void handleError(@NotNull String errorMessage) {
GitOutputConsole console = gitOutputConsoleFactory.create(REMOTE_REPO_COMMAND_NAME);
console.printError(errorMessage);
consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console);
notificationManager.notify(errorMessage);
}
Aggregations