本文整理汇总了Java中com.intellij.psi.impl.file.PsiPackageImpl类的典型用法代码示例。如果您正苦于以下问题:Java PsiPackageImpl类的具体用法?Java PsiPackageImpl怎么用?Java PsiPackageImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PsiPackageImpl类属于com.intellij.psi.impl.file包,在下文中一共展示了PsiPackageImpl类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSubPackages
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@NotNull
@Override
public PsiPackage[] getSubPackages(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
final Map<String, PsiPackage> packagesMap = new HashMap<String, PsiPackage>();
final String qualifiedName = psiPackage.getQualifiedName();
for (final String prefix : myPackagePrefixIndex.getAllPackagePrefixes(scope)) {
if (StringUtil.isEmpty(qualifiedName) || StringUtil.startsWithConcatenation(prefix, qualifiedName, ".")) {
final int i = prefix.indexOf('.', qualifiedName.length() + 1);
String childName = i >= 0 ? prefix.substring(0, i) : prefix;
if (!packagesMap.containsKey(childName)) {
packagesMap.put(childName, new PsiPackageImpl(psiPackage.getManager(), childName));
}
}
}
packagesMap.remove(qualifiedName); // avoid SOE caused by returning a package as a subpackage of itself
return packagesMap.values().toArray(new PsiPackage[packagesMap.size()]);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PackagePrefixElementFinder.java
示例2: getSubPackages
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@NotNull
@Override
public PsiPackage[] getSubPackages(@NotNull PsiPackage psiPackage, @NotNull GlobalSearchScope scope) {
final Map<String, PsiPackage> packagesMap = new HashMap<String, PsiPackage>();
final String qualifiedName = psiPackage.getQualifiedName();
for (final String prefix : myPackagePrefixIndex.getAllPackagePrefixes(scope)) {
if (StringUtil.isEmpty(qualifiedName) || StringUtil.startsWithConcatenation(prefix, qualifiedName, ".")) {
final int i = prefix.indexOf('.', qualifiedName.length() + 1);
String childName = i >= 0 ? prefix.substring(0, i) : prefix;
if (!packagesMap.containsKey(childName)) {
packagesMap.put(childName, new PsiPackageImpl((PsiManagerEx)psiPackage.getManager(), childName));
}
}
}
packagesMap.remove(qualifiedName); // avoid SOE caused by returning a package as a subpackage of itself
return packagesMap.values().toArray(new PsiPackage[packagesMap.size()]);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:PackagePrefixElementFinder.java
示例3: findPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@Nullable
@Override
@RequiredReadAction
public PsiJavaPackage findPackage(@NotNull String qualifiedName)
{
if(qualifiedName.equals("cli"))
{
return new PsiPackageImpl(myPsiManager, myPsiPackageManager, JavaModuleExtension.class, qualifiedName);
}
if(qualifiedName.startsWith("cli."))
{
PsiPackage aPackage = PsiPackageManager.getInstance(myProject).findPackage(qualifiedName.substring(4, qualifiedName.length()),
JavaModuleExtension.class);
if(aPackage != null)
{
return new PsiPackageImpl(myPsiManager, myPsiPackageManager, JavaModuleExtension.class, qualifiedName);
}
}
return super.findPackage(qualifiedName);
}
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:22,代码来源:IkvmPsiElementFinder.java
示例4: intellijComplete
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@NeovimHandler("IntellijComplete")
public DeopleteItem[] intellijComplete(final String path, final String bufferContents,
final int row, final int col) {
LookupElement[] c = mEmbeditorRequestHandler.getCompletionVariants(path, bufferContents, row, col);
if (c.length < 0) return null;
DeopleteHelper dh = new DeopleteHelper();
UIUtil.invokeAndWaitIfNeeded((Runnable) () -> {
for (LookupElement i : c) {
if (i instanceof PsiPackage
|| i instanceof LookupElementBuilder
|| i.getPsiElement() instanceof PsiPackageImpl) {
dh.add(i.getLookupString(), "", "");
continue;
}
String word = i.getLookupString();
List<String> params = new ArrayList<String>();
String info;
String kind = "";
PsiElement psiElement = i.getPsiElement();
if (psiElement == null) {
dh.add(word, "", "");
continue;
}
for (PsiElement e : psiElement.getChildren()) {
if (e instanceof PsiParameterList) {
for (PsiParameter param : ((PsiParameterList)e).getParameters()) {
params.add(param.getTypeElement().getText() + " " + param.getName());
}
} else if (e instanceof PsiTypeElement) {
kind = e.getText();
}
}
info = "(" + String.join(", ", params) + ")";
dh.add(word, info, kind);
}
});
return dh.getItems();
}
开发者ID:vhakulinen,项目名称:neovim-intellij-complete,代码行数:41,代码来源:NeovimIntellijComplete.java
示例5: findPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@Override
@Nullable
public PsiPackage findPackage(@NotNull String packageName) {
Query<VirtualFile> dirs = myPackageIndex.getDirsByPackageName(packageName, true);
if (dirs.findFirst() == null) return null;
return new PsiPackageImpl(myManager, packageName);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:JavaFileManagerImpl.java
示例6: findPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@Override
public PsiPackage findPackage(@NotNull String packageName) {
final List<VirtualFile> files = findDirectoriesByPackageName(packageName);
if (!files.isEmpty()) {
return new PsiPackageImpl(myPsiManager, packageName);
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:CoreJavaFileManager.java
示例7: getPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@Nullable
public PsiPackage getPackage(PsiDirectory dir) {
final VirtualFile file = dir.getVirtualFile();
for (VirtualFile root : myClasspath) {
if (VfsUtilCore.isAncestor(root, file, false)) {
String relativePath = FileUtil.getRelativePath(root.getPath(), file.getPath(), '/');
if (relativePath == null) continue;
return new PsiPackageImpl(myPsiManager, relativePath.replace('/', '.'));
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:CoreJavaFileManager.java
示例8: findPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@Override
public PsiPackage findPackage(@NotNull String qualifiedName) {
if (packagePrefixExists(qualifiedName)) {
return new PsiPackageImpl(PsiManager.getInstance(myProject), qualifiedName);
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PackagePrefixElementFinder.java
示例9: mockPsiPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
private void mockPsiPackage(Container applicationServices, Container projectServices) {
projectServices.register(PsiManager.class, mock(PsiManager.class));
applicationServices.register(JavaDirectoryService.class, mock(JavaDirectoryService.class));
PsiManager manager = PsiManager.getInstance(project);
PsiDirectory targetPsiDirectory = mock(PsiDirectory.class);
PsiPackage targetPsiPackage = new PsiPackageImpl(manager, "com.google.target");
when(PsiManager.getInstance(project).findDirectory(target)).thenReturn(targetPsiDirectory);
when(JavaDirectoryService.getInstance().getPackage(targetPsiDirectory))
.thenReturn(targetPsiPackage);
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:11,代码来源:BlazeAndroidProjectPathsTest.java
示例10: findPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@Override
public PsiPackage findPackage(@NotNull String packageName) {
final List<VirtualFile> files = findDirectoriesByPackageName(packageName);
if (files.size() > 0) {
return new PsiPackageImpl(myPsiManager, packageName);
}
return null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:CoreJavaFileManager.java
示例11: findPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@Override
public PsiPackage findPackage(@NotNull String qualifiedName) {
if (packagePrefixExists(qualifiedName)) {
return new PsiPackageImpl((PsiManagerEx)PsiManager.getInstance(myProject), qualifiedName);
}
return null;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:PackagePrefixElementFinder.java
示例12: getSubPackages
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@NotNull
@Override
@RequiredReadAction
public PsiJavaPackage[] getSubPackages(@NotNull PsiJavaPackage psiPackage, @NotNull GlobalSearchScope scope)
{
String qualifiedName = psiPackage.getQualifiedName();
if(qualifiedName.startsWith("cli"))
{
String substring = qualifiedName.substring(3, qualifiedName.length());
PsiPackage aPackage = PsiPackageManager.getInstance(myProject).findPackage(substring, DotNetModuleExtension.class);
if(aPackage == null)
{
aPackage = PsiPackageManager.getInstance(myProject).findPackage(substring, JavaModuleExtension.class);
}
if(aPackage != null)
{
PsiPackage[] subPackages = aPackage.getSubPackages(scope);
if(subPackages.length == 0)
{
return PsiJavaPackage.EMPTY_ARRAY;
}
PsiJavaPackage[] packages = new PsiJavaPackage[subPackages.length];
for(int i = 0; i < subPackages.length; i++)
{
PsiPackage subPackage = subPackages[i];
packages[i] = new PsiPackageImpl(myPsiManager, myPsiPackageManager, JavaModuleExtension.class, subPackage.getQualifiedName());
}
return packages;
}
}
return super.getSubPackages(psiPackage, scope);
}
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:33,代码来源:IkvmPsiElementFinder.java
示例13: createPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
@NotNull
@Override
public PsiPackage createPackage(
@NotNull PsiManager psiManager,
@NotNull PsiPackageManager packageManager,
@NotNull Class<? extends ModuleExtension> extensionClass,
@NotNull String packageName)
{
return new PsiPackageImpl(psiManager, packageManager, extensionClass, packageName);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:11,代码来源:JavaPsiPackageSupportProvider.java
示例14: createPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
private PsiPackageImpl createPackage(String qualifiedName) {
return new PsiPackageImpl(myManager, qualifiedName);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:NonClasspathClassFinder.java
示例15: generate
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
private Items.Item[] generate(String s) {
final EddyThread thread = EddyThread.getEddyThread();
final HashSet<Items.Item> results = new HashSet<Items.Item>();
// find and add packages
for (String pkgQualifiedName: packageIndex.get(s)) {
Items.Package pkg = (Items.Package) converter.addContainer(new PsiPackageImpl(psiManager, pkgQualifiedName));
results.add(pkg);
}
final Processor<PsiClass> classProc = new Processor<PsiClass>() {
@Override
public boolean process(PsiClass cls) {
// TODO: Ideally we'd check for interrupts here, but can't because our caller grabs fancy locks
if (thread != null && thread.canceled()) return false;
results.add(converter.addClass(cls));
return true;
}
};
final Processor<PsiMethod> methodProc = new Processor<PsiMethod>() {
@Override
public boolean process(PsiMethod method) {
// TODO: Ideally we'd check for interrupts here, but can't because our caller grabs fancy locks
if (thread != null && thread.canceled()) return false;
if (!method.isConstructor())
results.add(converter.addMethod(method));
return true;
}
};
final Processor<PsiField> fieldProc = new Processor<PsiField>() {
@Override
public boolean process(PsiField fld) {
// TODO: Ideally we'd check for interrupts here, but can't because our caller grabs fancy locks
if (thread != null && thread.canceled()) return false;
results.add(converter.addField(fld));
return true;
}
};
if (thread != null) thread.pushSoftInterrupts();
try {
final IdFilter filter = null;
psiCache.processClassesWithName(s, classProc, scope, filter);
psiCache.processMethodsWithName(s, methodProc, scope, filter);
psiCache.processFieldsWithName(s, fieldProc, scope, filter);
} finally {
if (thread != null) thread.popSoftInterrupts();
}
return results.toArray(new Items.Item[results.size()]);
}
开发者ID:eddysystems,项目名称:eddy,代码行数:53,代码来源:ItemGenerator.java
示例16: createPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
private PsiPackageImpl createPackage(String qualifiedName) {
return new PsiPackageImpl((PsiManagerEx)myManager, qualifiedName);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:NonClasspathClassFinder.java
示例17: createPackage
import com.intellij.psi.impl.file.PsiPackageImpl; //导入依赖的package包/类
private PsiPackageImpl createPackage(String qualifiedName)
{
return new PsiPackageImpl(myManager, myPackageManager, JavaModuleExtension.class, qualifiedName);
}
开发者ID:consulo,项目名称:consulo-java,代码行数:5,代码来源:NonClasspathClassFinder.java
注:本文中的com.intellij.psi.impl.file.PsiPackageImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论