Note: These pages are being reviewed.
How is MimeLookup composed?
In order to get MimeLookup you have to supply
MimePath. With the default
implementation provided by Netbeans the contents of
MimeLookup is defined by
a hierarchical structure of folders on the system FileSystem. The structure
starts in the
Editors folder and then follows all the components of the
For example if you ask for
MimeLookup for the following
text/x-java you will get
Lookup with contents from the following
As you can see
text/x-java contains not only editor
features registered for the
text/x-java mime type itself, but it also
inherits general features registered for an empty
MimePath (i.e. in the
root of the hierarchy).
The inheritence algorithm used for composing
MimeLookup for a given
MimePath supports more than just simple inheritance from the root. It also
supports compound mime types such as
text/x-ant+xml and embedded mime types
Compound mime types
Let’s have a look at the
MimeLookup composition for a compound mime type
text/x-ant+xml. The resulting
Lookup will contain things registered in
the following folders:
Editors/text/x-ant+xml Editors/text/xml Editors
That’s the reason why editor features provided by XML modules for general XML files work also for specialized, but XML-based, files.
Embedded mime types
The inheritance hierarchy becomes even more complicated when dealing with embedded mime
types. Let’s use a java scriplet inside a JSP page as an example of language embedding.
MimePath for the scriplet is
text/x-jsp/text/x-java and its
contain features registered in the following folders:
Editors/text/x-jsp/text/x-java Editors/text/x-java Editors
The algorithm for computing the inheritance tree for a particular
combines all the above cases together and works always the same way no matter what
feature you are going to look for in the resulting
Applies to: NetBeans 6.x and with some exceptions also to 5.x
See also: What is MimeLookup?, What is MimePath?, MimeLookup API
Apache Migration Information
The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.
This page was exported from http://wiki.netbeans.org/DevFaqEditorHowIsMimeLookupComposed , that was last modified by NetBeans user Vstejskal on 2010-06-16T14:05:24Z.
NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.