コード例 #1
0
 @Override
 protected void doInAwtIfFail(Exception e) {
   final Exception cause;
   if (e instanceof MyRuntime) {
     cause = (Exception) e.getCause();
   } else {
     cause = e;
   }
   LOG.info(e);
   VcsBalloonProblemNotifier.showOverChangesView(
       myProject, cause.getMessage(), MessageType.ERROR);
 }
コード例 #2
0
 private static VcsException createMoveTargetExistsError(@NotNull Exception e) {
   return new VcsException(
       Arrays.asList(
           "Target of move operation is already under version control.",
           "Subversion move had not been performed. ",
           e.getMessage()));
 }
コード例 #3
0
 /**
  * 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);
     }
   }
 }
コード例 #4
0
 /**
  * Checks Hg version and updates the myVersion variable. In the case of nullable or unsupported
  * version reports the problem.
  */
 public void checkVersion() {
   final String executable = getGlobalSettings().getHgExecutable();
   HgCommandResultNotifier errorNotification = new HgCommandResultNotifier(myProject);
   final String SETTINGS_LINK = "settings";
   final String UPDATE_LINK = "update";
   NotificationListener linkAdapter =
       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://mercurial.selenic.com");
           }
         }
       };
   try {
     myVersion = HgVersion.identifyVersion(executable);
     // if version is not supported, but have valid hg executable
     if (!myVersion.isSupported()) {
       LOG.info("Unsupported Hg version: " + myVersion);
       String message =
           String.format(
               "The <a href='"
                   + SETTINGS_LINK
                   + "'>configured</a> version of Hg is not supported: %s.<br/> "
                   + "The minimal supported version is %s. Please <a href='"
                   + UPDATE_LINK
                   + "'>update</a>.",
               myVersion,
               HgVersion.MIN);
       errorNotification.notifyError(null, "Unsupported Hg version", message, linkAdapter);
     } else if (myVersion.hasUnsupportedExtensions()) {
       String unsupportedExtensionsAsString = myVersion.getUnsupportedExtensions().toString();
       LOG.warn("Unsupported Hg extensions: " + unsupportedExtensionsAsString);
       String message =
           String.format(
               "Some hg extensions %s are not found or not supported by your hg version and will be ignored.\n"
                   + "Please, update your hgrc or Mercurial.ini file",
               unsupportedExtensionsAsString);
       errorNotification.notifyWarning("Unsupported Hg version", message);
     }
   } catch (Exception e) {
     if (getExecutableValidator().checkExecutableAndNotifyIfNeeded()) {
       // sometimes not hg application has version command, but we couldn't parse an answer as
       // valid hg,
       // so parse(output) throw ParseException, but hg and git executable seems to be valid in
       // this case
       final String reason = (e.getCause() != null ? e.getCause() : e).getMessage();
       String message = HgVcsMessages.message("hg4idea.unable.to.run.hg", executable);
       errorNotification.notifyError(
           null,
           message,
           String.format(
               reason
                   + "<br/> Please check your hg executable path in <a href='"
                   + SETTINGS_LINK
                   + "'> settings </a>"),
           linkAdapter);
     }
   }
 }