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


Java LightElement类代码示例

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


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

示例1: isAvailable

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
public static boolean isAvailable(@NotNull PsiModifierListOwner modifierListOwner, @NotNull String annotationFQN)
{
	if(!modifierListOwner.isValid())
	{
		return false;
	}
	if(!PsiUtil.isLanguageLevel5OrHigher(modifierListOwner))
	{
		return false;
	}

	// e.g. PsiTypeParameterImpl doesn't have modifier list
	PsiModifierList modifierList = modifierListOwner.getModifierList();
	return modifierList != null && !(modifierList instanceof LightElement) && !(modifierListOwner instanceof LightElement) && !AnnotationUtil.isAnnotated(modifierListOwner, annotationFQN, false,
			false, true);
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:AddAnnotationPsiFix.java

示例2: addPhysicalElements

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
private static void addPhysicalElements(PsiElement[] elements, LinkedHashSet<PsiElement> to) {
  for (PsiElement element : elements) {
    PsiElement mirror = PsiImplUtil.handleMirror(element);
    if (!(mirror instanceof LightElement)) {
      to.add(mirror);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JavaClassTreeElement.java

示例3: ConstructorParameterOnFieldRenameRenamer

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
public ConstructorParameterOnFieldRenameRenamer(PsiField aField, String newFieldName) {
  final JavaCodeStyleManager styleManager = JavaCodeStyleManager.getInstance(aField.getProject());
  final String propertyName = styleManager.variableNameToPropertyName(aField.getName(), VariableKind.FIELD);
  if (!Comparing.strEqual(propertyName, styleManager.variableNameToPropertyName(newFieldName, VariableKind.FIELD))) {
    final String paramName = styleManager.propertyNameToVariableName(propertyName, VariableKind.PARAMETER);
    final PsiClass aClass = aField.getContainingClass();

    Set<PsiParameter> toRename = new HashSet<PsiParameter>();
    for (PsiMethod constructor : aClass.getConstructors()) {
      if (constructor instanceof PsiMirrorElement) {
        final PsiElement prototype = ((PsiMirrorElement)constructor).getPrototype();
        if (prototype instanceof PsiMethod && ((PsiMethod)prototype).isConstructor()) {
          constructor = (PsiMethod)prototype;
        }
        else {
          continue;
        }
      }
      if (constructor instanceof LightElement) continue;
      final PsiParameter[] parameters = constructor.getParameterList().getParameters();
      for (final PsiParameter parameter : parameters) {
        final String parameterName = parameter.getName();
        if (paramName.equals(parameterName) ||
          propertyName.equals(styleManager.variableNameToPropertyName(parameterName, VariableKind.PARAMETER))) {
          toRename.add(parameter);
        }
      }
    }
    myElements.addAll(toRename);

    suggestAllNames(aField.getName(), newFieldName);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:ConstructorParameterOnFieldRenameRenamer.java

示例4: prepareRenaming

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
@Override
public void prepareRenaming(PsiElement element, String newName, Map<PsiElement, String> allRenames, SearchScope scope) {
  final PsiMethod[] constructors = ((PsiClass) element).getConstructors();
  for (PsiMethod constructor : constructors) {
    if (constructor instanceof PsiMirrorElement) {
      final PsiElement prototype = ((PsiMirrorElement)constructor).getPrototype();
      if (prototype instanceof PsiNamedElement) {
        allRenames.put(prototype, newName);
      }
    }
    else if (!(constructor instanceof LightElement)) {
      allRenames.put(constructor, newName);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:RenameJavaClassProcessor.java

示例5: classifyUsages

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
public static MultiMap<PsiElement, UsageInfo> classifyUsages(Collection<? extends PsiElement> elements, UsageInfo[] usages) {
  final MultiMap<PsiElement, UsageInfo> result = new MultiMap<PsiElement, UsageInfo>();
  for (UsageInfo usage : usages) {
    LOG.assertTrue(usage instanceof MoveRenameUsageInfo);
    if (usage.getReference() instanceof LightElement) {
      continue; //filter out implicit references (e.g. from derived class to super class' default constructor)
    }
    MoveRenameUsageInfo usageInfo = (MoveRenameUsageInfo)usage;
    if (usage instanceof RelatedUsageInfo) {
      final PsiElement relatedElement = ((RelatedUsageInfo)usage).getRelatedElement();
      if (elements.contains(relatedElement)) {
        result.putValue(relatedElement, usage);
      }
    } else {
      PsiElement referenced = usageInfo.getReferencedElement();
      if (elements.contains(referenced)) {
        result.putValue(referenced, usage);
      } else if (referenced != null) {
        PsiElement indirect = referenced.getNavigationElement();
        if (elements.contains(indirect)) {
          result.putValue(indirect, usage);
        }
      }

    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:RenameProcessor.java

示例6: poke

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
public boolean poke(final PsiElement what, final int rate) {
  if (what == null) return false;
  if (!(what instanceof LightElement) && !what.isValid()) {
    throw new PsiInvalidElementAccessException(what, "Trying to resolve a reference to an invalid element");
  }
  super.add(new RatedResolveResult(rate, what));
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ResolveResultList.java

示例7: setNavigation

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
@SuppressWarnings("MethodMayBeStatic")
private void setNavigation(LightElement element, PsiClass dependencyHandlerClass, String methodName, int parametersCount) {
  for (PsiMethod method : dependencyHandlerClass.findMethodsByName(methodName, false)) {
    int methodParameterCount = method.getParameterList().getParametersCount();
    if (methodParameterCount == parametersCount &&
        method.getParameterList().getParameters()[methodParameterCount - 1].getType().equalsToText(GROOVY_LANG_CLOSURE)) {
      element.setNavigationElement(method);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GradleConfigurationsNonCodeMembersContributor.java

示例8: getNavigationElement

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
@Override
@Nullable
public PsiElement getNavigationElement(@NotNull ClsMethodImpl clsMethod) {
  if (!isGroovyLanguage(clsMethod)) return null;

  PsiMethod source = clsMethod.getSourceMirrorMethod();
  if (source instanceof LightElement) {
    return source.getNavigationElement();
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GroovyClsCustomNavigationPolicy.java

示例9: getElementInfo

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
@NotNull
private static String getElementInfo(@NotNull PsiElement element) {
  String text;
  if (element instanceof LightElement) {
    final PsiElement context = element.getContext();
    text = context instanceof LightElement ? context.toString() : 
           context != null ? context.getText() : null;
  }
  else {
    text = element.getText();
  }
  return "invalid resolve candidate: " + element.getClass() + ", text: " + text;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ResolverProcessor.java

示例10: isAccessible

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
public static boolean isAccessible(@NotNull PsiElement place, @NotNull PsiMember member) {
  if (member instanceof LightElement) {
    return true;
  }

  if (place instanceof GrReferenceExpression && ((GrReferenceExpression)place).getQualifierExpression() == null) {
    if (member.getContainingClass() instanceof GroovyScriptClass) { //calling top level script members from the same script file
      return true;
    }
  }

  if (PsiTreeUtil.getParentOfType(place, GrDocComment.class) != null) return true;

  return com.intellij.psi.util.PsiUtil.isAccessible(member, place, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:PsiUtil.java

示例11: isLightElementDeclaredDuringCompletion

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
private static boolean isLightElementDeclaredDuringCompletion(Object object) {
  if (!(object instanceof LightElement && object instanceof PsiNamedElement)) return false;
  final String name = ((PsiNamedElement)object).getName();
  if (name == null) return false;

  return name.contains(CompletionInitializationContext.DUMMY_IDENTIFIER_TRIMMED.trim()) ||
         name.contains(GrDummyIdentifierProvider.DUMMY_IDENTIFIER_DECAPITALIZED.trim());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GrMainCompletionProvider.java

示例12: canProcessElement

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
@Override
public boolean canProcessElement(@NotNull PsiElement element) {
  if (!(element instanceof LightElement)) return false;
  if (element instanceof GrRenameableLightElement) return false;
  final Language language = element.getLanguage();
  return GroovyLanguage.INSTANCE.equals(language);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:GrLightElementRenamer.java

示例13: getNavigationElement

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
@Override
@Nullable
public PsiElement getNavigationElement(@NotNull ClsMethodImpl clsMethod) {
  PsiMethod source = clsMethod.getSourceMirrorMethod();
  if (source instanceof LightElement && source.getLanguage() == GroovyFileType.GROOVY_LANGUAGE) {
    return source.getNavigationElement();
  }

  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:GroovyClsCustomNavigationPolicy.java

示例14: getElementInfo

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
@NotNull
private static String getElementInfo(@NotNull PsiElement element) {
  String text;
  if (element instanceof LightElement) {
    final PsiElement context = element.getContext();
    text = context != null ? context.getText() : null;
  }
  else {
    text = element.getText();
  }
  return "invalid resolve candidate: " + element.getClass() + ", text: " + text;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:ResolverProcessor.java

示例15: canProcessElement

import com.intellij.psi.impl.light.LightElement; //导入依赖的package包/类
@Override
public boolean canProcessElement(@NotNull PsiElement element) {
  if (!(element instanceof LightElement)) return false;
  if (element instanceof GrRenameableLightElement) return false;
  final Language language = element.getLanguage();
  return GroovyFileType.GROOVY_LANGUAGE.equals(language);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:GrLightElementRenamer.java


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