本文整理匯總了Java中com.intellij.psi.PsiClass.putUserData方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiClass.putUserData方法的具體用法?Java PsiClass.putUserData怎麽用?Java PsiClass.putUserData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.PsiClass
的用法示例。
在下文中一共展示了PsiClass.putUserData方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addExtensions
import com.intellij.psi.PsiClass; //導入方法依賴的package包/類
private PsiClass addExtensions( GlobalSearchScope scope, ManModule module, String fqn, PsiClass psiClass )
{
if( isExtended( module, fqn ) )
{
// Find the class excluding our ManTypeFinder to avoid circularity
psiClass = psiClass != null ? psiClass : JavaPsiFacade.getInstance( module.getIjProject() ).findClass( fqn, scope );
if( psiClass != null )
{
psiClass = new ManifoldExtendedPsiClass( module.getIjModule(), psiClass );
psiClass.putUserData( ModuleUtil.KEY_MODULE, module.getIjModule() );
FqnCache<PsiClass> map = _type2Class.computeIfAbsent( module, k -> new FqnCache<>() );
map.add( fqn, psiClass );
}
}
return psiClass;
}
示例2: create
import com.intellij.psi.PsiClass; //導入方法依賴的package包/類
public static PsiClass create( Project project, Exception e )
{
PsiClass errorClass = JavaPsiFacade.getInstance( project ).getParserFacade().createClassFromText( "", null );
errorClass.putUserData( KEY_ERROR_MESSAGE, e );
return errorClass;
}
示例3: findJavaElementsFor
import com.intellij.psi.PsiClass; //導入方法依賴的package包/類
private static List<PsiElement> findJavaElementsFor( PsiClass psiClass, PsiElement element, FeaturePath parent )
{
List<PsiElement> result = new ArrayList<>();
if( isJavaElementFor( psiClass, element ) )
{
result.add( psiClass );
psiClass.putUserData( KEY_FEATURE_PATH, FeaturePath.make( parent, FeaturePath.FeatureType.Class, 0, 1 ) );
}
PsiMethod[] methods = psiClass.getMethods();
for( int i = 0; i < methods.length; i++ )
{
PsiMethod method = methods[i];
if( isJavaElementFor( method, element ) ||
element instanceof PsiClass && isJavaElementForType( method, (PsiClass)element ) )
{
result.add( method );
method.putUserData( KEY_FEATURE_PATH, FeaturePath.make( parent, FeaturePath.FeatureType.Method, i, methods.length ) );
}
}
PsiField[] fields = psiClass.getFields();
for( int i = 0; i < fields.length; i++ )
{
PsiField field = fields[i];
if( isJavaElementFor( field, element ) ||
element instanceof PsiClass && isJavaElementForType( field, (PsiClass)element ) )
{
result.add( field );
field.putUserData( KEY_FEATURE_PATH, FeaturePath.make( parent, FeaturePath.FeatureType.Field, i, fields.length ) );
}
}
PsiClass[] inners = psiClass.getInnerClasses();
for( int i = 0; i < inners.length; i++ )
{
PsiClass inner = inners[i];
if( isJavaElementFor( inner, element ) ||
element instanceof PsiClass && isJavaElementForType( inner, (PsiClass)element ) )
{
result.add( inner );
inner.putUserData( KEY_FEATURE_PATH, FeaturePath.make( parent, FeaturePath.FeatureType.Class, i, inners.length ) );
}
result.addAll( findJavaElementsFor( inner, element, new FeaturePath( parent, FeaturePath.FeatureType.Class, i, inners.length ) ) );
}
return result;
}