use of com.intellij.codeInspection.ex.ScopeToolState in project intellij-community by JetBrains.
the class InspectionsFilter method matches.
public boolean matches(@NotNull Tools tools, final InspectionConfigTreeNode node) {
if (myShowOnlyCleanupInspections && !tools.getTool().isCleanupTool()) {
return false;
}
if (mySuitableInspectionsStates != null && mySuitableInspectionsStates != tools.isEnabled()) {
return false;
}
if (myAvailableOnlyForAnalyze && !isAvailableOnlyForAnalyze(tools)) {
return false;
}
if (!mySuitableSeverities.isEmpty()) {
boolean suitable = false;
for (final ScopeToolState state : tools.getTools()) {
if (mySuitableInspectionsStates != null && mySuitableInspectionsStates != state.isEnabled()) {
continue;
}
if (mySuitableSeverities.contains(tools.getDefaultState().getLevel().getSeverity())) {
suitable = true;
break;
}
}
if (!suitable) {
return false;
}
}
final String languageId = tools.getDefaultState().getTool().getLanguage();
final boolean containsInSuitableLanguages = mySuitableLanguageIds.isEmpty() || mySuitableLanguageIds.contains(languageId);
if (!containsInSuitableLanguages) {
return false;
}
return !myShowOnlyModifiedInspections || node.isProperSetting();
}
use of com.intellij.codeInspection.ex.ScopeToolState in project intellij-community by JetBrains.
the class ExportHTMLAction method getWorkedTools.
@NotNull
private Set<InspectionToolWrapper> getWorkedTools(@NotNull InspectionNode node) {
final Set<InspectionToolWrapper> result = new HashSet<>();
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;
}
use of com.intellij.codeInspection.ex.ScopeToolState in project intellij-community by JetBrains.
the class ToolDescriptors method fromScopeToolState.
public static ToolDescriptors fromScopeToolState(final ScopeToolState state, @NotNull InspectionProfileModifiableModel profile, final Project project) {
List<ScopeToolState> nonDefaultTools = profile.getNonDefaultTools(state.getTool().getShortName(), project);
ArrayList<Descriptor> descriptors = new ArrayList<>(nonDefaultTools.size());
for (final ScopeToolState nonDefaultToolState : nonDefaultTools) {
descriptors.add(new Descriptor(nonDefaultToolState, profile, project));
}
return new ToolDescriptors(new Descriptor(state, profile, project), descriptors);
}
use of com.intellij.codeInspection.ex.ScopeToolState in project intellij-community by JetBrains.
the class InspectionFilterAction method tune.
private void tune(InspectionProfileImpl profile, Project project) {
addAction(new ResetFilterAction());
addSeparator();
if (ApplicationNamesInfo.getInstance().getProductName().contains("IDEA")) {
// minor IDEs don't have "New in XXX" in inspection descriptions
addAction(new ShowNewInspectionsAction());
}
addSeparator();
addAction(new ShowEnabledOrDisabledInspectionsAction(true));
addAction(new ShowEnabledOrDisabledInspectionsAction(false));
addAction(new ShowOnlyModifiedInspectionsAction());
addSeparator();
for (final HighlightSeverity severity : LevelChooserAction.getSeverities(mySeverityRegistrar)) {
add(new ShowWithSpecifiedSeverityInspectionsAction(severity));
}
addSeparator();
final Set<String> languageIds = new THashSet<>();
for (ScopeToolState state : profile.getDefaultStates(project)) {
languageIds.add(state.getTool().getLanguage());
}
final List<Language> languages = new SmartList<>();
for (String id : languageIds) {
if (id != null) {
final Language language = Language.findLanguageByID(id);
if (language != null) {
languages.add(language);
}
}
}
if (!languages.isEmpty()) {
final DefaultActionGroup languageActionGroupParent = new DefaultActionGroup("Filter by Language", languages.size() >= MIN_LANGUAGE_COUNT_TO_WRAP);
add(languageActionGroupParent);
Collections.sort(languages, Comparator.comparing(Language::getDisplayName));
for (Language language : languages) {
languageActionGroupParent.add(new LanguageFilterAction(language));
}
languageActionGroupParent.add(new LanguageFilterAction(null));
addSeparator();
}
add(new ShowAvailableOnlyOnAnalyzeInspectionsAction());
add(new ShowOnlyCleanupInspectionsAction());
}
Aggregations