• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PsiImportStatement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: value

import com.intellij.psi.PsiImportStatement; //导入依赖的package包/类
public final boolean value( PsiFile psiFile )
{
    final boolean[] hasPolygeneImportPackage = new boolean[]{ false };

    psiFile.accept( new JavaElementVisitor()
    {
        @Override
        public final void visitImportStatement( PsiImportStatement statement )
        {
            String packageName = statement.getQualifiedName();
            if( packageName != null && packageName.startsWith( "org.apache.polygene" ) )
            {
                hasPolygeneImportPackage[ 0 ] = true;
            }
        }

        @Override
        public void visitReferenceExpression( PsiReferenceExpression expression )
        {
            // Ignore
        }
    } );
    return hasPolygeneImportPackage[ 0 ];
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:25,代码来源:PolygeneFacetType.java


示例2: isReferenceToAnnotation

import com.intellij.psi.PsiImportStatement; //导入依赖的package包/类
private static ThreeState isReferenceToAnnotation(final PsiElement psiElement)
{
	if(psiElement.getLanguage() == JavaLanguage.INSTANCE && !PsiUtil.isLanguageLevel5OrHigher(psiElement))
	{
		return ThreeState.NO;
	}
	if(PsiTreeUtil.getParentOfType(psiElement, PsiAnnotation.class) != null)
	{
		return ThreeState.YES;
	}
	if(PsiTreeUtil.getParentOfType(psiElement, PsiImportStatement.class) != null)
	{
		return ThreeState.UNSURE;
	}
	return ThreeState.NO;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:17,代码来源:OrderEntryFix.java


示例3: visitClass

import com.intellij.psi.PsiImportStatement; //导入依赖的package包/类
@Override
public void visitClass(@NotNull PsiClass aClass) {
  // no call to super, so it doesn't drill down
  if (!(aClass.getParent() instanceof PsiJavaFile)) {
    return;
  }
  if (FileTypeUtils.isInJsp(aClass.getContainingFile())) {
    return;
  }
  final PsiJavaFile file = (PsiJavaFile)aClass.getParent();
  if (file == null) {
    return;
  }
  if (!file.getClasses()[0].equals(aClass)) {
    return;
  }
  final PsiImportList importList = file.getImportList();
  if (importList == null) {
    return;
  }
  final PsiImportStatement[] importStatements =
    importList.getImportStatements();
  for (final PsiImportStatement importStatement : importStatements) {
    if (!importStatement.isOnDemand()) {
      registerError(importStatement);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:SingleClassImportInspection.java


示例4: visitImportStatement

import com.intellij.psi.PsiImportStatement; //导入依赖的package包/类
@Override
public void visitImportStatement(PsiImportStatement statement) {
    mVisitor.report("PsiImportStatement", statement.getText(), statement);
    super.visitElement(statement);
}
 
开发者ID:cch-robo,项目名称:Android_Lint_SRP_Practice_Example,代码行数:6,代码来源:PsiClassStructureDetector.java


示例5: CollidingClassImportUsageInfo

import com.intellij.psi.PsiImportStatement; //导入依赖的package包/类
public CollidingClassImportUsageInfo(PsiImportStatement element, PsiElement referencedElement) {
  super(element, referencedElement);
  myImportStatement = element;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:CollidingClassImportUsageInfo.java


示例6: getImportStatement

import com.intellij.psi.PsiImportStatement; //导入依赖的package包/类
public PsiImportStatement getImportStatement() {
  return myImportStatement;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:CollidingClassImportUsageInfo.java


示例7: RemoveImportUsageInfo

import com.intellij.psi.PsiImportStatement; //导入依赖的package包/类
public RemoveImportUsageInfo(PsiImportStatement importStatement) {
  super(importStatement);
  myImportStatement = importStatement;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:RemoveImportUsageInfo.java


示例8: ensureBoundModelIsValid

import com.intellij.psi.PsiImportStatement; //导入依赖的package包/类
private static void ensureBoundModelIsValid(ProblemsHolder holder, PsiAnnotation annotation) {
  final BoundMetaData boundMetaData = DataBindUtil.getBoundMetaData(annotation);

  if (!boundMetaData.getBindingMetaData().isValidBindableModel()) {
    final PsiClass boundClass = boundMetaData.getBindingMetaData().getBoundClass();
    if (boundClass != null) {
      final PsiVariable var = (PsiVariable) Util.getImmediateOwnerElement(annotation);
      if (var == null) {
        return;
      }
      final PsiTypeElement typeElement = var.getTypeElement();
      if (typeElement == null) {
        return;
      }
      holder.registerProblem(typeElement, "The model type (" + boundClass.getQualifiedName() + ") is not bindable.");
    }
    else {
      final Collection<AnnotationSearchResult> autoBoundAnnotations
          = boundMetaData.getBindingMetaData().getModelAnnotations();

      if (autoBoundAnnotations.size() > 1) {
        holder.registerProblem(annotation, "Multiple model binding annotations found");
      }
    }
  }
  else {
    final PsiElement element = Util.getMethodOrField(annotation);

    if (!Util.elementIsAnnotated(element, Types.JAVAX_INJECT)) {
      holder.registerProblem(annotation, "Model specifier is not injected", new LocalQuickFix() {
        @NotNull
        @Override
        public String getName() {
          return "Add @Inject to class member";
        }

        @NotNull
        @Override
        public String getFamilyName() {
          return GroupNames.BUGS_GROUP_NAME;
        }

        @Override
        public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
          final JavaPsiFacade instance = JavaPsiFacade.getInstance(project);
          final PsiElementFactory elementFactory = instance.getElementFactory();

          final PsiImportStatement importJavaxInject = instance.getElementFactory()
              .createImportStatement(
                  instance.findClass(Types.JAVAX_INJECT,
                      ProjectScope.getAllScope(project))
              );

          final PsiImportList importList = ((PsiJavaFile) PsiUtil.getTopLevelClass(element).getParent()).getImportList();
          importList.add(importJavaxInject);

          ((PsiModifierListOwner) element).getModifierList().addAnnotation("Inject");
        }
      });
    }
  }
}
 
开发者ID:errai,项目名称:errai-intellij-idea-plugin,代码行数:63,代码来源:BoundModelValidInspection.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GroupDetails类代码示例发布时间:2022-05-22
下一篇:
Java NullSafeAccessor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap