Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address deprecated APIs fixes #40 #41

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {

dependencies {
classpath "org.jetbrains.intellij.plugins:gradle-intellij-plugin:1.13.3"
classpath "org.jetbrains.intellij.plugins:gradle-grammarkit-plugin:2022.3.1"
classpath "org.jetbrains.intellij.plugins:gradle-grammarkit-plugin:2022.3.2.2"
}
}

Expand Down Expand Up @@ -70,59 +70,49 @@ java {

task generateTLAplusLexer(type: GenerateLexerTask) {
sourceFile.set(file("src/main/grammar/tlaplus.flex"))
targetDir.set("src/gen/com/mayreh/intellij/plugin/tlaplus/lexer")
targetClass.set("_TLAplusLexer")
targetOutputDir.set(layout.projectDirectory.dir("src/gen/com/mayreh/intellij/plugin/tlaplus/lexer"))
purgeOldFiles.set(true)
}

task generateTLAplusModuleBeginLexer(type: GenerateLexerTask) {
sourceFile.set(file("src/main/grammar/tlaplus_modulebegin.flex"))
targetDir.set("src/gen/com/mayreh/intellij/plugin/tlaplus/lexer")
targetClass.set("_TLAplusModuleBeginLexer")
purgeOldFiles.set(true)
targetOutputDir.set(layout.projectDirectory.dir("src/gen/com/mayreh/intellij/plugin/tlaplus/lexer"))
}

task generateTLAplusPlusCalCommentLexer(type: GenerateLexerTask) {
sourceFile.set(file("src/main/grammar/tlaplus_plus_cal_comment.flex"))
targetDir.set("src/gen/com/mayreh/intellij/plugin/tlaplus/lexer")
targetClass.set("_TLAplusPlusCalCommentLexer")
purgeOldFiles.set(true)
targetOutputDir.set(layout.projectDirectory.dir("src/gen/com/mayreh/intellij/plugin/tlaplus/lexer"))
}

task generateTLCErrorTraceLexer(type: GenerateLexerTask) {
sourceFile.set(file("src/main/grammar/tlc_error_trace.flex"))
targetDir.set("src/gen/com/mayreh/intellij/plugin/tlaplus/tlc/lexer")
targetClass.set("_TLCErrorTraceLexer")
targetOutputDir.set(layout.projectDirectory.dir("src/gen/com/mayreh/intellij/plugin/tlaplus/tlc/lexer"))
purgeOldFiles.set(true)
}

task generateTLAplusParser(type: GenerateParserTask) {
sourceFile.set(file("src/main/grammar/tlaplus.bnf"))
targetRoot.set("src/gen")
targetRootOutputDir.set(layout.projectDirectory.dir("src/gen"))
pathToParser.set("/com/mayreh/intellij/plugin/tlaplus/parser/TLAplusParser.java")
pathToPsiRoot.set("/com/mayreh/intellij/plugin/tlaplus/psi")
purgeOldFiles.set(true)
}

task generateTLCConfigParser(type: GenerateParserTask) {
sourceFile.set(file("src/main/grammar/tlc_config.bnf"))
targetRoot.set("src/gen")
targetRootOutputDir.set(layout.projectDirectory.dir("src/gen"))
pathToParser.set("/com/mayreh/intellij/plugin/tlc/parser/TLCConfigParser.java")
pathToPsiRoot.set("/com/mayreh/intellij/plugin/tlc/psi")
purgeOldFiles.set(true)
}

task generateTLCConfigLexer(type: GenerateLexerTask) {
sourceFile.set(file("src/main/grammar/tlc_config.flex"))
targetDir.set("src/gen/com/mayreh/intellij/plugin/tlc/lexer")
targetClass.set("_TLCConfigLexer")
purgeOldFiles.set(true)
targetOutputDir.set(layout.projectDirectory.dir("src/gen/com/mayreh/intellij/plugin/tlc/lexer"))
}

task generatePlusCalAlgorithmBeginLexer(type: GenerateLexerTask) {
sourceFile.set(file("src/main/grammar/plus_cal_algorithmbegin.flex"))
targetDir.set("src/gen/com/mayreh/intellij/plugin/pluscal/lexer")
targetClass.set("_PlusCalAlgorithmBeginLexer")
targetOutputDir.set(layout.projectDirectory.dir("src/gen/com/mayreh/intellij/plugin/pluscal/lexer"))
purgeOldFiles.set(true)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.DumbAwareAction;
Expand All @@ -30,6 +31,11 @@ public void update(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(e.getProject() != null);
}

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

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
if (e.getProject() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.jetbrains.annotations.Nullable;

import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
Expand Down Expand Up @@ -44,7 +45,7 @@ protected void doAction(@NotNull AnActionEvent e,
}

Pair<Context, PsiDirectory> context = maybeContext(currentModuleName, document);
FileDocumentManager.getInstance().saveAllDocuments();
ApplicationManager.getApplication().invokeLater(() -> FileDocumentManager.getInstance().saveAllDocuments());

new EvaluateExpressionDialog(project, context == null ? null : context.first, new XDebuggerEditorsProviderBase() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
Expand Down Expand Up @@ -41,6 +41,11 @@ public void update(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(currentDocument(e) != null);
}

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

@Override
public void actionPerformed(@NotNull AnActionEvent e) {
TLAplusDocument document = currentDocument(e);
Expand All @@ -57,10 +62,7 @@ public void actionPerformed(@NotNull AnActionEvent e) {
if (project == null) {
return null;
}
Editor editor = e.getData(CommonDataKeys.EDITOR_EVEN_IF_INACTIVE);
if (editor == null) {
editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
}
Editor editor = e.getData(CommonDataKeys.EDITOR);
if (editor == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public PsiElement addAfter(@NotNull PsiElement element, @Nullable PsiElement anc
}

@Override
@SuppressWarnings("deprecation")
public void checkAdd(@NotNull PsiElement element) {
delegate.checkAdd(element);
}
Expand All @@ -245,6 +246,7 @@ public void delete() {
}

@Override
@SuppressWarnings("deprecation")
public void checkDelete() {
delegate.checkDelete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class TLCRunLineMarkerContributor extends RunLineMarkerContributor {
return null;
}
AnAction[] actions = ExecutorAction.getActions(0);
return new Info(TestState.Run, e ->
StringUtil.join(ContainerUtil.mapNotNull(actions, a -> getText(a, e)), "\n"), actions);
return new Info(TestState.Run, actions, e ->
StringUtil.join(ContainerUtil.mapNotNull(actions, a -> getText(a, e)), "\n"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,23 @@
import com.intellij.execution.Executor;
import com.intellij.execution.configurations.RunProfile;
import com.intellij.execution.filters.TextConsoleBuilderImpl;
import com.intellij.execution.testframework.TestConsoleProperties;
import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties;
import com.intellij.execution.ui.ConsoleView;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileManager;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.config.Storage;
import com.mayreh.intellij.plugin.tlaplus.TLAplusFile;
import com.mayreh.intellij.plugin.tlaplus.psi.TLAplusModule;
import com.mayreh.intellij.plugin.tlaplus.run.TLCRunConfiguration;

public class TLCTestConsoleProperties extends TestConsoleProperties {
public class TLCTestConsoleProperties extends SMTRunnerConsoleProperties {
private final TLCRunConfiguration configuration;

public TLCTestConsoleProperties(TLCRunConfiguration configuration,
Executor executor) {
super(new Storage.PropertiesComponentStorage(
"TLCSupport.",
PropertiesComponent.getInstance()), configuration.getProject(), executor);
super(configuration, "TLC", executor);
this.configuration = configuration;
}

Expand Down
Loading