本文整理汇总了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;
}
示例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()]);
}
示例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;
}
示例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;
}
示例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;
}
示例6: getChildren
@Override
public PsiElement[] getChildren()
{
return PsiElement.EMPTY_ARRAY;
}