view src/share/tools/IdealGraphVisualizer/Text Editor/src/at/ssw/visualizer/texteditor/EditorKit.java @ 2843:6960cc79f664

IdealGraphVisualizer: Import editor component from C1XVisualizer
author Peter Hofer <peter.hofer@jku.at>
date Wed, 01 Jun 2011 15:22:40 +0200
parents
children
line wrap: on
line source

package at.ssw.visualizer.texteditor;

import at.ssw.visualizer.texteditor.tooltip.ToolTipAction;
import javax.swing.Action;
import javax.swing.text.TextAction;
import org.netbeans.modules.editor.NbEditorKit;

/**
 * Abstract template class of a <code> EditorKit </code>class of the Visualizer.
 * 
 * The <code> scanner </code> field must be initialized with the
 * custom <code> Scanner </code> implementation and the method <code> 
 * getContentType </code> must be overwritten and return the mime type 
 * for the editor.
 * 
 * @author Alexander Reder
 */
public abstract class EditorKit extends NbEditorKit {

    @Override
    protected Action[] getCustomActions() {
        Action[] prev = super.getCustomActions();
        Action[] added = new Action[]{new ToolTipAction()};
        if (prev != null) {
            return TextAction.augmentList(prev, added);
        } else {
           return added;
        }
    }
    
}