[vcs-log] split log message from balloon message, enhance balloon message

Use specific vcs name and omit exception message.

GitOrigin-RevId: 21945bc9e9f48ee20132a06980ac608f69c11775
This commit is contained in:
Julia Beliaeva
2020-05-08 00:48:05 +00:00
committed by intellij-monorepo-bot
parent 04c287fbd3
commit 199f4c023c
4 changed files with 19 additions and 11 deletions
@@ -197,7 +197,7 @@ vcs.log.action.highlight.merge.commits=Merge Commits
vcs.log.action.highlight.my.commits=My Commits
# messages
vcs.log.recreated.due.to.corruption=VCS Log was recreated {0} times due to data corruption\nDelete {1} directory and restart {2} if this happens often.\n{3}
vcs.log.recreated.due.to.corruption={0} Log was recreated {1} times due to data corruption.\nDelete {2} directory and restart {3} if this happens often.
vcs.log.fatal.error.message=Could not delete {0}\nDelete it manually and restart IDEA.
vcs.log.is.not.available=Vcs Log is not available
@@ -157,21 +157,23 @@ public class VcsProjectLog implements Disposable {
@CalledInAwt
private void recreateOnError(@NotNull Throwable t) {
if ((++myRecreatedLogCount) % RECREATE_LOG_TRIES == 0) {
String message = VcsLogBundle.message("vcs.log.recreated.due.to.corruption",
myRecreatedLogCount,
LOG_CACHE,
ApplicationNamesInfo.getInstance().getFullProductName(),
t.getMessage());
LOG.error(message, t);
myRecreatedLogCount++;
String logMessage = "Recreating Vcs Log after storage corruption. Recreated count " + myRecreatedLogCount;
if (myRecreatedLogCount % RECREATE_LOG_TRIES == 0) {
LOG.error(logMessage, t);
VcsLogManager manager = getLogManager();
if (manager != null && manager.isLogVisible()) {
VcsBalloonProblemNotifier.showOverChangesView(myProject, message, MessageType.ERROR);
String balloonMessage = VcsLogBundle.message("vcs.log.recreated.due.to.corruption",
VcsLogUtil.getVcsDisplayName(myProject, manager),
myRecreatedLogCount,
LOG_CACHE,
ApplicationNamesInfo.getInstance().getFullProductName());
VcsBalloonProblemNotifier.showOverChangesView(myProject, balloonMessage, MessageType.ERROR);
}
}
else {
LOG.debug("Recreating VCS Log after storage corruption", t);
LOG.debug(logMessage, t);
}
disposeLog(true);
@@ -60,7 +60,7 @@ public class OpenAnotherLogTabAction extends DumbAwareAction {
// only for main log (it is a question, how and where we want to open tabs for external logs)
e.getPresentation().setEnabledAndVisible(projectLog.getLogManager() == logManager);
String vcsName = VcsLogUtil.getVcsDisplayName(project, logManager.getDataManager().getLogProviders().values());
String vcsName = VcsLogUtil.getVcsDisplayName(project, logManager);
e.getPresentation().setText(getText(vcsName));
e.getPresentation().setDescription(getDescription(vcsName));
}
@@ -21,6 +21,7 @@ import com.intellij.vcs.log.data.RefsModel;
import com.intellij.vcs.log.data.VcsLogData;
import com.intellij.vcs.log.impl.MainVcsLogUiProperties;
import com.intellij.vcs.log.impl.VcsChangesLazilyParsedDetails;
import com.intellij.vcs.log.impl.VcsLogManager;
import com.intellij.vcs.log.impl.VcsLogUiProperties;
import com.intellij.vcs.log.ui.VcsLogInternalDataKeys;
import com.intellij.vcsUtil.VcsUtil;
@@ -350,4 +351,9 @@ public class VcsLogUtil {
if (vcs.size() != 1) return VcsLogBundle.message("vcs");
return Objects.requireNonNull(getFirstItem(vcs)).getDisplayName();
}
@NotNull
public static String getVcsDisplayName(@NotNull Project project, @NotNull VcsLogManager logManager) {
return getVcsDisplayName(project, logManager.getDataManager().getLogProviders().values());
}
}