本文整理汇总了Java中com.intellij.psi.PsiClass.getQualifiedName方法的典型用法代码示例。如果您正苦于以下问题:Java PsiClass.getQualifiedName方法的具体用法?Java PsiClass.getQualifiedName怎么用?Java PsiClass.getQualifiedName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiClass
的用法示例。
在下文中一共展示了PsiClass.getQualifiedName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findResourceBundle
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private Optional<PropertiesFile> findResourceBundle(Project project, PsiClass configClass) {
String qualifiedName = configClass.getQualifiedName();
if (qualifiedName != null) {
int lastDotIndex = qualifiedName.lastIndexOf(".");
String packageName = qualifiedName.substring(0, lastDotIndex);
String className = qualifiedName.substring(lastDotIndex + 1);
PsiPackage psiPackage = JavaPsiFacade.getInstance(project).findPackage(packageName);
if (psiPackage != null) {
return Arrays.stream(psiPackage.getFiles(GlobalSearchScope.allScope(project)))
.filter(psiFile -> psiFile instanceof PropertiesFile && psiFile.getVirtualFile().getNameWithoutExtension().equals(className))
.map(psiFile -> (PropertiesFile) psiFile)
.findFirst();
}
}
return Optional.empty();
}
示例2: maybeGetInnerClass
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
@Nullable
private PsiClass maybeGetInnerClass( String fqn, PsiClass delegate )
{
String delegateFqn = delegate.getQualifiedName();
if( delegateFqn.length() < fqn.length() )
{
String rest = fqn.substring( delegateFqn.length() + 1 );
for( StringTokenizer tokenizer = new StringTokenizer( rest, "." ); tokenizer.hasMoreTokens(); )
{
String innerName = tokenizer.nextToken();
PsiClass innerClass = delegate.findInnerClassByName( innerName, false );
if( innerClass == null )
{
break;
}
delegate = innerClass;
}
}
return delegate;
}
示例3: typeIsTooGeneric
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
boolean typeIsTooGeneric(PsiType type) {
PsiClass clazz = PsiTypesUtil.getPsiClass(type);
if (clazz == null) {
return true;
}
String qualifiedName = clazz.getQualifiedName();
return qualifiedName == null
|| qualifiedName.startsWith("java.lang")
|| qualifiedName.startsWith("java.io")
|| qualifiedName.startsWith("java.util");
}
示例4: isMissingOnError
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
@Override
public boolean isMissingOnError(PsiMethod method) {
PsiClass clz = method.getContainingClass();
String type = clz.getQualifiedName();
if ("io.reactivex.Observable".equals(type) ||
"io.reactivex.Flowable".equals(type) ||
"io.reactivex.Completable".equals(type) ||
"io.reactivex.Single".equals(type) ||
"io.reactivex.Maybe".equals(type)) {
return checkMethodSignature(method);
}
return false;
}
示例5: getClassPath
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
@Nullable
public static String getClassPath(@NotNull AnActionEvent event) {
String packageName = null;
PsiElement element = event.getData(LangDataKeys.PSI_ELEMENT);
if (element == null) {
return packageName;
}
if (element instanceof PsiClass) {
PsiClass cls = (PsiClass) element;
if (cls.getContainingClass() != null) {
// 排除内部类的情况
packageName = cls.getContainingClass().getQualifiedName();
} else {
packageName = cls.getQualifiedName();
}
Log.debug("class => " + packageName);
} else if (element instanceof PsiMethod) {
PsiMethod method = (PsiMethod) element;
Log.debug("method => " + method.getName() + " # "
+ method.getContainingClass().getQualifiedName());
packageName = method.getContainingClass().getQualifiedName();
} else if (element instanceof PsiVariable) {
PsiVariable psiVariable = (PsiVariable) element;
packageName = psiVariable.getType().getCanonicalText();
// 去除泛型
if (!Utils.isEmpty(packageName)) {
packageName = packageName.replaceAll("<.*>", "");
}
// FIXME: 2017/11/11 变量对应类是内部类会有问题
Log.debug("PsiVariable:" + psiVariable.getType().getCanonicalText());
} else {
Log.debug("cls = " + element.getClass());
}
return packageName;
}
示例6: getRealPackage
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
/**
* 替换成 Developer 需要的包名
* 如 android.view.View.OnClickListener 替换成 android/view/View.OnClickListener.html
* @param psiClass
* @return
*/
private String getRealPackage(PsiClass psiClass) {
String topPackage = null;
if (psiClass.getContainingClass() != null) {
topPackage = psiClass.getContainingClass().getQualifiedName();
}
String classPackage = psiClass.getQualifiedName();
if (Utils.isEmpty(topPackage)) {
return classPackage.replaceAll("\\.", "/") + ".html";
}
classPackage = classPackage.replaceFirst(topPackage, topPackage.replaceAll("\\.", "/"));
return classPackage + ".html";
}
示例7: getNonGenericType
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
public static String getNonGenericType(PsiType type) {
if (type instanceof PsiClassType) {
PsiClassType pct = (PsiClassType) type;
final PsiClass psiClass = pct.resolve();
return psiClass != null ? psiClass.getQualifiedName() : null;
}
return type.getCanonicalText();
}
示例8: buildClassLookup
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private Optional<LookupElementBuilder> buildClassLookup(PsiClass psiClass) {
String qualifiedName = psiClass.getQualifiedName();
String name = psiClass.getName();
if (qualifiedName != null && name != null) {
return Optional.of(JavaLookupElementBuilder.forClass(psiClass, qualifiedName, true).withPresentableText(name));
} else {
return Optional.empty();
}
}
示例9: isSketchClass
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
public static boolean isSketchClass(PsiClass klass) {
if (klass.getQualifiedName() == null) { return false; }
// klass.isInheritor(myBase, true) && ConfigurationUtil.PUBLIC_INSTANTIATABLE_CLASS.value(klass)
// @TODO This would only find Processing 3 PApplet classes. Investigate handling Processing 2.0.
return InheritanceUtil.isInheritor(klass, "processing.core.PApplet")
&& ConfigurationUtil.PUBLIC_INSTANTIATABLE_CLASS.value(klass);
}
示例10: isInterfaceMadeStructuralByExtension
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private boolean isInterfaceMadeStructuralByExtension( PsiClass psiInterface, ManModule module )
{
final String fqn = psiInterface.getQualifiedName();
ManModule manModule = ManProject.getModule( module.getIjModule() );
for( ITypeManifold sp : manModule.getTypeManifolds() )
{
if( sp.getProducerKind() == Supplemental )
{
if( sp.isType( fqn ) )
{
List<IFile> files = sp.findFilesForType( fqn );
for( IFile file : files )
{
VirtualFile vExtensionClassFile = ((IjFile)file).getVirtualFile();
if( !vExtensionClassFile.isValid() )
{
continue;
}
PsiJavaFile psiExtClassJavaFile =
(PsiJavaFile)PsiManager.getInstance( module.getIjModule().getProject() ).findFile( vExtensionClassFile );
PsiClass[] classes = psiExtClassJavaFile.getClasses();
if( classes.length > 0 )
{
PsiClass psiExtClass = classes[0];
if( psiExtClass.getModifierList().findAnnotation( Structural.class.getName() ) != null )
{
return true;
}
}
}
}
}
}
return false;
}
示例11: findFeatureName
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private String findFeatureName( FeaturePath path )
{
PsiClass root = path.getRoot();
String fqn = root.getQualifiedName();
PsiClass psiClass = JavaPsiFacade.getInstance( root.getProject() ).findClass( fqn, GlobalSearchScope.moduleScope( ModuleUtilCore.findModuleForPsiElement( root ) ) );
if( psiClass == null )
{
return null;
}
PsiNamedElement renamedFeature = findFeatureElement( psiClass, path.getChild() );
return renamedFeature == null ? null : renamedFeature.getName();
}
示例12: getExtendedFqn
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
@NotNull
private String getExtendedFqn( PsiClass extensionClass )
{
String fqn = extensionClass.getQualifiedName();
int iExt = fqn.indexOf( ExtensionManifold.EXTENSIONS_PACKAGE + '.' );
fqn = fqn.substring( iExt + ExtensionManifold.EXTENSIONS_PACKAGE.length() + 1 );
fqn = fqn.substring( 0, fqn.lastIndexOf( '.' ) );
return fqn;
}
示例13: getAugments
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
public <E extends PsiElement> List<E> getAugments( Module module, PsiElement element, Class<E> cls )
{
// Module is assigned to user-data via ManTypeFinder, which loads the psiClass (element)
Module context = module != null ? module : element.getUserData( ModuleUtil.KEY_MODULE );
if( context == null )
{
return Collections.emptyList();
}
if( DumbService.getInstance( element.getProject() ).isDumb() )
{
// skip processing during index rebuild
return Collections.emptyList();
}
if( !(element instanceof PsiClass) || !element.isValid() || !PsiMethod.class.isAssignableFrom( cls ) )
{
return Collections.emptyList();
}
List<PsiElement> augFeatures = new ArrayList<>();
PsiClass psiClass = (PsiClass)element;
String className = psiClass.getQualifiedName();
if( className == null )
{
return Collections.emptyList();
}
addMethods( className, psiClass, context, augFeatures );
//noinspection unchecked
return (List<E>)augFeatures;
}
示例14: check
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
void check(@NonNull PsiClass clazz) {
// クラス内のインナークラスや匿名クラスは、対象としていません。
if (mClass != null) return;
// 無名クラスは、対象としていません。
if (clazz.getQualifiedName() == null) return;
init(clazz);
Debug.classFields(mClass, mClassFields);
Debug.classMethods(mClass, mUnusedMethods);
}
开发者ID:cch-robo,项目名称:Android_Lint_SRP_Practice_Example,代码行数:13,代码来源:SharingGroupClassificationDetector.java
示例15: resolvePackage
import com.intellij.psi.PsiClass; //导入方法依赖的package包/类
private PsiPackage resolvePackage(PsiClass aggregateRoot) {
String qualifiedName = aggregateRoot.getQualifiedName();
JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(getProject());
return javaPsiFacade.findPackage(qualifiedName.substring(0, qualifiedName.lastIndexOf(".")));
}