Note: These pages are being reviewed.
What is MimeLookup?
MimeLookup is a mechanism for extending editor functionality provided by
Most of the editor functionality in NetBeans is organized by mime types of documents that are edited. There are special modules that provide support for editing Java, XML, JSP, C++ and many other file types. All of these modules need to provide more or less the same features such as syntax coloring, code completion, code folding, popup menu, etc. However, the implementation of these features is different for particular file types.
The editor insfrastructure provides many SPI interfaces that can be implemented by modules providing specific implementations of editor features, and the
MimeLookup is the way that these implementations can be plugged in to the system.
As its name suggests,
MimeLookup is a mime-type specific
Lookup. This means that modules can register instances in the Lookup dedicated to the mime type of
files that they support. For example, there are different Lookups for
text/xml mime types, and both contain FoldManager
implementations specific for Java and XML languages respectively.
MimeLookup implementation is split in two parts. The first part is pretty
much independent of most of the other NetBeans libraries and provides a simple
API and SPI for accessing contents of
MimeLookup. The second part is a
NetBeans specific implementation of the
MimeLookup’s registry based on the
modules' XML layers. This registry is in fact a hierarchical structure of folders under the `Editors/ folder on the system filesystem.
# How to get the Lookup for Java files? MimePath mimePath = MimePath.parse("text/x-java"); Lookup lookup = MimeLookup.getLookup(mimePath); # How to register instances (e.g. EditorKit) in the Lookup for Java files? <folder name="Editors> <folder name="text"> <folder name="x-java"> <file name="org-netbeans-modules-java-JavaEditorKitImpl.instance"/> </folder> </folder> </folder>
Applies to: NetBeans 5.x, 6.x
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/DevFaqEditorWhatIsMimeLookup , that was last modified by NetBeans user Dbell on 2010-09-30T10:33:17Z.
NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.