KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > tasklist > providers > SuggestionProvider


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.tasklist.providers;
21
22 /**
23  * A suggestion provider provides Suggestions to the SuggestionManager.
24  *
25  * Classes which exist exclusively to produce suggestions are most likely
26  * SuggestionProviders rather than simple SuggestionManager clients.
27  * (If you're computing something and have a result that may be useful
28  * as a Suggestion, you don't need to make this into a SuggestionProvider;
29  * simply look up the SuggestionManager and register the Suggestion.)
30  * <p>
31  * The API does not define which thread these methods are called on,
32  * so don't make any assumptions. If you want to post something on
33  * the AWT event dispatching thread for example use SwingUtilities.
34  * <p>
35  * @todo Document threading behavior
36  * @todo Document timer behavior (some of the methods are called after
37  * a delay, others are called immediately.)
38  * @todo Add a reference to how SuggestionProviders are registered here?
39  *
40  * @author Tor Norbye
41  */

42 abstract public class SuggestionProvider {
43
44     /**
45      * Return the typename of the suggestions that this provider
46      * will create. TODO It's still in question if more providers
47      * can create same suggestion types without
48      * introducing duplications.
49      *
50      * @return typename, must not be be <code>null</code>.
51      */

52     abstract public String JavaDoc getType();
53     
54     /**
55      * Prepare to start creating suggestions. Do "heavy" computations
56      * related to starting creating suggestions here, such as creating
57      * database connections, constructing large objects etc, depending
58      * on what you need to create suggestions obviously.
59      * <p>
60      * Note - don't start creating suggestions until you get called
61      * with notifyRun().
62      * <p>
63      * This method is called internally by the toolkit and should not be
64      * called directly by programs.
65      * <p>
66      * (This is typically called when the Suggestions window is opened.
67      * It may not be showing yet, but we want to do heavy-duty preparations
68      * here since it's not good to do that every time the window is
69      * shown/hidden.)
70      */

71     public void notifyPrepare() {
72     }
73
74     /**
75      * Finish creating suggestions. You may free up associated resources.
76      * (This is typically called when the Suggestions window is closed.
77      * Now we now that we don't need to create Suggestions for a while, so
78      * it's a good time to free up resources.)
79      * <p>
80      * This method is called internally by the toolkit and should not be
81      * called directly by programs.
82      */

83     public void notifyFinish() {
84     }
85
86     /**
87      * Start creating suggestions when you think of them.
88      * (This is typically called when the Suggestions window is shown,
89      * for example because the Suggestions window tab is moved to the front,
90      * or the user has moved to a workspace containing a Suggestions Window.)
91      * <p>
92      * This method is called internally by the toolkit and should not be
93      * called directly by programs.
94      */

95     public void notifyRun() {
96     }
97
98     /**
99      * (Temporarily) stop creating suggestions.
100      * (This is typically called when the Suggestions window is hidden,
101      * for example because a different tab is moved to the front or because
102      * the user has moved to another workspace.)
103      * <p>
104      * This method is called internally by the toolkit and should not be
105      * called directly by programs.
106      */

107     public void notifyStop() {
108     }
109
110 }
111
Popular Tags