Commit 824c902f authored by agurov's avatar agurov

cant't save file or build waiting for user operation (bug 472752)

https://bugs.eclipse.org/bugs/show_bug.cgi?id=472752

git-svn-id: https://dev.eclipse.org/svnroot/technology/org.eclipse.subversive/trunk@21490 ee007c2a-0a25-0410-9ab9-bf268980928c
parent 6c8ee34b
......@@ -65,20 +65,19 @@ public class ResourceChangeListener implements IResourceChangeListener, ISavePar
if (!FileUtility.isConnected(resource)) {
return false;
}
if (FileUtility.isSVNInternals(resource)) {
IContainer parent = resource.getParent();
modified.add(parent);
if (parent.exists()) {
modified.addAll(Arrays.asList(parent.members()));
}
return false;
}
if (delta.getKind() == IResourceDelta.ADDED ||
delta.getKind() == IResourceDelta.REMOVED) {
if (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.REMOVED) {
if (FileUtility.isSVNInternals(resource)) {
IContainer parent = resource.getParent();
modified.add(parent);
if (parent.exists()) {
modified.addAll(Arrays.asList(parent.members()));
}
return false;
}
modified.add(resource);
}
if (delta.getKind() == IResourceDelta.CHANGED) {
else if (delta.getKind() == IResourceDelta.CHANGED) {
int flags = delta.getFlags();
if (resource instanceof IContainer && (flags & ResourceChangeListener.INTERESTING_CHANGES) != 0 ||
resource instanceof IFile && (flags & (ResourceChangeListener.INTERESTING_CHANGES | IResourceDelta.CONTENT)) != 0) {
......@@ -90,13 +89,12 @@ public class ResourceChangeListener implements IResourceChangeListener, ISavePar
}
}, IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS);
// reset statuses only for changed resources
// reset statuses only for changed resources, but notify regarding all and including parents
IResource []resources = modified.toArray(new IResource[modified.size()]);
SVNRemoteStorage.instance().refreshLocalResources(resources, IResource.DEPTH_INFINITE);
// but notify including parents
SVNRemoteStorage.instance().fireResourceStatesChangedEvent(new ResourceStatesChangedEvent(FileUtility.getPathNodes(resources), IResource.DEPTH_ZERO, ResourceStatesChangedEvent.PATH_NODES));
SVNRemoteStorage.instance().fireResourceStatesChangedEvent(new ResourceStatesChangedEvent(resources, IResource.DEPTH_ZERO, ResourceStatesChangedEvent.CHANGED_NODES));
SVNRemoteStorage.instance().scheduleRefresh(
resources, IResource.DEPTH_INFINITE,
new ResourceStatesChangedEvent(FileUtility.getPathNodes(resources), IResource.DEPTH_ZERO, ResourceStatesChangedEvent.PATH_NODES),
new ResourceStatesChangedEvent(resources, IResource.DEPTH_ZERO, ResourceStatesChangedEvent.CHANGED_NODES));
}
});
}
......
......@@ -132,6 +132,7 @@ public class SVNRemoteStorage extends AbstractSVNStorage implements IRemoteStora
protected Map parent2Children;
protected Map<Class, List<IResourceStatesListener>> resourceStateListeners;
protected LinkedList fetchQueue;
protected LinkedList refreshQueue;
protected long lastMonitorTime;
protected Map<IResource, File> changeMonitorMap;
......@@ -824,6 +825,53 @@ public class SVNRemoteStorage extends AbstractSVNStorage implements IRemoteStora
return retVal;
}
public void scheduleRefresh(IResource []resources, int depth, ResourceStatesChangedEvent pathEvent, ResourceStatesChangedEvent resourcesEvent) {
synchronized (this.refreshQueue) {
this.refreshQueue.add(new Object[] {resources, Integer.valueOf(depth), pathEvent, resourcesEvent});
if (this.refreshQueue.size() == 1) {
ProgressMonitorUtility.doTaskScheduledDefault(new AbstractActionOperation("Operation_UpdateSVNCache", SVNMessages.class) { //$NON-NLS-1$
public ISchedulingRule getSchedulingRule() {
return null;
}
protected void runImpl(IProgressMonitor monitor) throws Exception {
while (true) {
IResource []resources;
int depth;
ResourceStatesChangedEvent pathEvent;
ResourceStatesChangedEvent resourcesEvent;
synchronized (SVNRemoteStorage.this.refreshQueue) {
if (monitor.isCanceled() || SVNRemoteStorage.this.refreshQueue.size() == 0) {
SVNRemoteStorage.this.refreshQueue.clear();
break;
}
Object []entry = (Object [])SVNRemoteStorage.this.refreshQueue.get(0);
resources = (IResource [])entry[0];
depth = (Integer)entry[1];
pathEvent = (ResourceStatesChangedEvent)entry[2];
resourcesEvent = (ResourceStatesChangedEvent)entry[3];
}
if (resources != null) {
SVNRemoteStorage.instance().refreshLocalResources(resources, depth);
}
if (pathEvent != null) {
SVNRemoteStorage.instance().fireResourceStatesChangedEvent(pathEvent);
}
if (resourcesEvent != null) {
SVNRemoteStorage.instance().fireResourceStatesChangedEvent(resourcesEvent);
}
synchronized (SVNRemoteStorage.this.refreshQueue) {
SVNRemoteStorage.this.refreshQueue.remove(0);
if (SVNRemoteStorage.this.refreshQueue.size() == 0) {
break;
}
}
}
}
}, false);
}
}
}
protected void scheduleStatusesFetch(SVNChangeStatus []st, IResource target) {
synchronized (this.fetchQueue) {
this.fetchQueue.add(new Object[] {st, target});
......@@ -1431,6 +1479,7 @@ public class SVNRemoteStorage extends AbstractSVNStorage implements IRemoteStora
this.externalsLocations = new HashMap();
this.resourceStateListeners = new HashMap<Class, List<IResourceStatesListener>>();
this.fetchQueue = new LinkedList();
this.refreshQueue = new LinkedList();
this.lastMonitorTime = System.currentTimeMillis();
this.changeMonitorMap = new HashMap<IResource, File>();
}
......
......@@ -516,11 +516,15 @@ public final class FileUtility {
}
public static boolean isSVNInternals(IResource resource) {
if (SVNUtility.getSVNFolderName().equals(resource.getName())) {
return true;
return FileUtility.getSVNFolder(resource) != null;
}
public static IResource getSVNFolder(IResource resource) {
if (resource.getType() == IResource.FOLDER && SVNUtility.getSVNFolderName().equals(resource.getName())) {
return resource;
}
IResource parent = resource.getParent();
return parent == null ? false : FileUtility.isSVNInternals(parent);
return parent == null ? null : FileUtility.getSVNFolder(parent);
}
public static void findAndMarkSVNInternals(IResource node, boolean isTeamPrivate) throws CoreException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment