本文整理汇总了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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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());
}
}
示例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()));
}
}
示例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()));
}
}
示例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()));
}
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}