Skip to content

Commit

Permalink
Use invokeLater while opening files
Browse files Browse the repository at this point in the history
  • Loading branch information
infiniteregrets authored and nizienko committed Dec 27, 2023
1 parent 4829a09 commit 7319cb7
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,25 @@ class IdeaFrame(remoteRobot: RemoteRobot, remoteComponent: RemoteComponent) :
importPackage(com.intellij.openapi.fileEditor)
importPackage(com.intellij.openapi.vfs)
importPackage(com.intellij.openapi.wm.impl)
importClass(com.intellij.openapi.application.ApplicationManager)
const path = '$path'
const frameHelper = ProjectFrameHelper.getFrameHelper(component)
if (frameHelper) {
const project = frameHelper.getProject()
const projectPath = project.getBasePath()
const file = LocalFileSystem.getInstance().findFileByPath(projectPath + '/' + path)
FileEditorManager.getInstance(project).openTextEditor(
new OpenFileDescriptor(
project,
file
), true
)
const openFileFunction = new Runnable({
run: function() {
FileEditorManager.getInstance(project).openTextEditor(
new OpenFileDescriptor(
project,
file
), true
)
}
})
ApplicationManager.getApplication().invokeLater(openFileFunction)
}
""", true
)
Expand Down

0 comments on commit 7319cb7

Please sign in to comment.