Search in sources :

Example 1 with ProjectLevelVcsManagerEx

use of com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx in project intellij-community by JetBrains.

the class VcsGeneralConfigurationPanel method updateAvailableOptions.

public void updateAvailableOptions(final Collection<AbstractVcs> activeVcses) {
    for (VcsShowOptionsSettingImpl setting : myPromptOptions.keySet()) {
        final JCheckBox checkBox = myPromptOptions.get(setting);
        checkBox.setEnabled(setting.isApplicableTo(activeVcses) || myProject.isDefault());
        if (!myProject.isDefault()) {
            checkBox.setToolTipText(VcsBundle.message("tooltip.text.action.applicable.to.vcses", composeText(setting.getApplicableVcses())));
        }
    }
    if (!myProject.isDefault()) {
        final ProjectLevelVcsManagerEx vcsManager = ProjectLevelVcsManagerEx.getInstanceEx(myProject);
        final VcsShowConfirmationOptionImpl addConfirmation = vcsManager.getConfirmation(VcsConfiguration.StandardConfirmation.ADD);
        UIUtil.setEnabled(myAddConfirmationPanel, addConfirmation.isApplicableTo(activeVcses), true);
        myAddConfirmationPanel.setToolTipText(VcsBundle.message("tooltip.text.action.applicable.to.vcses", composeText(addConfirmation.getApplicableVcses())));
        final VcsShowConfirmationOptionImpl removeConfirmation = vcsManager.getConfirmation(VcsConfiguration.StandardConfirmation.REMOVE);
        UIUtil.setEnabled(myRemoveConfirmationPanel, removeConfirmation.isApplicableTo(activeVcses), true);
        myRemoveConfirmationPanel.setToolTipText(VcsBundle.message("tooltip.text.action.applicable.to.vcses", composeText(removeConfirmation.getApplicableVcses())));
    }
}
Also used : ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx)

Example 2 with ProjectLevelVcsManagerEx

use of com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx in project intellij-community by JetBrains.

the class GitMergeUtil method showUpdates.

/**
   * Show updates caused by git operation
   *
   * @param project     the context project
   * @param exceptions  the exception list
   * @param root        the git root
   * @param currentRev  the revision before update
   * @param beforeLabel the local history label before update
   * @param actionName  the action name
   * @param actionInfo  the information about the action
   */
public static void showUpdates(final Project project, final List<VcsException> exceptions, final VirtualFile root, final GitRevisionNumber currentRev, final Label beforeLabel, final String actionName, final ActionInfo actionInfo) {
    UpdatedFiles files = UpdatedFiles.create();
    MergeChangeCollector collector = new MergeChangeCollector(project, root, currentRev);
    collector.collect(files, exceptions);
    if (!exceptions.isEmpty())
        return;
    GuiUtils.invokeLaterIfNeeded(() -> {
        ProjectLevelVcsManagerEx manager = (ProjectLevelVcsManagerEx) ProjectLevelVcsManager.getInstance(project);
        UpdateInfoTree tree = manager.showUpdateProjectInfo(files, actionName, actionInfo, false);
        tree.setBefore(beforeLabel);
        tree.setAfter(LocalHistory.getInstance().putSystemLabel(project, "After update"));
    }, ModalityState.defaultModalityState());
    Collection<String> unmergedNames = files.getGroupById(FileGroup.MERGED_WITH_CONFLICT_ID).getFiles();
    if (!unmergedNames.isEmpty()) {
        List<VirtualFile> unmerged = mapNotNull(unmergedNames, name -> LocalFileSystem.getInstance().findFileByPath(name));
        GuiUtils.invokeLaterIfNeeded(() -> {
            GitVcs vcs = GitVcs.getInstance(project);
            if (vcs != null) {
                AbstractVcsHelper.getInstance(project).showMergeDialog(unmerged, vcs.getMergeProvider());
            }
        }, ModalityState.defaultModalityState());
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) GitVcs(git4idea.GitVcs) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) UpdatedFiles(com.intellij.openapi.vcs.update.UpdatedFiles) UpdateInfoTree(com.intellij.openapi.vcs.update.UpdateInfoTree)

Example 3 with ProjectLevelVcsManagerEx

use of com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx in project intellij-community by JetBrains.

the class SvnCheckoutProvider method notifyRootManagerIfUnderProject.

private static void notifyRootManagerIfUnderProject(final Project project, final File directory) {
    if (project.isDefault())
        return;
    final ProjectLevelVcsManagerEx plVcsManager = ProjectLevelVcsManagerEx.getInstanceEx(project);
    final SvnVcs vcs = (SvnVcs) plVcsManager.findVcsByName(SvnVcs.VCS_NAME);
    final VirtualFile[] files = vcs.getSvnFileUrlMapping().getNotFilteredRoots();
    for (VirtualFile file : files) {
        if (FileUtil.isAncestor(virtualToIoFile(file), directory, false)) {
            // todo: should be done like auto detection
            plVcsManager.fireDirectoryMappingsChanged();
            return;
        }
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) SvnVcs(org.jetbrains.idea.svn.SvnVcs)

Example 4 with ProjectLevelVcsManagerEx

use of com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx in project intellij-community by JetBrains.

the class ModuleDefaultVcsRootPolicy method getDirtyRoots.

@NotNull
@Override
public Collection<VirtualFile> getDirtyRoots() {
    Collection<VirtualFile> dirtyRoots = newHashSet();
    if (ProjectKt.isDirectoryBased(myProject)) {
        VirtualFile ideaDir = ProjectKt.getStateStore(myProject).getDirectoryStoreFile();
        if (ideaDir != null) {
            dirtyRoots.add(ideaDir);
        } else {
            LOG.warn(".idea was not found for base dir [" + myBaseDir.getPath() + "]");
        }
    }
    ContainerUtil.addAll(dirtyRoots, getContentRoots());
    String defaultMapping = ((ProjectLevelVcsManagerEx) ProjectLevelVcsManager.getInstance(myProject)).haveDefaultMapping();
    boolean haveDefaultMapping = !StringUtil.isEmpty(defaultMapping);
    if (haveDefaultMapping && myBaseDir != null) {
        dirtyRoots.add(myBaseDir);
    }
    return dirtyRoots;
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) ProjectLevelVcsManagerEx(com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ProjectLevelVcsManagerEx (com.intellij.openapi.vcs.ex.ProjectLevelVcsManagerEx)4 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 UpdateInfoTree (com.intellij.openapi.vcs.update.UpdateInfoTree)1 UpdatedFiles (com.intellij.openapi.vcs.update.UpdatedFiles)1 GitVcs (git4idea.GitVcs)1 NotNull (org.jetbrains.annotations.NotNull)1 SvnVcs (org.jetbrains.idea.svn.SvnVcs)1