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

Java AnalysisScope类代码示例

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

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



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

示例1: runInspection

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
@Override
public void runInspection(@NotNull final AnalysisScope scope,
                          @NotNull final InspectionManager manager,
                          @NotNull final GlobalInspectionContext globalContext,
                          @NotNull final ProblemDescriptionsProcessor problemDescriptionsProcessor) {
  globalContext.getRefManager().iterate(new RefJavaVisitor() {
    @Override public void visitClass(@NotNull RefClass refClass) {
      if (!globalContext.shouldCheck(refClass, RedundantSuppressInspectionBase.this)) return;
      CommonProblemDescriptor[] descriptors = checkElement(refClass, manager, globalContext.getProject());
      if (descriptors != null) {
        for (CommonProblemDescriptor descriptor : descriptors) {
          if (descriptor instanceof ProblemDescriptor) {
            final PsiElement psiElement = ((ProblemDescriptor)descriptor).getPsiElement();
            final PsiMember member = PsiTreeUtil.getParentOfType(psiElement, PsiMember.class);
            final RefElement refElement = globalContext.getRefManager().getReference(member);
            if (refElement != null) {
              problemDescriptionsProcessor.addProblemElement(refElement, descriptor);
              continue;
            }
          }
          problemDescriptionsProcessor.addProblemElement(refClass, descriptor);
        }
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:RedundantSuppressInspectionBase.java


示例2: createReferenceProcessor

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
private static PsiReferenceProcessor createReferenceProcessor(@NotNull final List<UsagesProcessor> processors,
                                                              final GlobalInspectionContext context) {
  return new PsiReferenceProcessor() {
    @Override
    public boolean execute(PsiReference reference) {
      AnalysisScope scope = context.getRefManager().getScope();
      if (scope != null && scope.contains(reference.getElement()) && reference.getElement().getLanguage() == StdLanguages.JAVA ||
          PsiTreeUtil.getParentOfType(reference.getElement(), PsiDocComment.class) != null) {
        return true;
      }

      synchronized (processors) {
        UsagesProcessor[] processorsArrayed = processors.toArray(new UsagesProcessor[processors.size()]);
        for (UsagesProcessor processor : processorsArrayed) {
          if (!processor.process(reference)) {
            processors.remove(processor);
          }
        }
      }

      return !processors.isEmpty();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GlobalJavaInspectionContextImpl.java


示例3: processValuesFlownTo

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
private static boolean processValuesFlownTo(@NotNull final PsiExpression argument,
                                            @NotNull PsiElement scope,
                                            @NotNull PsiManager manager,
                                            @NotNull final Processor<PsiExpression> processor) {
  SliceAnalysisParams params = new SliceAnalysisParams();
  params.dataFlowToThis = true;
  params.scope = new AnalysisScope(new LocalSearchScope(scope), manager.getProject());

  SliceRootNode rootNode = new SliceRootNode(manager.getProject(), new DuplicateMap(), LanguageSlicing.getProvider(argument).createRootUsage(argument, params));

  Collection<? extends AbstractTreeNode> children = rootNode.getChildren().iterator().next().getChildren();
  for (AbstractTreeNode child : children) {
    SliceUsage usage = (SliceUsage)child.getValue();
    PsiElement element = usage.getElement();
    if (element instanceof PsiExpression && !processor.process((PsiExpression)element)) return false;
  }

  return !children.isEmpty();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MagicConstantInspection.java


示例4: actionPerformed

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
@Override
public void actionPerformed(final AnActionEvent e) {
  final AnalysisScope scope = getScope();
  LOG.assertTrue(scope != null);
  final DependenciesBuilder builder;
  if (!myForward) {
    builder = new BackwardDependenciesBuilder(myProject, scope, myScopeOfInterest);
  } else {
    builder = new ForwardDependenciesBuilder(myProject, scope, myTransitiveBorder);
  }
  ProgressManager.getInstance().runProcessWithProgressAsynchronously(myProject, AnalysisScopeBundle.message("package.dependencies.progress.title"), new Runnable() {
    @Override
    public void run() {
      builder.analyze();
    }
  }, new Runnable() {
    @Override
    public void run() {
      myBuilders.add(builder);
      myDependencies.putAll(builder.getDependencies());
      putAllDependencies(builder);
      exclude(myExcluded);
      rebuild();
    }
  }, null, new PerformAnalysisInBackgroundOption(myProject));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DependenciesPanel.java


示例5: doTest

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
private void doTest() throws Exception {
  configureByFile("/codeInsight/slice/backward/"+getTestName(false)+".java");
  Map<String, RangeMarker> sliceUsageName2Offset = SliceTestUtil.extractSliceOffsetsFromDocument(getEditor().getDocument());
  PsiDocumentManager.getInstance(getProject()).commitAllDocuments();
  PsiElement element = new SliceHandler(true).getExpressionAtCaret(getEditor(), getFile());
  assertNotNull(element);
  SliceTestUtil.calcRealOffsets(element, sliceUsageName2Offset, myFlownOffsets);
  Collection<HighlightInfo> errors = highlightErrors();
  assertEmpty(errors);
  SliceAnalysisParams params = new SliceAnalysisParams();
  params.scope = new AnalysisScope(getProject());
  params.dataFlowToThis = true;

  SliceUsage usage = LanguageSlicing.getProvider(element).createRootUsage(element, params);
  SliceTestUtil.checkUsages(usage, myFlownOffsets);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SliceBackwardTest.java


示例6: doTest

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
protected void doTest(final boolean shouldSucceed) throws Exception {
  final String filePath = getTestFilePath();
  configureByFile(filePath);
  final PsiElement targetElement = TargetElementUtil.findTargetElement(getEditor(), TargetElementUtil.ELEMENT_NAME_ACCEPTED);
  assertTrue("<caret> is not on method name", targetElement instanceof PsiMember);
  final PsiMember psiMethod = (PsiMember)targetElement;

  try {
    MethodDuplicatesHandler.invokeOnScope(getProject(), psiMethod, new AnalysisScope(getFile()));
  }
  catch (RuntimeException e) {
    if (shouldSucceed) {
      fail("duplicates were not found");
    }
    return;
  }
  UIUtil.dispatchAllInvocationEvents();
  if (shouldSucceed) {
    checkResultByFile(filePath + ".after");
  }
  else {
    fail("duplicates found");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:FindMethodDuplicatesBaseTest.java


示例7: testForwardSimple

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
public void testForwardSimple(){
  final DependenciesBuilder builder = new ForwardDependenciesBuilder(myProject, new AnalysisScope(myProject));
  builder.analyze();

  final Set<PsiFile> searchIn = new HashSet<PsiFile>();
  final PsiClass aClass = myJavaFacade.findClass("A", GlobalSearchScope.allScope(myProject));
  searchIn.add(aClass.getContainingFile());
  final Set<PsiFile> searchFor = new HashSet<PsiFile>();
  final PsiClass bClass = myJavaFacade.findClass("B", GlobalSearchScope.allScope(myProject));
  searchFor.add(bClass.getContainingFile());

  final UsageInfo[] usagesInfos = FindDependencyUtil.findDependencies(builder, searchIn, searchFor);
  final UsageInfo2UsageAdapter[] usages = UsageInfo2UsageAdapter.convert(usagesInfos);
  final String [] psiUsages = new String [usagesInfos.length];
  for (int i = 0; i < usagesInfos.length; i++) {
    psiUsages[i] = toString(usages[i]);
  }
  checkResult(new String []{"(2: 3) B myB = new B();", "(2: 15) B myB = new B();", "(4: 9) myB.bb();"}, psiUsages);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:UsagesInAnalyzingDependenciesTest.java


示例8: testForwardJdkClasses

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
public void testForwardJdkClasses(){
  final DependenciesBuilder builder = new ForwardDependenciesBuilder(myProject, new AnalysisScope(myProject));
  builder.analyze();

  final Set<PsiFile> searchIn = new HashSet<PsiFile>();
  final PsiClass aClass = myJavaFacade.findClass("A", GlobalSearchScope.allScope(myProject));
  searchIn.add(aClass.getContainingFile());

  final Set<PsiFile> searchFor = new HashSet<PsiFile>();
  final PsiClass stringClass = myJavaFacade.findClass("java.lang.String", GlobalSearchScope.allScope(myProject));
  searchFor.add((PsiFile)stringClass.getContainingFile().getNavigationElement());

  final UsageInfo[] usagesInfos = FindDependencyUtil.findDependencies(builder, searchIn, searchFor);
  final UsageInfo2UsageAdapter[] usages = UsageInfo2UsageAdapter.convert(usagesInfos);
  final String [] psiUsages = new String [usagesInfos.length];
  for (int i = 0; i < usagesInfos.length; i++) {
    psiUsages[i] = toString(usages[i]);
  }
  checkResult(new String []{"(2: 3) String myName;"}, psiUsages);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:UsagesInAnalyzingDependenciesTest.java


示例9: launchInspections

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
protected void launchInspections(@NotNull final AnalysisScope scope) {
  ApplicationManager.getApplication().assertIsDispatchThread();
  PsiDocumentManager.getInstance(myProject).commitAllDocuments();

  LOG.info("Code inspection started");
  ProgressManager.getInstance().run(new Task.Backgroundable(getProject(), InspectionsBundle.message("inspection.progress.title"), true,
                                                            createOption()) {
    @Override
    public void run(@NotNull ProgressIndicator indicator) {
      performInspectionsWithProgress(scope, false, false);
    }

    @Override
    public void onSuccess() {
      notifyInspectionsFinished();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GlobalInspectionContextBase.java


示例10: perform

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
private void perform(List<DependenciesBuilder> builders) {
  try {
    PerformanceWatcher.Snapshot snapshot = PerformanceWatcher.takeSnapshot();
    for (AnalysisScope scope : myScopes) {
      builders.add(createDependenciesBuilder(scope));
    }
    for (DependenciesBuilder builder : builders) {
      builder.analyze();
    }
    snapshot.logResponsivenessSinceCreation("Dependency analysis");
  }
  catch (IndexNotReadyException e) {
    DumbService.getInstance(myProject).showDumbModeNotification("Analyze dependencies is not available until indices are ready");
    throw new ProcessCanceledException();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DependenciesHandlerBase.java


示例11: rerunFactory

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
@NotNull
private static Factory<UsageSearcher> rerunFactory(@NotNull final Project project, @NotNull final AnalysisScope scope) {
  return new Factory<UsageSearcher>() {
    @Override
    public UsageSearcher create() {
      return new UsageInfoSearcherAdapter() {
        @Override
        protected UsageInfo[] findUsages() {
          return AndroidInferNullityAnnotationAction.findUsages(project, scope, scope.getFileCount());
        }

        @Override
        public void generate(@NotNull Processor<Usage> processor) {
          processUsages(processor, project);
        }
      };
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AndroidInferNullityAnnotationAction.java


示例12: getScope

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
@Nullable
private AnalysisScope getScope() {
  final Set<PsiFile> selectedScope = getSelectedScope(myRightTree);
  Set<PsiFile> result = new HashSet<PsiFile>();
  ((PackageDependenciesNode)myLeftTree.getModel().getRoot()).fillFiles(result, !mySettings.UI_FLATTEN_PACKAGES);
  selectedScope.removeAll(result);
  if (selectedScope.isEmpty()) return null;
  List<VirtualFile> files = new ArrayList<VirtualFile>();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
  for (PsiFile psiFile : selectedScope) {
    final VirtualFile file = psiFile.getVirtualFile();
    LOG.assertTrue(file != null);
    if (fileIndex.isInContent(file)) {
      files.add(file);
    }
  }
  if (!files.isEmpty()) {
    return new AnalysisScope(myProject, files);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:DependenciesPanel.java


示例13: createGlobalContextForTool

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
@NotNull
@TestOnly
public static GlobalInspectionContextForTests createGlobalContextForTool(@NotNull AnalysisScope scope,
                                                                         @NotNull final Project project,
                                                                         @NotNull InspectionManagerEx inspectionManager,
                                                                         @NotNull final InspectionToolWrapper... toolWrappers) {
  final InspectionProfileImpl profile = InspectionProfileImpl.createSimple("test", project, toolWrappers);
  GlobalInspectionContextForTests context = new GlobalInspectionContextForTests(project, inspectionManager.getContentManager()) {
    @NotNull
    @Override
    protected List<Tools> getUsedTools() {
      return InspectionProfileImpl.initAndDo(new Computable<List<Tools>>() {
        @Override
        public List<Tools> compute() {
          for (InspectionToolWrapper tool : toolWrappers) {
            profile.enableTool(tool.getShortName(), project);
          }
          return profile.getAllEnabledInspectionTools(project);
        }
      });
    }
  };
  context.setCurrentScope(scope);

  return context;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:CodeInsightTestFixtureImpl.java


示例14: showOfflineView

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
@NotNull
public static InspectionResultsView showOfflineView(@NotNull Project project,
                                                    @NotNull Map<String, Map<String, Set<OfflineProblemDescriptor>>> resMap,
                                                    @NotNull InspectionProfile inspectionProfile,
                                                    @NotNull String title) {
  final AnalysisScope scope = new AnalysisScope(project);
  final InspectionManagerEx managerEx = (InspectionManagerEx)InspectionManager.getInstance(project);
  final GlobalInspectionContextImpl context = managerEx.createNewGlobalContext(false);
  context.setExternalProfile(inspectionProfile);
  context.setCurrentScope(scope);
  context.initializeTools(new ArrayList<Tools>(), new ArrayList<Tools>(), new ArrayList<Tools>());
  final InspectionResultsView view = new InspectionResultsView(project, inspectionProfile, scope, context,
                                                               new OfflineInspectionRVContentProvider(resMap, project));
  ((RefManagerImpl)context.getRefManager()).startOfflineView();
  view.update();
  TreeUtil.selectFirstNode(view.getTree());
  context.addView(view, title);
  return view;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ViewOfflineResultsAction.java


示例15: processValuesFlownTo

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
private static boolean processValuesFlownTo(@NotNull final PsiExpression argument,
                                            @NotNull PsiElement scope,
                                            @NotNull PsiManager manager,
                                            @NotNull final Processor<PsiExpression> processor) {
  SliceAnalysisParams params = new SliceAnalysisParams();
  params.dataFlowToThis = true;
  params.scope = new AnalysisScope(new LocalSearchScope(scope), manager.getProject());

  SliceRootNode rootNode = new SliceRootNode(manager.getProject(), new DuplicateMap(),
                                             LanguageSlicing.getProvider(argument).createRootUsage(argument, params));

  @SuppressWarnings("unchecked")
  Collection<? extends AbstractTreeNode> children = rootNode.getChildren().iterator().next().getChildren();
  for (AbstractTreeNode child : children) {
    SliceUsage usage = (SliceUsage)child.getValue();
    if (usage == null) {
      continue;
    }
    PsiElement element = usage.getElement();
    if (element instanceof PsiExpression && !processor.process((PsiExpression)element)) return false;
  }

  return !children.isEmpty();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ResourceTypeInspection.java


示例16: checkElement

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
@Override
@Nullable
public CommonProblemDescriptor[] checkElement(@NotNull RefEntity refEntity, @NotNull AnalysisScope analysisScope, @NotNull InspectionManager inspectionManager,
                                              @NotNull GlobalInspectionContext globalInspectionContext) {
  if (!(refEntity instanceof RefModule)) {
    return null;
  }
  final RefModule refModule = (RefModule)refEntity;
  final List<RefEntity> children = refModule.getChildren();
  if (children == null) {
    return null;
  }
  int numClasses = 0;
  for (RefEntity child : children) {
    if (child instanceof RefClass) {
      numClasses++;
    }
  }
  if (numClasses >= limit || numClasses == 0) {
    return null;
  }
  final Project project = globalInspectionContext.getProject();
  final Module[] modules = ModuleManager.getInstance(project).getModules();
  if (modules.length == 1) {
    return null;
  }
  final String errorString = InspectionGadgetsBundle.message("module.with.too.few.classes.problem.descriptor",
                                                             refModule.getName(), Integer.valueOf(numClasses), Integer.valueOf(limit));
  return new CommonProblemDescriptor[]{
    inspectionManager.createProblemDescriptor(errorString)
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ModuleWithTooFewClassesInspection.java


示例17: checkElement

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
@Override
@Nullable
public CommonProblemDescriptor[] checkElement(@NotNull RefEntity refEntity, @NotNull AnalysisScope scope, @NotNull InspectionManager manager, @NotNull GlobalInspectionContext globalContext,
                                              @NotNull ProblemDescriptionsProcessor processor) {
  if (refEntity instanceof RefMethod) {
    final RefMethod refMethod = (RefMethod)refEntity;

    if (refMethod.isConstructor()) return null;
    if (refMethod.hasSuperMethods()) return null;

    String returnValue = refMethod.getReturnValueIfSame();
    if (returnValue != null) {
      final String message;
      if (refMethod.getDerivedMethods().isEmpty()) {
        message = InspectionsBundle.message("inspection.same.return.value.problem.descriptor", "<code>" + returnValue + "</code>");
      } else if (refMethod.hasBody()) {
        message = InspectionsBundle.message("inspection.same.return.value.problem.descriptor1", "<code>" + returnValue + "</code>");
      } else {
        message = InspectionsBundle.message("inspection.same.return.value.problem.descriptor2", "<code>" + returnValue + "</code>");
      }

      return new ProblemDescriptor[] {manager.createProblemDescriptor(refMethod.getElement().getNavigationElement(), message, false, null, ProblemHighlightType.GENERIC_ERROR_OR_WARNING)};
    }
  }

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:SameReturnValueInspection.java


示例18: analyze

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
@Override
protected void analyze(@NotNull Project project, @NotNull AnalysisScope scope) {
  if (!Projects.isBuildWithGradle(project)) {
    super.analyze(project, scope);
    return;
  }
  int[] fileCount = new int[] {0};
  Map<Module, PsiFile> modules = findModulesInScope(project, scope, fileCount);
  if (modules == null) {
    return;
  }
  if (!checkModules(project, scope, modules)) {
    return;
  }
  PsiDocumentManager.getInstance(project).commitAllDocuments();
  final UsageInfo[] usageInfos = findUsages(project, scope, fileCount[0]);
  if (usageInfos == null) return;

  if (usageInfos.length < 5) {
    SwingUtilities.invokeLater(applyRunnable(project, new Computable<UsageInfo[]>() {
      @Override
      public UsageInfo[] compute() {
        return usageInfos;
      }
    }));
  }
  else {
    showUsageView(project, usageInfos, scope);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:AndroidInferNullityAnnotationAction.java


示例19: showUsageView

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
private void showUsageView(@NotNull Project project, final UsageInfo[] usageInfos, @NotNull AnalysisScope scope) {
  final UsageTarget[] targets = UsageTarget.EMPTY_ARRAY;
  final Ref<Usage[]> convertUsagesRef = new Ref<Usage[]>();
  if (!ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runReadAction(new Runnable() {
        @Override
        public void run() {
          convertUsagesRef.set(UsageInfo2UsageAdapter.convert(usageInfos));
        }
      });
    }
  }, "Preprocess Usages", true, project)) return;

  if (convertUsagesRef.isNull()) return;
  final Usage[] usages = convertUsagesRef.get();

  final UsageViewPresentation presentation = new UsageViewPresentation();
  presentation.setTabText("Infer Nullity Preview");
  presentation.setShowReadOnlyStatusAsRed(true);
  presentation.setShowCancelButton(true);
  presentation.setUsagesString(RefactoringBundle.message("usageView.usagesText"));

  final UsageView usageView = UsageViewManager.getInstance(project).showUsages(targets, usages, presentation, rerunFactory(project, scope));

  final Runnable refactoringRunnable = applyRunnable(project, new Computable<UsageInfo[]>() {
    @Override
    public UsageInfo[] compute() {
      final Set<UsageInfo> infos = UsageViewUtil.getNotExcludedUsageInfos(usageView);
      return infos.toArray(new UsageInfo[infos.size()]);
    }
  });

  String canNotMakeString = "Cannot perform operation.\nThere were changes in code after usages have been found.\nPlease perform operation search again.";

  usageView.addPerformOperationAction(refactoringRunnable, INFER_NULLITY_ANNOTATIONS, canNotMakeString, INFER_NULLITY_ANNOTATIONS, false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:InferNullityAnnotationsAction.java


示例20: checkElement

import com.intellij.analysis.AnalysisScope; //导入依赖的package包/类
@Override
@Nullable
public CommonProblemDescriptor[] checkElement(
  @NotNull RefEntity refEntity, @NotNull AnalysisScope analysisScope,
  @NotNull InspectionManager inspectionManager,
  @NotNull GlobalInspectionContext globalInspectionContext) {
  if (!(refEntity instanceof RefPackage)) {
    return null;
  }
  final List<RefEntity> children = refEntity.getChildren();
  if (children == null) {
    return null;
  }
  final Set<RefModule> modules = new HashSet<RefModule>();
  for (RefEntity child : children) {
    if (!(child instanceof RefClass)) {
      continue;
    }
    final RefClass refClass = (RefClass)child;
    final RefModule module = refClass.getModule();
    modules.add(module);
  }
  if (modules.size() <= 1) {
    return null;
  }
  final String errorString =
    InspectionGadgetsBundle.message(
      "package.in.multiple.modules.problem.descriptor",
      refEntity.getQualifiedName());

  return new CommonProblemDescriptor[]{
    inspectionManager.createProblemDescriptor(errorString)};
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:PackageInMultipleModulesInspection.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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