當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。