Content Types

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.

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.

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.

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.

In case there are multiple editors suitable to open a content type, you can declare one of these editors as default editor (the preferred editor). Just select the editor in the associated editors list and press the Default button. If there is no default editor, the first suitable editor found is used to open the content type.

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.