Reduce file watcher roundups on adding/removing watch roots

This commit is contained in:
Roman Shevchenko
2012-04-16 14:21:11 +02:00
parent cef35a4663
commit 2f667d277f
10 changed files with 237 additions and 196 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -98,12 +98,7 @@ public class CompilerProjectExtensionImpl extends CompilerProjectExtension {
public void setCompilerOutputUrl(String compilerOutputUrl) {
VirtualFilePointer pointer = VirtualFilePointerManager.getInstance().create(compilerOutputUrl, myProject, null);
setCompilerOutputPointer(pointer);
final LocalFileSystem.WatchRequest watchRequest =
LocalFileSystem.getInstance().addRootToWatch(ProjectRootManagerImpl.extractLocalPath(compilerOutputUrl), true);
if (myCompilerOutputWatchRequest != null) {
LocalFileSystem.getInstance().removeWatchedRoot(myCompilerOutputWatchRequest);
}
myCompilerOutputWatchRequest = watchRequest;
myCompilerOutputWatchRequest = LocalFileSystem.getInstance().replaceWatchedRoot(myCompilerOutputWatchRequest, compilerOutputUrl, true);
}
@NotNull