Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
jetbrains-plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JastAdd
jetbrains-plugin
Merge requests
!7
Resolve "IDE Exception"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "IDE Exception"
bugfix/forbidden-refresh-in-path-resolution
into
develop
Overview
0
Commits
1
Pipelines
2
Changes
1
Merged
Johannes Mey
requested to merge
bugfix/forbidden-refresh-in-path-resolution
into
develop
3 years ago
Overview
0
Commits
1
Pipelines
2
Changes
1
Expand
Closes
#11 (closed)
Edited
3 years ago
by
Johannes Mey
0
0
Merge request reports
Compare
develop
develop (base)
and
latest version
latest version
612d6bf5
1 commit,
3 years ago
1 file
+
8
−
3
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
src/main/java/org/jastadd/tooling/java/GeneratedCodeUtil.java
+
8
−
3
Options
package
org.jastadd.tooling.java
;
import
com.intellij.openapi.application.ApplicationManager
;
import
com.intellij.openapi.application.ex.ApplicationEx
;
import
com.intellij.openapi.editor.Document
;
import
com.intellij.openapi.fileEditor.FileDocumentManager
;
import
com.intellij.openapi.vfs.LocalFileSystem
;
import
com.intellij.openapi.vfs.VirtualFile
;
import
com.intellij.psi.PsiElement
;
import
com.intellij.util.ui.EDT
;
import
org.jetbrains.annotations.NotNull
;
import
java.nio.file.Paths
;
@@ -33,8 +36,11 @@ public class GeneratedCodeUtil {
}
String
path
=
jastAddFileLocation
.
substring
(
0
,
pos
);
System
.
out
.
println
(
path
);
VirtualFile
vFile
=
LocalFileSystem
.
getInstance
().
refreshAndFindFileByPath
(
path
);
// the method performing the refresh is not allowed when the following condition is not met
// see com.intellij.openapi.vfs.newvfs.RefreshQueueImpl:execute
VirtualFile
vFile
=
((
ApplicationEx
)
ApplicationManager
.
getApplication
()).
holdsReadLock
()
||
EDT
.
isCurrentThreadEdt
()
?
LocalFileSystem
.
getInstance
().
findFileByPath
(
path
)
:
LocalFileSystem
.
getInstance
().
refreshAndFindFileByPath
(
path
);
int
line
;
try
{
@@ -45,7 +51,6 @@ public class GeneratedCodeUtil {
if
(
vFile
==
null
)
{
return
Paths
.
get
(
path
).
getFileName
()
+
(
line
==
0
?
""
:
":"
+
line
);
}
System
.
out
.
println
(
line
);
Document
document
=
FileDocumentManager
.
getInstance
().
getDocument
(
vFile
);
if
(
document
==
null
)
{
Loading