mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IJPL-158659 vcs: fix missing readAction in GitToolbarWidgetAction
GitOrigin-RevId: ffeb82824c1115830a908fbf57a3616713564394
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0112a2d9c9
commit
1a89d14b2a
@@ -11,6 +11,7 @@ import com.intellij.ide.file.BatchFileChangeListener;
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.actionSystem.impl.SimpleDataContext;
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
@@ -477,18 +478,7 @@ public final class DvcsUtil {
|
||||
return root;
|
||||
}
|
||||
|
||||
// For libraries, check VCS for the owner module
|
||||
List<OrderEntry> entries = ProjectRootManager.getInstance(project).getFileIndex().getOrderEntriesForFile(file);
|
||||
Set<VirtualFile> modulesVcsRoots = new HashSet<>();
|
||||
for (OrderEntry entry : entries) {
|
||||
if (entry instanceof LibraryOrderEntry || entry instanceof JdkOrderEntry) {
|
||||
VirtualFile moduleVcsRoot = vcsManager.getVcsRootFor(entry.getOwnerModule().getModuleFile());
|
||||
if (moduleVcsRoot != null) {
|
||||
modulesVcsRoots.add(moduleVcsRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Set<VirtualFile> modulesVcsRoots = ReadAction.compute(() -> findVcsRootForModuleLibrary(project, file));
|
||||
if (modulesVcsRoots.isEmpty()) {
|
||||
LOG.debug("No library roots");
|
||||
return null;
|
||||
@@ -506,6 +496,25 @@ public final class DvcsUtil {
|
||||
return topRoot;
|
||||
}
|
||||
|
||||
/**
|
||||
* IJPL-95268 For libraries, check VCS for the owner module
|
||||
*/
|
||||
private static Set<VirtualFile> findVcsRootForModuleLibrary(@NotNull Project project, @NotNull VirtualFile file) {
|
||||
ProjectLevelVcsManager vcsManager = ProjectLevelVcsManager.getInstance(project);
|
||||
|
||||
List<OrderEntry> entries = ProjectRootManager.getInstance(project).getFileIndex().getOrderEntriesForFile(file);
|
||||
Set<VirtualFile> modulesVcsRoots = new HashSet<>();
|
||||
for (OrderEntry entry : entries) {
|
||||
if (entry instanceof LibraryOrderEntry || entry instanceof JdkOrderEntry) {
|
||||
VirtualFile moduleVcsRoot = vcsManager.getVcsRootFor(entry.getOwnerModule().getModuleFile());
|
||||
if (moduleVcsRoot != null) {
|
||||
modulesVcsRoots.add(moduleVcsRoot);
|
||||
}
|
||||
}
|
||||
}
|
||||
return modulesVcsRoots;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Prefer {@link #findVcsRootFor}, {@link #guessWidgetRepository} or {@link #guessRepositoryForOperation}.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user