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


Java PsiReferenceBase.Immediate方法代码示例

本文整理汇总了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};
}
 
开发者ID:letsdrink,项目名称:ouzo-phpstorm-plugin,代码行数:19,代码来源:RelationClassReferenceProvider.java

示例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;
    }
  };
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:11,代码来源:GlobReferenceSearcher.java

示例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};
}
 
开发者ID:letsdrink,项目名称:ouzo-phpstorm-plugin,代码行数:13,代码来源:ControllerActionReferenceProvider.java

示例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


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