/** * Checks Git version and updates the myVersion variable. In the case of exception or unsupported * version reports the problem. Note that unsupported version is also applied - some functionality * might not work (we warn about that), but no need to disable at all. */ public void checkVersion() { final String executable = myAppSettings.getPathToGit(); try { myVersion = GitVersion.identifyVersion(executable); if (!myVersion.isSupported()) { log.info("Unsupported Git version: " + myVersion); final String SETTINGS_LINK = "settings"; final String UPDATE_LINK = "update"; String message = String.format( "The <a href='" + SETTINGS_LINK + "'>configured</a> version of Git is not supported: %s.<br/> " + "The minimal supported version is %s. Please <a href='" + UPDATE_LINK + "'>update</a>.", myVersion, GitVersion.MIN); VcsNotifier.getInstance(myProject) .notifyError( "Unsupported Git version", message, new NotificationListener.Adapter() { @Override protected void hyperlinkActivated( @NotNull Notification notification, @NotNull HyperlinkEvent e) { if (SETTINGS_LINK.equals(e.getDescription())) { ShowSettingsUtil.getInstance() .showSettingsDialog(myProject, getConfigurable().getDisplayName()); } else if (UPDATE_LINK.equals(e.getDescription())) { BrowserUtil.browse("http://git-scm.com"); } } }); } } catch (Exception e) { if (getExecutableValidator() .checkExecutableAndNotifyIfNeeded()) { // check executable before notifying error final String reason = (e.getCause() != null ? e.getCause() : e).getMessage(); String message = GitBundle.message("vcs.unable.to.run.git", executable, reason); if (!myProject.isDefault()) { showMessage(message, ConsoleViewContentType.SYSTEM_OUTPUT.getAttributes()); } VcsBalloonProblemNotifier.showOverVersionControlView(myProject, message, MessageType.ERROR); } } }
/** Shows error message in the Version Control Console */ public void showErrorMessages(final String line) { showMessage(line, ConsoleViewContentType.ERROR_OUTPUT.getAttributes()); }
/** Shows a command line message in the Version Control Console */ public void showCommandLine(final String cmdLine) { SimpleDateFormat f = new SimpleDateFormat("HH:mm:ss.SSS"); showMessage( f.format(new Date()) + ": " + cmdLine, ConsoleViewContentType.SYSTEM_OUTPUT.getAttributes()); }
/** Shows a plain message in the Version Control Console. */ public void showMessages(@NotNull String message) { if (message.length() == 0) return; showMessage(message, ConsoleViewContentType.NORMAL_OUTPUT.getAttributes()); }