KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > spi > editor > mimelookup > Class2LayerFolder


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.spi.editor.mimelookup;
21
22 /**
23  * Provides further clasification of objects registered for a mime type. This
24  * interface is a hook into the implementation of the default
25  * <code>MimeDataProvider</code> that can be used to further specify where to
26  * look for instances of a certain class and how to create them.
27  *
28  * <p>The implementations of this interface should be registered among the services
29  * in the default lookup, for details look at
30  * <a HREF="http://openide.netbeans.org/lookup/index.html"> META-INF/services registration</a>.
31  *
32  * <p>The default <code>MimeDataProvider</code> allowes to register instances
33  * in a hierarchy of folders on the system filesystem (modules XML layers). The
34  * hierarchy starts with the Editors/ folder and then contains subfolders for
35  * each mime type that has some registered objects. So, for example there might
36  * be settings registered for the mime type identified by the following mime
37  * path 'text/x-jsp/text/x-java' and they would be located in the folder
38  * 'Editors/text/x-jsp/text/x-java' on the system filesystem. For more details
39  * on the implementation of the default <code>MimeDataProvider</code> please see
40  * the <a HREF="package-summary.html#defaultMimeDataProvider"/>SPI package</a> description.
41  *
42  * <p>The implementations of this interface are used for determining the structure
43  * under the folder belonging to a given mime type. This interface allows to
44  * tell the default <code>MimeDataProvider</code> that instances of a certain
45  * class are registered in a specific subfolder rather then under the folder
46  * belonging to the mime type. When looking up instances of such a class the
47  * default <code>MimeDataProvider</code> will not look in the mime type's folder,
48  * but in its subfolder, which name it will obtain by calling the implementation
49  * of this interface.
50  *
51  * <p>Therefore, for example instances of the <code>FolderManager</code> class
52  * can be registered in the 'Editors/text/x-java/foldManager' folder and they
53  * will be properly retrieved when calling
54  * <code>MimeLookup.getLookup(MimePath.get("text/x-java")).lookup(FolderManager.class);</code>.
55  *
56  * @author Miloslav Metelka, Martin Roskanin, Vita Stejskal
57  */

58 public interface Class2LayerFolder {
59     
60     /**
61      * Gets the class of the instances that are registered under the special
62      * subfolder.
63      *
64      * @return The class which this object provides an additional information for.
65      */

66     Class JavaDoc getClazz();
67     
68     /**
69      * Gets the name of the subfolder where the instances are registered. The
70      * subfolder should be located be located under the folder belonging to
71      * the appropriate mime type, i.e.
72      * <code>Editors/text/x-java/&lt;desired-layer-subfolder-name&gt;</code>.
73      *
74      * @return The mime type subfolder name.
75      */

76     String JavaDoc getLayerFolderName();
77     
78     /**
79      * Gets the <code>InstanceProvider</code> that should be used for creating
80      * the registered instances. This method can return <code>null</code> if
81      * there is no speacial <code>InstanceProvider</code> needed and the instances
82      * can be created in the standard way.
83      *
84      * @return The <code>InstanceProvider</code> capable of createing instances
85      * of the {@link #getClazz()} class. Can return <code>null</code>.
86      */

87     InstanceProvider getInstanceProvider();
88     
89 }
90
Popular Tags