diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/HotSwapManager.java b/java/debugger/impl/src/com/intellij/debugger/impl/HotSwapManager.java index 82f11ba51276..f531717f6bdd 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/HotSwapManager.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/HotSwapManager.java @@ -84,6 +84,9 @@ public class HotSwapManager extends AbstractProjectComponent { CompilerPathsEx.visitFiles(allDirs, new CompilerPathsEx.FileVisitor() { protected void acceptDirectory(final VirtualFile file, final String fileRoot, final String filePath) { + if (progress.isCancelled()) { + return; + } progress.setText(DebuggerBundle.message("progress.hotswap.scanning.path", filePath)); if(file.getFileSystem() instanceof JarFileSystem && FileTypes.ARCHIVE.equals(fileTypeManager.getFileTypeByFile(file))) { if(file.getTimeStamp() > timeStamp) { @@ -96,6 +99,9 @@ public class HotSwapManager extends AbstractProjectComponent { } protected void acceptFile(VirtualFile file, String fileRoot, String filePath) { + if (progress.isCancelled()) { + return; + } if (file.getTimeStamp() > timeStamp && StdFileTypes.CLASS.equals(fileTypeManager.getFileTypeByFile(file))) { //noinspection HardCodedStringLiteral if (SystemInfo.isFileSystemCaseSensitive? filePath.endsWith(CLASS_EXTENSION) : StringUtil.endsWithIgnoreCase(filePath, CLASS_EXTENSION)) { diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/HotSwapProgress.java b/java/debugger/impl/src/com/intellij/debugger/impl/HotSwapProgress.java index 97db498ead0d..55b3fe19b922 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/HotSwapProgress.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/HotSwapProgress.java @@ -25,7 +25,7 @@ import com.intellij.openapi.project.Project; public abstract class HotSwapProgress { private final Project myProject; private Runnable myCancelWorker; - private boolean myIsCancelled; + private volatile boolean myIsCancelled; public HotSwapProgress(Project project) { myProject = project;