mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
hotswap's listener to consider under compile output roots only: IDEA-115853 plugin project hotswaps classes from sandbox when it shouldn't
This commit is contained in:
@@ -33,7 +33,9 @@ import com.intellij.openapi.compiler.CompilationStatusListener;
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.compiler.CompilerTopics;
|
||||
import com.intellij.openapi.compiler.ex.CompilerPathsEx;
|
||||
import com.intellij.openapi.components.ProjectComponent;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
@@ -48,8 +50,10 @@ import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jps.util.JpsPathUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
@@ -302,9 +306,17 @@ public class HotSwapUIImpl extends HotSwapUI implements ProjectComponent {
|
||||
|
||||
private final AtomicReference<Map<String, List<String>>>
|
||||
myGeneratedPaths = new AtomicReference<Map<String, List<String>>>(new HashMap<String, List<String>>());
|
||||
private final Set<File> myOutputRoots;
|
||||
|
||||
private MyCompilationStatusListener() {
|
||||
myOutputRoots = new HashSet<File>();
|
||||
for (final String path : CompilerPathsEx.getOutputPaths(ModuleManager.getInstance(myProject).getModules())) {
|
||||
myOutputRoots.add(new File(path));
|
||||
}
|
||||
}
|
||||
|
||||
public void fileGenerated(String outputRoot, String relativePath) {
|
||||
if (StringUtil.endsWith(relativePath, ".class")) {
|
||||
if (StringUtil.endsWith(relativePath, ".class") && JpsPathUtil.isUnder(myOutputRoots, new File(outputRoot))) {
|
||||
// collect only classes
|
||||
final Map<String, List<String>> map = myGeneratedPaths.get();
|
||||
List<String> paths = map.get(outputRoot);
|
||||
|
||||
Reference in New Issue
Block a user