private boolean isInherited(@NotNull MyColorScheme scheme) {
   TextAttributes attributes = scheme.getAttributes(key);
   TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
   if (fallbackKey != null && !scheme.containsKey(key)) {
     TextAttributes fallbackAttributes = scheme.getAttributes(fallbackKey);
     if (attributes != null && attributes == fallbackAttributes) {
       return true;
     }
   }
   return false;
 }
 private SchemeTextAttributesDescription(
     String name,
     String group,
     @NotNull TextAttributesKey key,
     @NotNull MyColorScheme scheme,
     Icon icon,
     String toolTip) {
   super(name, group, getInitialAttributes(scheme, key).clone(), key, scheme, icon, toolTip);
   this.key = key;
   myAttributesToApply = getInitialAttributes(scheme, key);
   TextAttributesKey fallbackKey = key.getFallbackAttributeKey();
   if (fallbackKey != null) {
     myFallbackAttributes = scheme.getAttributes(fallbackKey);
     myBaseAttributeDescriptor =
         ColorSettingsPages.getInstance().getAttributeDescriptor(fallbackKey);
     if (myBaseAttributeDescriptor == null) {
       myBaseAttributeDescriptor =
           new Pair<ColorSettingsPage, AttributesDescriptor>(
               null, new AttributesDescriptor(fallbackKey.getExternalName(), fallbackKey));
     }
   }
   myIsInheritedInitial = isInherited(scheme);
   setInherited(myIsInheritedInitial);
   initCheckedStatus();
 }
  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);
    }
  }
 @NotNull
 private static TextAttributes getInitialAttributes(
     @NotNull MyColorScheme scheme, @NotNull TextAttributesKey key) {
   TextAttributes attributes = scheme.getAttributes(key);
   return attributes != null ? attributes : new TextAttributes();
 }