public class FileTypeManagerImpl extends FileTypeManagerEx implements PersistentStateComponent<Element>, Disposable
FileTypeRegistry.FileTypeDetectorDisposable.ParentTOPICourInstanceGetter| Constructor and Description |
|---|
FileTypeManagerImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addFileTypeListener(FileTypeListener listener)
Adds a listener for receiving notifications about changes in the list of
registered file types.
|
void |
associate(FileType type,
FileNameMatcher matcher) |
void |
associate(FileType fileType,
FileNameMatcher matcher,
boolean fireChange) |
void |
dispose()
Usually not invoked directly, see class javadoc.
|
void |
drainReDetectQueue() |
LanguageFileType |
findFileTypeByLanguage(Language language) |
FileType |
findFileTypeByName(java.lang.String fileTypeName)
Finds a file type with the specified name.
|
void |
fireBeforeFileTypesChanged() |
void |
fireFileTypesChanged() |
void |
freezeFileTypeTemporarilyIn(VirtualFile file,
java.lang.Runnable runnable) |
java.lang.String [] |
getAssociatedExtensions(FileType type)
Returns the list of extensions associated with the specified file type.
|
java.util.List<FileNameMatcher> |
getAssociations(FileType type) |
FileType |
getByFile(VirtualFile file) |
java.lang.String |
getExtension(java.lang.String fileName) |
FileType |
getFileTypeByExtension(java.lang.String extension)
Returns the file type for the specified extension.
|
FileType |
getFileTypeByFile(VirtualFile file)
Returns the file type for the specified file.
|
FileType |
getFileTypeByFile(VirtualFile file,
byte [] content)
Returns the file type for the specified file.
|
FileType |
getFileTypeByFileName(java.lang.CharSequence fileName)
Returns the file type for the specified file name.
|
FileType |
getFileTypeByFileName(java.lang.String fileName)
Same as FileTypeRegistry.getFileTypeByFileName(CharSequence) but receives String parameter.
|
java.lang.String |
getIgnoredFilesList()
Returns the semicolon-delimited list of patterns for files and folders
which are excluded from the project structure though they may be present
physically on disk.
|
FileType |
getKnownFileTypeOrAssociate(VirtualFile file)
If file is already associated with any known file type returns it.
|
FileType |
getKnownFileTypeOrAssociate(VirtualFile file,
Project project) |
FileType [] |
getRegisteredFileTypes()
Returns the list of all registered file types.
|
Element |
getState() |
FileType |
getStdFileType(java.lang.String name) |
void |
initializeComponent()
If class also is a component, then this method will be called after loading state (even if not state) but only once throughout the life cycle
|
boolean |
isFileIgnored(java.lang.String name)
Checks if the specified file is ignored by the IDE.
|
boolean |
isFileIgnored(VirtualFile file) |
boolean |
isIgnoredFilesListEqualToCurrent(java.lang.String list) |
void |
loadState(Element state)
This method is called when new component state is loaded.
|
protected byte |
readFlagsFromCache(VirtualFile file) |
void |
registerFileType(FileType fileType)
Deprecated.
|
void |
registerFileType(FileType type,
java.util.List<? extends FileNameMatcher> defaultAssociations) |
void |
removeAssociation(FileType type,
FileNameMatcher matcher) |
void |
removeAssociation(FileType fileType,
FileNameMatcher matcher,
boolean fireChange) |
void |
removeFileTypeListener(FileTypeListener listener)
Removes a listener for receiving notifications about changes in the list of
registered file types.
|
void |
setIgnoredFilesList(java.lang.String list)
Sets new list of semicolon-delimited patterns for files and folders which
are excluded from the project structure.
|
void |
unregisterFileType(FileType fileType) |
protected void |
writeFlagsToCache(VirtualFile file,
int flags) |
getInstanceExassociateExtension, associatePattern, getInstance, parseFromString, registerFileType, removeAssociatedExtensionisFileOfTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnoStateLoadedpublic void drainReDetectQueue()
public FileType getStdFileType(java.lang.String name)
getStdFileType in class FileTypeManagerpublic void initializeComponent()
PersistentStateComponentinitializeComponent in interface PersistentStateComponent<Element>public FileType getFileTypeByFileName(java.lang.String fileName)
FileTypeRegistrygetFileTypeByFileName in class FileTypeRegistrypublic FileType getFileTypeByFileName(java.lang.CharSequence fileName)
FileTypeRegistrygetFileTypeByFileName in class FileTypeRegistryfileName - The file name for which the type is requested.FileTypes.UNKNOWN if not found.public void freezeFileTypeTemporarilyIn(VirtualFile file, java.lang.Runnable runnable)
public FileType getFileTypeByFile(VirtualFile file)
FileTypeRegistrygetFileTypeByFile in class FileTypeRegistryfile - The file for which the type is requested.public FileType getFileTypeByFile(VirtualFile file, byte [] content)
FileTypeRegistrygetFileTypeByFile in class FileTypeRegistryfile - The file for which the type is requested.content - Content of the file (if already available, to avoid reading from disk again)public FileType getByFile(VirtualFile file)
protected byte readFlagsFromCache(VirtualFile file)
protected void writeFlagsToCache(VirtualFile file, int flags)
public FileType findFileTypeByName(java.lang.String fileTypeName)
FileTypeRegistryfindFileTypeByName in class FileTypeRegistrypublic LanguageFileType findFileTypeByLanguage(Language language)
findFileTypeByLanguage in class FileTypeRegistrypublic FileType getFileTypeByExtension(java.lang.String extension)
FileTypeRegistryFileTypeRegistry.getFileTypeByFile(VirtualFile)getFileTypeByExtension in class FileTypeRegistryextension - The extension for which the file type is requested, not including the leading '.'.UnknownFileType.INSTANCE if corresponding file type not found@Deprecated public void registerFileType(FileType fileType)
registerFileType in class FileTypeManagerExpublic void registerFileType(FileType type, java.util.List<? extends FileNameMatcher> defaultAssociations)
registerFileType in class FileTypeManagerpublic void unregisterFileType(FileType fileType)
unregisterFileType in class FileTypeManagerExpublic FileType [] getRegisteredFileTypes()
FileTypeRegistrygetRegisteredFileTypes in class FileTypeRegistrypublic java.lang.String getExtension(java.lang.String fileName)
getExtension in class FileTypeManagerExpublic java.lang.String getIgnoredFilesList()
FileTypeManagergetIgnoredFilesList in class FileTypeManagerpublic void setIgnoredFilesList(java.lang.String list)
FileTypeManagersetIgnoredFilesList in class FileTypeManagerlist - List of semicolon-delimited patterns.public boolean isIgnoredFilesListEqualToCurrent(java.lang.String list)
isIgnoredFilesListEqualToCurrent in class FileTypeManagerExpublic boolean isFileIgnored(java.lang.String name)
FileTypeManagerisFileIgnored in class FileTypeManagername - The name of the file to check.true if the file is ignored, false otherwise.public boolean isFileIgnored(VirtualFile file)
isFileIgnored in class FileTypeRegistrypublic java.lang.String [] getAssociatedExtensions(FileType type)
FileTypeManagergetAssociatedExtensions in class FileTypeManagertype - The file type for which the extensions are requested.public java.util.List<FileNameMatcher> getAssociations(FileType type)
getAssociations in class FileTypeManagerpublic void associate(FileType type, FileNameMatcher matcher)
associate in class FileTypeManagerpublic void removeAssociation(FileType type, FileNameMatcher matcher)
removeAssociation in class FileTypeManagerpublic void fireBeforeFileTypesChanged()
fireBeforeFileTypesChanged in class FileTypeManagerExpublic void fireFileTypesChanged()
fireFileTypesChanged in class FileTypeManagerExpublic void addFileTypeListener(FileTypeListener listener)
FileTypeManageraddFileTypeListener in class FileTypeManagerlistener - The listener instance.public void removeFileTypeListener(FileTypeListener listener)
FileTypeManagerremoveFileTypeListener in class FileTypeManagerlistener - The listener instance.public void loadState(Element state)
PersistentStateComponentState object should be used directly, defensive copying is not required.
loadState in interface PersistentStateComponent<Element>state - loaded component stateXmlSerializerUtil.copyBean(Object, Object)public Element getState()
getState in interface PersistentStateComponent<Element>null value indicates
that the returned state won't be stored, as a result previously stored state will be used.XmlSerializerpublic void associate(FileType fileType, FileNameMatcher matcher, boolean fireChange)
public void removeAssociation(FileType fileType, FileNameMatcher matcher, boolean fireChange)
public FileType getKnownFileTypeOrAssociate(VirtualFile file)
FileTypeManagergetKnownFileTypeOrAssociate in class FileTypeManagerfile - file to ask for file type associationnull. Never returns FileTypes.UNKNOWN.public FileType getKnownFileTypeOrAssociate(VirtualFile file, Project project)
getKnownFileTypeOrAssociate in class FileTypeManagerpublic void dispose()
Disposabledispose in interface Disposable