use of com.intellij.psi.JavaPsiFacade in project android by JetBrains.
the class NlProperties method currentActivityIfFoundIsDerivedFromAppCompatActivity.
private static boolean currentActivityIfFoundIsDerivedFromAppCompatActivity(@NotNull List<NlComponent> components) {
assert !components.isEmpty();
NlModel model = components.get(0).getModel();
Configuration configuration = model.getConfiguration();
String activityClassName = configuration.getActivity();
if (activityClassName == null) {
// Assume we are since this is how the default activities are created.
return true;
}
if (activityClassName.startsWith(".")) {
MergedManifest manifest = MergedManifest.get(model.getModule());
String pkg = StringUtil.notNullize(manifest.getPackage());
activityClassName = pkg + activityClassName;
}
JavaPsiFacade facade = JavaPsiFacade.getInstance(model.getProject());
PsiClass activityClass = facade.findClass(activityClassName, model.getModule().getModuleScope());
while (activityClass != null && !CLASS_APP_COMPAT_ACTIVITY.equals(activityClass.getQualifiedName())) {
activityClass = activityClass.getSuperClass();
}
return activityClass != null;
}
use of com.intellij.psi.JavaPsiFacade in project intellij-plugins by JetBrains.
the class StrutsVersionDetector method getStrutsJarRoot.
@Nullable
private static VirtualFile getStrutsJarRoot(final Module module) {
final GlobalSearchScope scope = GlobalSearchScope.moduleRuntimeScope(module, false);
final JavaPsiFacade psiManager = JavaPsiFacade.getInstance(module.getProject());
final VirtualFile virtualFile = getStrutsClass(scope, psiManager);
if (virtualFile == null || !(virtualFile.getFileSystem() instanceof JarFileSystem)) {
return null;
}
final VirtualFile jarFile = JarFileSystem.getInstance().getLocalVirtualFileFor(virtualFile);
if (jarFile == null) {
return null;
}
return JarFileSystem.getInstance().getJarRootForLocalFile(jarFile);
}
Aggregations