Skip to content

Commit

Permalink
fix: more fixes for #696
Browse files Browse the repository at this point in the history
  • Loading branch information
bjansen committed Oct 6, 2024
1 parent 9e72fd9 commit 80b655b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void update(AnActionEvent e) {
if ( editor!=null ) {
Point mousePosition = editor.getContentComponent().getMousePosition();
if ( mousePosition!=null ) {
LogicalPosition pos = editor.xyToLogicalPosition(mousePosition);
LogicalPosition pos = e.getUpdateSession().compute(this, "xyToLogicalPosition", ActionUpdateThread.EDT, () -> editor.xyToLogicalPosition(mousePosition));
int offset = editor.logicalPositionToOffset(pos);
PsiFile file = e.getData(LangDataKeys.PSI_FILE);
if ( file!=null ) {
Expand Down Expand Up @@ -85,7 +85,7 @@ public void update(AnActionEvent e) {

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.EDT;
return ActionUpdateThread.BGT;
}

@Override
Expand Down
25 changes: 25 additions & 0 deletions src/main/java/org/antlr/intellij/plugin/preview/PreviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ public boolean isSelected(@NotNull AnActionEvent e) {
public void setSelected(@NotNull AnActionEvent e, boolean state) {
autoRefresh = state;
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}
};
ToggleAction scrollFromSourceBtn = new ToggleAction("Scroll from Source", null, AutoscrollFromSource) {
@Override
Expand All @@ -148,6 +153,11 @@ public boolean isSelected(@NotNull AnActionEvent e) {
public void setSelected(@NotNull AnActionEvent e, boolean state) {
scrollFromSource = state;
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}
};
ToggleAction scrollToSourceBtn = new ToggleAction("Highlight Source", null, Find) {
@Override
Expand All @@ -159,6 +169,11 @@ public boolean isSelected(@NotNull AnActionEvent e) {
public void setSelected(@NotNull AnActionEvent e, boolean state) {
highlightSource = state;
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}
};
ToggleAction autoBuildTree = new ToggleAction("Build parse tree after parse",null,AllIcons.Toolwindows.ToolWindowHierarchy) {
@Override
Expand All @@ -168,6 +183,11 @@ public boolean isSelected(@NotNull AnActionEvent e) {

@Override
public void setSelected(@NotNull AnActionEvent e, boolean state) { buildTree = state; }

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}
};
ToggleAction autoBuildHier = new ToggleAction("Build hierarchy after parse",null,AllIcons.Actions.ShowAsTree) {
@Override
Expand All @@ -179,6 +199,11 @@ public boolean isSelected(@NotNull AnActionEvent e) {
public void setSelected(@NotNull AnActionEvent e, boolean state) {
buildHierarchy = state;
}

@Override
public @NotNull ActionUpdateThread getActionUpdateThread() {
return ActionUpdateThread.BGT;
}
};

DefaultActionGroup actionGroup = new DefaultActionGroup(
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ For really big files and slow grammars, there is an appreciable delay when displ

<change-notes><![CDATA[
<ul>
<li>Fixed syntax highlighting in 2024.1 EAP (<a href="https://github.com/antlr/intellij-plugin-v4/issues/691">#691</a>)</li>
<li>Explain when a grammar might lack the `parser` keyword (<a href="https://github.com/antlr/intellij-plugin-v4/issues/687">#687</a>)</li>
<li>Removed usages of `ActionUpdateThread.OLD_EDT` (<a href="https://github.com/antlr/intellij-plugin-v4/issues/696">#696</a>)</li>
<li>Updated ANTLR to 4.13.2</li>
</ul>
See the complete list of <a href="https://github.com/antlr/intellij-plugin-v4/issues?q=milestone%3A1.23.1fix+is%3Aclosed">fixed issues</a>.
See the complete list of <a href="https://github.com/antlr/intellij-plugin-v4/issues?q=milestone%3A1.24+is%3Aclosed">fixed issues</a>.
]]>
</change-notes>

Expand Down

0 comments on commit 80b655b

Please sign in to comment.