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.openide.cookies;

import java.util.NoSuchElementException;

import org.openide.nodes.Node;
import org.openide.src.SourceElement;

/** A cookie for obtaining a source hierarchy from data objects.
*
* @author Dafe Simonek, Petr Hamernik
*/
public interface SourceCookie extends Node.Cookie {

    /** Returns a source element describing the hierarchy
    * of the source.
    *
    * @return the element
    */
    public SourceElement getSource ();

    /** Extended source cookie permitting for bidirectional translation with Swing text elements.
    */
    public interface Editor extends SourceCookie, EditorCookie {
        /** Translate a source element to text.
        *
        * @param element an element from the source hierarchy
        * @return a text element
        */
        public javax.swing.text.Element sourceToText(org.openide.src.Element element);

        /** Translate a text element to a source element, if it is possible to do so.
        *
        * @param element a text element
        * @return the element from the source hierarchy
        * @exception NoSuchElementException if the text element doesn't match
        *  any element from the source hierarchy
        */
        public org.openide.src.Element textToSource(javax.swing.text.Element element)
        throws NoSuchElementException;

        /** Find the element at the specified offset in the document.
        * @param offset The position of the element
        * @return the element at the position.
        */
        public org.openide.src.Element findElement(int offset);
    }
}
... 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.