Search in sources :

Example 16 with IndexDiffCache

use of org.eclipse.egit.core.internal.indexdiff.IndexDiffCache 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 IndexDiffCache

use of org.eclipse.egit.core.internal.indexdiff.IndexDiffCache 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

IndexDiffCache (org.eclipse.egit.core.internal.indexdiff.IndexDiffCache)17 IndexDiffCacheEntry (org.eclipse.egit.core.internal.indexdiff.IndexDiffCacheEntry)8 Repository (org.eclipse.jgit.lib.Repository)8 File (java.io.File)5 Collection (java.util.Collection)4 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 IProject (org.eclipse.core.resources.IProject)3 IndexDiffData (org.eclipse.egit.core.internal.indexdiff.IndexDiffData)3 IOException (java.io.IOException)2 IFile (org.eclipse.core.resources.IFile)2 IFolder (org.eclipse.core.resources.IFolder)2 IResource (org.eclipse.core.resources.IResource)2 IPath (org.eclipse.core.runtime.IPath)2 Path (org.eclipse.core.runtime.Path)2 CommitOperation (org.eclipse.egit.core.op.CommitOperation)2 ConnectProviderOperation (org.eclipse.egit.core.op.ConnectProviderOperation)2 SWTBotTree (org.eclipse.swtbot.swt.finder.widgets.SWTBotTree)2 SWTBotTreeItem (org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem)2 Test (org.junit.Test)2