KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > javadoc > search > Jdk12SearchType


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.javadoc.search;
21
22 import org.openide.filesystems.FileObject;
23 import org.openide.util.HelpCtx;
24 import org.openide.util.NbBundle;
25
26 /* Base class providing search for JDK1.2/1.3 documentation
27  * @author Petr Hrebejk, Petr Suchomel
28  */

29 public class Jdk12SearchType extends JavadocSearchType {
30
31     private boolean caseSensitive = true;
32
33     /** generated Serialized Version UID */
34     static final long serialVersionUID =-2453877778724454324L;
35
36     /** Returns human presentable name
37      * @return human presentable name
38     */

39     public String JavaDoc displayName() {
40         return NbBundle.getBundle( Jdk12SearchType.class ).getString("CTL_Jdk12_search_eng"); //NOI18N
41
}
42
43     /** Returns HelpCtx
44      * @return help
45      */

46     public HelpCtx getHelpCtx () {
47         return new HelpCtx (Jdk12SearchType.class);
48     }
49     
50     /** Getter for property caseSensitive.
51      * @return Value of property caseSensitive.
52      */

53     public boolean isCaseSensitive() {
54         return caseSensitive;
55     }
56     
57     /** Setter for property caseSensitive.
58      * @param caseSensitive New value of property caseSensitive.
59     */

60     public void setCaseSensitive(boolean caseSensitive) {
61         boolean oldVal = this.caseSensitive;
62         this.caseSensitive = caseSensitive;
63         this.firePropertyChange("caseSensitive", oldVal ? Boolean.TRUE : Boolean.FALSE, caseSensitive ? Boolean.TRUE : Boolean.FALSE); //NOI18N
64
}
65
66     public FileObject getDocFileObject( FileObject apidocRoot ) {
67     
68         FileObject fo = apidocRoot.getFileObject( "index-files" ); // NOI18N
69
if ( fo != null ) {
70             return fo;
71         }
72
73         fo = apidocRoot.getFileObject( "index-all.html" ); // NOI18N
74
if ( fo != null ) {
75             return fo;
76         }
77
78         return null;
79     }
80     
81     /** Returns Java doc search thread for doument
82      * @param toFind String to find
83      * @param fo File object containing index-files
84      * @param diiConsumer consumer for parse events
85      * @return IndexSearchThread
86      * @see IndexSearchThread
87      */

88     public IndexSearchThread getSearchThread( String JavaDoc toFind, FileObject fo, IndexSearchThread.DocIndexItemConsumer diiConsumer ){
89         return new SearchThreadJdk12 ( toFind, fo, diiConsumer, isCaseSensitive() );
90     }
91
92
93     public boolean accepts(FileObject apidocRoot, String JavaDoc encoding) {
94         //XXX returns always true, must be the last JavadocType
95
return true;
96     }
97 }
98
Popular Tags