• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java PsiImportStaticStatement类的典型用法和代码示例

java 1次浏览

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

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

示例1: inlineElement

点赞 3

import com.intellij.psi.PsiImportStaticStatement; //导入依赖的package包/类
@Override
public void inlineElement(Project project, Editor editor, PsiElement element) {
  final PsiImportStaticStatement staticStatement = PsiTreeUtil.getParentOfType(element, PsiImportStaticStatement.class);
  final List<PsiJavaCodeReferenceElement> referenceElements =
    collectReferencesThrough(element.getContainingFile(), null, staticStatement);

  RefactoringEventData data = new RefactoringEventData();
  data.addElement(element);
  project.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringStarted(REFACTORING_ID, data);
  

  new WriteCommandAction(project, REFACTORING_NAME){
    @Override
    protected void run(@NotNull Result result) throws Throwable {
      replaceAllAndDeleteImport(referenceElements, null, staticStatement);
    }
  }.execute();
  project.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringDone(REFACTORING_ID, null);
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:20,
代码来源:InlineStaticImportHandler.java

示例2: checkStaticOnDemandImportResolvesToClass

点赞 3

import com.intellij.psi.PsiImportStaticStatement; //导入依赖的package包/类
static HighlightInfo checkStaticOnDemandImportResolvesToClass(PsiImportStaticStatement statement)
{
	if(statement.isOnDemand() && statement.resolveTargetClass() == null)
	{
		PsiJavaCodeReferenceElement ref = statement.getImportReference();
		if(ref != null)
		{
			PsiElement resolve = ref.resolve();
			if(resolve != null)
			{
				return HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(ObjectUtils.notNull(ref.getReferenceNameElement(), ref)).descriptionAndTooltip("Class " + ref
						.getCanonicalText() + " not found").create();
			}
		}
	}
	return null;
}
 

开发者ID:consulo,
项目名称:consulo-java
代码行数:18,
代码来源:ImportsHighlightUtil.java

示例3: buildFixes

点赞 3

import com.intellij.psi.PsiImportStaticStatement; //导入依赖的package包/类
@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos)
{
	final List<InspectionGadgetsFix> result = new SmartList<>();
	final PsiImportStaticStatement importStaticStatement = (PsiImportStaticStatement) infos[0];
	final SuppressForTestsScopeFix fix = SuppressForTestsScopeFix.build(this, importStaticStatement);
	ContainerUtil.addIfNotNull(result, fix);
	final PsiClass aClass = importStaticStatement.resolveTargetClass();
	if(aClass != null)
	{
		final String name = aClass.getQualifiedName();
		result.add(new IgnoreClassFix(name, allowedClasses, "Allow static imports for class '" + name + "'"));
	}
	result.add(buildFix(infos));
	return result.toArray(InspectionGadgetsFix.EMPTY_ARRAY);
}
 

开发者ID:consulo,
项目名称:consulo-java
代码行数:18,
代码来源:StaticImportInspection.java

示例4: inlineElement

点赞 2

import com.intellij.psi.PsiImportStaticStatement; //导入依赖的package包/类
@Override
public void inlineElement(Project project, Editor editor, PsiElement element) {
  final PsiImportStaticStatement staticStatement = PsiTreeUtil.getParentOfType(element, PsiImportStaticStatement.class);
  final List<PsiJavaCodeReferenceElement> referenceElements =
    collectReferencesThrough(element.getContainingFile(), null, staticStatement);
  new WriteCommandAction(project, REFACTORING_NAME){
    @Override
    protected void run(Result result) throws Throwable {
      replaceAllAndDeleteImport(referenceElements, null, staticStatement);
    }
  }.execute();
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:13,
代码来源:InlineStaticImportHandler.java

示例5: visitImportStaticStatement

点赞 2

import com.intellij.psi.PsiImportStaticStatement; //导入依赖的package包/类
@Override
public void visitImportStaticStatement(PsiImportStaticStatement statement) {
    mVisitor.report("PsiImportStaticStatement", statement.getText(), statement);
    super.visitElement(statement);
}
 

开发者ID:cch-robo,
项目名称:Android_Lint_SRP_Practice_Example,
代码行数:6,
代码来源:PsiClassStructureDetector.java

示例6: canInlineElement

点赞 2

import com.intellij.psi.PsiImportStaticStatement; //导入依赖的package包/类
@Override
public boolean canInlineElement(PsiElement element) {
  if (element.getContainingFile() == null) return false;
  return PsiTreeUtil.getParentOfType(element, PsiImportStaticStatement.class) != null;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:6,
代码来源:InlineStaticImportHandler.java

示例7: ReplaceStaticImportUsageInfo

点赞 2

import com.intellij.psi.PsiImportStaticStatement; //导入依赖的package包/类
public ReplaceStaticImportUsageInfo(final PsiImportStaticStatement staticImportStatement, final PsiClass[] targetClass) {
  super(staticImportStatement);
  myStaticImportStatement = staticImportStatement;
  myTargetClasses = targetClass;
}
 

开发者ID:jskierbi,
项目名称:intellij-ce-playground,
代码行数:6,
代码来源:ReplaceStaticImportUsageInfo.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)