当前位置: 首页>>代码示例>>Java>>正文


Java PsiClass.getQualifiedName方法代码示例

本文整理汇总了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();
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:17,代码来源:CoffigDocumentationProvider.java

示例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;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:21,代码来源:ManifoldPsiClassCache.java

示例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");
}
 
开发者ID:TNG,项目名称:jgiven-intellij-plugin,代码行数:12,代码来源:TypeIsTooGenericCalculator.java

示例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;
}
 
开发者ID:IlyaGulya,项目名称:rxlint,代码行数:14,代码来源:RxJava2SubscriberCheck.java

示例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;
}
 
开发者ID:pengwei1024,项目名称:AndroidSourceViewer,代码行数:36,代码来源:Utils.java

示例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";
}
 
开发者ID:pengwei1024,项目名称:AndroidSourceViewer,代码行数:19,代码来源:AndroidDeveloperAction.java

示例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();
}
 
开发者ID:LightSun,项目名称:data-mediator,代码行数:11,代码来源:PsiUtils.java

示例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();
    }
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:10,代码来源:ClassCompletionResolver.java

示例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);
}
 
开发者ID:mistodev,项目名称:processing-idea,代码行数:10,代码来源:SketchClassFilter.java

示例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;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:37,代码来源:ExtensionClassAnnotator.java

示例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();
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:13,代码来源:RenameResourceElementProcessor.java

示例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;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:10,代码来源:ExtensionMethodUsageSearcher.java

示例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;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:34,代码来源:ManAugmentProvider.java

示例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(".")));
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:6,代码来源:AggregateNode.java


注:本文中的com.intellij.psi.PsiClass.getQualifiedName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。