コード例 #1
0
 /**
  * This method is called when user invokes "Enable VCS Integration" and selects a particular VCS.
  * By default it sets up a single mapping {@code <Project> -> selected VCS}.
  */
 @CalledInAwt
 public void enableIntegration() {
   ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(myProject);
   if (vcsManager != null) {
     vcsManager.setDirectoryMappings(Arrays.asList(new VcsDirectoryMapping("", getName())));
   }
 }
コード例 #2
0
 public static void addMappingIfSubRoot(
     @NotNull Project project, @NotNull String newRepositoryPath, @NotNull String vcsName) {
   if (project.getBasePath() != null
       && FileUtil.isAncestor(project.getBasePath(), newRepositoryPath, true)) {
     ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project);
     manager.setDirectoryMappings(
         VcsUtil.addMapping(manager.getDirectoryMappings(), newRepositoryPath, vcsName));
   }
 }
コード例 #3
0
 @Override
 protected void hyperlinkActivated(
     @NotNull Notification notification, @NotNull HyperlinkEvent event) {
   if (event.getDescription().equals("configure") && !myProject.isDisposed()) {
     ShowSettingsUtil.getInstance()
         .showSettingsDialog(myProject, ActionsBundle.message("group.VcsGroup.text"));
     Collection<VcsRootError> errorsAfterPossibleFix = getInstance(myProject).scan();
     if (errorsAfterPossibleFix.isEmpty() && !notification.isExpired()) {
       notification.expire();
     }
   } else if (event.getDescription().equals("ignore")) {
     mySettings.addIgnoredUnregisteredRoots(
         ContainerUtil.map(myImportantUnregisteredRoots, PATH_FROM_ROOT_ERROR));
     notification.expire();
   } else if (event.getDescription().equals("add")) {
     List<VcsDirectoryMapping> mappings = myVcsManager.getDirectoryMappings();
     for (VcsRootError root : myImportantUnregisteredRoots) {
       mappings = VcsUtil.addMapping(mappings, root.getMapping(), root.getVcsKey().getName());
     }
     myVcsManager.setDirectoryMappings(mappings);
   }
 }