当前位置: 首页>>代码示例>>Java>>正文


Java VcsNotifier类代码示例

本文整理汇总了Java中com.intellij.openapi.vcs.VcsNotifier的典型用法代码示例。如果您正苦于以下问题:Java VcsNotifier类的具体用法?Java VcsNotifier怎么用?Java VcsNotifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VcsNotifier类属于com.intellij.openapi.vcs包,在下文中一共展示了VcsNotifier类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: notifyAboutSyncedBranches

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
private void notifyAboutSyncedBranches() {
  String description =
    "You have several " + myVcs.getDisplayName() + " roots in the project and they all are checked out at the same branch. " +
    "We've enabled synchronous branch control for the project. <br/>" +
    "If you wish to control branches in different roots separately, " +
    "you may <a href='settings'>disable</a> the setting.";
  NotificationListener listener = new NotificationListener() {
    @Override
    public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
      if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        ShowSettingsUtil.getInstance().showSettingsDialog(myProject, myVcs.getConfigurable().getDisplayName());
        if (myVcsSettings.getSyncSetting() == DvcsSyncSettings.Value.DONT_SYNC) {
          notification.expire();
        }
      }
    }
  };
  VcsNotifier.getInstance(myProject).notifyImportantInfo("Synchronous branch control enabled", description, listener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:DvcsBranchPopup.java

示例2: displayFetchResult

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
public static void displayFetchResult(@NotNull Project project,
                                      @NotNull GitFetchResult result,
                                      @Nullable String errorNotificationTitle, @NotNull Collection<? extends Exception> errors) {
  if (result.isSuccess()) {
    VcsNotifier.getInstance(project).notifySuccess("Fetched successfully" + result.getAdditionalInfo());
  } else if (result.isCancelled()) {
    VcsNotifier.getInstance(project).notifyMinorWarning("", "Fetch cancelled by user" + result.getAdditionalInfo());
  } else if (result.isNotAuthorized()) {
    String title;
    String description;
    if (errorNotificationTitle != null) {
      title = errorNotificationTitle;
      description = "Fetch failed: couldn't authorize";
    } else {
      title = "Fetch failed";
      description = "Couldn't authorize";
    }
    description += result.getAdditionalInfo();
    GitUIUtil.notifyMessage(project, title, description, true, null);
  } else {
    GitVcs instance = GitVcs.getInstance(project);
    if (instance != null && instance.getExecutableValidator().isExecutableValid()) {
      GitUIUtil.notifyMessage(project, "Fetch failed", result.getAdditionalInfo(), true, errors);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GitFetcher.java

示例3: initOrNotifyError

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
protected boolean initOrNotifyError(@NotNull final VirtualFile projectDir) {
  VcsNotifier vcsNotifier = VcsNotifier.getInstance(myProject);
  GitCommandResult result = myGit.init(myProject, projectDir);
  if (result.success()) {
    refreshVcsDir(projectDir, GitUtil.DOT_GIT);
    vcsNotifier.notifySuccess("Created Git repository in " + projectDir.getPresentableUrl());
    return true;
  }
  else {
    if (myVcs.getExecutableValidator().checkExecutableAndNotifyIfNeeded()) {
      vcsNotifier.notifyError("Couldn't git init " + projectDir.getPresentableUrl(), result.getErrorOutputAsHtmlString());
      LOG.info(result.getErrorOutputAsHtmlString());
    }
    return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GitIntegrationEnabler.java

示例4: notifyUnresolvedRemain

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
@Override
protected void notifyUnresolvedRemain() {
  VcsNotifier.getInstance(myProject).notifyImportantWarning("Conflicts were not resolved during unstash",
                                                            "Unstash is not complete, you have unresolved merges in your working tree<br/>" +
                                                            "<a href='resolve'>Resolve</a> conflicts.", new NotificationListener() {
      @Override
      public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
        if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
          if (event.getDescription().equals("resolve")) {
            new UnstashConflictResolver(myProject, myRoot, myStashInfo).mergeNoProceed();
          }
        }
      }
    }
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:GitUnstashDialog.java

示例5: notifyMessages

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
public static void notifyMessages(@NotNull Project project,
                                  @NotNull String title,
                                  @Nullable String description,
                                  boolean important,
                                  @Nullable Collection<String> messages) {
  String desc = (description != null ? description.replace("\n", "<br/>") : "");
  if (messages != null && !messages.isEmpty()) {
    desc += StringUtil.join(messages, "<hr/><br/>");
  }
  VcsNotifier notificator = VcsNotifier.getInstance(project);
  if (important) {
    notificator.notifyError(title, desc);
  }
  else {
    notificator.notifyImportantWarning(title, desc, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GitUIUtil.java

示例6: GitRebaseProcess

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
private GitRebaseProcess(@NotNull Project project,
                         @NotNull List<GitRepository> allRepositories,
                         @NotNull GitRebaseParams params,
                         @NotNull GitChangesSaver saver,
                         @NotNull MultiMap<GitRepository, GitRebaseUtils.CommitInfo> skippedCommits,
                         @NotNull Map<GitRepository, SuccessType> successfulRepositories) {
  myProject = project;
  myAllRepositories = allRepositories;
  myParams = params;
  mySaver = saver;
  mySuccessfulRepositories = successfulRepositories;

  myGit = ServiceManager.getService(Git.class);
  myChangeListManager = ChangeListManager.getInstance(myProject);
  myNotifier = VcsNotifier.getInstance(myProject);
  myFacade = ServiceManager.getService(GitPlatformFacade.class);

  myInitialHeadPositions = readInitialHeadPositions(myAllRepositories);
  mySkippedCommits = skippedCommits;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GitRebaseProcess.java

示例7: showUnmergedFilesNotification

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
@Override
public void showUnmergedFilesNotification(@NotNull final String operationName, @NotNull final Collection<GitRepository> repositories) {
  String title = unmergedFilesErrorTitle(operationName);
  String description = unmergedFilesErrorNotificationDescription(operationName);
  VcsNotifier.getInstance(myProject).notifyError(title, description,
    new NotificationListener() {
      @Override
      public void hyperlinkUpdate(@NotNull Notification notification,
                                  @NotNull HyperlinkEvent event) {
        if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED && event.getDescription().equals("resolve")) {
          GitConflictResolver.Params params = new GitConflictResolver.Params().
            setMergeDescription(String.format("The following files have unresolved conflicts. You need to resolve them before %s.",
                                              operationName)).
            setErrorNotificationTitle("Unresolved files remain.");
          new GitConflictResolver(myProject, myGit, myFacade, GitUtil.getRootsFromRepositories(repositories), params).merge();
        }
      }
    }
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GitBranchUiHandlerImpl.java

示例8: notifySuccess

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
@Override
protected void notifySuccess(@NotNull String message) {
  switch (myDeleteOnMerge) {
    case DELETE:
      super.notifySuccess(message);
      UIUtil.invokeLaterIfNeeded(new Runnable() { // bg process needs to be started from the EDT
        @Override
        public void run() {
          GitBrancher brancher = ServiceManager.getService(myProject, GitBrancher.class);
          brancher.deleteBranch(myBranchToMerge, new ArrayList<GitRepository>(getRepositories()));
        }
      });
      break;
    case PROPOSE:
      String description = message + "<br/><a href='delete'>Delete " + myBranchToMerge + "</a>";
      VcsNotifier.getInstance(myProject).notifySuccess("", description, new DeleteMergedLocalBranchNotificationListener());
      break;
    case NOTHING:
      super.notifySuccess(message);
      break;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GitMergeOperation.java

示例9: onSuccess

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
@Override
public void onSuccess() {
  if (myCancelled) {
    return;
  }

  removeHighlighting();

  if (myException != null) {
    VcsNotifier.getInstance(myProject).notifyError("Couldn't compare with branch " + myComparedBranch, myException.getMessage());
    return;
  }

  myHighlighter = new VcsLogHighlighter() {
    @NotNull
    @Override
    public VcsCommitStyle getStyle(int commitIndex, boolean isSelected) {
      return VcsCommitStyleFactory
        .foreground(!myNonPickedCommits.contains(commitIndex) ? MergeCommitsHighlighter.MERGE_COMMIT_FOREGROUND : null);
    }
  };
  myUi.addHighlighter(myHighlighter);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DeepComparator.java

示例10: push

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
public static void push(@NotNull final Project project, @NotNull HgPushCommand command) {
  final VirtualFile repo = command.getRepo();
  command.execute(new HgCommandResultHandler() {
    @Override
    public void process(@Nullable HgCommandResult result) {
      if (result == null) {
        return;
      }

      if (result.getExitValue() == PUSH_SUCCEEDED_EXIT_VALUE) {
        int commitsNum = getNumberOfPushedCommits(result);
        String successTitle = "Pushed successfully";
        String successDescription = String.format("Pushed %d %s [%s]", commitsNum, StringUtil.pluralize("commit", commitsNum),
                                                  repo.getPresentableName());
        VcsNotifier.getInstance(project).notifySuccess(successTitle, successDescription);
      }
      else if (result.getExitValue() == NOTHING_TO_PUSH_EXIT_VALUE) {
        VcsNotifier.getInstance(project).notifySuccess("Nothing to push");
      }
      else {
        new HgCommandResultNotifier(project).notifyError(result, "Push failed",
                                                         "Failed to push to [" + repo.getPresentableName() + "]");
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:HgPusher.java

示例11: getCommitRecords

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
@NotNull
public static <CommitInfo> List<CommitInfo> getCommitRecords(@NotNull Project project,
                                                             @Nullable HgCommandResult result,
                                                             @NotNull Function<String, CommitInfo> converter, boolean silent) {
  final List<CommitInfo> revisions = new LinkedList<CommitInfo>();
  if (result == null) {
    return revisions;
  }

  List<String> errors = result.getErrorLines();
  if (!errors.isEmpty()) {
    if (result.getExitValue() != 0) {
      if (silent) {
        LOG.debug(errors.toString());
      }
      else {
        VcsNotifier.getInstance(project).notifyError(HgVcsMessages.message("hg4idea.error.log.command.execution"), errors.toString());
      }
      return Collections.emptyList();
    }
    LOG.warn(errors.toString());
  }
  String output = result.getRawOutput();
  List<String> changeSets = StringUtil.split(output, HgChangesetUtil.CHANGESET_SEPARATOR);
  return ContainerUtil.mapNotNull(changeSets, converter);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:HgHistoryUtil.java

示例12: initOrNotifyError

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
@Override
protected boolean initOrNotifyError(@NotNull final VirtualFile projectDir) {
  final boolean[] success = new boolean[1];
  new HgInitCommand(myProject).execute(projectDir, new HgCommandResultHandler() {
    @Override
    public void process(@Nullable HgCommandResult result) {
      VcsNotifier notification = VcsNotifier.getInstance(myProject);
      if (!HgErrorUtil.hasErrorsInCommandExecution(result)) {
        success[0] = true;
        refreshVcsDir(projectDir, HgUtil.DOT_HG);
        notification.notifySuccess(HgVcsMessages.message("hg4idea.init.created.notification.title"),
                                   HgVcsMessages
                                     .message("hg4idea.init.created.notification.description", projectDir.getPresentableUrl())
        );
      }
      else {
        success[0] = false;
        String errors = result != null ? result.getRawError() : "";
        notification.notifyError(
          HgVcsMessages.message("hg4idea.init.error.description", projectDir.getPresentableUrl()), errors);
      }
    }
  });
  return success[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgIntegrationEnabler.java

示例13: updateRepoToInCurrentThread

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
public static boolean updateRepoToInCurrentThread(@NotNull final Project project,
                                                  @NotNull final VirtualFile repository,
                                                  @NotNull final String targetRevision,
                                                  final boolean clean) {
  final HgUpdateCommand hgUpdateCommand = new HgUpdateCommand(project, repository);
  hgUpdateCommand.setRevision(targetRevision);
  hgUpdateCommand.setClean(clean);
  HgCommandResult result = hgUpdateCommand.execute();
  new HgConflictResolver(project).resolve(repository);
  boolean success = !HgErrorUtil.isCommandExecutionFailed(result);
  boolean hasUnresolvedConflicts = !HgConflictResolver.findConflicts(project, repository).isEmpty();
  if (!success) {
    new HgCommandResultNotifier(project).notifyError(result, "", "Update failed");
  }
  else if (hasUnresolvedConflicts) {
    new VcsNotifier(project)
      .notifyImportantWarning("Unresolved conflicts.",
                              HgVcsMessages.message("hg4idea.update.warning.merge.conflicts", repository.getPath()));
  }
  getRepositoryManager(project).updateRepository(repository);
  HgErrorUtil.markDirtyAndHandleErrors(project, repository);
  return success;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:HgUpdateCommand.java

示例14: createRepository

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
private void createRepository(final VirtualFile selectedRoot, final VirtualFile mapRoot) {
  new HgInitCommand(myProject).execute(selectedRoot, new HgCommandResultHandler() {
    @Override
    public void process(@Nullable HgCommandResult result) {
      if (!HgErrorUtil.hasErrorsInCommandExecution(result)) {
        updateDirectoryMappings(mapRoot);
        VcsNotifier.getInstance(myProject).notifySuccess(HgVcsMessages.message("hg4idea.init.created.notification.title"),
                                                         HgVcsMessages.message("hg4idea.init.created.notification.description",
                                                                               selectedRoot.getPresentableUrl())
        );
      }
      else {
        new HgCommandResultNotifier(myProject.isDefault() ? null : myProject)
          .notifyError(result, HgVcsMessages.message("hg4idea.init.error.title"), HgVcsMessages.message("hg4idea.init.error.description",
                                                                                                        selectedRoot
                                                                                                          .getPresentableUrl()
          ));
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:HgInit.java

示例15: notifyError

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
public void notifyError(@Nullable HgCommandResult result,
                        @NotNull String failureTitle,
                        @NotNull String failureDescription,
                        @Nullable NotificationListener listener) {
  List<String> err;
  String errorMessage;
  if (StringUtil.isEmptyOrSpaces(failureDescription)) {
    failureDescription = failureTitle;
  }
  if (result == null) {
    errorMessage = failureDescription;
  } else {
    err = result.getErrorLines();
    if (err.isEmpty()) {
      LOG.assertTrue(!StringUtil.isEmptyOrSpaces(failureDescription),
                     "Failure title, failure description and errors log can not be empty at the same time");
      errorMessage = failureDescription;
    } else if (failureDescription.isEmpty()) {
      errorMessage = XmlStringUtil.wrapInHtml(StringUtil.join(err, "<br>"));
    } else {
      errorMessage = XmlStringUtil.wrapInHtml(failureDescription + "<br>" + StringUtil.join(err, "<br>"));
    }
  }
  VcsNotifier.getInstance(myProject).notifyError(failureTitle, errorMessage, listener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgCommandResultNotifier.java


注:本文中的com.intellij.openapi.vcs.VcsNotifier类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。