当前位置: 首页>>代码示例>>Java>>正文


Java PsiElement.EMPTY_ARRAY属性代码示例

本文整理汇总了Java中com.intellij.psi.PsiElement.EMPTY_ARRAY属性的典型用法代码示例。如果您正苦于以下问题:Java PsiElement.EMPTY_ARRAY属性的具体用法?Java PsiElement.EMPTY_ARRAY怎么用?Java PsiElement.EMPTY_ARRAY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.psi.PsiElement的用法示例。


在下文中一共展示了PsiElement.EMPTY_ARRAY属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGotoDeclarationTargets

@Nullable
@Override
public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) {
    if (psiElement == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    Project project = psiElement.getProject();
    if (!PlatformPatterns
            .psiElement(StringLiteralExpression.class)
            .withLanguage(PhpLanguage.INSTANCE)
            .accepts(psiElement.getContext())
    ) {
        return PsiElement.EMPTY_ARRAY;
    }
    PsiFile containingFile = psiElement.getContainingFile();
    PsiDirectory appDir = PsiUtil.getAppDirectoryFromFile(containingFile);
    String elementFilename = String.format("View/Elements/%s.ctp", psiElement.getText());
    VirtualFile relativeFile = VfsUtil.findRelativeFile(appDir, elementFilename);
    if (relativeFile != null) {
        Collection<VirtualFile> files = new HashSet<>();
        files.add(relativeFile);
        return PsiUtil.convertVirtualFilesToPsiFiles(project, files).toArray(new PsiElement[files.size()]);
    }
    return PsiElement.EMPTY_ARRAY;
}
 
开发者ID:dmeybohm,项目名称:chocolate-cakephp,代码行数:25,代码来源:ElementGotoDeclarationHandler.java

示例2: getGotoDeclarationTargets

@Nullable
@Override
public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) {
    if (psiElement == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    if (!PlatformPatterns.psiElement().withParent(FieldReference.class).accepts(psiElement)) {
        return PsiElement.EMPTY_ARRAY;
    }
    String filename = PsiUtil.getFileNameWithoutExtension(psiElement);
    if (filename == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    String controllerName = CakeUtil.controllerBaseNameFromControllerFileName(filename);
    if (controllerName == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    PsiElement parent = psiElement.getParent();
    if (parent == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    FieldReference fieldReference = (FieldReference)parent;
    String fieldName = fieldReference.getName();
    if (fieldName == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    Collection<PhpClass> classes = PsiUtil.getControllerFieldClasses(fieldName, psiElement.getProject());
    return classes.toArray(new PsiElement[classes.size()]);
}
 
开发者ID:dmeybohm,项目名称:chocolate-cakephp,代码行数:29,代码来源:ControllerFieldGotoDeclarationHandler.java

示例3: getGotoDeclarationTargets

@Nullable
@Override
public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) {
    if (psiElement == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    Project project = psiElement.getProject();
    if (!PlatformPatterns
            .psiElement(StringLiteralExpression.class)
            .withLanguage(PhpLanguage.INSTANCE)
            .accepts(psiElement.getContext())
    ) {
        return PsiElement.EMPTY_ARRAY;
    }
    PsiFile containingFile = psiElement.getContainingFile();
    VirtualFile virtualFile = containingFile.getVirtualFile();
    String filename = virtualFile.getNameWithoutExtension();
    String controllerName = CakeUtil.controllerBaseNameFromControllerFileName(filename);
    if (controllerName == null) {
        return PsiElement.EMPTY_ARRAY;
    }

    PsiDirectory appDir = PsiUtil.getAppDirectoryFromFile(containingFile);
    String templatePath = String.format("View/%s/%s.ctp", controllerName, psiElement.getText());
    VirtualFile relativeFile = VfsUtil.findRelativeFile(appDir, templatePath);
    if (relativeFile != null) {
        Collection<VirtualFile> files = new HashSet<>();
        files.add(relativeFile);
        return PsiUtil.convertVirtualFilesToPsiFiles(project, files).toArray(new PsiElement[files.size()]);
    }
    return PsiElement.EMPTY_ARRAY;
}
 
开发者ID:dmeybohm,项目名称:chocolate-cakephp,代码行数:32,代码来源:TemplateGotoDeclarationHandler.java

示例4: getGotoDeclarationTargets

@Nullable
@Override
public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) {
    if (psiElement == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    if (!PlatformPatterns
            .psiElement(StringLiteralExpression.class)
            .withLanguage(PhpLanguage.INSTANCE)
            .accepts(psiElement.getContext())
            ) {
        return PsiElement.EMPTY_ARRAY;
    }
    Field field = (Field)PsiUtil.findParent(psiElement, Field.class);
    if (field == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    String text = field.getText();
    // PhpStorm already has completion based on strings that contain class names, so
    // we only need to check for the components and helpers properties:
    if (text.contains("$components")) {
        return PsiUtil.getClassesAsArray(psiElement, psiElement.getText() + "Component");
    }
    if (text.contains("$helpers")) {
        return PsiUtil.getClassesAsArray(psiElement, psiElement.getText() + "Helper");
    }
    return PsiElement.EMPTY_ARRAY;
}
 
开发者ID:dmeybohm,项目名称:chocolate-cakephp,代码行数:28,代码来源:ControllerComponentsGotoDeclarationHandler.java

示例5: getGotoDeclarationTargets

@Nullable
@Override
public PsiElement[] getGotoDeclarationTargets(@Nullable PsiElement psiElement, int i, Editor editor) {
    if (psiElement == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    if (!PlatformPatterns.psiElement().withParent(FieldReference.class).accepts(psiElement)) {
        return PsiElement.EMPTY_ARRAY;
    }
    PsiElement parent = psiElement.getParent();
    if (parent == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    FieldReference fieldReference = (FieldReference)parent;
    String fieldName = fieldReference.getName();
    if (fieldName == null) {
        return PsiElement.EMPTY_ARRAY;
    }
    PhpExpression classReference = fieldReference.getClassReference();
    if (classReference == null) {
        return null;
    }
    PhpType types = classReference.getType();
    String fieldReferenceName = fieldReference.getName();
    if (!StringUtil.startsWithUppercaseCharacter(fieldReferenceName)) {
        return null;
    }
    for (String type : types.getTypes()) {
        if (type.contains("#Vthis")) {
            Collection<PhpClass> classes = PsiUtil.getViewHelperClasses(fieldName, psiElement.getProject());
            return classes.toArray(new PsiElement[classes.size()]);
        }
    }
    return PsiElement.EMPTY_ARRAY;
}
 
开发者ID:dmeybohm,项目名称:chocolate-cakephp,代码行数:35,代码来源:ViewHelperGotoDeclarationHandler.java

示例6: getChildren

@Override
public PsiElement[] getChildren()
{
  return PsiElement.EMPTY_ARRAY;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:5,代码来源:FakeTargetElement.java


注:本文中的com.intellij.psi.PsiElement.EMPTY_ARRAY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。