本文整理汇总了Java中com.intellij.codeInspection.ex.InspectionToolWrapper类的典型用法代码示例。如果您正苦于以下问题:Java InspectionToolWrapper类的具体用法?Java InspectionToolWrapper怎么用?Java InspectionToolWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InspectionToolWrapper类属于com.intellij.codeInspection.ex包,在下文中一共展示了InspectionToolWrapper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: configureLocalInspectionTools
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的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: convertToNewFormat
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
public static Element convertToNewFormat(Element profileFile, InspectionProfile profile) {
Element rootElement = new Element(INSPECTIONS_TAG);
rootElement.setAttribute(NAME_ATT, profile.getName());
final InspectionToolWrapper[] tools = profile.getInspectionTools(null);
for (final Object o : profileFile.getChildren(INSP_TOOL_TAG)) {
Element toolElement = ((Element)o).clone();
String toolClassName = toolElement.getAttributeValue(CLASS_ATT);
final String shortName = convertToShortName(toolClassName, tools);
if (shortName == null) {
continue;
}
toolElement.setAttribute(CLASS_ATT, shortName);
rootElement.addContent(toolElement);
}
return rootElement;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:InspectionProfileConvertor.java
示例3: fillErrorLevels
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
protected void fillErrorLevels(final ModifiableModel profile) {
InspectionToolWrapper[] toolWrappers = profile.getInspectionTools(null);
LOG.assertTrue(toolWrappers != null, "Profile was not correctly init");
//fill error levels
for (final String shortName : myDisplayLevelMap.keySet()) {
//key <-> short name
HighlightDisplayLevel level = myDisplayLevelMap.get(shortName);
HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
if (key == null) continue;
//set up tools for default profile
if (level != HighlightDisplayLevel.DO_NOT_SHOW) {
profile.enableTool(shortName, null, null);
}
if (level == null || level == HighlightDisplayLevel.DO_NOT_SHOW) {
level = HighlightDisplayLevel.WARNING;
}
profile.setErrorLevel(key, level, null);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:InspectionProfileConvertor.java
示例4: enableInspectionTool
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
public static void enableInspectionTool(@NotNull final Project project, @NotNull final InspectionToolWrapper toolWrapper) {
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
final String shortName = toolWrapper.getShortName();
final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
if (key == null) {
HighlightDisplayKey.register(shortName, toolWrapper.getDisplayName(), toolWrapper.getID());
}
InspectionProfileImpl.initAndDo(new Computable() {
@Override
public Object compute() {
InspectionProfileImpl impl = (InspectionProfileImpl)profile;
InspectionToolWrapper existingWrapper = impl.getInspectionTool(shortName, project);
if (existingWrapper == null || existingWrapper.isInitialized() != toolWrapper.isInitialized() || toolWrapper.isInitialized() && toolWrapper.getTool() != existingWrapper.getTool()) {
impl.addTool(project, toolWrapper, new THashMap<String, List<String>>());
}
impl.enableTool(shortName, project);
return null;
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LightPlatformTestCase.java
示例5: compareToolResults
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
public static void compareToolResults(@NotNull GlobalInspectionContextImpl context,
@NotNull InspectionToolWrapper toolWrapper,
boolean checkRange,
String testDir) {
final Element root = new Element("problems");
final Document doc = new Document(root);
InspectionToolPresentation presentation = context.getPresentation(toolWrapper);
presentation.updateContent(); //e.g. dead code need check for reachables
presentation.exportResults(root);
File file = new File(testDir + "/expected.xml");
try {
Document expectedDocument = JDOMUtil.loadDocument(file);
compareWithExpected(expectedDocument, doc, checkRange);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:InspectionTestUtil.java
示例6: getIcon
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
@NotNull
private static Icon getIcon(@NotNull InspectionToolWrapper tool) {
Icon icon = null;
final Language language = Language.findLanguageByID(tool.getLanguage());
if (language != null) {
final LanguageFileType fileType = language.getAssociatedFileType();
if (fileType != null) {
icon = fileType.getIcon();
}
}
if (icon == null) {
icon = UnknownFileType.INSTANCE.getIcon();
}
assert icon != null;
return icon;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:InspectionListCellRenderer.java
示例7: getWorkedTools
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
@NotNull
private Set<InspectionToolWrapper> getWorkedTools(@NotNull InspectionNode node) {
final Set<InspectionToolWrapper> result = new HashSet<InspectionToolWrapper>();
final InspectionToolWrapper wrapper = node.getToolWrapper();
if (myView.getCurrentProfileName() != null){
result.add(wrapper);
return result;
}
final String shortName = wrapper.getShortName();
final GlobalInspectionContextImpl context = myView.getGlobalInspectionContext();
final Tools tools = context.getTools().get(shortName);
if (tools != null) { //dummy entry points tool
for (ScopeToolState state : tools.getTools()) {
InspectionToolWrapper toolWrapper = state.getTool();
result.add(toolWrapper);
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ExportHTMLAction.java
示例8: startInspection
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
public void startInspection(@NotNull InspectionToolWrapper toolWrapper) {
myInspectionToolWrappers.add(toolWrapper);
@NonNls StringBuffer buf = new StringBuffer();
buf.append("<HTML><HEAD><TITLE>");
buf.append(ApplicationNamesInfo.getInstance().getFullProductName());
buf.append(InspectionsBundle.message("inspection.export.title"));
buf.append("</TITLE></HEAD>");
buf.append("<FRAMESET cols=\"30%,70%\"><FRAMESET rows=\"30%,70%\">");
buf.append("<FRAME src=\"");
buf.append(toolWrapper.getFolderName());
buf.append("/index.html\" name=\"inspectionFrame\">");
buf.append("<FRAME src=\"empty.html\" name=\"packageFrame\">");
buf.append("</FRAMESET>");
buf.append("<FRAME src=\"empty.html\" name=\"elementFrame\">");
buf.append("</FRAMESET></BODY></HTML");
HTMLExportUtil.writeFile(myRootFolder, toolWrapper.getFolderName() + "-index.html", buf, myProject);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HTMLExportFrameMaker.java
示例9: getDescription
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
@Override
public String getDescription(@NotNull final String refSuffix, @NotNull final Editor editor) {
final Project project = editor.getProject();
if (project == null) {
LOG.error(editor);
return null;
}
if (project.isDisposed()) return null;
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
return null;
}
final InspectionProfile profile = (InspectionProfile)InspectionProfileManager.getInstance().getRootProfile();
final InspectionToolWrapper toolWrapper = profile.getInspectionTool(refSuffix, file);
if (toolWrapper == null) return null;
String description = toolWrapper.loadDescription();
if (description == null) {
LOG.warn("No description for inspection '" + refSuffix + "'");
description = InspectionsBundle.message("inspection.tool.description.under.construction.text");
}
return description;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:InspectionDescriptionLinkHandler.java
示例10: invoke
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
final ProjectInspectionToolsConfigurable configurable =
new ProjectInspectionToolsConfigurable(InspectionProfileManager.getInstance(), profileManager) {
@Override
protected boolean acceptTool(InspectionToolWrapper entry) {
return super.acceptTool(entry) && entry.isCleanupTool();
}
@Override
public String getDisplayName() {
return CodeCleanupAction.CODE_CLEANUP_INSPECTIONS_DISPLAY_NAME;
}
};
ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:EditCleanupProfileIntentionAction.java
示例11: getInspectionShortNameByIssue
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
public static String getInspectionShortNameByIssue(@NotNull Project project, @NotNull Issue issue) {
synchronized (ISSUE_MAP_LOCK) {
if (ourIssue2InspectionShortName == null) {
ourIssue2InspectionShortName = new HashMap<Issue, String>();
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(project).getInspectionProfile();
for (InspectionToolWrapper e : profile.getInspectionTools(null)) {
final String shortName = e.getShortName();
if (shortName.startsWith("AndroidLint")) {
final InspectionProfileEntry entry = e.getTool();
if (entry instanceof AndroidLintInspectionBase) {
final Issue s = ((AndroidLintInspectionBase)entry).getIssue();
ourIssue2InspectionShortName.put(s, shortName);
}
}
}
}
return ourIssue2InspectionShortName.get(issue);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AndroidLintInspectionBase.java
示例12: addRemoveTestsScope
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
private void addRemoveTestsScope(Project project, boolean add) {
final InspectionProjectProfileManager profileManager = InspectionProjectProfileManager.getInstance(project);
final InspectionProfileImpl profile = (InspectionProfileImpl)profileManager.getInspectionProfile();
final String shortName = myInspection.getShortName();
final InspectionToolWrapper tool = profile.getInspectionTool(shortName, project);
if (tool == null) {
return;
}
final NamedScope namedScope = NamedScopesHolder.getScope(project, "Tests");
final HighlightDisplayKey key = HighlightDisplayKey.find(shortName);
final HighlightDisplayLevel level = profile.getErrorLevel(key, namedScope, project);
if (add) {
profile.addScope(tool, namedScope, level, false, project);
}
else {
profile.removeScope(shortName, 0, project);
}
profile.scopesChanged();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:SuppressForTestsScopeFix.java
示例13: convertToNewFormat
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
public static Element convertToNewFormat(Element profileFile, InspectionProfile profile) throws IOException, JDOMException {
Element rootElement = new Element(INSPECTIONS_TAG);
rootElement.setAttribute(NAME_ATT, profile.getName());
final InspectionToolWrapper[] tools = profile.getInspectionTools(null);
for (final Object o : profileFile.getChildren(INSP_TOOL_TAG)) {
Element toolElement = ((Element)o).clone();
String toolClassName = toolElement.getAttributeValue(CLASS_ATT);
final String shortName = convertToShortName(toolClassName, tools);
if (shortName == null) {
continue;
}
toolElement.setAttribute(CLASS_ATT, shortName);
rootElement.addContent(toolElement);
}
return rootElement;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:InspectionProfileConvertor.java
示例14: getElementsByName
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
@Override
public Object[] getElementsByName(final String id, final String pattern) {
final Set<InspectionToolWrapper> result = new HashSet<InspectionToolWrapper>();
InspectionToolWrapper e = myToolNames.get(id);
if (e != null) {
result.add(e);
}
e = myToolShortNames.get(id);
if (e != null) {
result.add(e);
}
final Set<InspectionToolWrapper> entries = myGroupNames.get(id);
if (entries != null) {
result.addAll(entries);
}
return result.toArray(new InspectionToolWrapper[result.size()]);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:GotoInspectionModel.java
示例15: update
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
@Override
public void update(AnActionEvent e) {
if (!myView.isSingleToolInSelection()) {
e.getPresentation().setEnabled(false);
return;
}
//noinspection ConstantConditions
@NotNull InspectionToolWrapper toolWrapper = myView.getTree().getSelectedToolWrapper();
final InspectionRVContentProvider provider = myView.getProvider();
if (provider.isContentLoaded()) {
final QuickFixAction[] quickFixes = provider.getQuickFixes(toolWrapper, myView.getTree());
if (quickFixes == null || quickFixes.length == 0) {
e.getPresentation().setEnabled(false);
return;
}
e.getPresentation().setEnabled(!ActionGroupUtil.isGroupEmpty(getFixes(quickFixes), e));
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:InvokeQuickFixAction.java
示例16: getDescription
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
@Override
public String getDescription(@NotNull final String refSuffix, @NotNull final Editor editor) {
final Project project = editor.getProject();
if (project == null) {
LOG.error(editor);
return null;
}
final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (file == null) {
return null;
}
final InspectionProfile profile = (InspectionProfile)InspectionProfileManager.getInstance().getRootProfile();
final InspectionToolWrapper toolWrapper = profile.getInspectionTool(refSuffix, file);
if (toolWrapper == null) return null;
String description = toolWrapper.loadDescription();
if (description == null) {
LOG.warn("No description for inspection '" + refSuffix + "'");
description = InspectionsBundle.message("inspection.tool.description.under.construction.text");
}
return description;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:InspectionDescriptionLinkHandler.java
示例17: run
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的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
示例18: compareToolResults
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
public static void compareToolResults(@Nonnull GlobalInspectionContextImpl context,
@Nonnull InspectionToolWrapper toolWrapper,
boolean checkRange,
String testDir) {
final Element root = new Element("problems");
final Document doc = new Document(root);
InspectionToolPresentation presentation = context.getPresentation(toolWrapper);
presentation.updateContent(); //e.g. dead code need check for reachables
presentation.exportResults(root);
File file = new File(testDir + "/expected.xml");
try {
Document expectedDocument = JDOMUtil.loadDocument(file);
compareWithExpected(expectedDocument, doc, checkRange);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:consulo,项目名称:consulo,代码行数:22,代码来源:InspectionTestUtil.java
示例19: getIcon
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
@Nonnull
private static Icon getIcon(@Nonnull InspectionToolWrapper tool) {
Icon icon = null;
final Language language = Language.findLanguageByID(tool.getLanguage());
if (language != null) {
final LanguageFileType fileType = language.getAssociatedFileType();
if (fileType != null) {
icon = fileType.getIcon();
}
}
if (icon == null) {
icon = UnknownFileType.INSTANCE.getIcon();
}
assert icon != null;
return icon;
}
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:InspectionListCellRenderer.java
示例20: getWorkedTools
import com.intellij.codeInspection.ex.InspectionToolWrapper; //导入依赖的package包/类
@Nonnull
private Set<InspectionToolWrapper> getWorkedTools(@Nonnull InspectionNode node) {
final Set<InspectionToolWrapper> result = new HashSet<InspectionToolWrapper>();
final InspectionToolWrapper wrapper = node.getToolWrapper();
if (myView.getCurrentProfileName() != null){
result.add(wrapper);
return result;
}
final String shortName = wrapper.getShortName();
final GlobalInspectionContextImpl context = myView.getGlobalInspectionContext();
final Tools tools = context.getTools().get(shortName);
if (tools != null) { //dummy entry points tool
for (ScopeToolState state : tools.getTools()) {
InspectionToolWrapper toolWrapper = state.getTool();
result.add(toolWrapper);
}
}
return result;
}
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:ExportHTMLAction.java
注:本文中的com.intellij.codeInspection.ex.InspectionToolWrapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论