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