From 25e23bd82a93dcccca5826268ed5959ae9d64678 Mon Sep 17 00:00:00 2001 From: "Nadya.Zabrodina" Date: Thu, 7 Feb 2013 19:23:18 +0400 Subject: [PATCH] Refactor error title if mercurial log command failed. *Add notification title to HgVcsMessages. --- .../resources/org/zmlx/hg4idea/HgVcsMessages.properties | 1 + .../hg4idea/provider/HgCachingCommitedChangesProvider.java | 4 ++-- .../src/org/zmlx/hg4idea/provider/HgHistoryProvider.java | 3 ++- .../zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties b/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties index 734d83ea79fd..6774e0ff1dd4 100644 --- a/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties +++ b/plugins/hg4idea/resources/org/zmlx/hg4idea/HgVcsMessages.properties @@ -113,6 +113,7 @@ hg4idea.warning.no-default-update-path=Skipped \"{0}\". No default update path. hg4idea.merge.please-commit=Merged heads, please commit repository \"{0}\" hg4idea.error.invalidExecutable=\"{0}\" is not a valid mercurial executable hg4idea.integrate.other.head=Other head: {0} +hg4idea.error.log.command.execution=Error during log command execution hg4idea.dialog.login.password.required=Login and password required hg4idea.dialog.login.description=Login to {0} diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgCachingCommitedChangesProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgCachingCommitedChangesProvider.java index aeb41d7edfe5..e6e76934febc 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgCachingCommitedChangesProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgCachingCommitedChangesProvider.java @@ -212,7 +212,7 @@ public class HgCachingCommitedChangesProvider implements CachingCommittedChanges localRevisions = hgLogCommand.execute(hgFile, maxCount == 0 ? -1 : maxCount, true, args); } catch (HgCommandException e) { - new HgCommandResultNotifier(project).notifyError(null, "Error during log command execution", e.getMessage()); + new HgCommandResultNotifier(project).notifyError(null, HgVcsMessages.message("hg4idea.error.log.command.execution"), e.getMessage()); return result; } Collections.reverse(localRevisions); @@ -331,7 +331,7 @@ public class HgCachingCommitedChangesProvider implements CachingCommittedChanges revisions = hgLogCommand.execute(hgFile, 1, true, args); } catch (HgCommandException e) { - new HgCommandResultNotifier(project).notifyError(null, "Error during log command execution", e.getMessage()); + new HgCommandResultNotifier(project).notifyError(null, HgVcsMessages.message("hg4idea.error.log.command.execution"), e.getMessage()); return null; } if (revisions == null || revision.isEmpty()) { diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java index ceac54f427e2..d3f4d1eba4ee 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/HgHistoryProvider.java @@ -26,6 +26,7 @@ import org.jetbrains.annotations.Nullable; import org.zmlx.hg4idea.HgCopyHistoryRevisionNumberAction; import org.zmlx.hg4idea.HgFile; import org.zmlx.hg4idea.HgFileRevision; +import org.zmlx.hg4idea.HgVcsMessages; import org.zmlx.hg4idea.action.HgCommandResultNotifier; import org.zmlx.hg4idea.command.HgLogCommand; import org.zmlx.hg4idea.command.HgWorkingCopyRevisionsCommand; @@ -115,7 +116,7 @@ public class HgHistoryProvider implements VcsHistoryProvider { return logCommand.execute(new HgFile(vcsRoot, filePath), limit, false); } catch (HgCommandException e) { - new HgCommandResultNotifier(project).notifyError(null, "Mercurial log command error ", e.getMessage()); + new HgCommandResultNotifier(project).notifyError(null, HgVcsMessages.message("hg4idea.error.log.command.execution"), e.getMessage()); return Collections.emptyList(); } } diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java index f5cdca7a3aad..eaad2b9a0e4c 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/annotate/HgAnnotationProvider.java @@ -24,6 +24,7 @@ import com.intellij.vcsUtil.VcsUtil; import org.jetbrains.annotations.NotNull; import org.zmlx.hg4idea.HgFile; import org.zmlx.hg4idea.HgFileRevision; +import org.zmlx.hg4idea.HgVcsMessages; import org.zmlx.hg4idea.command.HgAnnotateCommand; import org.zmlx.hg4idea.command.HgLogCommand; import org.zmlx.hg4idea.command.HgWorkingCopyRevisionsCommand; @@ -57,7 +58,7 @@ public class HgAnnotationProvider implements AnnotationProvider { logResult = (new HgLogCommand(myProject)).execute(hgFile, DEFAULT_LIMIT, false); } catch (HgCommandException e) { - throw new VcsException("Can not annotate, log command failed ", e); + throw new VcsException("Can not annotate, " + HgVcsMessages.message("hg4idea.error.log.command.execution"), e); } VcsRevisionNumber revisionNumber = revision == null ? new HgWorkingCopyRevisionsCommand(myProject).tip(vcsRoot) :