本文整理汇总了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);
}
示例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);
}
}
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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());
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}