alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 *
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 *
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.modules.editor.options;

import java.awt.Color;
import java.awt.Font;
import java.io.IOException;
import java.util.Iterator;
import java.util.HashMap;
import java.util.Map;

import org.netbeans.editor.Coloring;
import org.netbeans.editor.SettingsDefaults;
import org.netbeans.editor.SettingsNames;
import org.netbeans.editor.SettingsUtil;
import org.openide.xml.XMLUtil;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

/** MIME Option XML file for Fonts and Colors settings.
 *  Fonts and colors settings are loaded and saved in XML format
 *  according to EditorFontsColors-1_0.dtd
 *
 *  @author  Martin Roskanin
 *  @since 08/2001
 */
public class FontsColorsMIMEOptionFile extends MIMEOptionFile{
    
    /** Elements */
    public static final String TAG_ROOT = "fontscolors"; //NOI18N
    static final String TAG_FONTCOLOR = "fontcolor"; //NOI18N
    static final String TAG_ELEMENTCOLOR = "elementcolor"; //NOI18N
    static final String TAG_FONT = "font"; //NOI18N
    
    /** Elementcolor attributes */
    static final String ATTR_NAME = "name"; // NOI18N
    static final String ATTR_COLOR = "color"; // NOI18N
    
    /** Fontcolor attributes */
    static final String ATTR_SYNTAXNAME = "syntaxName"; // NOI18N
    static final String ATTR_FORECOLOR = "foreColor"; // NOI18N
    static final String ATTR_BGCOLOR = "bgColor"; // NOI18N
    
    /** Font attributes */
    static final String ATTR_SIZE = "size"; // NOI18N
    static final String ATTR_STYLE = "style"; // NOI18N
    
    /** File name of this MIMEOptionFile */
    static final String FILENAME = "fontsColors"; //NOI18N
    
    public FontsColorsMIMEOptionFile(BaseOptions base, Object proc) {
        super(base, proc);
    }

    /** Loads settings from XML file.
     * @param propagate if true - propagates the loaded settings to Editor UI */
     protected synchronized void loadSettings(boolean propagate){
        Document doc = dom;
        Element rootElement = doc.getDocumentElement();
        
        if (!TAG_ROOT.equals(rootElement.getTagName())) {
            // Wrong root element
            return;
        }
        
        // gets current coloring map
        Map cm = new HashMap( SettingsUtil.getColoringMap(base.getKitClass(), false, true) ); // !!! !evaluateEvaluators
        cm.put(null, base.getKitClass().getName() ); // add kit class
        
        Map mapa = cm;
        properties.clear();
        
        NodeList fc = rootElement.getElementsByTagName(TAG_FONTCOLOR);
        for (int i=0;i0)){
            base.setColoringMap(mapa, false);
        }
        
        // Let's set the Elements color
        NodeList ec = rootElement.getElementsByTagName(TAG_ELEMENTCOLOR);
        for (int i=0;i
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.