本文整理汇总了Java中consulo.psi.PsiPackageManager类的典型用法代码示例。如果您正苦于以下问题:Java PsiPackageManager类的具体用法?Java PsiPackageManager怎么用?Java PsiPackageManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PsiPackageManager类属于consulo.psi包,在下文中一共展示了PsiPackageManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findPackage
import consulo.psi.PsiPackageManager; //导入依赖的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);
}
示例2: getChildDirectoryIcon
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
/**
* Return child directory icon
* If psiDirectory is null it require force package support if this provider is supported it
* @param psiDirectory child directory
* @return icon of child directory
*/
@Nullable
@RequiredReadAction
public final Icon getChildDirectoryIcon(@Nullable PsiDirectory psiDirectory) {
Icon packageIcon = getChildPackageIcon();
if(packageIcon == null) {
return getChildDirectoryIcon();
}
if(psiDirectory != null) {
PsiPackage anyPackage = PsiPackageManager.getInstance(psiDirectory.getProject()).findAnyPackage(psiDirectory);
if(anyPackage != null) {
return packageIcon;
}
else {
return getChildDirectoryIcon();
}
}
else {
//
return packageIcon;
}
}
示例3: addSubtreeToUpdateByElement
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
@Override
public boolean addSubtreeToUpdateByElement(Object element) {
// should convert PsiDirectories into PackageElements
if (element instanceof PsiDirectory) {
PsiDirectory dir = (PsiDirectory)element;
final PsiPackage aPackage = PsiPackageManager.getInstance(dir.getProject()).findAnyPackage(dir);
if (ProjectView.getInstance(myProject).isShowModules(getId())) {
Module[] modules = getModulesFor(dir);
boolean rv = false;
for (Module module : modules) {
rv |= addPackageElementToUpdate(aPackage, module);
}
return rv;
}
else {
return addPackageElementToUpdate(aPackage, null);
}
}
return super.addSubtreeToUpdateByElement(element);
}
示例4: getSubpackages
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
@Nonnull
public static PsiPackage[] getSubpackages(@Nonnull PsiPackage aPackage,
@Nullable Module module,
@Nonnull Project project,
final boolean searchInLibraries) {
final PsiDirectory[] dirs = getDirectories(aPackage, project, module, searchInLibraries);
final Set<PsiPackage> subpackages = new HashSet<PsiPackage>();
for (PsiDirectory dir : dirs) {
final PsiDirectory[] subdirectories = dir.getSubdirectories();
for (PsiDirectory subdirectory : subdirectories) {
final PsiPackage psiPackage = PsiPackageManager.getInstance(project).findAnyPackage(subdirectory);
if (psiPackage != null) {
final String name = psiPackage.getName();
// skip "default" subpackages as they should be attributed to other modules
// this is the case when contents of one module is nested into contents of another
if (name != null && !name.isEmpty()) {
subpackages.add(psiPackage);
}
}
}
}
return subpackages.toArray(new PsiPackage[subpackages.size()]);
}
示例5: createPackage
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
@Nonnull
@Override
public PsiPackage createPackage(@Nonnull PsiManager psiManager,
@Nonnull PsiPackageManager packageManager,
@Nonnull Class<? extends ModuleExtension> extensionClass,
@Nonnull String packageName) {
return new PsiPackageBase(psiManager, packageManager, extensionClass, packageName) {
@Override
protected ArrayFactory<? extends PsiPackage> getPackageArrayFactory() {
return PsiPackage.ARRAY_FACTORY;
}
@RequiredReadAction
@Nonnull
@Override
public Language getLanguage() {
return SandLanguage.INSTANCE;
}
};
}
示例6: NonClasspathClassFinder
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
public NonClasspathClassFinder(@NotNull Project project, @NotNull String... fileExtensions)
{
myProject = project;
myPackageManager = PsiPackageManager.getInstance(myProject);
myManager = PsiManager.getInstance(myProject);
myFileExtensions = ArrayUtil.append(fileExtensions, "class");
final MessageBusConnection connection = project.getMessageBus().connect(project);
connection.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener()
{
@Override
public void after(@NotNull List<? extends VFileEvent> events)
{
clearCache();
}
});
LowMemoryWatcher.register(this::clearCache, project);
}
示例7: JavaCoreProjectEnvironment
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
public JavaCoreProjectEnvironment(Disposable parentDisposable, CoreApplicationEnvironment applicationEnvironment) {
super(parentDisposable, applicationEnvironment);
myProject.registerService(PsiElementFactory.class, new PsiElementFactoryImpl(myPsiManager));
myProject.registerService(JavaPsiImplementationHelper.class, createJavaPsiImplementationHelper());
myProject.registerService(PsiResolveHelper.class, new PsiResolveHelperImpl(myPsiManager));
myProject.registerService(JavaResolveCache.class, new JavaResolveCache(myMessageBus));
myProject.registerService(JavaCodeStyleSettingsFacade.class, new CoreJavaCodeStyleSettingsFacade());
myProject.registerService(JavaCodeStyleManager.class, new CoreJavaCodeStyleManager());
registerProjectExtensionPoint(PsiElementFinder.EP_NAME, PsiElementFinder.class);
/* myPackageIndex = createCorePackageIndex();
myProject.registerService(PackageIndex.class, myPackageIndex); */
myFileManager = createCoreFileManager();
myProject.registerService(JavaFileManager.class, myFileManager);
PsiPackageManager manager = new PsiPackageManagerImpl(getProject(), DirectoryIndex.getInstance(getProject()));
myProject.registerService(PsiPackageManager.class, manager);
JavaPsiFacadeImpl javaPsiFacade = new JavaPsiFacadeImpl(myProject, manager);
registerProjectComponent(JavaPsiFacade.class, javaPsiFacade);
myProject.registerService(JavaPsiFacade.class, javaPsiFacade);
}
示例8: getSubPackages
import consulo.psi.PsiPackageManager; //导入依赖的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);
}
示例9: isAvailable
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
@Override
@RequiredDispatchThread
protected boolean isAvailable(DataContext dataContext)
{
Module module = findModule(dataContext);
if(module != null)
{
DotNetModuleExtension extension = ModuleUtilCore.getExtension(module, DotNetModuleExtension.class);
if(extension != null && extension.isAllowSourceRoots())
{
final IdeView view = dataContext.getData(LangDataKeys.IDE_VIEW);
if(view == null)
{
return false;
}
PsiDirectory orChooseDirectory = view.getOrChooseDirectory();
if(orChooseDirectory == null)
{
return false;
}
PsiPackage aPackage = PsiPackageManager.getInstance(module.getProject()).findPackage(orChooseDirectory, DotNetModuleExtension.class);
if(aPackage == null)
{
return false;
}
}
}
return module != null && ModuleUtilCore.getExtension(module, CSharpSimpleModuleExtension.class) != null;
}
示例10: createPackage
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
@NotNull
@Override
public PsiPackage createPackage(@NotNull PsiManager psiManager, @NotNull PsiPackageManager psiPackageManager,
@NotNull Class<? extends ModuleExtension> aClass, @NotNull String s)
{
return new HaxePackageImpl(psiManager, psiPackageManager, aClass, s);
}
示例11: calculateDirtyNamespace
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public String calculateDirtyNamespace(@NotNull PsiDirectory directory)
{
PsiPackage aPackage = PsiPackageManager.getInstance(directory.getProject()).findPackage(directory, DotNetModuleExtension.class);
String namespace = null;
if(aPackage != null)
{
namespace = aPackage.getQualifiedName();
}
return namespace;
}
示例12: createPackage
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
@NotNull
@Override
public PsiPackage createPackage(@NotNull PsiManager psiManager, @NotNull PsiPackageManager psiPackageManager, @NotNull Class<? extends
ModuleExtension> aClass, @NotNull String s)
{
return new DotNetPackage(psiManager, psiPackageManager, aClass, s);
}
示例13: getGroupForFile
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
protected UsageGroup getGroupForFile(final VirtualFile dir) {
PsiDirectory psiDirectory = PsiManager.getInstance(myProject).findDirectory(dir);
if (psiDirectory != null) {
PsiPackage aPackage = PsiPackageManager.getInstance(myProject).findAnyPackage(psiDirectory);
if (aPackage != null) {
return new PackageGroup(aPackage);
}
}
return new DirectoryGroup(dir);
}
示例14: getCompilableFiles
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
private static VirtualFile[] getCompilableFiles(Project project, VirtualFile[] files) {
if (files == null || files.length == 0) {
return VirtualFile.EMPTY_ARRAY;
}
final PsiManager psiManager = PsiManager.getInstance(project);
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
final CompilerManager compilerManager = CompilerManager.getInstance(project);
final List<VirtualFile> filesToCompile = new ArrayList<VirtualFile>();
for (final VirtualFile file : files) {
if (!fileIndex.isInSourceContent(file)) {
continue;
}
if (!file.isInLocalFileSystem()) {
continue;
}
if (file.isDirectory()) {
final PsiDirectory directory = psiManager.findDirectory(file);
if (directory == null || PsiPackageManager.getInstance(project).findAnyPackage(directory) == null) {
continue;
}
}
else {
FileType fileType = file.getFileType();
if (!(compilerManager.isCompilableFileType(fileType) || isCompilableResourceFile(project, file))) {
continue;
}
}
filesToCompile.add(file);
}
return VfsUtil.toVirtualFileArray(filesToCompile);
}
示例15: adjustElementToCopy
import consulo.psi.PsiPackageManager; //导入依赖的package包/类
@Nullable
@Override
public PsiElement adjustElementToCopy(PsiElement element) {
if (element instanceof PsiPackage) {
return element;
}
if (element instanceof PsiDirectory) {
final PsiPackage psiPackage = PsiPackageManager.getInstance(element.getProject()).findAnyPackage((PsiDirectory)element);
if (psiPackage != null) {
return psiPackage;
}
}
return null;
}