本文整理汇总了Java中com.intellij.codeInspection.ex.LocalInspectionToolWrapper类的典型用法代码示例。如果您正苦于以下问题:Java LocalInspectionToolWrapper类的具体用法?Java LocalInspectionToolWrapper怎么用?Java LocalInspectionToolWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalInspectionToolWrapper类属于com.intellij.codeInspection.ex包,在下文中一共展示了LocalInspectionToolWrapper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: configureLocalInspectionTools
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@NotNull
@Override
protected LocalInspectionTool[] configureLocalInspectionTools() {
if ("RandomEditingForUnused".equals(getTestName(false))) {
return new LocalInspectionTool[]{new UnusedImportLocalInspection(),};
}
List<InspectionToolWrapper> all = InspectionToolRegistrar.getInstance().createTools();
List<LocalInspectionTool> locals = new ArrayList<>();
for (InspectionToolWrapper tool : all) {
if (tool instanceof LocalInspectionToolWrapper) {
LocalInspectionTool e = ((LocalInspectionToolWrapper)tool).getTool();
locals.add(e);
}
}
return locals.toArray(new LocalInspectionTool[locals.size()]);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:HighlightStressTest.java
示例2: init
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
private static boolean init() {
// It's assumed that default spell checking inspection settings are just fine for processing all types of data.
// Please perform corresponding settings tuning if that assumption is broken at future.
Class<LocalInspectionTool>[] inspectionClasses = (Class<LocalInspectionTool>[])new Class<?>[] {SpellCheckingInspection.class};
for (Class<LocalInspectionTool> inspectionClass : inspectionClasses) {
try {
LocalInspectionTool tool = inspectionClass.newInstance();
SPELL_CHECK_TOOLS.put(tool.getShortName(), new LocalInspectionToolWrapper(tool));
}
catch (Throwable e) {
return false;
}
}
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SpellCheckingEditorCustomization.java
示例3: inspectEx
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@NotNull
public static Map<String, List<ProblemDescriptor>> inspectEx(@NotNull final List<LocalInspectionToolWrapper> toolWrappers,
@NotNull final PsiFile file,
@NotNull final InspectionManager iManager,
final boolean isOnTheFly,
boolean failFastOnAcquireReadAction,
@NotNull final ProgressIndicator indicator) {
if (toolWrappers.isEmpty()) return Collections.emptyMap();
final List<PsiElement> elements = new ArrayList<PsiElement>();
TextRange range = file.getTextRange();
Divider.divideInsideAndOutside(file, range.getStartOffset(), range.getEndOffset(), range, elements, new ArrayList<ProperTextRange>(),
Collections.<PsiElement>emptyList(), Collections.<ProperTextRange>emptyList(), true, Conditions.<PsiFile>alwaysTrue());
return inspectElements(toolWrappers, file, iManager, isOnTheFly, failFastOnAcquireReadAction, indicator, elements,
calcElementDialectIds(elements));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:InspectionEngine.java
示例4: getDialectIdsSpecifiedForTool
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@Nullable("null means not specified")
private static Set<String> getDialectIdsSpecifiedForTool(@NotNull LocalInspectionToolWrapper wrapper) {
String langId = wrapper.getLanguage();
if (langId == null) {
return null;
}
Language language = Language.findLanguageByID(langId);
Set<String> result;
if (language != null) {
List<Language> dialects = language.getDialects();
boolean applyToDialects = wrapper.applyToDialects();
result = applyToDialects && !dialects.isEmpty() ? new THashSet<String>(1 + dialects.size()) : new SmartHashSet<String>();
result.add(langId);
if (applyToDialects) {
for (Language dialect : dialects) {
result.add(dialect.getID());
}
}
}
else {
// unknown language in plugin.xml, ignore
result = Collections.singleton(langId);
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:InspectionEngine.java
示例5: setUp
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
SSBasedInspection inspection = new SSBasedInspection();
List<Configuration> configurations = new ArrayList<Configuration>();
SearchConfiguration configuration = new SearchConfiguration();
MatchOptions options = new MatchOptions();
options.setFileType(StdFileTypes.JAVA);
options.setSearchPattern("int i;");
configuration.setMatchOptions(options);
configurations.add(configuration);
configuration = new SearchConfiguration();
options = new MatchOptions();
options.setFileType(StdFileTypes.JAVA);
options.setSearchPattern("f();");
configuration.setMatchOptions(options);
configurations.add(configuration);
inspection.setConfigurations(configurations, myProject);
myWrapper = new LocalInspectionToolWrapper(inspection);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SSBasedInspectionTest.java
示例6: testHighlightStatus_OtherInspections
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
public void testHighlightStatus_OtherInspections() throws Throwable {
myElement.setFileDescription(new DomFileDescription<DomElement>(DomElement.class, "a"));
final MyDomElementsInspection inspection = new MyDomElementsInspection() {
@Override
public ProblemDescriptor[] checkFile(@NotNull final PsiFile file, @NotNull final InspectionManager manager,
final boolean isOnTheFly) {
myAnnotationsManager.appendProblems(myElement, createHolder(), this.getClass());
return new ProblemDescriptor[0];
}
@Override
public void checkFileElement(final DomFileElement fileElement, final DomElementAnnotationHolder holder) {
}
};
HighlightDisplayKey.register(inspection.getShortName());
myInspectionProfile.setInspectionTools(new LocalInspectionToolWrapper(inspection));
myAnnotationsManager.appendProblems(myElement, createHolder(), MockAnnotatingDomInspection.class);
assertEquals(DomHighlightStatus.ANNOTATORS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement));
myAnnotationsManager.appendProblems(myElement, createHolder(), inspection.getClass());
assertEquals(DomHighlightStatus.INSPECTIONS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:DomHighlightingLiteTest.java
示例7: testHighlightStatus_OtherInspections2
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
public void testHighlightStatus_OtherInspections2() throws Throwable {
myElement.setFileDescription(new DomFileDescription<DomElement>(DomElement.class, "a"));
final MyDomElementsInspection inspection = new MyDomElementsInspection() {
@Override
public ProblemDescriptor[] checkFile(@NotNull final PsiFile file, @NotNull final InspectionManager manager,
final boolean isOnTheFly) {
myAnnotationsManager.appendProblems(myElement, createHolder(), this.getClass());
return new ProblemDescriptor[0];
}
@Override
public void checkFileElement(final DomFileElement fileElement, final DomElementAnnotationHolder holder) {
}
};
HighlightDisplayKey.register(inspection.getShortName());
LocalInspectionToolWrapper toolWrapper = new LocalInspectionToolWrapper(inspection);
myInspectionProfile.setInspectionTools(toolWrapper);
myInspectionProfile.setEnabled(toolWrapper, false);
myAnnotationsManager.appendProblems(myElement, createHolder(), MockAnnotatingDomInspection.class);
assertEquals(DomHighlightStatus.INSPECTIONS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DomHighlightingLiteTest.java
示例8: testHighlightStatus_OtherInspections
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
public void testHighlightStatus_OtherInspections() throws Throwable {
myElement.setFileDescription(new DomFileDescription(DomElement.class, "a"));
final MyDomElementsInspection inspection = new MyDomElementsInspection() {
@Override
public ProblemDescriptor[] checkFile(@NotNull final PsiFile file, @NotNull final InspectionManager manager,
final boolean isOnTheFly) {
myAnnotationsManager.appendProblems(myElement, createHolder(), this.getClass());
return new ProblemDescriptor[0];
}
@Override
public void checkFileElement(final DomFileElement fileElement, final DomElementAnnotationHolder holder) {
}
};
HighlightDisplayKey.register(inspection.getShortName());
myInspectionProfile.setInspectionTools(new LocalInspectionToolWrapper(inspection));
myAnnotationsManager.appendProblems(myElement, createHolder(), MockAnnotatingDomInspection.class);
assertEquals(DomHighlightStatus.ANNOTATORS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement));
myAnnotationsManager.appendProblems(myElement, createHolder(), inspection.getClass());
assertEquals(DomHighlightStatus.INSPECTIONS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement));
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:DomHighlightingLiteTest.java
示例9: testHighlightStatus_OtherInspections2
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
public void testHighlightStatus_OtherInspections2() throws Throwable {
myElement.setFileDescription(new DomFileDescription(DomElement.class, "a"));
final MyDomElementsInspection inspection = new MyDomElementsInspection() {
@Override
public ProblemDescriptor[] checkFile(@NotNull final PsiFile file, @NotNull final InspectionManager manager,
final boolean isOnTheFly) {
myAnnotationsManager.appendProblems(myElement, createHolder(), this.getClass());
return new ProblemDescriptor[0];
}
@Override
public void checkFileElement(final DomFileElement fileElement, final DomElementAnnotationHolder holder) {
}
};
HighlightDisplayKey.register(inspection.getShortName());
LocalInspectionToolWrapper toolWrapper = new LocalInspectionToolWrapper(inspection);
myInspectionProfile.setInspectionTools(toolWrapper);
myInspectionProfile.setEnabled(toolWrapper, false);
myAnnotationsManager.appendProblems(myElement, createHolder(), MockAnnotatingDomInspection.class);
assertEquals(DomHighlightStatus.INSPECTIONS_FINISHED, myAnnotationsManager.getHighlightStatus(myElement));
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:DomHighlightingLiteTest.java
示例10: run
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@Override
protected void run() {
InspectionManager inspectionManager = InspectionManager.getInstance(project);
GlobalInspectionContext context = inspectionManager.createNewGlobalContext(false);
InspectionToolWrapper toolWrapper = new LocalInspectionToolWrapper(inspectionTool);
List<ProblemDescriptor> problemDescriptors;
try {
problemDescriptors = InspectionEngine.runInspectionOnFile(psiFile, toolWrapper, context);
} catch (IndexNotReadyException exception) {
return;
}
for (ProblemDescriptor problemDescriptor : problemDescriptors) {
QuickFix[] fixes = problemDescriptor.getFixes();
if (fixes != null) {
writeQuickFixes(problemDescriptor, fixes);
}
}
}
开发者ID:dubreuia,项目名称:intellij-plugin-save-actions,代码行数:19,代码来源:InspectionProcessor.java
示例11: inspectEx
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@Nonnull
public static Map<String, List<ProblemDescriptor>> inspectEx(@Nonnull final List<LocalInspectionToolWrapper> toolWrappers,
@Nonnull final PsiFile file,
@Nonnull final InspectionManager iManager,
final boolean isOnTheFly,
boolean failFastOnAcquireReadAction,
@Nonnull final ProgressIndicator indicator) {
if (toolWrappers.isEmpty()) return Collections.emptyMap();
TextRange range = file.getTextRange();
List<Divider.DividedElements> allDivided = new ArrayList<>();
Divider.divideInsideAndOutsideAllRoots(file, range, range, Conditions.alwaysTrue(), new CommonProcessors.CollectProcessor<>(allDivided));
List<PsiElement> elements = ContainerUtil.concat(
(List<List<PsiElement>>)ContainerUtil.map(allDivided, d -> ContainerUtil.concat(d.inside, d.outside, d.parents)));
return inspectElements(toolWrappers, file, iManager, isOnTheFly, failFastOnAcquireReadAction, indicator, elements,
calcElementDialectIds(elements));
}
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:InspectionEngine.java
示例12: getDialectIdsSpecifiedForTool
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@Nullable
public static Set<String> getDialectIdsSpecifiedForTool(@Nonnull LocalInspectionToolWrapper wrapper) {
String langId = wrapper.getLanguage();
if (langId == null) {
return null;
}
Language language = Language.findLanguageByID(langId);
Set<String> result;
if (language != null) {
result = new SmartHashSet<String>();
result.add(langId);
}
else {
// unknown language in plugin.xml, ignore
result = Collections.singleton(langId);
}
return result;
}
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:InspectionEngine.java
示例13: testSimpleInspection
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
public void testSimpleInspection() {
// force Camel enabled so the inspection test can run
CamelInspection inspection = new CamelInspection(true);
// must be called fooroute as inspectionsimplejava fails for some odd reason
doTest("testData/fooroute/", new LocalInspectionToolWrapper(inspection), "java 1.8");
}
开发者ID:camel-idea-plugin,项目名称:camel-idea-plugin,代码行数:8,代码来源:CamelInspectJavaSimpleTestIT.java
示例14: testIgnore
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
public void testIgnore() throws Exception {
final RedundantCastInspection castInspection = new RedundantCastInspection();
castInspection.IGNORE_ANNOTATED_METHODS = true;
castInspection.IGNORE_SUSPICIOUS_METHOD_CALLS = true;
final LocalInspectionToolWrapper tool = new LocalInspectionToolWrapper(castInspection);
doTest("redundantCast/generics/" + getTestName(false), tool, "java 1.5");
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:RedundantCast15Test.java
示例15: inspect
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@NotNull
public static List<ProblemDescriptor> inspect(@NotNull final List<LocalInspectionToolWrapper> toolWrappers,
@NotNull final PsiFile file,
@NotNull final InspectionManager iManager,
final boolean isOnTheFly,
boolean failFastOnAcquireReadAction,
@NotNull final ProgressIndicator indicator) {
final Map<String, List<ProblemDescriptor>> problemDescriptors = inspectEx(toolWrappers, file, iManager, isOnTheFly, failFastOnAcquireReadAction, indicator);
final List<ProblemDescriptor> result = new ArrayList<ProblemDescriptor>();
for (List<ProblemDescriptor> group : problemDescriptors.values()) {
result.addAll(group);
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:InspectionEngine.java
示例16: getToolsToSpecifiedLanguages
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@NotNull
public static Map<LocalInspectionToolWrapper, Set<String>> getToolsToSpecifiedLanguages(@NotNull List<LocalInspectionToolWrapper> toolWrappers) {
Map<LocalInspectionToolWrapper, Set<String>> toolToLanguages = new THashMap<LocalInspectionToolWrapper, Set<String>>();
for (LocalInspectionToolWrapper wrapper : toolWrappers) {
ProgressManager.checkCanceled();
Set<String> specifiedLangIds = getDialectIdsSpecifiedForTool(wrapper);
toolToLanguages.put(wrapper, specifiedLangIds);
}
return toolToLanguages;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:InspectionEngine.java
示例17: runLocalTool
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
private ProblemDescriptor runLocalTool(@NotNull PsiElement psiElement,
@NotNull InspectionManager inspectionManager,
@NotNull OfflineProblemDescriptor offlineProblemDescriptor) {
PsiFile containingFile = psiElement.getContainingFile();
final ProblemsHolder holder = new ProblemsHolder(inspectionManager, containingFile, false);
final LocalInspectionTool localTool = ((LocalInspectionToolWrapper)myToolWrapper).getTool();
final int startOffset = psiElement.getTextRange().getStartOffset();
final int endOffset = psiElement.getTextRange().getEndOffset();
LocalInspectionToolSession session = new LocalInspectionToolSession(containingFile, startOffset, endOffset);
final PsiElementVisitor visitor = localTool.buildVisitor(holder, false, session);
localTool.inspectionStarted(session, false);
final PsiElement[] elementsInRange = getElementsIntersectingRange(containingFile, startOffset, endOffset);
for (PsiElement element : elementsInRange) {
element.accept(visitor);
}
localTool.inspectionFinished(session, holder);
if (holder.hasResults()) {
final List<ProblemDescriptor> list = holder.getResults();
final int idx = offlineProblemDescriptor.getProblemIndex();
int curIdx = 0;
for (ProblemDescriptor descriptor : list) {
final PsiNamedElement member = localTool.getProblemElement(descriptor.getPsiElement());
if (psiElement instanceof PsiFile || member != null && member.equals(psiElement)) {
if (curIdx == idx) {
setUserObject(descriptor);
return descriptor;
}
curIdx++;
}
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:OfflineProblemDescriptorNode.java
示例18: GotoInspectionModel
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
public GotoInspectionModel(Project project) {
super(project, IdeBundle.message("prompt.goto.inspection.enter.name"), "goto.inspection.help.id");
final InspectionProfileImpl rootProfile = (InspectionProfileImpl)InspectionProfileManager.getInstance().getRootProfile();
for (ScopeToolState state : rootProfile.getAllTools(project)) {
InspectionToolWrapper tool = state.getTool();
if (tool instanceof LocalInspectionToolWrapper && ((LocalInspectionToolWrapper)tool).isUnfair()) {
continue;
}
final String name = tool.getDisplayName() + " " + StringUtil.join(tool.getGroupPath(), " ");
myToolNames.put(name, tool);
}
myNames = ArrayUtil.toStringArray(myToolNames.keySet());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GotoInspectionModel.java
示例19: getInspectionTools
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@NotNull
@Override
List<LocalInspectionToolWrapper> getInspectionTools(@NotNull InspectionProfileWrapper profile) {
List<LocalInspectionToolWrapper> tools = super.getInspectionTools(profile);
List<LocalInspectionToolWrapper> result = new ArrayList<LocalInspectionToolWrapper>(tools.size());
for (LocalInspectionToolWrapper tool : tools) {
if (!tool.runForWholeFile()) result.add(tool);
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:LocalInspectionsPassFactory.java
示例20: createHighlightingPass
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper; //导入依赖的package包/类
@Override
@Nullable
public TextEditorHighlightingPass createHighlightingPass(@NotNull final PsiFile file, @NotNull final Editor editor) {
TextRange textRange = FileStatusMap.getDirtyTextRange(editor, Pass.LOCAL_INSPECTIONS);
if (textRange == null ||
!InspectionProjectProfileManager.getInstance(file.getProject()).isProfileLoaded() ||
myFileTools.containsKey(file) && !myFileTools.get(file)) {
return null;
}
return new LocalInspectionsPass(file, editor.getDocument(), 0, file.getTextLength(), LocalInspectionsPass.EMPTY_PRIORITY_RANGE, true,
new DefaultHighlightInfoProcessor()) {
@NotNull
@Override
List<LocalInspectionToolWrapper> getInspectionTools(@NotNull InspectionProfileWrapper profile) {
List<LocalInspectionToolWrapper> tools = super.getInspectionTools(profile);
List<LocalInspectionToolWrapper> result = new ArrayList<LocalInspectionToolWrapper>(tools.size());
for (LocalInspectionToolWrapper tool : tools) {
if (tool.runForWholeFile()) result.add(tool);
}
myFileTools.put(file, !result.isEmpty());
return result;
}
@Override
protected String getPresentableName() {
return DaemonBundle.message("pass.whole.inspections");
}
@Override
void inspectInjectedPsi(@NotNull List<PsiElement> elements,
boolean onTheFly,
@NotNull ProgressIndicator indicator,
@NotNull InspectionManager iManager,
boolean inVisibleRange,
@NotNull List<LocalInspectionToolWrapper> wrappers) {
// already inspected in LIP
}
};
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:WholeFileLocalInspectionsPassFactory.java
注:本文中的com.intellij.codeInspection.ex.LocalInspectionToolWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论