set "scan required" flag in DebugSession if hotswap was cancelled

This commit is contained in:
Eugene Zhuravlev
2013-10-31 17:33:52 +01:00
parent 804b35ab80
commit 22393787b9
2 changed files with 21 additions and 4 deletions
@@ -155,6 +155,10 @@ public class HotSwapManager extends AbstractProjectComponent {
}
private void reloadClasses(DebuggerSession session, Map<String, HotSwapFile> classesToReload, HotSwapProgress progress) {
if (progress.isCancelled()) {
session.setModifiedClassesScanRequired(true);
return;
}
final long newSwapTime = System.currentTimeMillis();
new ReloadClassesWorker(session, progress).reloadClasses(classesToReload);
setTimeStamp(session, newSwapTime);
@@ -220,7 +224,13 @@ public class HotSwapManager extends AbstractProjectComponent {
swapProgress.setTitle(DebuggerBundle.message("progress.hotswap.scanning.classes"));
scanClassesCommand.run();
return swapProgress.isCancelled() ? new HashMap<DebuggerSession, Map<String, HotSwapFile>>() : modifiedClasses;
if (swapProgress.isCancelled()) {
for (DebuggerSession session : sessions) {
session.setModifiedClassesScanRequired(true);
}
return new HashMap<DebuggerSession, Map<String, HotSwapFile>>();
}
return modifiedClasses;
}
public static void reloadModifiedClasses(final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses, final HotSwapProgress reloadClassesProgress) {
@@ -240,6 +250,10 @@ public class HotSwapManager extends AbstractProjectComponent {
debuggerSession, modifiedClasses.get(debuggerSession), reloadClassesProgress
);
}
protected void commandCancelled() {
debuggerSession.setModifiedClassesScanRequired(true);
}
});
}
@@ -19,11 +19,11 @@ import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
import com.intellij.openapi.util.Pair;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
public class MultiProcessCommand implements Runnable{
private final List<Pair<DebugProcessImpl, DebuggerCommandImpl>> myCommands = new ArrayList<Pair<DebugProcessImpl, DebuggerCommandImpl>>();
private final List<Pair<DebugProcessImpl, DebuggerCommandImpl>> myCommands = new LinkedList<Pair<DebugProcessImpl, DebuggerCommandImpl>>();
public void run() {
while(true) {
@@ -40,7 +40,10 @@ public class MultiProcessCommand implements Runnable{
public void cancel() {
synchronized(myCommands) {
myCommands.clear();
while (!myCommands.isEmpty()) {
Pair<DebugProcessImpl, DebuggerCommandImpl> pair = myCommands.remove(0);
pair.getSecond().notifyCancelled();
}
}
}