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


Java PsiClass类代码示例

本文整理汇总了Java中com.intellij.psi.PsiClass的典型用法代码示例。如果您正苦于以下问题:Java PsiClass类的具体用法?Java PsiClass怎么用?Java PsiClass使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PsiClass类属于com.intellij.psi包,在下文中一共展示了PsiClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findClass

import com.intellij.psi.PsiClass; //导入依赖的package包/类
@Override
public PsiClass findClass( String fqn, GlobalSearchScope globalSearchScope )
{
  //System.out.println( "findClass() : " + fqn + " : " + globalSearchScope );

  if( DumbService.getInstance( globalSearchScope.getProject() ).isDumb() )
  {
    // skip processing during index rebuild
    return null;
  }

  List<ManModule> modules = findModules( globalSearchScope );

  for( ManModule m : modules )
  {
    PsiClass psiClass = ManifoldPsiClassCache.instance().getPsiClass( globalSearchScope, m, fqn );
    if( psiClass != null )
    {
      return psiClass;
    }
  }
  return null;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:24,代码来源:ManTypeFinder.java

示例2: computeChildren

import com.intellij.psi.PsiClass; //导入依赖的package包/类
protected MultiMap<PsiFile, ToolNode> computeChildren(PsiFile psiFile) {
    MultiMap<PsiFile, ToolNode> children = new MultiMap<>();
    Project project = getProject();
    if (project != null) {
        PsiClass toolInterface = JavaPsiFacade.getInstance(project).findClass(TOOL_INTERFACE, GlobalSearchScope.allScope(project));
        if (toolInterface != null) {
            ClassInheritorsSearch.search(toolInterface, GlobalSearchScope.allScope(project), true).forEach(psiClass -> {
                PsiFile containingFile = psiClass.getContainingFile();
                if (!isAbstract(psiClass)) {
                    children.putValue(containingFile, new ToolNode(this, psiClass));
                }
            });
        }
    }
    return children;
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:17,代码来源:ToolsNode.java

示例3: FieldsDialog

import com.intellij.psi.PsiClass; //导入依赖的package包/类
public FieldsDialog(ConvertBridge.Operator operator, ClassEntity classEntity,
                    PsiElementFactory factory, PsiClass psiClass, PsiClass aClass, PsiFile file, Project project
        , String generateClassStr) {
    this.operator = operator;
    this.factory = factory;
    this.aClass = aClass;
    this.file = file;
    this.project = project;
    this.psiClass = psiClass;
    this.generateClassStr = generateClassStr;
    setContentPane(contentPane);
    setTitle("Virgo Model");
    getRootPane().setDefaultButton(buttonOK);
    this.setAlwaysOnTop(true);
    initListener(classEntity, generateClassStr);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:FieldsDialog.java

示例4: canProcessElement

import com.intellij.psi.PsiClass; //导入依赖的package包/类
@Override
public boolean canProcessElement( @NotNull PsiElement elem )
{
  PsiElement[] element = new PsiElement[]{elem};
  List<PsiElement> javaElems = findJavaElements( element );
  if( javaElems.isEmpty() )
  {
    return false;
  }

  for( PsiElement javaElem : javaElems )
  {
    if( !(javaElem instanceof PsiMethod) &&
        !(javaElem instanceof PsiField) &&
        !(javaElem instanceof PsiClass) )
    {
      return false;
    }
  }

  return true;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:23,代码来源:RenameResourceElementProcessor.java

示例5: isJavaElementForType

import com.intellij.psi.PsiClass; //导入依赖的package包/类
private static boolean isJavaElementForType( PsiModifierListOwner modifierListOwner, PsiClass psiClass )
{
  PsiAnnotation annotation = modifierListOwner.getModifierList().findAnnotation( TypeReference.class.getName() );
  if( annotation != null )
  {
    PsiNameValuePair[] attributes = annotation.getParameterList().getAttributes();
    for( PsiNameValuePair pair : attributes )
    {
      String fqn = pair.getLiteralValue();
      if( psiClass.getQualifiedName().contains( fqn ) )
      {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:18,代码来源:ResourceToManifoldUtil.java

示例6: makePsiMethod

import com.intellij.psi.PsiClass; //导入依赖的package包/类
private PsiMethod makePsiMethod( AbstractSrcMethod method, PsiClass psiClass )
{
  PsiElementFactory elementFactory = JavaPsiFacade.getInstance( psiClass.getProject() ).getElementFactory();
  StringBuilder sb = new StringBuilder();
  method.render( sb, 0 );
  try
  {
    return elementFactory.createMethodFromText( sb.toString(), psiClass );
  }
  catch( IncorrectOperationException ioe )
  {
    // the text of the method does not conform to method grammar, probably being edited in an IJ editor,
    // ignore these since the editor provides error information
    return null;
  }
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:17,代码来源:ManAugmentProvider.java

示例7: actionPerformed

import com.intellij.psi.PsiClass; //导入依赖的package包/类
public void actionPerformed(AnActionEvent event) {
        Project project = event.getData(PlatformDataKeys.PROJECT);
        Editor editor = event.getData(PlatformDataKeys.EDITOR);
        PsiFile mFile = PsiUtilBase.getPsiFileInEditor(editor, project);
        PsiClass psiClass = getTargetClass(editor, mFile);
        GridMain gridMain = new GridMain(psiClass,mFile,project);
        //DBConn dbConn = new DBConn(psiClass,mFile,project);
//        JsonDialog jsonD = new JsonDialog(psiClass, mFile, project);
//        jsonD.setClass(psiClass);
//        jsonD.setFile(mFile);
//        jsonD.setProject(project);
//        jsonD.setSize(600, 400);
//        jsonD.setLocationRelativeTo(null);
//        jsonD.setVisible(true);

    }
 
开发者ID:zeng198821,项目名称:CodeGenerate,代码行数:17,代码来源:MainAction.java

示例8: checkClass

import com.intellij.psi.PsiClass; //导入依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
    super.checkClass(context, node);

    JavaEvaluator evaluator = context.getEvaluator();
    if (evaluator.isAbstract(node)) {
        return;
    }

    boolean isFragmentPagerAdapter = evaluator.extendsClass(node, CLASS_FRAGMENT_PAGER_ADAPTER, false);
    if (isFragmentPagerAdapter) return;

    boolean isFragmentStatePagerAdapter = evaluator.extendsClass(node, CLASS_FRAGMENT_STATE_PAGER_ADAPTER, false);
    if (isFragmentStatePagerAdapter) return;

    boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTOPOINT_PAGER_ADAPTER, false);

    if (!supportAutoPoint) {
        context.report(ISSUE_PAGER_ADAPTER, node, context.getLocation(node),
                "Pager Adapter 必须实现DDPagerAdapter,否则不支持自动打点 class:" + node.getName());
    }
}
 
开发者ID:jessie345,项目名称:CustomLintRules,代码行数:23,代码来源:AutoPointPagerAdapterDetector.java

示例9: checkClass

import com.intellij.psi.PsiClass; //导入依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
    super.checkClass(context, node);

    JavaEvaluator evaluator = context.getEvaluator();
    if (evaluator.isAbstract(node)) {
        return;
    }

    boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTO_POINT_POP_WINDOW, false);

    if (!supportAutoPoint) {
        context.report(ISSUE_POP_WINDOW, node, context.getLocation(node),
                String.format("%s do not support auto point,should extends DDPopupWindow", node.toString()));
    }
}
 
开发者ID:jessie345,项目名称:CustomLintRules,代码行数:17,代码来源:AutoPointPopWindowDetector.java

示例10: checkClass

import com.intellij.psi.PsiClass; //导入依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
    super.checkClass(context, node);

    JavaEvaluator evaluator = context.getEvaluator();
    if (evaluator.isAbstract(node)) {
        return;
    }

    boolean supportAutoPoint = evaluator.extendsClass(node, CLASS_AUTO_POINT_ALERT_DIALOG, false);

    if (!supportAutoPoint) {
        context.report(ISSUE_ALERT_DIALOG, node, context.getLocation(node),
                String.format("%s do not support auto point,should extends DDAlertDialog", node.toString()));
    }
}
 
开发者ID:jessie345,项目名称:CustomLintRules,代码行数:17,代码来源:AutoPointAlertDialogDetector.java

示例11: checkClass

import com.intellij.psi.PsiClass; //导入依赖的package包/类
@Override
public void checkClass(JavaContext context, PsiClass node) {
    super.checkClass(context, node);

    JavaEvaluator evaluator = context.getEvaluator();
    if (evaluator.isAbstract(node)) {
        return;
    }

    boolean autopoint_dialog = evaluator.extendsClass(node, CLASS_AUTO_POINT_DIALOG, false);
    boolean alert_dialog = evaluator.extendsClass(node, CLASS_ALERT_DIALOG, false);
    boolean alert_v7_dialog = evaluator.extendsClass(node, CLASS_ALERT_V7_DIALOG, false);

    if (!alert_v7_dialog && !alert_dialog && !autopoint_dialog) {
        context.report(ISSUE_DIALOG, node, context.getLocation(node),
                String.format("%s do not support auto point,should extends DDDialog", node.toString()));
    }
}
 
开发者ID:jessie345,项目名称:CustomLintRules,代码行数:19,代码来源:AutoPointDialogDetector.java

示例12: findExtensionMethodNavigationElement

import com.intellij.psi.PsiClass; //导入依赖的package包/类
private PsiElement findExtensionMethodNavigationElement( PsiClass extClass, PsiMethod plantedMethod )
{
  PsiMethod[] found = extClass.findMethodsByName( plantedMethod.getName(), false );
  outer:
  for( PsiMethod m : found )
  {
    PsiParameter[] extParams = m.getParameterList().getParameters();
    PsiParameter[] plantedParams = plantedMethod.getParameterList().getParameters();
    if( extParams.length - 1 == plantedParams.length )
    {
      for( int i = 1; i < extParams.length; i++ )
      {
        PsiParameter extParam = extParams[i];
        PsiParameter plantedParam = plantedParams[i - 1];
        PsiType extErased = TypeConversionUtil.erasure( extParam.getType() );
        PsiType plantedErased = TypeConversionUtil.erasure( plantedParam.getType() );
        if( !extErased.toString().equals( plantedErased.toString() ) )
        {
          continue outer;
        }
      }
      return m.getNavigationElement();
    }
  }
  return null;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:27,代码来源:ManAugmentProvider.java

示例13: resolveCompletions

import com.intellij.psi.PsiClass; //导入依赖的package包/类
@Override
public Stream<LookupElementBuilder> resolveCompletions(String propertyName, PsiType psiType) {
    PsiType[] parameters = ((PsiClassReferenceType) psiType).getParameters();
    Stream<PsiClass> psiClassStream = null;
    if (parameters.length == 1 && parameters[0] instanceof PsiWildcardType) {
        PsiWildcardType psiWildcardType = ((PsiWildcardType) parameters[0]);
        if (psiWildcardType.isBounded()) {
            if (psiWildcardType.isExtends()) {
                psiClassStream = subClasses((PsiClassType) psiWildcardType.getExtendsBound()).stream();
            } else if (psiWildcardType.isSuper()) {
                psiClassStream = superClasses((PsiClassType) psiWildcardType.getSuperBound()).stream();
            }
        }
    }
    if (psiClassStream != null) {
        return psiClassStream.map(this::buildClassLookup).filter(Optional::isPresent).map(Optional::get);
    } else {
        return Stream.empty();
    }
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:21,代码来源:ClassCompletionResolver.java

示例14: findUsages

import com.intellij.psi.PsiClass; //导入依赖的package包/类
@Nullable
@Override
public List<UsageInfo> findUsages( PsiFile psiFile, PsiDirectory newParent, boolean searchInComments, boolean searchInNonJavaFiles )
{
  Module mod = ModuleUtilCore.findModuleForPsiElement( psiFile );
  ManModule module = ManProject.getModule( mod );
  PsiClass psiClass = findPsiClass( psiFile );
  if( psiClass == null )
  {
    return Collections.emptyList();
  }

  Query<PsiReference> search = ReferencesSearch.search( psiClass, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope( module.getIjModule() ) );
  List<UsageInfo> usages = new ArrayList<>();
  for( PsiReference ref: search.findAll() )
  {
    usages.add( new MoveRenameUsageInfo( ref.getElement(), ref, ref.getRangeInElement().getStartOffset(),
      ref.getRangeInElement().getEndOffset(), psiClass,
      ref.resolve() == null && !(ref instanceof PsiPolyVariantReference && ((PsiPolyVariantReference)ref).multiResolve( true ).length > 0) ) );
  }
  return usages;
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:23,代码来源:MoveTypeManifoldFileProcessor.java

示例15: 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


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