當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。