Creating a File Type
See Also
The New File Type wizard creates a new file type.
To create a new file type:
- Right-click a module project and choose New > File Type.
- In the File Recognition page, you have to set the following:
- MIME Type. Specifies a unique Multipurpose Internet Mail Extension (MIME) type that enables
the file type to be registered in the layer.xml file. Together, the MIME type and the filename extension
or XML root element enable the IDE to distinguish one file type from another.
- by
- Filename Extension. Specifies one or more file extensions that the IDE will recognize
as belonging to the specified MIME type. The file extension can optionally be preceded by a dot.
Separators are commas, spaces, or both. Therefore, all of the following are valid:
- .abc,.def
- .abc .def
- abc def
- abc,.def ghi, .wow
- XML Root Element. Specifies a unique namespace that distinguishes
the XML file type from all other XML file types.
- In the Name, Icon, and Location page, you have to set the following:
- Class Name. Specifies the name of the new files that
will be generated.
- Icon. Specifies the icon that will accompany the new file type. For example, when
you see the new file type in the Projects window, Files window, or Favorites window,
it will be identified by the icon specified here. (Optional)
- Package. Specifies the name of the package where the class will be housed.
- After completing the wizard, you can do one or more of the following:
- Tweak the layer.xml file
to change the icon or to rearrange the position of the action within the actions provided by the available modules.
- Add properties to the default property sheet used by the new file type.
- Use the New Action wizard to add actions
to the new file type's pop-up menu. When you do so, select Conditionally Enabled in
the first page of the New Action wizard. The condition
specifies that you can use only DataObject as the cookie, or the particular DataObject subclass that
you create in the New Action wizard.
In the second page,
set the file type context menu item.
- Use the New Wizard wizard to create a New File wizard
that the user will use to create new files of the new type defined in the New File Type wizard.
- Use the New Project Template wizard to add a sample
project containing example files of the new file type to the New Project wizard.
- Add advanced support for the file type, such as syntax highlighting.
- See Also
- About NetBeans Platform and Module Development
- About the NetBeans Platform
Legal Notices