use of org.eclipse.egit.core.internal.indexdiff.GitResourceDeltaVisitor in project egit by eclipse.
the class GitSubscriberMergeContext method scanDeltaAndRefresh.
private void scanDeltaAndRefresh(RepositoryMapping mapping, IResourceDelta delta) {
Repository repo = mapping.getRepository();
GitResourceDeltaVisitor visitor = new GitResourceDeltaVisitor(repo);
try {
delta.accept(visitor);
Collection<IFile> files = visitor.getFileResourcesToUpdate();
if (files != null && files.isEmpty())
return;
for (GitSynchronizeData gsd : gsds) {
if (repo.equals(gsd.getRepository()))
refreshResources(files);
}
} catch (CoreException e) {
Activator.logError(e.getMessage(), e);
}
}
use of org.eclipse.egit.core.internal.indexdiff.GitResourceDeltaVisitor in project egit by eclipse.
the class GitResourceDeltaTestHelper method setUp.
public void setUp() {
resourceChangeListener = new IResourceChangeListener() {
@Override
public void resourceChanged(final IResourceChangeEvent event) {
try {
event.getDelta().accept(new IResourceDeltaVisitor() {
@Override
public boolean visit(IResourceDelta delta) throws CoreException {
final IResource resource = delta.getResource();
IProject project = resource.getProject();
if (project == null)
return true;
RepositoryMapping mapping = RepositoryMapping.getMapping(resource);
if (mapping == null)
return true;
if (mapping.getRepository() != repository)
return false;
GitResourceDeltaVisitor visitor = new GitResourceDeltaVisitor(repository);
try {
event.getDelta().accept(visitor);
} catch (CoreException e) {
String msg = "Exception during accept of GitResourceDeltaVisitor for resource delta";
throw new RuntimeException(msg, e);
}
IPath gitDirAbsolutePath = mapping.getGitDirAbsolutePath();
for (IResource res : visitor.getResourcesToUpdate()) {
if (ignoreTeamPrivateMember && (res.isTeamPrivateMember() || gitDirAbsolutePath.isPrefixOf(res.getRawLocation().makeAbsolute())))
continue;
changedResources.add(res);
}
return false;
}
});
} catch (CoreException e) {
throw new RuntimeException("Exception during accept of test visitor for resource delta", e);
}
}
};
ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
}
Aggregations