Search in sources :

Example 21 with GitOutputConsole

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);
        }
    });
}
Also used : ConfirmCallback(org.eclipse.che.ide.api.dialogs.ConfirmCallback) ServerException(org.eclipse.che.ide.commons.exception.ServerException) PromiseError(org.eclipse.che.api.promises.client.PromiseError) GitOutputConsole(org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole) MergeResult(org.eclipse.che.api.git.shared.MergeResult) Operation(org.eclipse.che.api.promises.client.Operation) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 22 with GitOutputConsole

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("");
}
Also used : GitOutputConsole(org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole)

Aggregations

GitOutputConsole (org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole)22 Operation (org.eclipse.che.api.promises.client.Operation)13 OperationException (org.eclipse.che.api.promises.client.OperationException)13 PromiseError (org.eclipse.che.api.promises.client.PromiseError)13 List (java.util.List)5 Resource (org.eclipse.che.ide.api.resources.Resource)5 Path (org.eclipse.che.ide.resource.Path)4 Branch (org.eclipse.che.api.git.shared.Branch)3 DevMachine (org.eclipse.che.ide.api.machine.DevMachine)3 StatusNotification (org.eclipse.che.ide.api.notification.StatusNotification)3 Preconditions.checkState (com.google.common.base.Preconditions.checkState)2 Inject (com.google.inject.Inject)2 Singleton (com.google.inject.Singleton)2 Collections.singletonList (java.util.Collections.singletonList)2 IndexFile (org.eclipse.che.api.git.shared.IndexFile)2 FontAwesome (org.eclipse.che.ide.FontAwesome)2 ActionEvent (org.eclipse.che.ide.api.action.ActionEvent)2 AppContext (org.eclipse.che.ide.api.app.AppContext)2 GitServiceClient (org.eclipse.che.ide.api.git.GitServiceClient)2 NotificationManager (org.eclipse.che.ide.api.notification.NotificationManager)2