Skip to content

Commit

Permalink
force more methods to run in EDT
Browse files Browse the repository at this point in the history
  • Loading branch information
MCMicS committed Dec 4, 2022
1 parent 2a80c81 commit 16b676a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [Unreleased]

## [0.13.15-2]
- \#413 0.13.15-2022.2 - still not working with Intellij 2022.3

## [0.13.15]
- maximum timeout increased to 300
- add Support for 2022.3
Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pluginGroup = org.codinjutsu
pluginName = jenkins-control-plugin
# SemVer format -> https://semver.org
pluginVersion = 0.13.15
pluginVersion = 0.13.15-2

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand All @@ -22,8 +22,9 @@ platformType = IC
#platformType = CWMG
#Jetbrains Gateway
#platformType = GW
platformVersion = 222-EAP-SNAPSHOT
#platformVersion = 222-EAP-SNAPSHOT
#platformVersion = 223-EAP-SNAPSHOT
platformVersion = 2022.3
platformVersionToVerify = 222.2964.55

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.intellij.openapi.project.Project;
import com.intellij.util.messages.MessageBusConnection;
import org.codinjutsu.tools.jenkins.model.Jenkins;
import org.codinjutsu.tools.jenkins.util.GuiUtil;
import org.codinjutsu.tools.jenkins.view.BrowserPanel;

public class BrowserPanelAuthenticationHandler implements AuthenticationNotifier, Disposable {
Expand All @@ -27,19 +28,21 @@ public static BrowserPanelAuthenticationHandler getInstance(Project project) {

@Override
public void emptyConfiguration(){
browser.handleEmptyConfiguration();
GuiUtil.runInSwingThread(browser::handleEmptyConfiguration);
}

@Override
public void afterLogin(Jenkins jenkinsWorkspace) {
browser.updateWorkspace(jenkinsWorkspace);
browser.postAuthenticationInitialization();
browser.initScheduledJobs();
GuiUtil.runInSwingThread(() -> {
browser.updateWorkspace(jenkinsWorkspace);
browser.postAuthenticationInitialization();
browser.initScheduledJobs();
});
}

@Override
public void loginCancelled() {
browser.handleEmptyConfiguration();
emptyConfiguration();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
public class GuiUtil {

public static void runInSwingThread(Runnable runnable) {
// maxbe use ModalityUiUtil.invokeLaterIfNeeded
Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
runnable.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private static void visit(Job job, BuildStatusVisitor buildStatusVisitor) {
}

private void updateDoubleClickAction(@NotNull JobAction doubleClickAction) {
jobTree.updateDoubleClickAction(doubleClickAction);
GuiUtil.runInSwingThread(() -> jobTree.updateDoubleClickAction(doubleClickAction));
}

/*whole method could be moved inside of ExecutorProvider (executor would expose interface that would allow to schedule
Expand Down Expand Up @@ -274,10 +274,9 @@ public void refreshJob(Job job) {
}

private void updateJobNode(Job job) {
jobTree.updateJobNode(job);

BuildStatusAggregator buildStatusAggregator = new BuildStatusAggregator();
GuiUtil.runInSwingThread(() -> {
jobTree.updateJobNode(job);
CollectionUtil.flattenedJobs(jenkins.getJobs()).forEach(j -> visit(j, buildStatusAggregator));
JenkinsWidget.getInstance(project).updateStatusIcon(buildStatusAggregator);
});
Expand Down Expand Up @@ -501,9 +500,9 @@ public void reloadConfiguration(@NotNull JenkinsAppSettings newJenkinsAppSetting
}

public void expandSelectedJob() {
Optional.ofNullable(jobTree.getLastSelectedPathComponent())
GuiUtil.runInSwingThread(() -> Optional.ofNullable(jobTree.getLastSelectedPathComponent())
.filter(node -> node.getUserObject() instanceof JenkinsTreeNode.JobNode)
.ifPresent(node -> jobTree.getTree().expandPath(new TreePath(node.getPath())));
.ifPresent(node -> jobTree.getTree().expandPath(new TreePath(node.getPath()))));
}

private class LoadSelectedViewJob implements JenkinsBackgroundTask.JenkinsTask {
Expand Down

0 comments on commit 16b676a

Please sign in to comment.