Search in sources :

Example 21 with PsiModifierList

use of com.intellij.psi.PsiModifierList in project android by JetBrains.

the class AndroidClassBrowserBase method showDialog.

@Override
protected String showDialog() {
    Project project = getProject();
    final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
    Module module = myModuleSelector.getModule();
    if (module == null) {
        Messages.showErrorDialog(project, ExecutionBundle.message("module.not.specified.error.text"), CommonBundle.getErrorTitle());
        return null;
    }
    GlobalSearchScope scope = myIncludeLibraryClasses ? module.getModuleWithDependenciesAndLibrariesScope(true) : module.getModuleWithDependenciesScope();
    PsiClass initialSelection = facade.findClass(getText(), scope);
    TreeClassChooser chooser = createTreeClassChooser(project, scope, initialSelection, new ClassFilter() {

        @Override
        public boolean isAccepted(PsiClass aClass) {
            if (aClass.isInterface())
                return false;
            final PsiModifierList modifierList = aClass.getModifierList();
            return modifierList == null || !modifierList.hasModifierProperty(PsiModifier.ABSTRACT);
        }
    });
    if (chooser == null)
        return null;
    chooser.showDialog();
    PsiClass selClass = chooser.getSelected();
    return selClass != null ? selClass.getQualifiedName() : null;
}
Also used : JavaPsiFacade(com.intellij.psi.JavaPsiFacade) Project(com.intellij.openapi.project.Project) TreeClassChooser(com.intellij.ide.util.TreeClassChooser) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) ClassFilter(com.intellij.ide.util.ClassFilter) PsiClass(com.intellij.psi.PsiClass) Module(com.intellij.openapi.module.Module) PsiModifierList(com.intellij.psi.PsiModifierList)

Aggregations

PsiModifierList (com.intellij.psi.PsiModifierList)21 PsiClass (com.intellij.psi.PsiClass)6 PsiAnnotation (com.intellij.psi.PsiAnnotation)4 PsiElement (com.intellij.psi.PsiElement)4 PsiModifierListOwner (com.intellij.psi.PsiModifierListOwner)3 NotNull (org.jetbrains.annotations.NotNull)3 Module (com.intellij.openapi.module.Module)2 Project (com.intellij.openapi.project.Project)2 PsiMember (com.intellij.psi.PsiMember)2 LaunchOptionConfigurableContext (com.android.tools.idea.run.editor.LaunchOptionConfigurableContext)1 AddAnnotationFix (com.intellij.codeInsight.intention.AddAnnotationFix)1 LookupElementBuilder (com.intellij.codeInsight.lookup.LookupElementBuilder)1 LookupImpl (com.intellij.codeInsight.lookup.impl.LookupImpl)1 ProblemDescriptor (com.intellij.codeInspection.ProblemDescriptor)1 ClassFilter (com.intellij.ide.util.ClassFilter)1 TreeClassChooser (com.intellij.ide.util.TreeClassChooser)1 Document (com.intellij.openapi.editor.Document)1 Editor (com.intellij.openapi.editor.Editor)1 TextRange (com.intellij.openapi.util.TextRange)1 JavaPsiFacade (com.intellij.psi.JavaPsiFacade)1