本文整理匯總了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;
}