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-2003 Sun
 * Microsystems, Inc. All Rights Reserved.
 */
package org.netbeans.modules.xml.core;

import org.openide.loaders.*;
import org.openide.filesystems.FileObject;
import org.openide.util.HelpCtx;
import org.openide.actions.EditAction;
import org.openide.util.actions.SystemAction;
import org.openide.nodes.Node;
import org.openide.nodes.Children;
import org.openide.nodes.CookieSet;

import org.netbeans.modules.xml.core.text.TextEditorSupport;
import org.netbeans.modules.xml.core.sync.*;
import org.netbeans.modules.xml.core.cookies.*;

import org.netbeans.spi.xml.cookies.*;
import org.xml.sax.InputSource;

/** 
 * Object that provides main functionality for XML Entity data object.
 *
 * @author Libor Kramolis
 * @version 0.1
 */
public final class EntityDataObject extends MultiDataObject implements XMLDataObjectLook {
    /** Serial Version UID */
    private static final long serialVersionUID = 2909112365229995364L;
    
    /** Default XML Entity MIME type. */
    public static final String MIME_TYPE = "text/xml-external-parsed-entity"; // NOI18N

    /** Delegate sync support */
    private transient Synchronizator synchronizator;

    /** Cookie Manager */
    private transient final DataObjectCookieManager cookieManager;

    
    //
    // init
    //

    public EntityDataObject (final FileObject obj, final UniFileLoader loader) throws DataObjectExistsException {
        super (obj, loader);

        CookieSet set = getCookieSet();
        set.add (cookieManager = new DataObjectCookieManager (this, set));
        
        TextEditorSupport.TextEditorSupportFactory editorFactory =
            new TextEditorSupport.TextEditorSupportFactory (this, MIME_TYPE);
        editorFactory.registerCookies (set);

//         CookieSet.Factory treeEditorFactory = new TreeEditorCookieImpl.CookieFactoryImpl (this);
//         set.add (TreeEditorCookie.class, treeEditorFactory);

        // add check cookie
        InputSource in = DataObjectAdapters.inputSource(this);
        set.add(new CheckXMLSupport(in, CheckXMLSupport.CHECK_ENTITY_MODE));
        
//         new CookieManager (this, set, EntityCookieFactoryCreator.class);
    }


    /**
     */
    protected Node createNodeDelegate () {
        return new EntityDataNode (this);
    }


    /** @return provider of sync interface.  */
    public synchronized Synchronizator getSyncInterface() {
        if (synchronizator == null) {
            synchronizator = new EntitySyncSupport (this);
        
        }
        return synchronizator;
    }

    public DataObjectCookieManager getCookieManager() {
        return cookieManager;
    }

    
    /**
     */
    public HelpCtx getHelpCtx() {
        return new HelpCtx (EntityDataObject.class);
    }
        

    //
    // class EntityDataNode
    //

    /**
     *
     */
    private static class EntityDataNode extends DataNode {

        /** Create new EntityDataNode. */
        public EntityDataNode (EntityDataObject obj) {
            super (obj, Children.LEAF);

            setDefaultAction (SystemAction.get (EditAction.class));
            setIconBase ("org/netbeans/modules/xml/core/resources/entObject"); // NOI18N
            setShortDescription(Util.THIS.getString("PROP_EntityDataNode_desc"));
        }

        /**
         */
        public HelpCtx getHelpCtx() {
            return new HelpCtx (EntityDataObject.class);
        }
        
    } // end of class EntityDataNode


//     //
//     // interface EntityCookieFactoryCreator
//     //

//     /**
//      *
//      */
//     public static interface EntityCookieFactoryCreator extends CookieFactoryCreator {
        
//     } // end: interface EntityCookieFactoryCreator

}
... 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.