Content Types preference page

The command linkGeneral > Content Types preference page enables you to edit content types and their associated file names, editors and character sets. You can also associate arbitrary file names or file extensions with content types. A content type acts as a description of a certain class of files (for instance, XML files). Eclipse uses this description in various scenarios, such as editor look-ups and file comparisons.

To access the Content Types preference page, select Window > Preferences > General > Content Types.

Content types preference page

Manage content type definitions

You can define new content types from this preference page. On the right of the tree showing all content types, click on Add Root... or Add Child... (in case a content type is already selected) to define a new content type. You'll then be asked for the name.

Content types that were created manually from the preference page are stored in the user data area.

Content types that were created manually can be removed thanks to the Remove button. Removing a content type definition also removes all children content type definitions. Content type that were defined by plug-ins cannot be removed.

Associating content types with file name or extension

By selecting a content type in the topmost tree, you can alter the file names and extensions that are associated with it.

Note: Certain name specification will show a "lock" icon. An item is locked if it is one of the associations provided by the plug-in that declares the content type. In other words, you can remove only user-contributed associations.

Adding an association is as simple as clicking Add.... A dialog prompts you to enter the file name or extension.

New file type dialog

Associating editors with content types

The second list below the content types tree shows the editors that are directly declared as suitable to open the given content type. Editors associated with parent content types are also valid editors for the children content type, although they are not shown there.

For any content type, you can declare a new editor association using the Add... button besides the list of editors. This button will let you pick a new editor to associate with the selected content type.

Editor selection dialog

Those user-defined editor associations are stored in the user data area.

Editor associations defined manually can be removed thanks to the Remove button. Editor associations that were defined by a plug-in are locked and cannot be removed.

Define default encoding for content type

You can also set the default encoding for a given content type. To do this, simply enter the encoding name in the provided field and click Update.

Image of character set field