Skip to content

fix Compatibility #297

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

Merged
merged 1 commit into from
Mar 19, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.intellij.diagnostic.AbstractMessage;
import com.intellij.openapi.diagnostic.ErrorReportSubmitter;
import com.intellij.openapi.diagnostic.IdeaLoggingEvent;
import com.intellij.openapi.diagnostic.SubmittedReportInfo;
import com.intellij.util.Consumer;
import com.shuzijun.leetcode.plugin.utils.PropertiesUtils;
import com.shuzijun.leetcode.plugin.utils.SentryUtils;
Expand All @@ -23,7 +22,7 @@ public String getReportActionText() {
}

@Override
public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo, @NotNull Component parentComponent, @NotNull Consumer<SubmittedReportInfo> consumer) {
public boolean submit(@NotNull IdeaLoggingEvent[] events, @Nullable String additionalInfo, @NotNull Component parentComponent, @NotNull Consumer consumer) {
for (IdeaLoggingEvent event : events) {
Throwable throwable = event.getThrowable();
if (event.getData() instanceof AbstractMessage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.intellij.ide.DataManager;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowFactory;
Expand All @@ -13,6 +14,7 @@
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.util.concurrent.atomic.AtomicReference;

/**
* @author shuzijun
Expand All @@ -33,9 +35,13 @@ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindo
}

public static DataContext getDataContext(@NotNull Project project) {
ToolWindow leetcodeToolWindows = ToolWindowManager.getInstance(project).getToolWindow(ID);
DataContext dataContext = DataManager.getInstance().getDataContext(leetcodeToolWindows.getContentManager().getContent(0).getComponent());
return dataContext;
AtomicReference<DataContext> dataContext = new AtomicReference<>();
ApplicationManager.getApplication().invokeAndWait(() -> {

ToolWindow leetcodeToolWindows = ToolWindowManager.getInstance(project).getToolWindow(ID);
dataContext.set(DataManager.getInstance().getDataContext(leetcodeToolWindows.getContentManager().getContent(0).getComponent()));
});
return dataContext.get();
}

public static void updateTitle(@NotNull Project project, String userName) {
Expand Down