com.intellij.openapi.fileTypes
Interface FileType

All Known Implementing Classes:
LanguageFileType, UserBinaryFileType, UserFileType

public interface FileType


Field Summary
static FileType[] EMPTY_ARRAY
           
 
Method Summary
 java.lang.String getCharset(VirtualFile file)
          Returns the character set for the specified file.
 java.lang.String getDefaultExtension()
          Returns the default extension for files of the type.
 java.lang.String getDescription()
          Returns the user-readable description of the file type.
 SyntaxHighlighter getHighlighter(Project project)
          Returns the syntax highlighter for the files of the type.
 javax.swing.Icon getIcon()
          Returns the icon used for showing files of the type.
 java.lang.String getName()
          Returns the name of the file type.
 StructureViewBuilder getStructureViewBuilder(VirtualFile file, Project project)
          Returns the structure view builder for the specified file.
 boolean isBinary()
          Returns true if files of the specified type contain binary data.
 boolean isReadOnly()
          Returns true if the specified file type is read-only.
 

Field Detail

EMPTY_ARRAY

static final FileType[] EMPTY_ARRAY
Method Detail

getName

@NotNull
java.lang.String getName()
Returns the name of the file type. The name must be unique among all file types registered in the system.

Returns:
The file type name.

getDescription

@NotNull
java.lang.String getDescription()
Returns the user-readable description of the file type.

Returns:
The file type description.

getDefaultExtension

@NotNull
java.lang.String getDefaultExtension()
Returns the default extension for files of the type.

Returns:
The extension, not including the leading '.'.

getIcon

@Nullable
javax.swing.Icon getIcon()
Returns the icon used for showing files of the type.

Returns:
The icon instance, or null if no icon should be shown.

isBinary

boolean isBinary()
Returns true if files of the specified type contain binary data. Used for source control, to-do items scanning and other purposes.

Returns:
true if the file is binary, false if the file is plain text.

isReadOnly

boolean isReadOnly()
Returns true if the specified file type is read-only. Read-only file types are not shown in the "File Types" settings dialog, and users cannot change the extensions associated with the file type.

Returns:
true if the file type is read-only, false otherwise.

getCharset

@Nullable
java.lang.String getCharset(@NotNull
                                     VirtualFile file)
Returns the character set for the specified file.

Parameters:
file - The file for which the character set is requested.
Returns:
The character set name, in the format supported by Charset class.

getHighlighter

@Nullable
SyntaxHighlighter getHighlighter(@Nullable
                                          Project project)
Returns the syntax highlighter for the files of the type.

Parameters:
project - The project in which the highligher will work, or null if the highlighter is not tied to any project.
Returns:
The highlighter implementation.

getStructureViewBuilder

@Nullable
StructureViewBuilder getStructureViewBuilder(@NotNull
                                                      VirtualFile file,
                                                      @NotNull
                                                      Project project)
Returns the structure view builder for the specified file.

Parameters:
file - The file for which the structure view builder is requested.
project - The project to which the file belongs.
Returns:
The structure view builder, or null if no structure view is available for the file.