KickJava   Java API By Example, From Geeks To Geeks.

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


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

35 public class Jdk12SearchType_japan extends Jdk12SearchType {
36
37     private String JavaDoc japanEncoding;
38
39     /** generated Serialized Version UID */
40     static final long serialVersionUID =-2453877778724454324L;
41
42     /** Returns human presentable name
43      * @return human presentable name
44     */

45     public String JavaDoc displayName() {
46         return NbBundle.getBundle( Jdk12SearchType_japan.class ).getString("CTL_Jdk12_search_eng_ja"); //NOI18N
47
}
48
49     /** Returns HelpCtx
50      * @return help
51      */

52     public HelpCtx getHelpCtx () {
53         return new HelpCtx (Jdk12SearchType_japan.class);
54     }
55     
56     /** Getter for property encoding.
57      * @return Value of property encoding.
58     */

59     public java.lang.String JavaDoc getJapanEncoding() {
60         return ( japanEncoding != null ) ? japanEncoding : "JISAutoDetect"; //NOI18N
61
}
62     
63     /** Setter for property encoding.
64      * @param encoding New value of property encoding.
65     */

66     public void setJapanEncoding(java.lang.String JavaDoc japanEncoding) {
67         String JavaDoc old = this.japanEncoding;
68         this.japanEncoding = japanEncoding;
69         firePropertyChange("japanEncoding", old, japanEncoding); //NOI18N
70
}
71         
72     /** Returns Java doc search thread for doument
73      * @param toFind String to find
74      * @param fo File object containing index-files
75      * @param diiConsumer consumer for parse events
76      * @return IndexSearchThread
77      * @see IndexSearchThread
78      */

79     public IndexSearchThread getSearchThread( String JavaDoc toFind, FileObject fo, IndexSearchThread.DocIndexItemConsumer diiConsumer ){
80         //here you can send one more parameter .. getJapanEncoding
81
return new SearchThreadJdk12_japan ( toFind, fo, diiConsumer, isCaseSensitive(), getJapanEncoding() );
82     }
83
84     public boolean accepts(org.openide.filesystems.FileObject root, String JavaDoc encoding) {
85         if (encoding == null) {
86             return false;
87         }
88         encoding = encoding.toLowerCase();
89         String JavaDoc acceptedEncoding = getJapanEncoding().toLowerCase();
90         
91         if ("jisautodetect".equals(acceptedEncoding)) { //NOI18N
92
return "iso-2022-jp".equals (encoding) || //NOI18N
93
"sjis".equals (encoding) || //NOI18N
94
"euc-jp".equals (encoding); //NOI18N
95
// || "utf-".equals (encoding); XXX Probably not, UTF-8 can be anything ????
96

97         }
98         else {
99             return encoding.equals (acceptedEncoding); //NOI18N
100
}
101     }
102     
103     
104
105     
106     
107 }
108
Popular Tags