use of com.intellij.codeInspection.ex.Descriptor in project intellij-community by JetBrains.
the class ScopesChooser method fillActionGroup.
private void fillActionGroup(final DefaultActionGroup group, final List<NamedScope> scopes, final List<Descriptor> defaultDescriptors, final InspectionProfileImpl inspectionProfile, final Set<String> excludedScopeNames) {
for (final NamedScope scope : scopes) {
final String scopeName = scope.getName();
if (excludedScopeNames.contains(scopeName)) {
continue;
}
group.add(new DumbAwareAction(scopeName) {
@Override
public void actionPerformed(final AnActionEvent e) {
for (final Descriptor defaultDescriptor : defaultDescriptors) {
inspectionProfile.addScope(defaultDescriptor.getToolWrapper().createCopy(), scope, defaultDescriptor.getLevel(), true, getEventProject(e));
}
onScopeAdded();
}
});
}
}
use of com.intellij.codeInspection.ex.Descriptor 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.Descriptor in project intellij-community by JetBrains.
the class InspectionsConfigTreeRenderer method getTreeCellRendererComponent.
@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
final SimpleColoredComponent component = new SimpleColoredComponent();
if (!(value instanceof InspectionConfigTreeNode))
return component;
InspectionConfigTreeNode node = (InspectionConfigTreeNode) value;
Object object = node.getUserObject();
boolean reallyHasFocus = ((TreeTableTree) tree).getTreeTable().hasFocus();
final Color background = selected ? (reallyHasFocus ? UIUtil.getTreeSelectionBackground() : UIUtil.getTreeUnfocusedSelectionBackground()) : UIUtil.getTreeTextBackground();
UIUtil.changeBackGround(component, background);
Color foreground = selected ? UIUtil.getTreeSelectionForeground() : node.isProperSetting() ? PlatformColors.BLUE : UIUtil.getTreeTextForeground();
@NonNls String text;
int style = SimpleTextAttributes.STYLE_PLAIN;
String hint = null;
if (object instanceof String) {
text = (String) object;
style = SimpleTextAttributes.STYLE_BOLD;
} else {
final ToolDescriptors descriptors = node.getDescriptors();
assert descriptors != null;
final Descriptor defaultDescriptor = descriptors.getDefaultDescriptor();
text = defaultDescriptor.getText();
hint = getHint(defaultDescriptor);
}
if (text != null) {
SearchUtil.appendFragments(getFilter(), text, style, foreground, background, component);
}
if (hint != null) {
component.append(" " + hint, selected ? new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, foreground) : SimpleTextAttributes.GRAYED_ATTRIBUTES);
}
component.setForeground(foreground);
return component;
}
Aggregations