use of com.intellij.psi.PsiModifierList in project intellij-community by JetBrains.
the class GrTypeDefinitionRangeHandler method getDeclarationRange.
@NotNull
@Override
public TextRange getDeclarationRange(@NotNull GrTypeDefinition aClass) {
if (aClass instanceof GrAnonymousClassDefinition) {
GrNewExpression call = (GrNewExpression) aClass.getParent();
int startOffset = call.getTextRange().getStartOffset();
int endOffset = call.getArgumentList().getTextRange().getEndOffset();
return new TextRange(startOffset, endOffset);
} else {
final PsiModifierList modifierList = aClass.getModifierList();
int startOffset = modifierList == null ? aClass.getTextRange().getStartOffset() : modifierList.getTextRange().getStartOffset();
final GrImplementsClause implementsList = aClass.getImplementsClause();
int endOffset = implementsList == null ? aClass.getTextRange().getEndOffset() : implementsList.getTextRange().getEndOffset();
return new TextRange(startOffset, endOffset);
}
}
use of com.intellij.psi.PsiModifierList in project kotlin by JetBrains.
the class JavaScriptInterfaceDetector method isJavaScriptAnnotated.
private static boolean isJavaScriptAnnotated(PsiClass clz) {
while (clz != null) {
PsiModifierList modifierList = clz.getModifierList();
if (modifierList != null && modifierList.findAnnotation(JAVASCRIPT_INTERFACE_CLS) != null) {
return true;
}
for (PsiMethod method : clz.getMethods()) {
if (method.getModifierList().findAnnotation(JAVASCRIPT_INTERFACE_CLS) != null) {
return true;
}
}
clz = clz.getSuperClass();
}
return false;
}
use of com.intellij.psi.PsiModifierList in project android by JetBrains.
the class AndroidLayoutXmlTagNameProvider method isDeclarationDeprecated.
private static boolean isDeclarationDeprecated(@Nullable PsiElement declaration) {
if (!(declaration instanceof PsiClass)) {
return false;
}
final PsiClass aClass = (PsiClass) declaration;
final PsiModifierList modifierList = aClass.getModifierList();
if (modifierList == null) {
return false;
}
return modifierList.findAnnotation("java.lang.Deprecated") != null;
}
use of com.intellij.psi.PsiModifierList in project android by JetBrains.
the class PsiCFGField method parseModifiers.
private void parseModifiers() {
PsiModifierList modifierList = mPsiFieldRef.getModifierList();
modifierBits = Modifier.ParseModifierList(modifierList);
}
use of com.intellij.psi.PsiModifierList in project android by JetBrains.
the class AndroidActivityAliasCompletionContributor method fillCompletionVariants.
@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
if (parameters.getCompletionType() != CompletionType.BASIC) {
return;
}
final Editor editor = parameters.getEditor();
LaunchOptionConfigurableContext context = editor.getUserData(LaunchOptionConfigurableContext.KEY);
if (context == null) {
return;
}
final Module module = context.getModule();
if (module == null) {
return;
}
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet == null) {
return;
}
final String prefix = parameters.getEditor().getDocument().getText().substring(0, parameters.getOffset());
result = result.withPrefixMatcher(prefix);
final PsiClass activityClass = JavaPsiFacade.getInstance(module.getProject()).findClass(AndroidUtils.ACTIVITY_BASE_CLASS_NAME, module.getModuleWithDependenciesAndLibrariesScope(false));
if (activityClass != null) {
final CompletionResultSet finalResult = result;
ClassInheritorsSearch.search(activityClass, module.getModuleWithDependenciesScope(), true, true, false).forEach(new Processor<PsiClass>() {
@Override
public boolean process(PsiClass psiClass) {
final PsiModifierList modifierList = psiClass.getModifierList();
if (modifierList != null && modifierList.hasModifierProperty(PsiModifier.PUBLIC) && !modifierList.hasModifierProperty(PsiModifier.ABSTRACT)) {
final String qName = psiClass.getQualifiedName();
if (qName != null && qName.length() > 0) {
finalResult.addElement(JavaLookupElementBuilder.forClass(psiClass, qName));
}
}
return true;
}
});
}
final Set<String> aliases = collectActivityAliases(facet);
if (aliases.size() > 0) {
for (String alias : aliases) {
LookupElementBuilder element = LookupElementBuilder.create(alias);
final String shortName = StringUtilRt.getShortName(alias);
if (!shortName.equals(alias)) {
element = element.withLookupString(shortName);
}
result.addElement(element);
}
}
result.stopHere();
}
Aggregations