private static void initDescriptions( @NotNull ColorAndFontDescriptorsProvider provider, @NotNull List<EditorSchemeAttributeDescriptor> descriptions, @NotNull MyColorScheme scheme) { String group = provider.getDisplayName(); List<AttributesDescriptor> attributeDescriptors = ColorSettingsUtil.getAllAttributeDescriptors(provider); for (AttributesDescriptor descriptor : attributeDescriptors) { addSchemedDescription( descriptions, descriptor.getDisplayName(), group, descriptor.getKey(), scheme, null, null); } ColorDescriptor[] colorDescriptors = provider.getColorDescriptors(); for (ColorDescriptor descriptor : colorDescriptors) { ColorKey back = descriptor.getKind() == ColorDescriptor.Kind.BACKGROUND ? descriptor.getKey() : null; ColorKey fore = descriptor.getKind() == ColorDescriptor.Kind.FOREGROUND ? descriptor.getKey() : null; addEditorSettingDescription( descriptions, descriptor.getDisplayName(), group, back, fore, scheme); } }
private static void initScopesDescriptors( @NotNull List<EditorSchemeAttributeDescriptor> descriptions, @NotNull MyColorScheme scheme) { Set<Pair<NamedScope, NamedScopesHolder>> namedScopes = new THashSet<Pair<NamedScope, NamedScopesHolder>>( new TObjectHashingStrategy<Pair<NamedScope, NamedScopesHolder>>() { @Override public int computeHashCode( @NotNull final Pair<NamedScope, NamedScopesHolder> object) { return object.getFirst().getName().hashCode(); } @Override public boolean equals( @NotNull final Pair<NamedScope, NamedScopesHolder> o1, @NotNull final Pair<NamedScope, NamedScopesHolder> o2) { return o1.getFirst().getName().equals(o2.getFirst().getName()); } }); Project[] projects = ProjectManager.getInstance().getOpenProjects(); for (Project project : projects) { DependencyValidationManagerImpl validationManager = (DependencyValidationManagerImpl) DependencyValidationManager.getInstance(project); List<Pair<NamedScope, NamedScopesHolder>> cachedScopes = validationManager.getScopeBasedHighlightingCachedScopes(); namedScopes.addAll(cachedScopes); } List<Pair<NamedScope, NamedScopesHolder>> list = new ArrayList<Pair<NamedScope, NamedScopesHolder>>(namedScopes); Collections.sort( list, new Comparator<Pair<NamedScope, NamedScopesHolder>>() { @Override public int compare( @NotNull final Pair<NamedScope, NamedScopesHolder> o1, @NotNull final Pair<NamedScope, NamedScopesHolder> o2) { return o1.getFirst().getName().compareToIgnoreCase(o2.getFirst().getName()); } }); for (Pair<NamedScope, NamedScopesHolder> pair : list) { NamedScope namedScope = pair.getFirst(); String name = namedScope.getName(); TextAttributesKey textAttributesKey = ScopeAttributesUtil.getScopeTextAttributeKey(name); if (scheme.getAttributes(textAttributesKey) == null) { scheme.setAttributes(textAttributesKey, new TextAttributes()); } NamedScopesHolder holder = pair.getSecond(); PackageSet value = namedScope.getValue(); String toolTip = holder.getDisplayName() + (value == null ? "" : ": " + value.getText()); addSchemedDescription( descriptions, name, SCOPES_GROUP, textAttributesKey, scheme, holder.getIcon(), toolTip); } }