• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java VcsNotifier类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: doCheckout

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
@Override
public void doCheckout(@NotNull final Project project, final Listener listener) {
    BasicAction.saveAll();

    if (!IdeaHelper.isTFConfigured(project)) {
        return;
    }

    // TF is configured, proceed with checkout
    try {
        final CheckoutController controller = new CheckoutController(project, listener, new TfvcCheckoutModel());
        controller.showModalDialog();
    } catch (Throwable t) {
        logger.warn("doCheckout failed unexpectedly", t);
        VcsNotifier.getInstance(project).notifyError(TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_DIALOG_TITLE),
                TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_ERRORS_UNEXPECTED, t.getMessage()));
    }
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:19,代码来源:TfvcCheckoutProvider.java


示例17: doActionPerformed

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
@Override
public void doActionPerformed(final AnActionEvent anActionEvent) {
    final Project project = anActionEvent.getData(CommonDataKeys.PROJECT);
    if (project == null || project.isDisposed()) {
        return;
    }

    BasicAction.saveAll();

    try {
        final ImportController controller = new ImportController(project);
        controller.showModalDialog();
    } catch (Throwable t) {
        //unexpected error
        logger.warn("ImportAction doActionPerformed failed unexpected error", t);
        VcsNotifier.getInstance(project).notifyError(TfPluginBundle.message(TfPluginBundle.KEY_ACTIONS_IMPORT),
                TfPluginBundle.message(TfPluginBundle.KEY_IMPORT_ERRORS_UNEXPECTED, t.getMessage()));
    }
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:20,代码来源:ImportAction.java


示例18: doCheckout

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
@Override
public void doCheckout(@NotNull final Project project, final Listener listener) {
    BasicAction.saveAll();

    if(!IdeaHelper.isGitExeConfigured(project)) {
        return;
    }

    //Git.exe is configured, proceed with checkout
    try {

        final CheckoutController controller = new CheckoutController(project, listener, new GitCheckoutModel());
        controller.showModalDialog();
    } catch (Throwable t) {
        //unexpected error
        logger.warn("doCheckout failed unexpected error", t);
        VcsNotifier.getInstance(project).notifyError(TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_DIALOG_TITLE),
                TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_ERRORS_UNEXPECTED, t.getMessage()));
    }
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:21,代码来源:GitCheckoutProvider.java


示例19: processCommand

import com.intellij.openapi.vcs.VcsNotifier; //导入依赖的package包/类
/**
 * Kicks off the SimpleCheckout workflow with the Git Url passed
 */
public void processCommand() {
    final Project project = DefaultProjectFactory.getInstance().getDefaultProject();
    final CheckoutProvider.Listener listener = ProjectLevelVcsManager.getInstance(project).getCompositeCheckoutListener();

    try {
        launchApplicationWindow();

        final SimpleCheckoutController controller = new SimpleCheckoutController(project, listener, gitUrl, ref);
        controller.showModalDialog();
    } catch (Throwable t) {
        //unexpected error occurred while doing simple checkout
        logger.warn("VSTS commandline checkout failed due to an unexpected error", t);
        VcsNotifier.getInstance(project).notifyError(TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_DIALOG_TITLE),
                TfPluginBundle.message(TfPluginBundle.KEY_CHECKOUT_ERRORS_UNEXPECTED, t.getMessage()));
    }
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:20,代码来源:SimpleCheckoutStarter.java


示例20: 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(@Nonnull Notification notification, @Nonnull 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:consulo,项目名称:consulo,代码行数:21,代码来源:DvcsBranchPopup.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Base64类代码示例发布时间:2022-05-22
下一篇:
Java ObjectSerializer类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap