KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > css > CSSObject


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 package org.netbeans.modules.css;
20
21 import java.lang.ref.Reference JavaDoc;
22 import java.lang.ref.SoftReference JavaDoc;
23 import java.io.IOException JavaDoc;
24 import java.net.URL JavaDoc;
25 import java.util.*;
26
27 import org.openide.filesystems.*;
28 import org.openide.loaders.*;
29 import org.openide.text.*;
30 import org.openide.cookies.*;
31 import org.openide.util.*;
32 import org.openide.util.actions.*;
33 import org.openide.nodes.*;
34
35 import org.netbeans.modules.css.text.*;
36
37 import org.xml.sax.SAXException JavaDoc;
38
39 /**
40  * CSSDataObject wraps CSS data layer functionality.
41  *
42  * This class is final only for performance reasons,
43  * can be unfinaled if desired.
44  *
45  * @author Petr Kuzel
46  */

47 public final class CSSObject extends MultiDataObject {
48     private static final long serialVersionUID = -3041598815183192198L;
49     public static final String JavaDoc MIME_TYPE = "text/css"; // NOI18N
50

51
52     public CSSObject(final FileObject obj,final UniFileLoader loader) throws DataObjectExistsException {
53         super (obj, loader);
54
55         CookieSet set = getCookieSet();
56         set.add (new CSSEditorSupport(getPrimaryEntry()));
57
58         getPrimaryFile().addFileChangeListener (FileUtil.weakFileChangeListener(new FileListener (), getPrimaryFile()));
59     }
60
61     /** Provides node that should represent this data object. When a node for representation
62      * in a parent is requested by a call to getNode (parent) it is the exact copy of this node
63      * with only parent changed. This implementation creates instance
64      * <CODE>DataNode</CODE>.
65      * <P>
66      * This method is called only once.
67      *
68      * @return the node representation for this data object
69      * @see DataNode
70      */

71     protected Node createNodeDelegate () {
72         return new CSSNode (this);
73     }
74
75     public HelpCtx getHelpCtx() {
76         return new HelpCtx (CSSObject.class);
77     }
78
79     /////////////////////
80
// class FileListener
81
class FileListener extends FileChangeAdapter {
82
83         /** Fired when a file is changed.
84          * @param fe the event describing context where action has taken place
85          */

86         public void fileChanged (FileEvent fe) {
87
88         }
89
90     } // end of inner class FileListener
91

92 }
93
Popular Tags