KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > project > ui > ProjectXMLCatalogReader


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.project.ui;
21
22 import java.awt.Image JavaDoc;
23 import java.beans.PropertyChangeListener JavaDoc;
24 import java.util.Collections JavaDoc;
25 import java.util.Iterator JavaDoc;
26 import org.netbeans.modules.xml.catalog.spi.CatalogDescriptor;
27 import org.netbeans.modules.xml.catalog.spi.CatalogListener;
28 import org.netbeans.modules.xml.catalog.spi.CatalogReader;
29 import org.openide.util.NbBundle;
30 import org.openide.util.Utilities;
31
32 /**
33  * Supplies a catalog which lets users validate against project-related XML schemas.
34  * @author Jesse Glick
35  * @see "issue #49976"
36  */

37 public class ProjectXMLCatalogReader implements CatalogReader, CatalogDescriptor {
38     
39     private static final String JavaDoc PREFIX = "http://www.netbeans.org/ns/"; // NOI18N
40
private static final String JavaDoc SUFFIX = ".xsd"; // NOI18N
41

42     /** Default constructor for use from layer. */
43     public ProjectXMLCatalogReader() {}
44
45     public String JavaDoc resolveURI(String JavaDoc name) {
46         if (name.startsWith(PREFIX)) {
47             return name + SUFFIX;
48         } else {
49             return null;
50         }
51     }
52
53     public String JavaDoc resolvePublic(String JavaDoc publicId) {
54         return null;
55     }
56
57     public String JavaDoc getSystemID(String JavaDoc publicId) {
58         return null;
59     }
60
61     public void removePropertyChangeListener(PropertyChangeListener JavaDoc l) {}
62
63     public void addPropertyChangeListener(PropertyChangeListener JavaDoc l) {}
64
65     public void removeCatalogListener(CatalogListener l) {}
66
67     public void addCatalogListener(CatalogListener l) {}
68
69     public Image JavaDoc getIcon(int type) {
70         return Utilities.loadImage("org/netbeans/modules/project/ui/resources/projectTab.gif", true);
71     }
72
73     public void refresh() {}
74
75     public String JavaDoc getShortDescription() {
76         return NbBundle.getMessage(ProjectXMLCatalogReader.class, "HINT_project_xml_schemas");
77     }
78
79     public Iterator JavaDoc getPublicIDs() {
80         return Collections.EMPTY_SET.iterator();
81     }
82
83     public String JavaDoc getDisplayName() {
84         return NbBundle.getMessage(ProjectXMLCatalogReader.class, "LBL_project_xml_schemas");
85     }
86     
87 }
88
Popular Tags