KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > editor > completion > Completion


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.api.editor.completion;
21
22 import org.netbeans.modules.editor.completion.CompletionImpl;
23
24 /**
25  * Code completion allows the clients to request explicit showing
26  * or hiding of the code completion.
27  * <br>
28  * It's a singleton instance.
29  *
30  * @author Miloslav Metelka
31  * @version 1.01
32  */

33
34 public final class Completion {
35
36     private static final Completion singleton = new Completion();
37
38     /**
39      * Get the singleton instance of this class.
40      */

41     public static Completion get() {
42         return singleton;
43     }
44     
45     private Completion() {
46     }
47
48     /**
49      * Request showing of the code completion popup
50      * for the currently focused text component.
51      * <br>
52      * The completion will be shown if there are any results to be shown
53      * for the particular context.
54      *
55      * <p>
56      * This method can be called from any thread but when
57      * called outside of AWT the request will be rescheduled into AWT.
58      */

59     public void showCompletion() {
60         CompletionImpl.get().showCompletion();
61     }
62     
63     /**
64      * Hide a completion popup window if it's opened.
65      *
66      * <p>
67      * This method can be called from any thread.
68      * The cancelling of the possibly running tasks is done synchronously
69      * and the GUI will be updated in the AWT thread.
70      */

71     public void hideCompletion() {
72         CompletionImpl.get().hideCompletion();
73     }
74
75     /**
76      * Request showing of the documentation popup
77      * for the currently focused text component.
78      * <br>
79      * The documentation popup will be shown if there are any results to be shown
80      * for the particular context.
81      *
82      * <p>
83      * This method can be called from any thread but when
84      * called outside of AWT the request will be rescheduled into AWT.
85      */

86     public void showDocumentation() {
87         CompletionImpl.get().showDocumentation();
88     }
89     
90     /**
91      * Hides a documentation popup window if it's opened.
92      *
93      * <p>
94      * This method can be called from any thread.
95      * The cancelling of the possibly running tasks is done synchronously
96      * and the GUI will be updated in the AWT thread.
97      */

98     public void hideDocumentation() {
99         CompletionImpl.get().hideDocumentation();
100     }
101
102     /**
103      * Request showing of the tooltip popup
104      * for the currently focused text component.
105      * <br>
106      * The tooltip popup will be shown if there are any results to be shown
107      * for the particular context.
108      *
109      * <p>
110      * This method can be called from any thread but when
111      * called outside of AWT the request will be rescheduled into AWT.
112      */

113     public void showToolTip() {
114         CompletionImpl.get().showToolTip();
115     }
116     
117     /**
118      * Hides a tooltip popup window if it's opened.
119      *
120      * <p>
121      * This method can be called from any thread.
122      * The cancelling of the possibly running tasks is done synchronously
123      * and the GUI will be updated in the AWT thread.
124      */

125     public void hideToolTip() {
126         CompletionImpl.get().hideToolTip();
127     }
128
129     /**
130      * Hide either of the possibly opened code completion,
131      * documentation or tooltip windows.
132      */

133     public void hideAll() {
134         CompletionImpl.get().hideAll();
135     }
136
137 }
138
Popular Tags