Search in sources :

Example 1 with RepositoryLocation

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

the class SvnCommittedListsZipper method groupLocations.

public Pair<List<RepositoryLocationGroup>, List<RepositoryLocation>> groupLocations(final List<RepositoryLocation> in) {
    final List<RepositoryLocationGroup> groups = new ArrayList<>();
    final List<RepositoryLocation> singles = new ArrayList<>();
    final MultiMap<SVNURL, RepositoryLocation> map = new MultiMap<>();
    for (RepositoryLocation location : in) {
        final SvnRepositoryLocation svnLocation = (SvnRepositoryLocation) location;
        final String url = svnLocation.getURL();
        final SVNURL root = SvnUtil.getRepositoryRoot(myVcs, url);
        if (root == null) {
            // should not occur
            LOG.info("repository root not found for location:" + location.toPresentableString());
            singles.add(location);
        } else {
            map.putValue(root, svnLocation);
        }
    }
    final Set<SVNURL> keys = map.keySet();
    for (SVNURL key : keys) {
        final Collection<RepositoryLocation> repositoryLocations = map.get(key);
        if (repositoryLocations.size() == 1) {
            singles.add(repositoryLocations.iterator().next());
        } else {
            final SvnRepositoryLocationGroup group = new SvnRepositoryLocationGroup(key, repositoryLocations);
            groups.add(group);
        }
    }
    return Pair.create(groups, singles);
}
Also used : SVNURL(org.tmatesoft.svn.core.SVNURL) ArrayList(java.util.ArrayList) RepositoryLocation(com.intellij.openapi.vcs.RepositoryLocation) MultiMap(com.intellij.util.containers.MultiMap) RepositoryLocationGroup(com.intellij.openapi.vcs.changes.committed.RepositoryLocationGroup)

Example 2 with RepositoryLocation

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

the class VcsCommittedListsZipperAdapter method groupLocations.

public Pair<List<RepositoryLocationGroup>, List<RepositoryLocation>> groupLocations(final List<RepositoryLocation> in) {
    final List<RepositoryLocationGroup> groups = new ArrayList<>();
    final List<RepositoryLocation> singles = new ArrayList<>();
    final MultiMap<Object, RepositoryLocation> map = new MultiMap<>();
    for (RepositoryLocation location : in) {
        final Object key = myGroupCreator.createKey(location);
        map.putValue(key, location);
    }
    final Set<Object> keys = map.keySet();
    for (Object key : keys) {
        final Collection<RepositoryLocation> locations = map.get(key);
        if (locations.size() == 1) {
            singles.addAll(locations);
        } else {
            final RepositoryLocationGroup group = myGroupCreator.createGroup(key, locations);
            groups.add(group);
        }
    }
    return Pair.create(groups, singles);
}
Also used : MultiMap(com.intellij.util.containers.MultiMap) ArrayList(java.util.ArrayList) RepositoryLocation(com.intellij.openapi.vcs.RepositoryLocation)

Example 3 with RepositoryLocation

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

the class ClearCommittedAction method update.

public void update(final AnActionEvent e) {
    Project project = e.getData(CommonDataKeys.PROJECT);
    if (project != null) {
        CommittedChangesPanel panel = ChangesViewContentManager.getInstance(project).getActiveComponent(CommittedChangesPanel.class);
        RepositoryLocation rl = panel == null ? null : panel.getRepositoryLocation();
        e.getPresentation().setVisible(rl == null);
        e.getPresentation().setEnabled(panel != null && (!panel.isInLoad()));
    } else {
        e.getPresentation().setVisible(false);
        e.getPresentation().setEnabled(false);
    }
}
Also used : Project(com.intellij.openapi.project.Project) RepositoryLocation(com.intellij.openapi.vcs.RepositoryLocation)

Aggregations

RepositoryLocation (com.intellij.openapi.vcs.RepositoryLocation)3 MultiMap (com.intellij.util.containers.MultiMap)2 ArrayList (java.util.ArrayList)2 Project (com.intellij.openapi.project.Project)1 RepositoryLocationGroup (com.intellij.openapi.vcs.changes.committed.RepositoryLocationGroup)1 SVNURL (org.tmatesoft.svn.core.SVNURL)1