本文整理汇总了Java中com.intellij.psi.PsiReferenceBase.Immediate方法的典型用法代码示例。如果您正苦于以下问题:Java PsiReferenceBase.Immediate方法的具体用法?Java PsiReferenceBase.Immediate怎么用?Java PsiReferenceBase.Immediate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiReferenceBase
的用法示例。
在下文中一共展示了PsiReferenceBase.Immediate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReferencesByElement
import com.intellij.psi.PsiReferenceBase; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) {
if (!isApplicable(psiElement)) {
return new PsiReference[]{};
}
PhpIndex phpIndex = PhpIndex.getInstance(psiElement.getProject());
Collection<PhpClass> phpClasses = phpIndex.getClassesByFQN(OuzoUtils.OUZO_MODEL_NAMESPACE + PsiUtils.getContent(psiElement));
PhpClass phpClass = Iterables.getLast(phpClasses, null);
if (phpClass == null) {
return new PsiReference[]{};
}
PsiReferenceBase.Immediate reference = new PsiReferenceBase.Immediate(psiElement, phpClass);
return new PsiReference[]{reference};
}
示例2: globReference
import com.intellij.psi.PsiReferenceBase; //导入方法依赖的package包/类
private static PsiReference globReference(GlobExpression glob, PsiFileSystemItem file) {
return new PsiReferenceBase.Immediate<GlobExpression>(
glob, glob.getReferenceTextRange(), file) {
@Override
public PsiElement bindToElement(@NotNull PsiElement element)
throws IncorrectOperationException {
return glob;
}
};
}
示例3: getReferencesByElement
import com.intellij.psi.PsiReferenceBase; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) {
if (!isApplicable(psiElement)) {
return new PsiReference[]{};
}
String controller = extractController(PsiUtils.getContent(psiElement));
String action = extractAction(PsiUtils.getContent(psiElement));
PsiReferenceBase.Immediate reference = new PsiReferenceBase.Immediate(psiElement, OuzoUtils.getControllerAction(psiElement.getProject(), controller, action));
return new PsiReference[]{reference};
}
示例4: getReference
import com.intellij.psi.PsiReferenceBase; //导入方法依赖的package包/类
@Override
public PsiReference getReference() {
final JSGraphQLEndpointNamedTypePsiElement self = this;
final PsiElement nameIdentifier = getNameIdentifier();
if(nameIdentifier != null) {
if(JSGraphQLScalars.SCALAR_TYPES.contains(nameIdentifier.getText())) {
return new PsiReferenceBase.Immediate<PsiElement>(this, TextRange.allOf(nameIdentifier.getText()), getFirstChild());
}
return new PsiReferenceBase<PsiElement>(this, TextRange.from(nameIdentifier.getTextOffset() - self.getTextOffset(), nameIdentifier.getTextLength())) {
@Nullable
@Override
public PsiElement resolve() {
final Collection<JSGraphQLEndpointNamedTypeDefinition> definitions = JSGraphQLEndpointPsiUtil.getKnownDefinitions(
self.getContainingFile(),
JSGraphQLEndpointNamedTypeDefinition.class,
false,
null
);
final JSGraphQLEndpointNamedTypeDefinition resolvedElement = definitions.stream()
.filter(d -> d.getNamedTypeDef() != null && d.getNamedTypeDef().getText().equals(nameIdentifier.getText()))
.findFirst().orElse(null);
if(resolvedElement != null) {
return resolvedElement.getNamedTypeDef();
}
return null;
}
@NotNull
@Override
public Object[] getVariants() {
return NO_VARIANTS;
}
@Override
public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException {
return self.setName(newElementName);
}
};
}
return null;
}
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:42,代码来源:JSGraphQLEndpointNamedTypePsiElement.java