KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > codegen > DocumentBinding


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.netbeans.modules.java.codegen;
21
22 import java.util.Collection JavaDoc;
23 import java.io.IOException JavaDoc;
24
25 import org.openide.cookies.SourceCookie;
26
27 import org.openide.src.SourceException;
28 import org.openide.src.Element;
29
30 import org.openide.text.CloneableEditorSupport;
31 import org.openide.text.PositionBounds;
32 import org.openide.text.PositionRef;
33
34 import org.netbeans.modules.java.bridge.Binding;
35 import org.netbeans.modules.java.bridge.BindingFactory;
36
37 /**
38  * Definition of code generation package. The package exports those functions of
39  * the BindingFactory and several management functions.
40  *
41  * @author Svatopluk Dedic <mailto:sdedic@netbeans.org>
42  * @version 0.1
43  */

44 public interface DocumentBinding extends BindingFactory {
45     /**
46      * Finds and returns the CloneableEditorSupport. This method siply delegates
47      * to the environment's findEditorSupport() method.
48      * @return CloneableEditorSupport instance used for binding of the model.
49      */

50     public CloneableEditorSupport getEditorSupport();
51     
52     /**
53      * Causes the operation to run atomically on the document. The document
54      * will be locked out for writing for the length of the operation.
55      * @throw SourceException if the document cannot be loaded, locked or if some
56      * of the Runnable's operation fails.
57      */

58     public void runAtomic(Runnable JavaDoc r) throws SourceException;
59     
60     /**
61      * Causes the operation to run atomically on the document at the user-level. The document
62      * will be locked out for writing for the length of the operation.
63      * @throw SourceException if the document cannot be loaded, locked or if some
64      * of the Runnable's operation fails.
65      */

66     public void enableAtomicAsUser(boolean enable);
67
68     /**
69      * Atomically updates bindings in the source, possibly inserting new ones. The
70      * hierarchy of Bindings is locked for the length of the operation. This will lock out
71      * operations like get
72      */

73     public void updateBindings(Runnable JavaDoc r);
74     
75     /**
76      * Enables or disables the code generator. If the calling code disables the generation,
77      * it is <B>responsible</B> to reenable it again at the appropriate time. For example,
78      * parsing updater should disable code generation before it starts to update the
79      * source text model.
80      */

81     public void enableGenerator(boolean enableFlag);
82
83     /**
84      * Environment for the document generation package.
85      */

86     public static interface Env {
87         /**
88          * Finds CloneableEditorSupport for the code generator. The support is used
89          * to load/access the document.
90          */

91         public CloneableEditorSupport findEditorSupport();
92
93         /** Attempts to find "free" position in the source text, between (inclusive)
94          * the given bounds. This is, actually, a test for a guarded block - it is
95          * deferred to the user of the code generation suite.
96          */

97         public PositionRef findFreePosition(PositionBounds bounds);
98
99         /**
100          * @throws IOException
101          */

102         public void takeLock() throws IOException JavaDoc;
103     }
104 }
105
106
Popular Tags