KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > module > api > AntProjectCookie


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
20 package org.apache.tools.ant.module.api;
21
22 import javax.swing.event.ChangeListener JavaDoc;
23 import java.io.File JavaDoc;
24 import org.w3c.dom.Document JavaDoc;
25 import org.w3c.dom.Element JavaDoc;
26 import org.openide.nodes.Node;
27 import org.openide.filesystems.FileObject;
28
29 /**
30  * Cookie containing the state of an Ant Project.
31  * Note that there is a document, and also a parse exception.
32  * At least one must be non-null; it is possible for both to be
33  * non-null in case there was a valid parse before, and some changes
34  * are now invalid.
35  */

36 public interface AntProjectCookie extends Node.Cookie {
37     /** Get the disk file for the build script.
38      * @return the disk file, or null if none (but must be a file object)
39      */

40     File JavaDoc getFile ();
41     /** Get the file object for the build script.
42      * @return the file object, or null if none (but must be a disk file)
43      */

44     FileObject getFileObject ();
45     /** Get the DOM document for the build script.
46      * @return the document, or null if it could not be parsed
47      */

48     Document JavaDoc getDocument ();
49     /** Get the DOM root element (<code>&lt;project&gt;</code>) for the build script.
50      * @return the root element, or null if it could not be parsed
51      */

52     Element JavaDoc getProjectElement ();
53     /** Get the last parse-related exception, if there was one.
54      * @return the parse exception, or null if it is valid
55      */

56     Throwable JavaDoc getParseException ();
57     /** Add a listener to changes in the document.
58      * @param l the listener to add
59      */

60     void addChangeListener (ChangeListener JavaDoc l);
61     /** Remove a listener to changes in the document.
62      * @param l the listener to remove
63      */

64     void removeChangeListener (ChangeListener JavaDoc l);
65     
66     /** Extended cookie permitting queries of parse status.
67      * If only the basic cookie is available, you cannot
68      * determine if a project is already parsed or not, and
69      * methods which require it to be parsed for them to return
70      * may block until a parse is complete.
71      * @since 2.10
72      */

73     interface ParseStatus extends AntProjectCookie {
74         /** Check whether the project is currently parsed.
75          * Note that "parsed in error" is still considered parsed.
76          * <p>If not parsed, then if and when it does later become
77          * parsed, a change event should be fired. A project
78          * might become unparsed after being parsed, due to e.g.
79          * garbage collection; this need not fire any event.
80          * <p>If the project is currently parsed, the methods
81          * {@link AntProjectCookie#getDocument},
82          * {@link AntProjectCookie#getProjectElement}, and
83          * {@link AntProjectCookie#getParseException} should
84          * not block.
85          * @return true if this project is currently parsed
86          */

87         boolean isParsed();
88     }
89     
90 }
91
Popular Tags