本文整理汇总了Java中com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil类的典型用法代码示例。如果您正苦于以下问题:Java HighlightMessageUtil类的具体用法?Java HighlightMessageUtil怎么用?Java HighlightMessageUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HighlightMessageUtil类属于com.intellij.codeInsight.daemon.impl.analysis包,在下文中一共展示了HighlightMessageUtil类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkMethodOverridesDeprecated
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; //导入依赖的package包/类
static void checkMethodOverridesDeprecated(MethodSignatureBackedByPsiMethod methodSignature,
List<MethodSignatureBackedByPsiMethod> superMethodSignatures,
boolean ignoreAbstractDeprecatedOverrides, ProblemsHolder holder) {
PsiMethod method = methodSignature.getMethod();
PsiElement methodName = method.getNameIdentifier();
for (MethodSignatureBackedByPsiMethod superMethodSignature : superMethodSignatures) {
PsiMethod superMethod = superMethodSignature.getMethod();
PsiClass aClass = superMethod.getContainingClass();
if (aClass == null) continue;
// do not show deprecated warning for class implementing deprecated methods
if (ignoreAbstractDeprecatedOverrides && !aClass.isDeprecated() && superMethod.hasModifierProperty(PsiModifier.ABSTRACT)) continue;
if (superMethod.isDeprecated()) {
String description = JavaErrorMessages.message("overrides.deprecated.method",
HighlightMessageUtil.getSymbolName(aClass, PsiSubstitutor.EMPTY));
holder.registerProblem(methodName, description, ProblemHighlightType.LIKE_DEPRECATED);
}
}
}
示例2: checkDeprecated
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; //导入依赖的package包/类
public static void checkDeprecated(PsiElement refElement,
PsiElement elementToHighlight,
@Nullable TextRange rangeInElement,
boolean ignoreInsideDeprecated,
boolean ignoreImportStatements,
ProblemsHolder holder) {
if (!(refElement instanceof PsiDocCommentOwner)) return;
if (!((PsiDocCommentOwner)refElement).isDeprecated()) return;
if (ignoreInsideDeprecated) {
PsiElement parent = elementToHighlight;
while ((parent = PsiTreeUtil.getParentOfType(parent, PsiDocCommentOwner.class, true)) != null) {
if (((PsiDocCommentOwner)parent).isDeprecated()) return;
}
}
if (ignoreImportStatements && PsiTreeUtil.getParentOfType(elementToHighlight, PsiImportStatementBase.class) != null) {
return;
}
String description = JavaErrorMessages.message("deprecated.symbol",
HighlightMessageUtil.getSymbolName(refElement, PsiSubstitutor.EMPTY));
holder.registerProblem(elementToHighlight, description, ProblemHighlightType.LIKE_DEPRECATED, rangeInElement);
}
示例3: checkDeprecated
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; //导入依赖的package包/类
public static void checkDeprecated(PsiElement refElement,
PsiElement elementToHighlight,
@Nullable TextRange rangeInElement,
boolean ignoreInsideDeprecated,
boolean ignoreImportStatements,
boolean ignoreMethodsOfDeprecated,
ProblemsHolder holder) {
if (!(refElement instanceof PsiDocCommentOwner)) return;
if (!((PsiDocCommentOwner)refElement).isDeprecated()) {
if (!ignoreMethodsOfDeprecated) {
checkDeprecated(((PsiDocCommentOwner)refElement).getContainingClass(), elementToHighlight, rangeInElement,
ignoreInsideDeprecated, ignoreImportStatements, false, holder);
}
return;
}
if (ignoreInsideDeprecated) {
PsiElement parent = elementToHighlight;
while ((parent = PsiTreeUtil.getParentOfType(parent, PsiDocCommentOwner.class, true)) != null) {
if (((PsiDocCommentOwner)parent).isDeprecated()) return;
}
}
if (ignoreImportStatements && PsiTreeUtil.getParentOfType(elementToHighlight, PsiImportStatementBase.class) != null) {
return;
}
String description = JavaErrorMessages.message("deprecated.symbol",
HighlightMessageUtil.getSymbolName(refElement, PsiSubstitutor.EMPTY));
holder.registerProblem(elementToHighlight, description, ProblemHighlightType.LIKE_DEPRECATED, rangeInElement);
}
示例4: checkAccessStaticMemberViaInstanceReference
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; //导入依赖的package包/类
private void checkAccessStaticMemberViaInstanceReference(PsiReferenceExpression expr, ProblemsHolder holder, boolean onTheFly) {
JavaResolveResult result = expr.advancedResolve(false);
PsiElement resolved = result.getElement();
if (!(resolved instanceof PsiMember)) return;
PsiExpression qualifierExpression = expr.getQualifierExpression();
if (qualifierExpression == null) return;
if (qualifierExpression instanceof PsiReferenceExpression) {
final PsiElement qualifierResolved = ((PsiReferenceExpression)qualifierExpression).resolve();
if (qualifierResolved instanceof PsiClass || qualifierResolved instanceof PsiPackage) {
return;
}
}
if (!((PsiMember)resolved).hasModifierProperty(PsiModifier.STATIC)) return;
String description = JavaErrorMessages.message("static.member.accessed.via.instance.reference",
JavaHighlightUtil.formatType(qualifierExpression.getType()),
HighlightMessageUtil.getSymbolName(resolved, result.getSubstitutor()));
if (!onTheFly) {
if (RemoveUnusedVariableUtil.checkSideEffects(qualifierExpression, null, new ArrayList<PsiElement>())) {
holder.registerProblem(expr, description);
return;
}
}
holder.registerProblem(expr, description, createAccessStaticViaInstanceFix(expr, onTheFly, result));
}
示例5: calcText
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; //导入依赖的package包/类
private static String calcText(PsiMember member, PsiSubstitutor substitutor) {
PsiClass aClass = member.getContainingClass();
if (aClass == null) return "";
return QuickFixBundle.message("access.static.via.class.reference.text",
HighlightMessageUtil.getSymbolName(member, substitutor),
HighlightUtil.formatClass(aClass),
HighlightUtil.formatClass(aClass, false));
}
示例6: checkMethodOverridesDeprecated
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; //导入依赖的package包/类
static void checkMethodOverridesDeprecated(MethodSignatureBackedByPsiMethod methodSignature,
List<MethodSignatureBackedByPsiMethod> superMethodSignatures,
boolean ignoreAbstractDeprecatedOverrides,
ProblemsHolder holder)
{
PsiMethod method = methodSignature.getMethod();
PsiElement methodName = method.getNameIdentifier();
for(MethodSignatureBackedByPsiMethod superMethodSignature : superMethodSignatures)
{
PsiMethod superMethod = superMethodSignature.getMethod();
PsiClass aClass = superMethod.getContainingClass();
if(aClass == null)
{
continue;
}
// do not show deprecated warning for class implementing deprecated methods
if(ignoreAbstractDeprecatedOverrides && !aClass.isDeprecated() && superMethod.hasModifierProperty(PsiModifier.ABSTRACT))
{
continue;
}
if(superMethod.isDeprecated())
{
String description = JavaErrorMessages.message("overrides.deprecated.method", HighlightMessageUtil.getSymbolName(aClass,
PsiSubstitutor.EMPTY));
holder.registerProblem(methodName, description, ProblemHighlightType.LIKE_DEPRECATED);
}
}
}
示例7: calcText
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; //导入依赖的package包/类
private static String calcText(PsiMember member, PsiSubstitutor substitutor) {
PsiClass aClass = member.getContainingClass();
if (aClass == null) return "";
return JavaQuickFixBundle.message("access.static.via.class.reference.text",
HighlightMessageUtil.getSymbolName(member, substitutor),
HighlightUtil.formatClass(aClass),
HighlightUtil.formatClass(aClass, false));
}
示例8: getText
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; //导入依赖的package包/类
@Override
@NotNull
public String getText() {
PsiElement startElement = getStartElement();
return QuickFixBundle.message("safe.delete.text", startElement == null ? "" : HighlightMessageUtil.getSymbolName(startElement, PsiSubstitutor.EMPTY));
}
示例9: checkDeprecated
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; //导入依赖的package包/类
public static void checkDeprecated(PsiElement refElement,
PsiElement elementToHighlight,
@Nullable TextRange rangeInElement,
boolean ignoreInsideDeprecated,
boolean ignoreImportStatements,
boolean ignoreMethodsOfDeprecated,
ProblemsHolder holder)
{
if(!(refElement instanceof PsiDocCommentOwner))
{
return;
}
if(!((PsiDocCommentOwner) refElement).isDeprecated())
{
if(!ignoreMethodsOfDeprecated)
{
checkDeprecated(((PsiDocCommentOwner) refElement).getContainingClass(), elementToHighlight, rangeInElement, ignoreInsideDeprecated,
ignoreImportStatements, false, holder);
}
return;
}
if(ignoreInsideDeprecated)
{
PsiElement parent = elementToHighlight;
while((parent = PsiTreeUtil.getParentOfType(parent, PsiDocCommentOwner.class, true)) != null)
{
if(((PsiDocCommentOwner) parent).isDeprecated())
{
return;
}
}
}
if(ignoreImportStatements && PsiTreeUtil.getParentOfType(elementToHighlight, PsiImportStatementBase.class) != null)
{
return;
}
String description = null;
String symbolName = HighlightMessageUtil.getSymbolName(refElement, PsiSubstitutor.EMPTY);
PsiAnnotation annotation = AnnotationUtil.findAnnotation((PsiModifierListOwner) refElement, DeprecationInfo.class.getName());
if(annotation != null)
{
String value = AnnotationUtil.getStringAttributeValue(annotation, PsiAnnotation.DEFAULT_REFERENCED_METHOD_NAME);
description = JavaErrorMessages.message("deprecated.symbol.0", symbolName, value);
}
if(description == null)
{
description = JavaErrorMessages.message("deprecated.symbol", symbolName);
}
holder.registerProblem(elementToHighlight, description, ProblemHighlightType.LIKE_DEPRECATED, rangeInElement);
}
示例10: getText
import com.intellij.codeInsight.daemon.impl.analysis.HighlightMessageUtil; //导入依赖的package包/类
@Override
@NotNull
public String getText() {
PsiElement startElement = getStartElement();
return JavaQuickFixBundle.message("safe.delete.text", startElement == null ? "" : HighlightMessageUtil.getSymbolName(startElement, PsiSubstitutor.EMPTY));
}