mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ProjectLocator.guessProjectForFile() behavior restored
This commit is contained in:
@@ -33,14 +33,16 @@ public class ProjectLocatorImpl extends ProjectLocator {
|
||||
@Nullable
|
||||
public Project guessProjectForFile(final VirtualFile file) {
|
||||
ProjectManager projectManager = ProjectManager.getInstance();
|
||||
if (projectManager == null || file == null) return null;
|
||||
if (projectManager == null) return null;
|
||||
final Project[] projects = projectManager.getOpenProjects();
|
||||
if (projects.length == 0) return null;
|
||||
if (projects.length == 1 && !projects[0].isDisposed()) return projects[0];
|
||||
|
||||
for (Project project : projects) {
|
||||
if (project.isInitialized() && !project.isDisposed() && ProjectRootManager.getInstance(project).getFileIndex().isInContent(file)) {
|
||||
return project;
|
||||
if (file != null) {
|
||||
for (Project project : projects) {
|
||||
if (project.isInitialized() && !project.isDisposed() && ProjectRootManager.getInstance(project).getFileIndex().isInContent(file)) {
|
||||
return project;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user