// Path: src/main/java/tk/skuro/idea/orgmode/OrgBundle.java
// public class OrgBundle {
//     @NonNls
//     protected static final String PATH_TO_BUNDLE = "messages.OrgBundle";
//     private static Reference<ResourceBundle> reference;
// 
//     private OrgBundle() {
//     }
// 
//     /**
//      * Retrieve Message from bundle
//      * @param key message key
//      * @param params optinal value for placeholders
//      * @return Message associated to key
//      */
//     public static String message(@PropertyKey(resourceBundle = PATH_TO_BUNDLE)String key, Object... params) {
//         return CommonBundle.message(getBundle(), key, params);
//     }
// 
//     private static ResourceBundle getBundle() {
//         ResourceBundle bundle = null;
//         if (reference != null) bundle = reference.get();
//         if (bundle == null) {
//             bundle = ResourceBundle.getBundle(PATH_TO_BUNDLE);
//             reference = new SoftReference<ResourceBundle>(bundle);
//         }
//         return bundle;
//     }
// }
// 
// Path: src/main/java/tk/skuro/idea/orgmode/OrgIcons.java
// public interface OrgIcons {
//     Icon ORG_ICON = IconLoader.getIcon("/org/fileType.png");
// }
// 
// Path: src/main/java/tk/skuro/idea/orgmode/highlight/OrgHighlighterColors.java
// public interface OrgHighlighterColors {
// 
//     /**
//      * Default style for outline
//      */
//     TextAttributesKey OUTLINE_ATTR_KEY = createTextAttributesKey("ORG.OUTLINE", KEYWORD);
// 
//     /**
//      * Default style of comments
//      */
//     TextAttributesKey COMMENTS_ATTR_KEY = createTextAttributesKey("ORG.COMMENT", LINE_COMMENT);
// 
//     /**
//      * Default style of comment keyword {@code #+TITLE}
//      */
//     TextAttributesKey KEYWORD_ATTR_KEY = createTextAttributesKey("ORG.KEYWORD", LINE_COMMENT);
// 
//     /**
//      * Default style of block delimiter
//      */
//     TextAttributesKey BLOCK_DELIM_ATTR_KEY = createTextAttributesKey("ORG.BLOCK_DELIMITER", KEYWORD_ATTR_KEY);
// 
//     /**
//      * Default style of code
//      */
//     TextAttributesKey CODE_ATTR_KEY = createTextAttributesKey("ORG.CODE", TEMPLATE_LANGUAGE_COLOR);
// 
//     /**
//      * Default style of block content
//      */
//     TextAttributesKey BLOCK_CONTENT_ATTR_KEY = createTextAttributesKey("ORG.BLOCK_CONTENT", CODE_ATTR_KEY);
// 
//     /**
//      * Default style of Bold text
//      */
//     TextAttributesKey BOLD_ATTR_KEY = createTextAttributesKey("ORG.BOLD", STRING);
//     /**
//      * Default style of underline text
//      */
//     TextAttributesKey UNDERLINE_ATTR_KEY = createTextAttributesKey("ORG.UNDERLINE", STRING);
// 
// 
// }


import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.options.colors.AttributesDescriptor;
import com.intellij.openapi.options.colors.ColorDescriptor;
import com.intellij.openapi.options.colors.ColorSettingsPage;
import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
import tk.skuro.idea.orgmode.OrgBundle;
import tk.skuro.idea.orgmode.OrgIcons;
import javax.swing.*;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import static tk.skuro.idea.orgmode.highlight.OrgHighlighterColors.*;
     * @return the text loaded from {@link #SAMPLE_ORG_DOCUMENT_PATH}
     * @see #getDemoText()
     * @see #SAMPLE_ORG_DOCUMENT_PATH
     * @see #SAMPLE_ORG_DOCUMENT
     */
    protected static String loadSampleOrgDocument() {
        // ¤note: File must have unix style separators: \n
        try {
            return FileUtil.loadTextAndClose(new InputStreamReader(
                    OrgColorSettingsPage.class.getResourceAsStream(SAMPLE_ORG_DOCUMENT_PATH)));
        } catch (Exception e) {
            LOGGER.error("Failed loading sample Org document", e);
        }
        return OrgBundle.message("org.editor.colorsettingspage.sample-loading-error");
    }

    /**
     * Util factorising method to add attribute in a more succint dry way
     *
     * @param name              the key of the message bundle for the name of attribut
     * @param textAttributesKey the attribute key to bind
     * @return whether the attribute was adde or not
     */
    private boolean addAttribute(String name, TextAttributesKey textAttributesKey) {
        return attributeDescriptors.add(
                new AttributesDescriptor(OrgBundle.message(name), textAttributesKey));
    }

    @Override
    public Icon getIcon() {
// Path: src/main/java/tk/skuro/idea/orgmode/OrgBundle.java
// public class OrgBundle {
//     @NonNls
//     protected static final String PATH_TO_BUNDLE = "messages.OrgBundle";
//     private static Reference<ResourceBundle> reference;
// 
//     private OrgBundle() {
//     }
// 
//     /**
//      * Retrieve Message from bundle
//      * @param key message key
//      * @param params optinal value for placeholders
//      * @return Message associated to key
//      */
//     public static String message(@PropertyKey(resourceBundle = PATH_TO_BUNDLE)String key, Object... params) {
//         return CommonBundle.message(getBundle(), key, params);
//     }
// 
//     private static ResourceBundle getBundle() {
//         ResourceBundle bundle = null;
//         if (reference != null) bundle = reference.get();
//         if (bundle == null) {
//             bundle = ResourceBundle.getBundle(PATH_TO_BUNDLE);
//             reference = new SoftReference<ResourceBundle>(bundle);
//         }
//         return bundle;
//     }
// }
// 
// Path: src/main/java/tk/skuro/idea/orgmode/OrgIcons.java
// public interface OrgIcons {
//     Icon ORG_ICON = IconLoader.getIcon("/org/fileType.png");
// }
// 
// Path: src/main/java/tk/skuro/idea/orgmode/highlight/OrgHighlighterColors.java
// public interface OrgHighlighterColors {
// 
//     /**
//      * Default style for outline
//      */
//     TextAttributesKey OUTLINE_ATTR_KEY = createTextAttributesKey("ORG.OUTLINE", KEYWORD);
// 
//     /**
//      * Default style of comments
//      */
//     TextAttributesKey COMMENTS_ATTR_KEY = createTextAttributesKey("ORG.COMMENT", LINE_COMMENT);
// 
//     /**
//      * Default style of comment keyword {@code #+TITLE}
//      */
//     TextAttributesKey KEYWORD_ATTR_KEY = createTextAttributesKey("ORG.KEYWORD", LINE_COMMENT);
// 
//     /**
//      * Default style of block delimiter
//      */
//     TextAttributesKey BLOCK_DELIM_ATTR_KEY = createTextAttributesKey("ORG.BLOCK_DELIMITER", KEYWORD_ATTR_KEY);
// 
//     /**
//      * Default style of code
//      */
//     TextAttributesKey CODE_ATTR_KEY = createTextAttributesKey("ORG.CODE", TEMPLATE_LANGUAGE_COLOR);
// 
//     /**
//      * Default style of block content
//      */
//     TextAttributesKey BLOCK_CONTENT_ATTR_KEY = createTextAttributesKey("ORG.BLOCK_CONTENT", CODE_ATTR_KEY);
// 
//     /**
//      * Default style of Bold text
//      */
//     TextAttributesKey BOLD_ATTR_KEY = createTextAttributesKey("ORG.BOLD", STRING);
//     /**
//      * Default style of underline text
//      */
//     TextAttributesKey UNDERLINE_ATTR_KEY = createTextAttributesKey("ORG.UNDERLINE", STRING);
// 
// 
// }


// Path: src/main/java/tk/skuro/idea/orgmode/highlight/OrgColorSettingsPage.java
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.options.colors.AttributesDescriptor;
import com.intellij.openapi.options.colors.ColorDescriptor;
import com.intellij.openapi.options.colors.ColorSettingsPage;
import com.intellij.openapi.util.io.FileUtil;
import org.jetbrains.annotations.NotNull;
import tk.skuro.idea.orgmode.OrgBundle;
import tk.skuro.idea.orgmode.OrgIcons;
import javax.swing.*;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import static tk.skuro.idea.orgmode.highlight.OrgHighlighterColors.*;

     * @return the text loaded from {@link #SAMPLE_ORG_DOCUMENT_PATH}
     * @see #getDemoText()
     * @see #SAMPLE_ORG_DOCUMENT_PATH
     * @see #SAMPLE_ORG_DOCUMENT
     */
    protected static String loadSampleOrgDocument() {
        // ¤note: File must have unix style separators: \n
        try {
            return FileUtil.loadTextAndClose(new InputStreamReader(
                    OrgColorSettingsPage.class.getResourceAsStream(SAMPLE_ORG_DOCUMENT_PATH)));
        } catch (Exception e) {
            LOGGER.error("Failed loading sample Org document", e);
        }
        return OrgBundle.message("org.editor.colorsettingspage.sample-loading-error");
    }

    /**
     * Util factorising method to add attribute in a more succint dry way
     *
     * @param name              the key of the message bundle for the name of attribut
     * @param textAttributesKey the attribute key to bind
     * @return whether the attribute was adde or not
     */
    private boolean addAttribute(String name, TextAttributesKey textAttributesKey) {
        return attributeDescriptors.add(
                new AttributesDescriptor(OrgBundle.message(name), textAttributesKey));
    }

    @Override
    public Icon getIcon() {
        return OrgIcons.ORG_ICON;