本文整理汇总了Java中com.intellij.codeInspection.ex.ScopeToolState类的典型用法代码示例。如果您正苦于以下问题:Java ScopeToolState类的具体用法?Java ScopeToolState怎么用?Java ScopeToolState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ScopeToolState类属于com.intellij.codeInspection.ex包,在下文中一共展示了ScopeToolState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWorkedTools
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的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;
}
示例2: isEnabled
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
@Nullable
private Boolean isEnabled(final int rowIndex) {
Boolean previousValue = null;
final ExistedScopesStatesAndNonExistNames existedScopesStatesAndNonExistNames = getScopeToolState(rowIndex);
for (final ScopeToolState scopeToolState : existedScopesStatesAndNonExistNames.getExistedStates()) {
final boolean currentValue = scopeToolState.isEnabled();
if (previousValue == null) {
previousValue = currentValue;
} else if (!previousValue.equals(currentValue)){
return null;
}
}
if (!existedScopesStatesAndNonExistNames.getNonExistNames().isEmpty() && !Boolean.FALSE.equals(previousValue)) {
return null;
}
return previousValue;
}
示例3: getScopeToolState
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
@Nullable
private ScopeToolState getScopeToolState(final String keyName, final int rowIndex) {
if (rowIndex == lastRowIndex()) {
return myInspectionProfile.getToolDefaultState(keyName, myProject);
}
else {
final String scopeName = myScopeNames[rowIndex];
final List<ScopeToolState> nonDefaultTools = myInspectionProfile.getNonDefaultTools(keyName, myProject);
for (final ScopeToolState nonDefaultTool : nonDefaultTools) {
if (Comparing.equal(scopeName, nonDefaultTool.getScopeName())) {
return nonDefaultTool;
}
}
}
return null;
}
示例4: isEnabled
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
@Nullable
private Boolean isEnabled(final List<HighlightDisplayKey> selectedInspectionsNodes) {
Boolean isPreviousEnabled = null;
for (final HighlightDisplayKey key : selectedInspectionsNodes) {
final ToolsImpl tools = mySettings.getInspectionProfile().getTools(key.toString(), mySettings.getProject());
for (final ScopeToolState state : tools.getTools()) {
final boolean enabled = state.isEnabled();
if (isPreviousEnabled == null) {
isPreviousEnabled = enabled;
} else if (!isPreviousEnabled.equals(enabled)) {
return null;
}
}
}
return isPreviousEnabled;
}
示例5: putOne
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
private void putOne(final ScopeToolState state) {
if (!state.isEnabled()) {
return;
}
final Icon icon = state.getLevel().getIcon();
final String scopeName = state.getScopeName();
if (icon instanceof HighlightDisplayLevel.ColoredIcon) {
final SeverityAndOccurrences severityAndOccurrences = myScopeToAverageSeverityMap.get(scopeName);
final String inspectionName = state.getTool().getShortName();
if (severityAndOccurrences == null) {
myScopeToAverageSeverityMap.put(scopeName, new SeverityAndOccurrences().incOccurrences(inspectionName, state.getLevel().getSeverity()));
} else {
severityAndOccurrences.incOccurrences(inspectionName, state.getLevel().getSeverity());
}
}
}
示例6: getAvailableScopes
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
private List<String> getAvailableScopes(Project project, List<Descriptor> descriptors) {
final ArrayList<NamedScope> scopes = new ArrayList<NamedScope>();
for (NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(project)) {
Collections.addAll(scopes, holder.getScopes());
}
scopes.remove(CustomScopesProviderEx.getAllScope());
CustomScopesProviderEx.filterNoSettingsScopes(project, scopes);
final Set<NamedScope> used = new HashSet<NamedScope>();
for (Descriptor descriptor : descriptors) {
final List<ScopeToolState> nonDefaultTools = getSelectedProfile().getNonDefaultTools(descriptor.getKey().toString(), project);
if (nonDefaultTools != null) {
for (ScopeToolState state : nonDefaultTools) {
used.add(state.getScope(project));
}
}
}
scopes.removeAll(used);
final List<String> availableScopes = new ArrayList<String>();
for (NamedScope scope : scopes) {
availableScopes.add(scope.getName());
}
return availableScopes;
}
示例7: getWorkedTools
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的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;
}
示例8: GotoInspectionModel
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的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());
}
示例9: fromScopeToolState
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
public static ToolDescriptors fromScopeToolState(final ScopeToolState state,
final InspectionProfileImpl profile,
final Project project) {
final InspectionToolWrapper toolWrapper = state.getTool();
final List<ScopeToolState> nonDefaultTools = profile.getNonDefaultTools(toolWrapper.getShortName(), project);
final ArrayList<Descriptor> descriptors = new ArrayList<Descriptor>(nonDefaultTools.size());
for (final ScopeToolState nonDefaultToolState : nonDefaultTools) {
descriptors.add(new Descriptor(nonDefaultToolState, profile, project));
}
return new ToolDescriptors(new Descriptor(state, profile, project), descriptors);
}
示例10: getSeverity
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
@NotNull
public static HighlightSeverity getSeverity(final List<ScopeToolState> scopeToolStates) {
HighlightSeverity previousValue = null;
for (final ScopeToolState scopeToolState : scopeToolStates) {
final HighlightSeverity currentValue = scopeToolState.getLevel().getSeverity();
if (previousValue == null) {
previousValue = currentValue;
} else if (!previousValue.equals(currentValue)){
return MIXED_FAKE_SEVERITY;
}
}
return previousValue;
}
示例11: refreshAggregatedScopes
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
private void refreshAggregatedScopes() {
final LinkedHashSet<String> scopesNames = new LinkedHashSet<String>();
for (final String keyName : myKeyNames) {
final List<ScopeToolState> nonDefaultTools = myInspectionProfile.getNonDefaultTools(keyName, myProject);
for (final ScopeToolState tool : nonDefaultTools) {
scopesNames.add(tool.getScopeName());
}
}
myScopeNames = ArrayUtil.toStringArray(scopesNames);
Arrays.sort(myScopeNames, myScopeComparator);
}
示例12: matches
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
public boolean matches(final Tools tools) {
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();
return mySuitableLanguageIds.isEmpty() || mySuitableLanguageIds.contains(languageId);
}
示例13: setToolEnabled
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
private void setToolEnabled(boolean newState, InspectionProfileImpl profile, HighlightDisplayKey tool) {
final String toolId = tool.toString();
if (newState) {
profile.enableTool(toolId, mySettings.getProject());
}
else {
profile.disableTool(toolId, mySettings.getProject());
}
for (ScopeToolState scopeToolState : profile.getTools(toolId, mySettings.getProject()).getTools()) {
scopeToolState.setEnabled(newState);
}
}
示例14: put
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的package包/类
public void put(@NotNull final ScopeToolState defaultState, @NotNull final List<ScopeToolState> nonDefault) {
putOne(defaultState);
if (myDefaultScopeName == null) {
myDefaultScopeName = defaultState.getScopeName();
}
for (final ScopeToolState scopeToolState : nonDefault) {
putOne(scopeToolState);
}
}
示例15: GotoInspectionModel
import com.intellij.codeInspection.ex.ScopeToolState; //导入依赖的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();
InspectionToolWrapper workingTool = tool;
if (tool instanceof LocalInspectionToolWrapper) {
workingTool = LocalInspectionToolWrapper.findTool2RunInBatch(project, null, tool.getShortName());
if (workingTool == null) {
continue;
}
}
myToolNames.put(tool.getDisplayName(), workingTool);
final String groupName = tool.getGroupDisplayName();
Set<InspectionToolWrapper> toolsInGroup = myGroupNames.get(groupName);
if (toolsInGroup == null) {
toolsInGroup = new HashSet<InspectionToolWrapper>();
myGroupNames.put(groupName, toolsInGroup);
}
toolsInGroup.add(workingTool);
myToolShortNames.put(tool.getShortName(), workingTool);
}
final Set<String> nameIds = new HashSet<String>();
nameIds.addAll(myToolNames.keySet());
nameIds.addAll(myGroupNames.keySet());
myNames = ArrayUtil.toStringArray(nameIds);
}