Skip to content

Commit

Permalink
#2644 Added readaction to the cpanminus adapter and adjusted test to …
Browse files Browse the repository at this point in the history
…single-action
  • Loading branch information
hurricup committed Sep 30, 2023
1 parent 6451355 commit 1a4c673
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.perl5.lang.perl.cpanminus.adapter;

import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.util.NlsSafe;
Expand Down Expand Up @@ -85,7 +86,7 @@ public static boolean isAvailable(@Nullable Project project) {
public static final class Factory implements PackageManagerAdapterFactory<CpanminusAdapter> {
@Override
public @Nullable CpanminusAdapter createAdapter(@NotNull Sdk sdk, @Nullable Project project) {
return isAvailable(project) ? new CpanminusAdapter(sdk, project) : null;
return ReadAction.compute(() -> isAvailable(project) ? new CpanminusAdapter(sdk, project) : null);
}

@VisibleForTesting
Expand Down
2 changes: 1 addition & 1 deletion plugin/src/test/java/run/PerlRunTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void testMissingPackageNotification() {
assertNotNull(notification);
assertEquals(PerlBundle.message("perl.missing.library.notification"), notification.getGroupId());
assertEquals(PerlBundle.message("perl.missing.library.notification.title", "Some::Missing::Module"), notification.getTitle());
assertSize(2, notification.getActions());
assertSize(1, notification.getActions());
assertEquals(PerlBundle.message("perl.missing.library.notification.message"), notification.getContent());
}

Expand Down

0 comments on commit 1a4c673

Please sign in to comment.