KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > bridge > Util


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.bridge;
21
22 import java.beans.PropertyChangeEvent JavaDoc;
23 import java.util.ResourceBundle JavaDoc;
24
25 import org.openide.src.SourceException;
26 import org.openide.util.NbBundle;
27
28 import org.openide.ErrorManager;
29
30 /**
31  *
32  * @author sdedic
33  * @version
34  */

35 class Util extends Object JavaDoc {
36     /** ResourceBundle for java-loader package. */
37     static ResourceBundle JavaDoc bundle;
38
39     /** Computes the localized string for the key.
40     * @param key The key of the string.
41     * @return the localized string.
42     */

43     static String JavaDoc getString(String JavaDoc key) {
44         if (bundle == null)
45             bundle = NbBundle.getBundle(Util.class);
46         return bundle.getString(key);
47     }
48
49     static void throwException(String JavaDoc desc, String JavaDoc bundleKey) throws SourceException {
50     throw (SourceException)ErrorManager.getDefault().annotate(
51         new SourceException(desc),
52         getString(bundleKey)
53     );
54     }
55     
56     static PropertyChangeEvent JavaDoc computePropretyDiffs(Object JavaDoc[] oldValues, Object JavaDoc[] newValues) {
57         if (newValues.length == oldValues.length)
58             // array lengths match, there's a change or a reorder.
59
return null;
60             //return computeChange(oldValues, newValues);
61
return null;
62     }
63     
64     /*
65     static org.openide.ErrorManager getErrorManager() {
66         return ErroManager.getDefault().getInstance("org.netbeans.modules.java.model"); // NOI18N
67     }
68      */

69     
70     static ErrorManager em;
71     
72     static void log(String JavaDoc msg) {
73         if (em == null) {
74             synchronized (Util.class) {
75                 if (em == null)
76                     em = ErrorManager.getDefault().getInstance("org.netbeans.modules.java.model"); // NOI18N
77
}
78         }
79         em.log(msg);
80     }
81 }
82
Popular Tags