mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduce PyPsiFacade; extract interface from QualifiedNameResolver
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="core-api" />
|
||||
<orderEntry type="module" module-name="projectModel-api" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.jetbrains.python.psi;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.jetbrains.python.psi.impl.PyQualifiedName;
|
||||
import com.jetbrains.python.psi.resolve.QualifiedNameResolver;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public abstract class PyPsiFacade {
|
||||
public static PyPsiFacade getInstance(Project project) {
|
||||
return ServiceManager.getService(project, PyPsiFacade.class);
|
||||
}
|
||||
|
||||
public abstract QualifiedNameResolver qualifiedNameResolver(String qNameString);
|
||||
public abstract QualifiedNameResolver qualifiedNameResolver(PyQualifiedName qualifiedName);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.jetbrains.python.psi.resolve;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFileSystemItem;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public interface QualifiedNameResolver {
|
||||
QualifiedNameResolver fromElement(@NotNull PsiElement foothold);
|
||||
|
||||
QualifiedNameResolver fromModule(@NotNull Module module);
|
||||
|
||||
QualifiedNameResolver withAllModules();
|
||||
|
||||
QualifiedNameResolver withSdk(Sdk sdk);
|
||||
|
||||
QualifiedNameResolver withRelative(int relativeLevel);
|
||||
|
||||
QualifiedNameResolver withoutRoots();
|
||||
|
||||
QualifiedNameResolver withPlainDirectories();
|
||||
|
||||
@NotNull
|
||||
List<PsiFileSystemItem> resultsAsList();
|
||||
|
||||
@Nullable
|
||||
PsiFileSystemItem firstResult();
|
||||
|
||||
@NotNull
|
||||
<T extends PsiElement> List<T> resultsOfType(Class<T> clazz);
|
||||
|
||||
@Nullable
|
||||
<T extends PsiElement> T firstResultOfType(Class<T> clazz);
|
||||
}
|
||||
Reference in New Issue
Block a user