From 2dd77ecf210dc22af938283f85af53d26158c4e9 Mon Sep 17 00:00:00 2001 From: Igor Vinokur Date: Wed, 2 Mar 2016 14:54:04 +0200 Subject: [PATCH] CHE-414: Display staged changes in green when status called --- .../impl/nativegit/NativeGitConnection.java | 44 ++++++--- .../org/eclipse/che/ide/api/theme/Style.java | 12 +++ .../org/eclipse/che/ide/api/theme/Theme.java | 8 ++ .../org/eclipse/che/ide/theme/DarkTheme.java | 15 +++ .../org/eclipse/che/ide/theme/LightTheme.java | 15 +++ .../org/eclipse/che/api/core/ErrorCodes.java | 1 + .../eclipse/che/api/git/shared/Status.java | 57 +++++++---- .../git/client/add/AddToIndexPresenter.java | 4 +- .../git/client/branch/BranchPresenter.java | 2 - .../git/client/commit/CommitPresenter.java | 2 +- .../delete/DeleteRepositoryPresenter.java | 2 +- .../ext/git/client/fetch/FetchPresenter.java | 2 +- .../client/init/InitRepositoryPresenter.java | 2 +- .../ext/git/client/merge/MergePresenter.java | 2 +- .../outputconsole/GitOutputConsole.java | 22 ++--- .../GitOutputConsolePresenter.java | 43 ++++----- .../outputconsole/GitOutputPartView.java | 15 +-- .../outputconsole/GitOutputPartViewImpl.java | 39 +------- .../ext/git/client/pull/PullPresenter.java | 95 +++++++++---------- .../client/push/PushToRemotePresenter.java | 2 +- .../remove/RemoveFromIndexPresenter.java | 2 +- .../reset/commit/ResetToCommitPresenter.java | 2 +- .../reset/files/ResetFilesPresenter.java | 4 +- .../client/status/StatusCommandPresenter.java | 39 ++++---- .../client/add/AddToIndexPresenterTest.java | 4 +- .../client/commit/CommitPresenterTest.java | 2 +- .../delete/DeleteRepositoryPresenterTest.java | 2 +- .../git/client/fetch/FetchPresenterTest.java | 2 +- .../init/InitRepositoryPresenterTest.java | 2 +- .../git/client/merge/MergePresenterTest.java | 2 +- .../git/client/pull/PullPresenterTest.java | 8 +- .../push/PushToRemotePresenterTest.java | 4 +- .../remove/RemoveFromIndexPresenterTest.java | 2 +- .../commit/ResetToCommitPresenterTest.java | 4 +- .../reset/files/ResetFilesPresenterTest.java | 4 +- 35 files changed, 255 insertions(+), 212 deletions(-) diff --git a/core/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnection.java b/core/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnection.java index c261fae0ea..6e886b5954 100644 --- a/core/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnection.java +++ b/core/che-core-git-impl-native/src/main/java/org/eclipse/che/git/impl/nativegit/NativeGitConnection.java @@ -88,8 +88,6 @@ import org.eclipse.che.git.impl.nativegit.ssh.GitSshScriptProvider; import java.io.File; import java.net.URISyntaxException; -import java.util.ArrayList; -import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.regex.Pattern; @@ -104,14 +102,19 @@ import static org.eclipse.che.api.git.shared.ProviderInfo.PROVIDER_NAME; */ public class NativeGitConnection implements GitConnection { - private static final Pattern authErrorPattern = - Pattern.compile( - ".*fatal: could not read (Username|Password) for '.*': No such device or address.*|" + - ".*fatal: could not read (Username|Password) for '.*': Input/output error.*|" + - ".*fatal: Authentication failed for '.*'.*|.*fatal: Could not read from remote repository\\.\\n\\nPlease make sure " + - "you have the correct access rights\\nand the repository exists\\.\\n.*", - Pattern.MULTILINE); - private static final Pattern notInGitRepoErrorPattern = Pattern.compile("^fatal: Not a git repository.*(\\n.*)*$", Pattern.MULTILINE); + private static final Pattern authErrorPattern = + Pattern.compile( + ".*fatal: could not read (Username|Password) for '.*': No such device or address.*|" + + ".*fatal: could not read (Username|Password) for '.*': Input/output error.*|" + + ".*fatal: Authentication failed for '.*'.*|.*fatal: Could not read from remote repository\\.\\n\\nPlease make sure " + + "you have the correct access rights\\nand the repository exists\\.\\n.*", + Pattern.MULTILINE); + private static final Pattern notInGitRepoErrorPattern = + Pattern.compile("^fatal: Not a git repository.*(\\n.*)*$", Pattern.MULTILINE); + private static final Pattern noInitCommitWhenBranchCreateErrorPattern = Pattern.compile("fatal: Not a valid object name: '.*'.\n"); + private static final Pattern noInitCommitWhenLogErrorPattern = + Pattern.compile("fatal: your current branch '.*' does not have any commits yet\n"); + private static final Pattern noInitCommitWhenPullErrorPattern = Pattern.compile("fatal: empty ident name .* not allowed\n"); private final NativeGit nativeGit; private final CredentialsLoader credentialsLoader; private final GitUserResolver userResolver; @@ -180,8 +183,7 @@ public class NativeGitConnection implements GitConnection { try { branchCreateCommand.execute(); } catch (ServerException exception) { - Pattern errorPattern = Pattern.compile("fatal: Not a valid object name: '.*'.\n"); - if (errorPattern.matcher(exception.getMessage()).find()) { + if (noInitCommitWhenBranchCreateErrorPattern.matcher(exception.getMessage()).find()) { throw new GitException(exception.getMessage(), ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED); } } @@ -373,8 +375,7 @@ public class NativeGitConnection implements GitConnection { try { return new LogPage(nativeGit.createLogCommand().setFileFilter(request.getFileFilter()).execute()); } catch (ServerException exception) { - Pattern errorPattern = Pattern.compile("fatal: your current branch '.*' does not have any commits yet\n"); - if (errorPattern.matcher(exception.getMessage()).find()) { + if (noInitCommitWhenLogErrorPattern.matcher(exception.getMessage()).find()) { throw new GitException(exception.getMessage(), ErrorCodes.INIT_COMMIT_WAS_NOT_PERFORMED); } else { throw exception; @@ -422,7 +423,20 @@ public class NativeGitConnection implements GitConnection { .setRemoteUri(remoteUri) .setTimeout(request.getTimeout()); - executeRemoteCommand(pullCommand); + try { + executeRemoteCommand(pullCommand); + } catch (GitException exception) { + if (noInitCommitWhenPullErrorPattern.matcher(exception.getMessage()).find()) { + throw new GitException(exception.getMessage(), ErrorCodes.NO_COMMITTER_NAME_OR_EMAIL_DEFINED); + } else if ("Unable get private ssh key".equals(exception.getMessage())) { + throw new GitException(exception.getMessage(), ErrorCodes.UNABLE_GET_PRIVATE_SSH_KEY); + } else if (("Auto-merging file\nCONFLICT (content): Merge conflict in file\n" + + "Automatic merge failed; fix conflicts and then commit the result.\n").equals(exception.getMessage())) { + throw new GitException(exception.getMessage(), ErrorCodes.MERGE_CONFLICT); + } else { + throw exception; + } + } return pullCommand.getPullResponse(); } diff --git a/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/theme/Style.java b/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/theme/Style.java index 9d02271887..1ae34b583f 100644 --- a/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/theme/Style.java +++ b/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/theme/Style.java @@ -564,4 +564,16 @@ public class Style { return theme.getListBoxDropdownBackgroundColor(); } + public static String getGitConsoleStagedFilesColor() { + return theme.gitConsoleStagedFilesColor(); + } + + public static String getGitConsoleUnstagedFilesColor() { + return theme.gitConsoleUnstagedFilesColor(); + } + + public static String getGitConsoleErrorColor() { + return theme.gitConsoleErrorColor(); + } + } diff --git a/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/theme/Theme.java b/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/theme/Theme.java index 27b332a989..4528e4e5c6 100644 --- a/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/theme/Theme.java +++ b/core/ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/theme/Theme.java @@ -1457,4 +1457,12 @@ public interface Theme { String toolButtonHoverBoxShadow(); String toolButtonActiveBoxShadow(); + /******************************************************************************************** + * + * Git output console + * + ********************************************************************************************/ + String gitConsoleStagedFilesColor(); + String gitConsoleUnstagedFilesColor(); + String gitConsoleErrorColor(); } diff --git a/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/theme/DarkTheme.java b/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/theme/DarkTheme.java index 52c08fa60a..f089a464b9 100644 --- a/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/theme/DarkTheme.java +++ b/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/theme/DarkTheme.java @@ -1439,4 +1439,19 @@ public class DarkTheme implements Theme { public String toolButtonActiveBoxShadow() { return "inset 1px 1px 0 0 #3c3c3c"; } + + @Override + public String gitConsoleStagedFilesColor() { + return "lightgreen"; + } + + @Override + public String gitConsoleUnstagedFilesColor() { + return "#F62217"; + } + + @Override + public String gitConsoleErrorColor() { + return "#F62217"; + } } diff --git a/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/theme/LightTheme.java b/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/theme/LightTheme.java index 3ebcc212b8..1077c60f70 100644 --- a/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/theme/LightTheme.java +++ b/core/ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/theme/LightTheme.java @@ -1416,4 +1416,19 @@ public class LightTheme implements Theme { public String toolButtonActiveBoxShadow() { return "inset 1px 1px 0 0 #6F6E6E"; } + + @Override + public String gitConsoleStagedFilesColor() { + return "green"; + } + + @Override + public String gitConsoleUnstagedFilesColor() { + return "red"; + } + + @Override + public String gitConsoleErrorColor() { + return "red"; + } } diff --git a/core/platform-api/che-core-api-core/src/main/java/org/eclipse/che/api/core/ErrorCodes.java b/core/platform-api/che-core-api-core/src/main/java/org/eclipse/che/api/core/ErrorCodes.java index 0267dda372..e654b256e7 100644 --- a/core/platform-api/che-core-api-core/src/main/java/org/eclipse/che/api/core/ErrorCodes.java +++ b/core/platform-api/che-core-api-core/src/main/java/org/eclipse/che/api/core/ErrorCodes.java @@ -22,6 +22,7 @@ public class ErrorCodes { public static final int NO_COMMITTER_NAME_OR_EMAIL_DEFINED = 15216; public static final int UNABLE_GET_PRIVATE_SSH_KEY = 32068; public static final int UNAUTHORIZED_GIT_OPERATION = 32080; + public static final int MERGE_CONFLICT = 32062; public static final int FAILED_CHECKOUT = 32063; public static final int FAILED_CHECKOUT_WITH_START_POINT = 32064; public static final int INIT_COMMIT_WAS_NOT_PERFORMED = 32082; diff --git a/core/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/shared/Status.java b/core/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/shared/Status.java index a281169753..34a91c02e0 100644 --- a/core/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/shared/Status.java +++ b/core/platform-api/che-core-api-git/src/main/java/org/eclipse/che/api/git/shared/Status.java @@ -29,34 +29,59 @@ public interface Status { void setBranchName(String branchName); + /** + * New files that are staged in index. + */ List getAdded(); void setAdded(List added); - List getChanged(); - - void setChanged(List changed); - - List getRemoved(); - - void setRemoved(List removed); - - List getMissing(); - - void setMissing(List missing); - - List getModified(); - - void setModified(List modified); - + /** + * New files that are not staged in index. + */ List getUntracked(); void setUntracked(List untracked); + /** + * Modified files that are staged in index. + */ + List getChanged(); + + void setChanged(List changed); + + /** + * Modified files that are not staged in index. + */ + List getModified(); + + void setModified(List modified); + + /** + * Deleted files that are staged in index. + */ + List getRemoved(); + + void setRemoved(List removed); + + /** + * Deleted files that are not staged in index. + */ + List getMissing(); + + void setMissing(List missing); + + /** + * Folders that contain only untracked files. + * @see #getUntracked() + */ List getUntrackedFolders(); void setUntrackedFolders(List untrackedFolders); + /** + * Files that have conflicts. + */ List getConflicting(); void setConflicting(List added); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/add/AddToIndexPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/add/AddToIndexPresenter.java index d829ed693c..1f09cf996c 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/add/AddToIndexPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/add/AddToIndexPresenter.java @@ -115,7 +115,7 @@ public class AddToIndexPresenter implements AddToIndexView.ActionDelegate { if (!result.isClean()) { addSelection(); } else { - console.printInfo(constant.nothingAddToIndex()); + console.print(constant.nothingAddToIndex()); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notificationManager.notify(constant.nothingAddToIndex(), project.getRootProject()); } @@ -181,7 +181,7 @@ public class AddToIndexPresenter implements AddToIndexView.ActionDelegate { @Override protected void onSuccess(final Void result) { - console.printInfo(constant.addSuccess()); + console.print(constant.addSuccess()); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notificationManager.notify(constant.addSuccess(), project.getRootProject()); } diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/branch/BranchPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/branch/BranchPresenter.java index 84e2315059..c68d356252 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/branch/BranchPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/branch/BranchPresenter.java @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.che.ide.ext.git.client.branch; -import com.google.gwt.json.client.JSONObject; -import com.google.gwt.json.client.JSONParser; import com.google.inject.Inject; import com.google.inject.Singleton; import com.google.web.bindery.event.shared.EventBus; diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/commit/CommitPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/commit/CommitPresenter.java index 83d4d72e3e..524e3eab2d 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/commit/CommitPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/commit/CommitPresenter.java @@ -231,7 +231,7 @@ public class CommitPresenter implements CommitView.ActionDelegate { message += " " + constant.commitUser(revision.getCommitter().getName()); } GitOutputConsole console = gitOutputConsoleFactory.create(COMMIT_COMMAND_NAME); - console.printInfo(message); + console.print(message); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notificationManager.notify(message, appContext.getCurrentProject().getRootProject()); view.setMessage(""); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/delete/DeleteRepositoryPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/delete/DeleteRepositoryPresenter.java index cf24047cd4..e4d90a617f 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/delete/DeleteRepositoryPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/delete/DeleteRepositoryPresenter.java @@ -88,7 +88,7 @@ public class DeleteRepositoryPresenter { service.deleteRepository(workspaceId, project.getRootProject(), new AsyncRequestCallback() { @Override protected void onSuccess(Void result) { - console.printInfo(constant.deleteGitRepositorySuccess()); + console.print(constant.deleteGitRepositorySuccess()); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notificationManager.notify(constant.deleteGitRepositorySuccess(), project.getRootProject()); getRootProject(project.getRootProject()); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/fetch/FetchPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/fetch/FetchPresenter.java index c6cf106cd1..b95fd6ae21 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/fetch/FetchPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/fetch/FetchPresenter.java @@ -178,7 +178,7 @@ public class FetchPresenter implements FetchView.ActionDelegate { new RequestCallback() { @Override protected void onSuccess(String result) { - console.printInfo(constant.fetchSuccess(remoteUrl)); + console.print(constant.fetchSuccess(remoteUrl)); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notification.setStatus(SUCCESS); notification.setTitle(constant.fetchSuccess(remoteUrl)); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/init/InitRepositoryPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/init/InitRepositoryPresenter.java index 2c74cf9f9f..572f78f213 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/init/InitRepositoryPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/init/InitRepositoryPresenter.java @@ -92,7 +92,7 @@ public class InitRepositoryPresenter { @Override public void onSuccess(Void result) { - console.printInfo(constant.initSuccess()); + console.print(constant.initSuccess()); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notificationManager.notify(constant.initSuccess(), currentProject.getRootProject()); getRootProject(currentProject.getRootProject()); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/merge/MergePresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/merge/MergePresenter.java index f0c9d3463d..f8af44e206 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/merge/MergePresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/merge/MergePresenter.java @@ -179,7 +179,7 @@ public class MergePresenter implements MergeView.ActionDelegate { new AsyncRequestCallback(dtoUnmarshallerFactory.newUnmarshaller(MergeResult.class)) { @Override protected void onSuccess(final MergeResult result) { - console.printInfo(formMergeMessage(result)); + console.print(formMergeMessage(result)); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notificationManager.notify(formMergeMessage(result), appContext.getCurrentProject().getRootProject()); refreshProject(openedEditors); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputConsole.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputConsole.java index 7667f616ae..af2e395f35 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputConsole.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputConsole.java @@ -21,9 +21,8 @@ import javax.validation.constraints.NotNull; * @author Roman Nikitenko */ public interface GitOutputConsole extends OutputConsole { - /** - * Print text on console. + * Print text in console. * * @param text * text that need to be shown @@ -31,25 +30,22 @@ public interface GitOutputConsole extends OutputConsole { void print(@NotNull String text); /** - * [INFO] text + * Print colored text in console. * * @param text + * text that need to be shown + * @param color + * color of printed text */ - void printInfo(String text); + void print(@NotNull String text, @NotNull String color); /** - * [ERROR] text + * Print error in console. * * @param text + * text that need to be shown as error */ - void printError(String text); - - /** - * [WARNING] text - * - * @param text - */ - void printWarn(String text); + void printError(@NotNull String text); /** Clear console. Remove all messages. */ void clear(); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputConsolePresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputConsolePresenter.java index 4344105a30..01dfe1f33e 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputConsolePresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputConsolePresenter.java @@ -15,6 +15,7 @@ import com.google.inject.Inject; import com.google.inject.assistedinject.Assisted; import org.eclipse.che.ide.api.app.AppContext; +import org.eclipse.che.ide.api.theme.Style; import org.eclipse.che.ide.ext.git.client.GitLocalizationConstant; import org.eclipse.che.ide.ext.git.client.GitResources; import org.vectomatic.dom.svg.ui.SVGResource; @@ -77,6 +78,21 @@ public class GitOutputConsolePresenter implements GitOutputPartView.ActionDelega } } + @Override + public void print(String text, String color) { + view.print(text, color); + view.scrollBottom(); + + for (ConsoleOutputListener outputListener : outputListeners) { + outputListener.onConsoleOutput(this); + } + } + + @Override + public void printError(String text) { + print(text, Style.getGitConsoleErrorColor()); + } + /** {@inheritDoc} */ public void clear() { view.clear(); @@ -93,33 +109,6 @@ public class GitOutputConsolePresenter implements GitOutputPartView.ActionDelega view.scrollBottom(); } - public void printInfo(String text) { - view.printInfo(text); - view.scrollBottom(); - - for (ConsoleOutputListener outputListener : outputListeners) { - outputListener.onConsoleOutput(this); - } - } - - public void printWarn(String text) { - view.printWarn(text); - view.scrollBottom(); - - for (ConsoleOutputListener outputListener : outputListeners) { - outputListener.onConsoleOutput(this); - } - } - - public void printError(String text) { - view.printError(text); - view.scrollBottom(); - - for (ConsoleOutputListener outputListener : outputListeners) { - outputListener.onConsoleOutput(this); - } - } - @Override public String getTitle() { return title; diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputPartView.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputPartView.java index a1f99fc963..8f4fdffedf 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputPartView.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/outputconsole/GitOutputPartView.java @@ -37,14 +37,17 @@ public interface GitOutputPartView extends View { } - private static final String INFO_COLOR = "lightgreen"; - private static final String WARNING_COLOR = "cyan"; - private static final String ERROR_COLOR = "#F62217"; - private ActionDelegate delegate; @UiField @@ -89,25 +85,9 @@ public class GitOutputPartViewImpl extends Composite implements GitOutputPartVie String preStyle = " style='margin:0px; font-size: 12px;' "; HTML html = new HTML(); - - String TEXT = text.toUpperCase(); - if (TEXT.startsWith("[INFO]")) { - html.setHTML("[INFO] " + - SimpleHtmlSanitizer.sanitizeHtml(text.substring(6)).asString() + ""); - - } else if (TEXT.startsWith("[ERROR]")) { - html.setHTML("[ERROR] " + - SimpleHtmlSanitizer.sanitizeHtml(text.substring(7)).asString() + ""); - - } else if (TEXT.startsWith("[WARNING]")) { - html.setHTML("[WARNING] " + - SimpleHtmlSanitizer.sanitizeHtml(text.substring(9)).asString() + ""); - - } else { - html.setHTML("" + SimpleHtmlSanitizer.sanitizeHtml(text).asString() + ""); - } - + html.setHTML("" + SimpleHtmlSanitizer.sanitizeHtml(text).asString() + ""); html.getElement().setAttribute("style", "padding-left: 2px;"); + consoleArea.add(html); } @@ -123,21 +103,6 @@ public class GitOutputPartViewImpl extends Composite implements GitOutputPartVie consoleArea.add(html); } - @Override - public void printInfo(String text) { - print(text, INFO_COLOR); - } - - @Override - public void printWarn(String text) { - print(text, WARNING_COLOR); - } - - @Override - public void printError(String text) { - print(text, ERROR_COLOR); - } - /** {@inheritDoc} */ @Override public void clear() { diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/pull/PullPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/pull/PullPresenter.java index 1a2a0c568c..476564b30e 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/pull/PullPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/pull/PullPresenter.java @@ -14,7 +14,7 @@ import com.google.inject.Inject; import com.google.inject.Singleton; import com.google.web.bindery.event.shared.EventBus; -import org.eclipse.che.api.core.rest.shared.dto.ServiceError; +import org.eclipse.che.api.core.ErrorCodes; import org.eclipse.che.api.git.gwt.client.GitServiceClient; import org.eclipse.che.api.git.shared.Branch; import org.eclipse.che.api.git.shared.PullResponse; @@ -27,7 +27,6 @@ import org.eclipse.che.ide.api.event.FileContentUpdateEvent; import org.eclipse.che.ide.api.notification.NotificationManager; import org.eclipse.che.ide.api.notification.StatusNotification; import org.eclipse.che.ide.api.project.tree.VirtualFile; -import org.eclipse.che.ide.dto.DtoFactory; import org.eclipse.che.ide.ext.git.client.BranchSearcher; import org.eclipse.che.ide.ext.git.client.GitLocalizationConstant; import org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole; @@ -36,11 +35,13 @@ import org.eclipse.che.ide.extension.machine.client.processes.ConsolesPanelPrese import org.eclipse.che.ide.part.explorer.project.ProjectExplorerPresenter; import org.eclipse.che.ide.rest.AsyncRequestCallback; import org.eclipse.che.ide.rest.DtoUnmarshallerFactory; +import org.eclipse.che.ide.ui.dialogs.DialogFactory; import javax.validation.constraints.NotNull; import java.util.ArrayList; import java.util.List; +import static org.eclipse.che.ide.util.ExceptionUtils.getErrorCode; import static org.eclipse.che.api.git.shared.BranchListRequest.LIST_LOCAL; import static org.eclipse.che.api.git.shared.BranchListRequest.LIST_REMOTE; import static org.eclipse.che.ide.api.notification.StatusNotification.Status.FAIL; @@ -58,6 +59,8 @@ import static org.eclipse.che.ide.ext.git.client.compare.branchList.BranchListPr public class PullPresenter implements PullView.ActionDelegate { public static final String PULL_COMMAND_NAME = "Git pull"; + private static final String GREEN_COLOR = "lightgreen"; + private final PullView view; private final GitServiceClient gitServiceClient; private final EventBus eventBus; @@ -66,7 +69,7 @@ public class PullPresenter implements PullView.ActionDelegate { private final AppContext appContext; private final NotificationManager notificationManager; private final DtoUnmarshallerFactory dtoUnmarshallerFactory; - private final DtoFactory dtoFactory; + private final DialogFactory dialogFactory; private final BranchSearcher branchSearcher; private final ProjectExplorerPresenter projectExplorer; private final GitOutputConsoleFactory gitOutputConsoleFactory; @@ -84,13 +87,13 @@ public class PullPresenter implements PullView.ActionDelegate { GitLocalizationConstant constant, NotificationManager notificationManager, DtoUnmarshallerFactory dtoUnmarshallerFactory, - DtoFactory dtoFactory, + DialogFactory dialogFactory, BranchSearcher branchSearcher, ProjectExplorerPresenter projectExplorer, GitOutputConsoleFactory gitOutputConsoleFactory, ConsolesPanelPresenter consolesPanelPresenter) { this.view = view; - this.dtoFactory = dtoFactory; + this.dialogFactory = dialogFactory; this.branchSearcher = branchSearcher; this.projectExplorer = projectExplorer; this.gitOutputConsoleFactory = gitOutputConsoleFactory; @@ -131,13 +134,7 @@ public class PullPresenter implements PullView.ActionDelegate { @Override protected void onFailure(Throwable exception) { - String errorMessage = - exception.getMessage() != null ? exception.getMessage() - : constant.remoteListFailed(); - GitOutputConsole console = gitOutputConsoleFactory.create(REMOTE_REPO_COMMAND_NAME); - console.printError(errorMessage); - consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); - notificationManager.notify(constant.remoteListFailed(), FAIL, true, project.getRootProject()); + handleError(exception, REMOTE_REPO_COMMAND_NAME); view.setEnablePullButton(false); } } @@ -172,13 +169,7 @@ public class PullPresenter implements PullView.ActionDelegate { @Override protected void onFailure(Throwable exception) { - String errorMessage = - exception.getMessage() != null ? exception.getMessage() - : constant.branchesListFailed(); - GitOutputConsole console = gitOutputConsoleFactory.create(BRANCH_LIST_COMMAND_NAME); - console.printError(errorMessage); - consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); - notificationManager.notify(constant.branchesListFailed(), FAIL, true, project.getRootProject()); + handleError(exception, BRANCH_LIST_COMMAND_NAME); view.setEnablePullButton(false); } } @@ -199,30 +190,30 @@ public class PullPresenter implements PullView.ActionDelegate { final StatusNotification notification = notificationManager.notify(constant.pullProcess(), PROGRESS, true, project.getRootProject()); - final GitOutputConsole console = gitOutputConsoleFactory.create(PULL_COMMAND_NAME); gitServiceClient.pull(workspaceId, project.getRootProject(), getRefs(), remoteName, new AsyncRequestCallback(dtoUnmarshallerFactory.newUnmarshaller(PullResponse.class)) { @Override protected void onSuccess(PullResponse result) { - console.printInfo(result.getCommandOutput()); + GitOutputConsole console = gitOutputConsoleFactory.create(PULL_COMMAND_NAME); + console.print(result.getCommandOutput(), GREEN_COLOR); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notification.setStatus(SUCCESS); if (result.getCommandOutput().contains("Already up-to-date")) { notification.setTitle(constant.pullUpToDate()); } else { - refreshProject(openedEditors); + refreshProjectNodesAndEditors(openedEditors); notification.setTitle(constant.pullSuccess(remoteUrl)); } } @Override - protected void onFailure(Throwable throwable) { - if (throwable.getMessage().contains("Merge conflict")) { - refreshProject(openedEditors); + protected void onFailure(Throwable exception) { + notification.setStatus(FAIL); + if (getErrorCode(exception) == ErrorCodes.MERGE_CONFLICT) { + refreshProjectNodesAndEditors(openedEditors); } - handleError(throwable, remoteUrl, notification, console); - consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); + handleError(exception, PULL_COMMAND_NAME); } }); } @@ -233,7 +224,7 @@ public class PullPresenter implements PullView.ActionDelegate { * @param openedEditors * editors that corresponds to open files */ - private void refreshProject(final List openedEditors) { + private void refreshProjectNodesAndEditors(final List openedEditors) { projectExplorer.reloadChildren(); for (EditorPartPresenter partPresenter : openedEditors) { final VirtualFile file = partPresenter.getEditorInput().getFile(); @@ -255,32 +246,40 @@ public class PullPresenter implements PullView.ActionDelegate { /** * Handler some action whether some exception happened. * - * @param throwable - * exception what happened + * @param exception + * exception that happened + * @param commandName + * name of the command */ - private void handleError(@NotNull Throwable throwable, @NotNull String remoteUrl, StatusNotification notification, - GitOutputConsole console) { - String errorMessage = throwable.getMessage(); - notification.setStatus(FAIL); - if (errorMessage == null) { - console.printError(constant.pullFail(remoteUrl)); - notification.setTitle(constant.pullFail(remoteUrl)); + private void handleError(@NotNull Throwable exception, @NotNull String commandName) { + int errorCode = getErrorCode(exception); + if (errorCode == ErrorCodes.NO_COMMITTER_NAME_OR_EMAIL_DEFINED) { + dialogFactory.createMessageDialog(constant.pullTitle(), constant.committerIdentityInfoEmpty(), null).show(); + return; + } else if (errorCode == ErrorCodes.UNABLE_GET_PRIVATE_SSH_KEY) { + dialogFactory.createMessageDialog(constant.pullTitle(), constant.messagesUnableGetSshKey(), null).show(); return; } - try { - errorMessage = dtoFactory.createDtoFromJson(errorMessage, ServiceError.class).getMessage(); - if (errorMessage.equals("Unable get private ssh key")) { - console.printError(constant.messagesUnableGetSshKey()); - notification.setTitle(constant.messagesUnableGetSshKey()); - return; + String errorMessage = exception.getMessage(); + if (errorMessage == null) { + switch (commandName) { + case REMOTE_REPO_COMMAND_NAME: + errorMessage = constant.remoteListFailed(); + break; + case BRANCH_LIST_COMMAND_NAME: + errorMessage = constant.branchesListFailed(); + break; + case PULL_COMMAND_NAME: + errorMessage = constant.pullFail(view.getRepositoryUrl()); + break; } - console.printError(errorMessage); - notification.setTitle(errorMessage); - } catch (Exception e) { - console.printError(errorMessage); - notification.setTitle(errorMessage); } + + GitOutputConsole console = gitOutputConsoleFactory.create(commandName); + console.printError(errorMessage); + consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); + notificationManager.notify(errorMessage, FAIL, true, project.getRootProject()); } /** {@inheritDoc} */ diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/push/PushToRemotePresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/push/PushToRemotePresenter.java index 7e932493cb..c8a7501c4e 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/push/PushToRemotePresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/push/PushToRemotePresenter.java @@ -300,7 +300,7 @@ public class PushToRemotePresenter implements PushToRemoteView.ActionDelegate { new AsyncRequestCallback(dtoUnmarshallerFactory.newUnmarshaller(PushResponse.class)) { @Override protected void onSuccess(PushResponse result) { - console.printInfo(result.getCommandOutput()); + console.print(result.getCommandOutput()); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notification.setStatus(SUCCESS); if (result.getCommandOutput().contains("Everything up-to-date")) { diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/remove/RemoveFromIndexPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/remove/RemoveFromIndexPresenter.java index 7a71dd7895..a8fb2b7cb3 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/remove/RemoveFromIndexPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/remove/RemoveFromIndexPresenter.java @@ -160,7 +160,7 @@ public class RemoveFromIndexPresenter implements RemoveFromIndexView.ActionDeleg new AsyncRequestCallback() { @Override protected void onSuccess(String result) { - console.printInfo(constant.removeFilesSuccessfull()); + console.print(constant.removeFilesSuccessfull()); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notificationManager.notify(constant.removeFilesSuccessfull(), project.getRootProject()); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/reset/commit/ResetToCommitPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/reset/commit/ResetToCommitPresenter.java index d2966dcc59..1c41bdc2cd 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/reset/commit/ResetToCommitPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/reset/commit/ResetToCommitPresenter.java @@ -180,7 +180,7 @@ public class ResetToCommitPresenter implements ResetToCommitView.ActionDelegate //so we must repeat the logic which is performed when we open a project eventBus.fireEvent(new OpenProjectEvent(project)); } - console.printInfo(constant.resetSuccessfully()); + console.print(constant.resetSuccessfully()); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notificationManager.notify(constant.resetSuccessfully(), project); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/reset/files/ResetFilesPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/reset/files/ResetFilesPresenter.java index cb7cb03328..e3743a8223 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/reset/files/ResetFilesPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/reset/files/ResetFilesPresenter.java @@ -150,7 +150,7 @@ public class ResetFilesPresenter implements ResetFilesView.ActionDelegate { final GitOutputConsole console = gitOutputConsoleFactory.create(RESET_COMMAND_NAME); if (files.isEmpty()) { view.close(); - console.printInfo(constant.nothingToReset()); + console.print(constant.nothingToReset()); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notificationManager.notify(constant.nothingToReset(), project.getRootProject()); return; @@ -160,7 +160,7 @@ public class ResetFilesPresenter implements ResetFilesView.ActionDelegate { service.reset(workspaceId, project.getRootProject(), "HEAD", ResetType.MIXED, files, new AsyncRequestCallback() { @Override protected void onSuccess(Void result) { - console.printInfo(constant.resetFilesSuccessfully()); + console.print(constant.resetFilesSuccessfully()); consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); notificationManager.notify(constant.resetFilesSuccessfully(), project.getRootProject()); } diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/status/StatusCommandPresenter.java b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/status/StatusCommandPresenter.java index 3f95512925..f3b1dbfc8b 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/status/StatusCommandPresenter.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/status/StatusCommandPresenter.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.che.ide.ext.git.client.status; +import org.eclipse.che.ide.api.theme.Style; import org.eclipse.che.ide.ext.git.client.GitLocalizationConstant; import org.eclipse.che.api.git.gwt.client.GitServiceClient; import org.eclipse.che.ide.api.app.AppContext; @@ -24,6 +25,9 @@ import org.eclipse.che.ide.rest.StringUnmarshaller; import com.google.inject.Inject; import com.google.inject.Singleton; +import java.util.Arrays; +import java.util.List; + import static org.eclipse.che.api.git.shared.StatusFormat.LONG; import static org.eclipse.che.ide.api.notification.StatusNotification.Status.FAIL; @@ -72,9 +76,7 @@ public class StatusCommandPresenter { new AsyncRequestCallback(new StringUnmarshaller()) { @Override protected void onSuccess(String result) { - final GitOutputConsole console = gitOutputConsoleFactory.create(STATUS_COMMAND_NAME); - printGitStatus(result, console); - consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); + printGitStatus(result); } @Override @@ -89,27 +91,28 @@ public class StatusCommandPresenter { * * @param statusText * text to be printed - * @param console - * console for displaying status */ - private void printGitStatus(String statusText, GitOutputConsole console) { - + private void printGitStatus(String statusText) { + GitOutputConsole console = gitOutputConsoleFactory.create(STATUS_COMMAND_NAME); console.print(""); - String[] lines = statusText.split("\n"); - for (String line : lines) { - if (line.startsWith("\tmodified:") || line.startsWith("#\tmodified:")) { - console.printError(line); + List statusLines = Arrays.asList(statusText.split("\n")); + boolean containsStagedChanges = statusLines.contains("Changes to be committed:"); + boolean stagedChangesAlreadyPrinted = false; + for (String line : statusLines) { + if ((line.startsWith("\t") || line.startsWith("#\t")) && containsStagedChanges && !stagedChangesAlreadyPrinted) { + console.print(line, Style.getGitConsoleStagedFilesColor()); + if (statusLines.indexOf(line) == statusLines.size() - 1 || statusLines.get(statusLines.indexOf(line) + 1).equals("")) { + stagedChangesAlreadyPrinted = true; + } + continue; + } else if ((line.startsWith("\t") || line.startsWith("#\t"))) { + console.print(line, Style.getGitConsoleUnstagedFilesColor()); continue; } - - if (line.startsWith("\t") || line.startsWith("#\t")) { - console.printInfo(line); - continue; - } - console.print(line); } - } + consolesPanelPresenter.addCommandOutput(appContext.getDevMachineId(), console); + } } diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/add/AddToIndexPresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/add/AddToIndexPresenterTest.java index 2e38a80739..d0eec29b5e 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/add/AddToIndexPresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/add/AddToIndexPresenterTest.java @@ -119,7 +119,7 @@ public class AddToIndexPresenterTest extends BaseTest { onSuccess.invoke(callback, this.statusResponse); verify(gitOutputConsoleFactory).create(ADD_TO_INDEX_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(notificationManager).notify(anyString(), eq(rootProjectConfig)); verify(view, never()).showDialog(); @@ -281,7 +281,7 @@ public class AddToIndexPresenterTest extends BaseTest { verify(service).add(anyString(), eq(rootProjectConfig), eq(NEED_UPDATING), (List)anyObject(), (RequestCallback)anyObject()); verify(gitOutputConsoleFactory, times(2)).create(ADD_TO_INDEX_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(notificationManager).notify(anyString(), eq(rootProjectConfig)); verify(constant, times(2)).addSuccess(); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/commit/CommitPresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/commit/CommitPresenterTest.java index 9ab6f90b80..32d4d9ffe9 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/commit/CommitPresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/commit/CommitPresenterTest.java @@ -134,7 +134,7 @@ public class CommitPresenterTest extends BaseTest { verify(service).commit(anyString(), eq(rootProjectConfig), eq(COMMIT_TEXT), eq(ALL_FILE_INCLUDES), eq(IS_OVERWRITTEN), (AsyncRequestCallback)anyObject()); verify(gitOutputConsoleFactory).create(COMMIT_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(notificationManager).notify(anyString(), rootProjectConfig); } diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/delete/DeleteRepositoryPresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/delete/DeleteRepositoryPresenterTest.java index cdcaec56b7..71ca9dc242 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/delete/DeleteRepositoryPresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/delete/DeleteRepositoryPresenterTest.java @@ -82,7 +82,7 @@ public class DeleteRepositoryPresenterTest extends BaseTest { verify(appContext).getCurrentProject(); verify(service).deleteRepository(anyString(), eq(rootProjectConfig), (AsyncRequestCallback)anyObject()); verify(gitOutputConsoleFactory).create(DELETE_REPO_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(notificationManager).notify(anyString(), rootProjectConfig); } diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/fetch/FetchPresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/fetch/FetchPresenterTest.java index 5f63f5eb8d..7fce7ca084 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/fetch/FetchPresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/fetch/FetchPresenterTest.java @@ -228,7 +228,7 @@ public class FetchPresenterTest extends BaseTest { eq(NO_REMOVE_DELETE_REFS), (RequestCallback)anyObject()); verify(view).close(); verify(gitOutputConsoleFactory).create(FETCH_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(notificationManager).notify(anyString(), rootProjectConfig); verify(constant, times(2)).fetchSuccess(eq(REMOTE_URI)); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/init/InitRepositoryPresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/init/InitRepositoryPresenterTest.java index dd9c4e0062..31f1d32296 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/init/InitRepositoryPresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/init/InitRepositoryPresenterTest.java @@ -74,7 +74,7 @@ public class InitRepositoryPresenterTest extends BaseTest { verify(gitRepositoryInitializer).initGitRepository(eq(rootProjectConfig), (AsyncCallback)anyObject()); verify(gitOutputConsoleFactory).create(INIT_COMMAND_NAME); - verify(console).printInfo(eq(constant.initSuccess())); + verify(console).print(eq(constant.initSuccess())); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(notificationManager).notify(anyString(), rootProjectConfig); } diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/merge/MergePresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/merge/MergePresenterTest.java index c87283975f..ea8dfae285 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/merge/MergePresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/merge/MergePresenterTest.java @@ -184,7 +184,7 @@ public class MergePresenterTest extends BaseTest { verify(partPresenter).getEditorInput(); verify(file).getPath(); verify(gitOutputConsoleFactory).create(MERGE_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(notificationManager).notify(anyString(), rootProjectConfig); } diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/pull/PullPresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/pull/PullPresenterTest.java index ec431c47b8..adc57921b9 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/pull/PullPresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/pull/PullPresenterTest.java @@ -106,7 +106,7 @@ public class PullPresenterTest extends BaseTest { constant, notificationManager, dtoUnmarshallerFactory, - dtoFactory, + dialogFactory, branchSearcher, projectExplorer, gitOutputConsoleFactory, @@ -316,7 +316,7 @@ public class PullPresenterTest extends BaseTest { verify(editorAgent).getOpenedEditors(); verify(service).pull(anyObject(), eq(rootProjectConfig), anyString(), eq(REPOSITORY_NAME), (AsyncRequestCallback)anyObject()); verify(gitOutputConsoleFactory).create(PULL_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(constant).pullSuccess(anyString()); verify(notificationManager).notify(anyString(), rootProjectConfig); @@ -350,7 +350,7 @@ public class PullPresenterTest extends BaseTest { verify(editorAgent).getOpenedEditors(); verify(service).pull(anyObject(), eq(rootProjectConfig), anyString(), eq(REPOSITORY_NAME), (AsyncRequestCallback)anyObject()); verify(gitOutputConsoleFactory).create(PULL_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(constant).pullUpToDate(); verify(notificationManager).notify(anyString(), rootProjectConfig); @@ -438,7 +438,7 @@ public class PullPresenterTest extends BaseTest { verify(view).close(); verify(gitOutputConsoleFactory).create(PULL_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(notificationManager).notify(anyString(), rootProjectConfig); //check Refresh project is not called diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/push/PushToRemotePresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/push/PushToRemotePresenterTest.java index b471a756c0..e3b621c83c 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/push/PushToRemotePresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/push/PushToRemotePresenterTest.java @@ -321,7 +321,7 @@ public class PushToRemotePresenterTest extends BaseTest { (AsyncRequestCallback)anyObject()); verify(view).close(); verify(gitOutputConsoleFactory).create(PUSH_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(constant).pushSuccess(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(notificationManager).notify(anyString(), rootProjectConfig); @@ -344,7 +344,7 @@ public class PushToRemotePresenterTest extends BaseTest { (AsyncRequestCallback)anyObject()); verify(view).close(); verify(gitOutputConsoleFactory).create(PUSH_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(constant).pushUpToDate(); verify(notificationManager).notify(anyString(), rootProjectConfig); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/remove/RemoveFromIndexPresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/remove/RemoveFromIndexPresenterTest.java index 847b3d09db..241650e836 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/remove/RemoveFromIndexPresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/remove/RemoveFromIndexPresenterTest.java @@ -165,7 +165,7 @@ public class RemoveFromIndexPresenterTest extends BaseTest { verify(service).remove(anyString(), eq(rootProjectConfig), anyObject(), eq(REMOVED), anyObject()); verify(notificationManager).notify(anyString(), rootProjectConfig); verify(gitOutputConsoleFactory).create(REMOVE_FROM_INDEX_COMMAND_NAME); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(consolesPanelPresenter).addCommandOutput(anyString(), eq(console)); verify(constant, times(2)).removeFilesSuccessfull(); verify(view).close(); diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/reset/commit/ResetToCommitPresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/reset/commit/ResetToCommitPresenterTest.java index 9c01e32f4c..45e95e2929 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/reset/commit/ResetToCommitPresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/reset/commit/ResetToCommitPresenterTest.java @@ -180,7 +180,7 @@ public class ResetToCommitPresenterTest extends BaseTest { verify(service).reset(anyString(), anyObject(), eq(PROJECT_PATH), eq(HARD), (List)anyObject(), (AsyncRequestCallback)anyObject()); verify(eventBus).fireEvent(Matchers.>anyObject()); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(notificationManager).notify(anyString(), rootProjectConfig); } @@ -214,7 +214,7 @@ public class ResetToCommitPresenterTest extends BaseTest { verify(service).reset(anyString(), anyObject(), eq(PROJECT_PATH), eq(HARD), (List)anyObject(), (AsyncRequestCallback)anyObject()); verify(eventBus).fireEvent(Matchers.>anyObject()); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(notificationManager).notify(anyString(), rootProjectConfig); } diff --git a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/reset/files/ResetFilesPresenterTest.java b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/reset/files/ResetFilesPresenterTest.java index dcec4d701d..309496e719 100644 --- a/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/reset/files/ResetFilesPresenterTest.java +++ b/plugins/plugin-git/che-plugin-git-ext-git/src/test/java/org/eclipse/che/ide/ext/git/client/reset/files/ResetFilesPresenterTest.java @@ -184,7 +184,7 @@ public class ResetFilesPresenterTest extends BaseTest { verify(view).close(); verify(service, never()).reset(anyString(), eq(projectConfig), anyString(), (ResetRequest.ResetType)anyObject(), (List)anyObject(), (AsyncRequestCallback)anyObject()); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(notificationManager).notify(anyString(), rootProjectConfig); verify(constant, times(2)).nothingToReset(); } @@ -227,7 +227,7 @@ public class ResetFilesPresenterTest extends BaseTest { verify(service).reset(anyString(), eq(rootProjectConfig), anyString(), (ResetRequest.ResetType)anyObject(), (List)anyObject(), (AsyncRequestCallback)anyObject()); verify(notificationManager).notify(anyString(), rootProjectConfig); - verify(console).printInfo(anyString()); + verify(console).print(anyString()); verify(constant, times(2)).resetFilesSuccessfully(); }