Search in sources :

Example 16 with IndexDiffCacheEntry

use of org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry in project egit by eclipse.

the class IgnoreOperationUI method refresh.

private void refresh() {
    Map<Repository, Collection<String>> pathsByRepository = ResourceUtil.splitPathsByRepository(paths);
    for (Repository repository : pathsByRepository.keySet()) {
        IndexDiffCache cache = org.eclipse.egit.core.Activator.getDefault().getIndexDiffCache();
        IndexDiffCacheEntry entry = cache.getIndexDiffCacheEntry(repository);
        if (entry != null)
            entry.refresh();
    }
    GitLightweightDecorator.refresh();
}
Also used : Repository(org.eclipse.jgit.lib.Repository) IndexDiffCacheEntry(org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry) Collection(java.util.Collection) IndexDiffCache(org.eclipse.egit.core.internal.indexdiff.IndexDiffCache)

Example 17 with IndexDiffCacheEntry

use of org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry in project egit by eclipse.

the class PatchOperationUI method isWorkingTreeClean.

private boolean isWorkingTreeClean() {
    IndexDiffCache diffCache = org.eclipse.egit.core.Activator.getDefault().getIndexDiffCache();
    if (diffCache != null) {
        IndexDiffCacheEntry diffCacheEntry = diffCache.getIndexDiffCacheEntry(repository);
        if (diffCacheEntry == null) {
            return true;
        }
        IndexDiffData diffData = diffCacheEntry.getIndexDiff();
        if (diffData != null) {
            Set<String> modified = diffData.getModified();
            Set<String> untracked = diffData.getUntracked();
            Set<String> missing = diffData.getMissing();
            for (IResource resource : resources) {
                String repoRelativePath = makeRepoRelative(resource);
                if (containsPrefix(modified, repoRelativePath))
                    return false;
                if (containsPrefix(untracked, repoRelativePath))
                    return false;
                if (containsPrefix(missing, repoRelativePath))
                    return false;
            }
        }
    }
    return true;
}
Also used : IndexDiffCacheEntry(org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry) IndexDiffCache(org.eclipse.egit.core.internal.indexdiff.IndexDiffCache) IndexDiffData(org.eclipse.egit.core.internal.indexdiff.IndexDiffData) IResource(org.eclipse.core.resources.IResource)

Aggregations

IndexDiffCacheEntry (org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry)17 IndexDiffCache (org.eclipse.egit.core.internal.indexdiff.IndexDiffCache)8 IndexDiffData (org.eclipse.egit.core.internal.indexdiff.IndexDiffData)8 Repository (org.eclipse.jgit.lib.Repository)5 Collection (java.util.Collection)4 IOException (java.io.IOException)3 IFile (org.eclipse.core.resources.IFile)3 IResource (org.eclipse.core.resources.IResource)3 IPath (org.eclipse.core.runtime.IPath)3 Map (java.util.Map)2 CoreException (org.eclipse.core.runtime.CoreException)2 Path (org.eclipse.core.runtime.Path)2 RepositoryMapping (org.eclipse.egit.core.project.RepositoryMapping)2 Test (org.junit.Test)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IFolder (org.eclipse.core.resources.IFolder)1 IProject (org.eclipse.core.resources.IProject)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1