mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-31 12:24:10 -08:00
Fix IDEA debugger exception. See #307
This commit is contained in:
parent
a9beef3a15
commit
a24d628603
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.teavm.idea.debug;
|
package org.teavm.idea.debug;
|
||||||
|
|
||||||
|
import com.intellij.openapi.application.ApplicationManager;
|
||||||
import com.intellij.openapi.project.Project;
|
import com.intellij.openapi.project.Project;
|
||||||
import com.intellij.openapi.roots.ProjectRootManager;
|
import com.intellij.openapi.roots.ProjectRootManager;
|
||||||
import com.intellij.openapi.vfs.VirtualFile;
|
import com.intellij.openapi.vfs.VirtualFile;
|
||||||
|
@ -67,13 +68,17 @@ public class TeaVMExecutionStack extends XExecutionStack {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
VirtualFile findVirtualFile(@NotNull String partialPath) {
|
VirtualFile findVirtualFile(@NotNull String partialPath) {
|
||||||
Stream<VirtualFile> roots = Stream.concat(
|
VirtualFile[] resultHolder = new VirtualFile[1];
|
||||||
Arrays.stream(rootManager.getContentSourceRoots()),
|
ApplicationManager.getApplication().runReadAction(() -> {
|
||||||
Arrays.stream(rootManager.orderEntries().getAllSourceRoots()));
|
Stream<VirtualFile> roots = Stream.concat(
|
||||||
return roots
|
Arrays.stream(rootManager.getContentSourceRoots()),
|
||||||
.map(sourceRoot -> sourceRoot.findFileByRelativePath(partialPath))
|
Arrays.stream(rootManager.orderEntries().getAllSourceRoots()));
|
||||||
.filter(Objects::nonNull)
|
resultHolder[0] = roots
|
||||||
.findFirst()
|
.map(sourceRoot -> sourceRoot.findFileByRelativePath(partialPath))
|
||||||
.orElse(null);
|
.filter(Objects::nonNull)
|
||||||
|
.findFirst()
|
||||||
|
.orElse(null);
|
||||||
|
});
|
||||||
|
return resultHolder[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user