private void readScheme(Element node) { myDeprecatedBackgroundColor = null; if (!SCHEME_ELEMENT.equals(node.getName())) { return; } setName(node.getAttributeValue(NAME_ATTR)); int readVersion = Integer.parseInt(node.getAttributeValue(VERSION_ATTR, "0")); if (readVersion > CURR_VERSION) { throw new IllegalStateException("Unsupported color scheme version: " + readVersion); } myVersion = readVersion; String isDefaultScheme = node.getAttributeValue(DEFAULT_SCHEME_ATTR); boolean isDefault = isDefaultScheme != null && Boolean.parseBoolean(isDefaultScheme); if (!isDefault) { myParentScheme = DefaultColorSchemesManager.getInstance() .getScheme(node.getAttributeValue(PARENT_SCHEME_ATTR, DEFAULT_SCHEME_NAME)); } for (final Object o : node.getChildren()) { Element childNode = (Element) o; String childName = childNode.getName(); if (OPTION_ELEMENT.equals(childName)) { readSettings(childNode, isDefault); } else if (EDITOR_FONT.equals(childName)) { readFontSettings(childNode, myFontPreferences, isDefault); } else if (CONSOLE_FONT.equals(childName)) { readFontSettings(childNode, myConsoleFontPreferences, isDefault); } else if (COLORS_ELEMENT.equals(childName)) { readColors(childNode); } else if (ATTRIBUTES_ELEMENT.equals(childName)) { readAttributes(childNode); } } if (myDeprecatedBackgroundColor != null) { TextAttributes textAttributes = myAttributesMap.get(HighlighterColors.TEXT); if (textAttributes == null) { textAttributes = new TextAttributes( Color.black, myDeprecatedBackgroundColor, null, EffectType.BOXED, Font.PLAIN); myAttributesMap.put(HighlighterColors.TEXT, textAttributes); } else { textAttributes.setBackgroundColor(myDeprecatedBackgroundColor); } } if (myConsoleFontPreferences.getEffectiveFontFamilies().isEmpty()) { myFontPreferences.copyTo(myConsoleFontPreferences); } initFonts(); }
private MyColorScheme(@NotNull EditorColorsScheme parentScheme) { super(parentScheme, DefaultColorSchemesManager.getInstance()); parentScheme.getFontPreferences().copyTo(getFontPreferences()); setLineSpacing(parentScheme.getLineSpacing()); parentScheme.getConsoleFontPreferences().copyTo(getConsoleFontPreferences()); setConsoleLineSpacing(parentScheme.getConsoleLineSpacing()); setQuickDocFontSize(parentScheme.getQuickDocFontSize()); myName = parentScheme.getName(); if (parentScheme instanceof ExternalizableScheme) { getExternalInfo().copy(((ExternalizableScheme) parentScheme).getExternalInfo()); } initFonts(); }