mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
removing unused code
This commit is contained in:
@@ -20,9 +20,7 @@ import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
|
||||
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.compiler.ex.CompilerPathsEx;
|
||||
import com.intellij.openapi.components.AbstractProjectComponent;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.OrderEnumerator;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
@@ -69,59 +67,26 @@ public class HotSwapManager extends AbstractProjectComponent {
|
||||
myTimeStamps.put(session, Long.valueOf(tStamp));
|
||||
}
|
||||
|
||||
public Map<String, HotSwapFile> scanForModifiedClasses(final DebuggerSession session, final HotSwapProgress progress, final boolean scanWithVFS) {
|
||||
public Map<String, HotSwapFile> scanForModifiedClasses(final DebuggerSession session, final HotSwapProgress progress) {
|
||||
DebuggerManagerThreadImpl.assertIsManagerThread();
|
||||
|
||||
final long timeStamp = getTimeStamp(session);
|
||||
final Map<String, HotSwapFile> modifiedClasses = new HashMap<>();
|
||||
|
||||
if (scanWithVFS) {
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
public void run() {
|
||||
final List<VirtualFile> allDirs = OrderEnumerator.orderEntries(myProject).withoutSdk().withoutLibraries().getPathsList().getRootDirs();
|
||||
CompilerPathsEx.visitFiles(allDirs, new CompilerPathsEx.FileVisitor() {
|
||||
protected void acceptDirectory(final VirtualFile file, final String fileRoot, final String filePath) {
|
||||
if (!progress.isCancelled()) {
|
||||
progress.setText(DebuggerBundle.message("progress.hotswap.scanning.path", filePath));
|
||||
super.acceptDirectory(file, fileRoot, filePath);
|
||||
}
|
||||
}
|
||||
|
||||
protected void acceptFile(VirtualFile file, String fileRoot, String filePath) {
|
||||
if (progress.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
if (file.getTimeStamp() > timeStamp && StdFileTypes.CLASS.equals(file.getFileType())) {
|
||||
//noinspection HardCodedStringLiteral
|
||||
if (SystemInfo.isFileSystemCaseSensitive ? filePath.endsWith(CLASS_EXTENSION) : StringUtil.endsWithIgnoreCase(filePath, CLASS_EXTENSION)) {
|
||||
progress.setText(DebuggerBundle.message("progress.hotswap.scanning.path", filePath));
|
||||
//noinspection HardCodedStringLiteral
|
||||
final String qualifiedName = filePath.substring(fileRoot.length() + 1, filePath.length() - CLASS_EXTENSION.length()).replace('/', '.');
|
||||
modifiedClasses.put(qualifiedName, new HotSwapFile(new File(filePath)));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
final List<File> outputRoots = new ArrayList<>();
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
public void run() {
|
||||
final List<VirtualFile> allDirs = OrderEnumerator.orderEntries(myProject).withoutSdk().withoutLibraries().getPathsList().getRootDirs();
|
||||
for (VirtualFile dir : allDirs) {
|
||||
outputRoots.add(new File(dir.getPath()));
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
final List<File> outputRoots = new ArrayList<>();
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
public void run() {
|
||||
final List<VirtualFile> allDirs = OrderEnumerator.orderEntries(myProject).withoutSdk().withoutLibraries().getPathsList().getRootDirs();
|
||||
for (VirtualFile dir : allDirs) {
|
||||
outputRoots.add(new File(dir.getPath()));
|
||||
}
|
||||
}
|
||||
});
|
||||
for (File root : outputRoots) {
|
||||
final String rootPath = FileUtil.toCanonicalPath(root.getPath());
|
||||
collectModifiedClasses(root, rootPath, rootPath + "/", modifiedClasses, progress, timeStamp);
|
||||
}
|
||||
});
|
||||
for (File root : outputRoots) {
|
||||
final String rootPath = FileUtil.toCanonicalPath(root.getPath());
|
||||
collectModifiedClasses(root, rootPath, rootPath + "/", modifiedClasses, progress, timeStamp);
|
||||
}
|
||||
|
||||
|
||||
return modifiedClasses;
|
||||
}
|
||||
|
||||
@@ -197,7 +162,8 @@ public class HotSwapManager extends AbstractProjectComponent {
|
||||
}
|
||||
|
||||
|
||||
public static Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClasses(final List<DebuggerSession> sessions, final HotSwapProgress swapProgress, final boolean scanWithVFS) {
|
||||
public static Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClasses(final List<DebuggerSession> sessions,
|
||||
final HotSwapProgress swapProgress) {
|
||||
final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses = new HashMap<>();
|
||||
|
||||
final MultiProcessCommand scanClassesCommand = new MultiProcessCommand();
|
||||
@@ -214,7 +180,7 @@ public class HotSwapManager extends AbstractProjectComponent {
|
||||
protected void action() throws Exception {
|
||||
swapProgress.setDebuggerSession(debuggerSession);
|
||||
final Map<String, HotSwapFile> sessionClasses =
|
||||
getInstance(swapProgress.getProject()).scanForModifiedClasses(debuggerSession, swapProgress, scanWithVFS);
|
||||
getInstance(swapProgress.getProject()).scanForModifiedClasses(debuggerSession, swapProgress);
|
||||
if (!sessionClasses.isEmpty()) {
|
||||
modifiedClasses.put(debuggerSession, sessionClasses);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiDocumentManager;
|
||||
import com.intellij.util.PairFunction;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -141,9 +140,6 @@ public class HotSwapUIImpl extends HotSwapUI implements ProjectComponent {
|
||||
final boolean shouldAskBeforeHotswap = myAskBeforeHotswap;
|
||||
myAskBeforeHotswap = true;
|
||||
|
||||
// need this because search with PSI is perormed during hotswap
|
||||
PsiDocumentManager.getInstance(myProject).commitAllDocuments();
|
||||
|
||||
final DebuggerSettings settings = DebuggerSettings.getInstance();
|
||||
final String runHotswap = settings.RUN_HOTSWAP_AFTER_COMPILE;
|
||||
final boolean shouldDisplayHangWarning = shouldDisplayHangWarning(settings, sessions);
|
||||
@@ -173,7 +169,7 @@ public class HotSwapUIImpl extends HotSwapUI implements ProjectComponent {
|
||||
public void run() {
|
||||
final Map<DebuggerSession, Map<String, HotSwapFile>> modifiedClasses;
|
||||
if (shouldPerformScan) {
|
||||
modifiedClasses = scanForModifiedClassesWithProgress(sessions, findClassesProgress, false);
|
||||
modifiedClasses = scanForModifiedClassesWithProgress(sessions, findClassesProgress);
|
||||
}
|
||||
else {
|
||||
final List<DebuggerSession> toScan = new ArrayList<>();
|
||||
@@ -187,7 +183,7 @@ public class HotSwapUIImpl extends HotSwapUI implements ProjectComponent {
|
||||
modifiedClasses.putAll(HotSwapManager.findModifiedClasses(toUseGenerated, generatedPaths));
|
||||
}
|
||||
if (!toScan.isEmpty()) {
|
||||
modifiedClasses.putAll(scanForModifiedClassesWithProgress(toScan, findClassesProgress, !true));
|
||||
modifiedClasses.putAll(scanForModifiedClassesWithProgress(toScan, findClassesProgress));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,13 +252,12 @@ public class HotSwapUIImpl extends HotSwapUI implements ProjectComponent {
|
||||
}
|
||||
|
||||
private static Map<DebuggerSession, Map<String, HotSwapFile>> scanForModifiedClassesWithProgress(final List<DebuggerSession> sessions,
|
||||
final HotSwapProgressImpl progress,
|
||||
final boolean scanWithVFS) {
|
||||
final HotSwapProgressImpl progress) {
|
||||
final Ref<Map<DebuggerSession, Map<String, HotSwapFile>>> result = Ref.create(null);
|
||||
ProgressManager.getInstance().runProcess(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
result.set(HotSwapManager.scanForModifiedClasses(sessions, progress, scanWithVFS));
|
||||
result.set(HotSwapManager.scanForModifiedClasses(sessions, progress));
|
||||
}
|
||||
finally {
|
||||
progress.finished();
|
||||
|
||||
Reference in New Issue
Block a user