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


Java PsiDocMethodOrFieldRef类代码示例

本文整理汇总了Java中com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef的典型用法代码示例。如果您正苦于以下问题:Java PsiDocMethodOrFieldRef类的具体用法?Java PsiDocMethodOrFieldRef怎么用?Java PsiDocMethodOrFieldRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PsiDocMethodOrFieldRef类属于com.intellij.psi.impl.source.javadoc包,在下文中一共展示了PsiDocMethodOrFieldRef类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bindReference

import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef; //导入依赖的package包/类
private static void bindReference(PsiFile psiFile,
                                  PsiField psiField,
                                  PsiClass containingClass,
                                  String fieldName,
                                  PsiReference reference,
                                  Project project) {
  if (reference instanceof PsiReferenceExpression) {
    PsiReferenceExpressionImpl.bindToElementViaStaticImport(containingClass, fieldName, ((PsiJavaFile)psiFile).getImportList());
    final PsiElement qualifier = ((PsiReferenceExpression)reference).getQualifier();
    if (qualifier != null) {
      final Boolean canRemoveQualifier = qualifier.getCopyableUserData(ChangeContextUtil.CAN_REMOVE_QUALIFIER_KEY);
      if (canRemoveQualifier != null && canRemoveQualifier.booleanValue()) {
        qualifier.delete();
      } else {
        final PsiJavaCodeReferenceElement classReferenceElement =
          JavaPsiFacade.getElementFactory(project).createReferenceExpression(containingClass);
        qualifier.replace(classReferenceElement);
      }
    }
  } else if (reference.getElement() instanceof PsiDocMethodOrFieldRef){
    reference.bindToElement(psiField);    //todo refs through inheritors
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ReplaceImplementsWithStaticImportAction.java

示例2: visitDocTagValue

import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef; //导入依赖的package包/类
@Override
public void visitDocTagValue(PsiDocTagValue value)
{
	PsiReference reference = value.getReference();
	if(reference != null)
	{
		PsiElement element = reference.resolve();
		final TextAttributesScheme colorsScheme = myHolder.getColorsScheme();
		if(element instanceof PsiMethod)
		{
			PsiElement nameElement = ((PsiDocMethodOrFieldRef) value).getNameElement();
			if(nameElement != null)
			{
				myHolder.add(HighlightNamesUtil.highlightMethodName((PsiMethod) element, nameElement, false, colorsScheme));
			}
		}
		else if(element instanceof PsiParameter)
		{
			myHolder.add(HighlightNamesUtil.highlightVariableName((PsiVariable) element, value.getNavigationElement(), colorsScheme));
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:HighlightVisitorImpl.java

示例3: shouldKeepSpace

import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef; //导入依赖的package包/类
private static boolean shouldKeepSpace(final PsiElement parent)
{
	ASTNode node = parent.getNode();
	if(node == null)
	{
		return true;
	}

	final IElementType type = node.getElementType();
	if(type == JavaDocElementType.DOC_TAG_VALUE_ELEMENT)
	{
		return PsiTreeUtil.getParentOfType(parent, PsiDocMethodOrFieldRef.class) != null;
	}

	return type == JavaDocElementType.DOC_COMMENT || type == JavaDocElementType.DOC_TAG || type == JavaDocElementType.DOC_INLINE_TAG;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:JavaSpacePropertyProcessor.java

示例4: visitDocTagValue

import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef; //导入依赖的package包/类
@Override
public void visitDocTagValue(PsiDocTagValue value) {
  PsiReference reference = value.getReference();
  if (reference != null) {
    PsiElement element = reference.resolve();
    final TextAttributesScheme colorsScheme = myHolder.getColorsScheme();
    if (element instanceof PsiMethod) {
      myHolder.add(HighlightNamesUtil.highlightMethodName((PsiMethod)element, ((PsiDocMethodOrFieldRef)value).getNameElement(), false,
                                                          colorsScheme));
    }
    else if (element instanceof PsiParameter) {
      myHolder.add(HighlightNamesUtil.highlightVariableName((PsiVariable)element, value.getNavigationElement(), colorsScheme));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:HighlightVisitorImpl.java

示例5: shouldKeepSpace

import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef; //导入依赖的package包/类
private static boolean shouldKeepSpace(final PsiElement parent) {
  ASTNode node = parent.getNode();
  if (node == null) {
    return true;
  }

  final IElementType type = node.getElementType();
  if (type == JavaDocElementType.DOC_TAG_VALUE_ELEMENT) {
    return PsiTreeUtil.getParentOfType(parent, PsiDocMethodOrFieldRef.class) != null;
  }

  return type == JavaDocElementType.DOC_COMMENT || type == JavaDocElementType.DOC_TAG || type == JavaDocElementType.DOC_INLINE_TAG;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JavaSpacePropertyProcessor.java

示例6: createUsageInfoForParameter

import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef; //导入依赖的package包/类
@Override
public void createUsageInfoForParameter(final PsiReference reference,
                                        final List<UsageInfo> usages,
                                        final PsiParameter parameter,
                                        final PsiMethod method) {
  int index = method.getParameterList().getParameterIndex(parameter);
  final PsiElement element = reference.getElement();
  PsiCall call = null;
  if (element instanceof PsiCall) {
    call = (PsiCall)element;
  }
  else {
    final PsiElement parent = element.getParent();
    if (parent instanceof PsiCall) {
      call = (PsiCall)parent;
    } else if (parent instanceof PsiAnonymousClass) {
      call = (PsiNewExpression)parent.getParent();
    }
  }
  if (call != null) {
    final PsiExpressionList argList = call.getArgumentList();
    if (argList != null) {
      final PsiExpression[] args = argList.getExpressions();
      if (index < args.length) {
        if (!parameter.isVarArgs()) {
          usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(args[index], parameter, true));
        }
        else {
          for (int i = index; i < args.length; i++) {
            usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(args[i], parameter, true));
          }
        }
      }
    }
  }
  else if (element instanceof PsiDocMethodOrFieldRef) {
    if (((PsiDocMethodOrFieldRef)element).getSignature() != null) {
      @NonNls final StringBuffer newText = new StringBuffer();
      newText.append("/** @see #").append(method.getName()).append('(');
      final List<PsiParameter> parameters = new ArrayList<PsiParameter>(Arrays.asList(method.getParameterList().getParameters()));
      parameters.remove(parameter);
      newText.append(StringUtil.join(parameters, new Function<PsiParameter, String>() {
        @Override
        public String fun(PsiParameter psiParameter) {
          return psiParameter.getType().getCanonicalText();
        }
      }, ","));
      newText.append(")*/");
      usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(element, parameter, true) {
        public void deleteElement() throws IncorrectOperationException {
          final PsiDocMethodOrFieldRef.MyReference javadocMethodReference =
            (PsiDocMethodOrFieldRef.MyReference)element.getReference();
          if (javadocMethodReference != null) {
            javadocMethodReference.bindToText(method.getContainingClass(), newText);
          }
        }
      });
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:61,代码来源:JavaSafeDeleteDelegateImpl.java

示例7: createUsageInfoForParameter

import com.intellij.psi.impl.source.javadoc.PsiDocMethodOrFieldRef; //导入依赖的package包/类
@Override
public void createUsageInfoForParameter(final PsiReference reference,
                                        final List<UsageInfo> usages,
                                        final PsiParameter parameter,
                                        final PsiMethod method) {
  int index = method.getParameterList().getParameterIndex(parameter);
  final PsiElement element = reference.getElement();
  PsiCall call = null;
  if (element instanceof PsiCall) {
    call = (PsiCall)element;
  }
  else if (element.getParent() instanceof PsiCall) {
    call = (PsiCall)element.getParent();
  }
  if (call != null) {
    final PsiExpressionList argList = call.getArgumentList();
    if (argList != null) {
      final PsiExpression[] args = argList.getExpressions();
      if (index < args.length) {
        if (!parameter.isVarArgs()) {
          usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(args[index], parameter, true));
        }
        else {
          for (int i = index; i < args.length; i++) {
            usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(args[i], parameter, true));
          }
        }
      }
    }
  }
  else if (element instanceof PsiDocMethodOrFieldRef) {
    if (((PsiDocMethodOrFieldRef)element).getSignature() != null) {
      @NonNls final StringBuffer newText = new StringBuffer();
      newText.append("/** @see #").append(method.getName()).append('(');
      final List<PsiParameter> parameters = new ArrayList<PsiParameter>(Arrays.asList(method.getParameterList().getParameters()));
      parameters.remove(parameter);
      newText.append(StringUtil.join(parameters, new Function<PsiParameter, String>() {
        @Override
        public String fun(PsiParameter psiParameter) {
          return parameter.getType().getCanonicalText();
        }
      }, ","));
      newText.append(")*/");
      usages.add(new SafeDeleteReferenceJavaDeleteUsageInfo(element, parameter, true) {
        public void deleteElement() throws IncorrectOperationException {
          final PsiDocMethodOrFieldRef.MyReference javadocMethodReference =
            (PsiDocMethodOrFieldRef.MyReference)element.getReference();
          if (javadocMethodReference != null) {
            javadocMethodReference.bindToText(method.getContainingClass(), newText);
          }
        }
      });
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:56,代码来源:JavaSafeDeleteDelegateImpl.java


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