External system api: avoid calling getPath() when watched files changed (IDEA-190829)

This commit is contained in:
Vladislav.Soroka
2018-05-16 15:26:52 +03:00
parent 8c208f0216
commit f4cd919eae
@@ -41,6 +41,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.*;
import com.intellij.openapi.vfs.newvfs.events.VFileContentChangeEvent;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
@@ -551,9 +552,10 @@ public class ExternalSystemProjectsWatcherImpl extends ExternalSystemTaskNotific
protected boolean isRelevant(String path) {
if (!myKnownFiles.get(path).isEmpty()) return true;
String canonicalPath = FileUtil.toCanonicalPath(path);
for (VirtualFilePointer pointer : myFilesPointers.keySet()) {
VirtualFile f = pointer.getFile();
if (f != null && FileUtil.pathsEqual(path, f.getPath())) {
String filePath = VfsUtilCore.urlToPath(pointer.getUrl());
if (StringUtil.isNotEmpty(filePath) && FileUtil.namesEqual(canonicalPath, FileUtil.toCanonicalPath(filePath))) {
for (String projectPath : myFilesPointers.get(pointer)) {
myKnownFiles.putValue(path, projectPath);
myKnownAffectedFiles.putValue(projectPath, path);