当前位置: 首页>>代码示例>>Java>>正文


Java LocalInspectionToolSession类代码示例

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


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

示例1: processFile

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
@Override
@NotNull
public Runnable processFile(@NotNull final PsiFile file) {
  final LocalInspectionToolSession session = new LocalInspectionToolSession(file, 0, file.getTextLength());
  final PyUnresolvedReferencesInspection.Visitor visitor = new PyUnresolvedReferencesInspection.Visitor(null,
                                                                                                        session,
                                                                                                        Collections.<String>emptyList());
  file.accept(new PyRecursiveElementVisitor() {
    @Override
    public void visitPyElement(PyElement node) {
      super.visitPyElement(node);
      node.accept(visitor);
    }
  });
  return new Runnable() {
    @Override
    public void run() {
      visitor.optimizeImports();
      if (file instanceof PyFile) {
        new ImportSorter((PyFile)file).run();
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PyImportOptimizer.java

示例2: Visitor

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
public Visitor(final ProblemsHolder holder, LocalInspectionToolSession session) {
  super(holder, session);
  PsiFile psiFile = session.getFile();
  // save us continuous checks for level, module, stc
  myLevel = LanguageLevel.forElement(psiFile);
  // string classes
  final List<PyClass> stringClasses = new ArrayList<PyClass>(2);
  final PyBuiltinCache builtins = PyBuiltinCache.getInstance(psiFile);
  PyClass cls = builtins.getClass("str");
  if (cls != null) stringClasses.add(cls);
  cls = builtins.getClass("unicode");
  if (cls != null) stringClasses.add(cls);
  myStringClasses = stringClasses;
  // reference signatures
  PyClass objectClass = builtins.getClass("object");
  if (objectClass != null) {
    final PyFunction methodRepr = objectClass.findMethodByName("__repr__", false);
    if (methodRepr != null) myOneParamFunction = methodRepr;
    final PyFunction methodDelattr = objectClass.findMethodByName("__delattr__", false);
    if (methodDelattr != null) myTwoParamFunction = methodDelattr;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PyPropertyDefinitionInspection.java

示例3: removeFormerImport

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
private static void removeFormerImport(@NotNull final PsiFile usageFile, boolean addImport) {
  if (usageFile instanceof PyFile && addImport) {
    final LocalInspectionToolSession session = new LocalInspectionToolSession(usageFile, 0, usageFile.getTextLength());
    final PyUnresolvedReferencesInspection.Visitor visitor = new PyUnresolvedReferencesInspection.Visitor(null,
                                                                                                          session,
                                                                                                          Collections.<String>emptyList());
    usageFile.accept(new PyRecursiveElementVisitor() {
      @Override
      public void visitPyElement(PyElement node) {
        super.visitPyElement(node);
        node.accept(visitor);
      }
    });

    visitor.optimizeImports();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PyMakeFunctionFromMethodQuickFix.java

示例4: buildVisitor

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
@NotNull
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder,
                                      final boolean isOnTheFly,
                                      @NotNull LocalInspectionToolSession session) {
  final PyUnusedLocalInspectionVisitor visitor = new PyUnusedLocalInspectionVisitor(holder,
                                                                                    session,
                                                                                    ignoreTupleUnpacking,
                                                                                    ignoreLambdaParameters,
                                                                                    ignoreLoopIterationVariables);
  // buildVisitor() will be called on injected files in the same session - don't overwrite if we already have one
  final PyUnusedLocalInspectionVisitor existingVisitor = session.getUserData(KEY);
  if (existingVisitor == null) {
    session.putUserData(KEY, visitor);
  }
  return visitor;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:PyUnusedLocalInspection.java

示例5: buildVisitor

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder,
                                      final boolean isOnTheFly,
                                      @NotNull final LocalInspectionToolSession session) {
  return new Visitor(holder, session);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:8,代码来源:PyStudyInterpreterInspection.java

示例6: inspectionFinished

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
@Override
public void inspectionFinished(@NotNull LocalInspectionToolSession session, @NotNull ProblemsHolder problemsHolder) {
  if (LOG.isDebugEnabled()) {
    final Long startTime = session.getUserData(TIME_KEY);
    if (startTime != null) {
      LOG.debug(String.format("[%d] elapsed time: %d ms\n",
                              Thread.currentThread().getId(),
                              (System.nanoTime() - startTime) / 1000000));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PyTypeCheckerInspection.java

示例7: buildVisitor

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder,
                                      boolean isOnTheFly,
                                      @NotNull LocalInspectionToolSession session) {
  return new Visitor(holder, session);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PyUnreachableCodeInspection.java

示例8: buildVisitor

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) {
  if (LOG.isDebugEnabled())
    session.putUserData(TIME_KEY, System.nanoTime());
  return new Visitor(holder, session);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PyTypeCheckerInspection.java

示例9: buildVisitor

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder,
                                      boolean isOnTheFly,
                                      @NotNull LocalInspectionToolSession session) {
  return new Visitor(holder, session);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PyNestedDecoratorsInspection.java

示例10: buildVisitor

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull ProblemsHolder holder,
                                      boolean isOnTheFly,
                                      @NotNull LocalInspectionToolSession session) {
  return new Visitor(holder, session, ignoreComparisonToZero);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PySimplifyBooleanCheckInspection.java

示例11: buildVisitor

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder,
                                      final boolean isOnTheFly,
                                      @NotNull final LocalInspectionToolSession session) {
  return new MyVisitor(holder);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:CommandLineInspection.java

示例12: buildVisitor

import com.intellij.codeInspection.LocalInspectionToolSession; //导入依赖的package包/类
@NotNull
@Override
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder,
                                      final boolean isOnTheFly,
                                      @NotNull final LocalInspectionToolSession session) {
  return new Visitor(holder, session);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PyAssignmentToLoopOrWithParameterInspection.java


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