Example usage for com.intellij.openapi.fileTypes FileTypeManager associate

List of usage examples for com.intellij.openapi.fileTypes FileTypeManager associate

Introduction

In this page you can find the example usage for com.intellij.openapi.fileTypes FileTypeManager associate.

Prototype

public abstract void associate(@NotNull FileType type, @NotNull FileNameMatcher matcher);

Source Link

Usage

From source file:org.metaborg.intellij.idea.filetypes.FileTypeUtils.java

License:Apache License

/**
 * Registers the given file type with IntelliJ IDEA.
 *
 * @param fileType The file type to register.
 *//*  w  w  w  . j  a  va2s.  co  m*/
public static void register(final IMetaborgFileType fileType) {
    FileTypeManagerEx.getInstanceEx().registerFileType(fileType);

    // Associate the file type with its file extensions.
    final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
    for (final String ext : fileType.getExtensions()) {
        final FileNameMatcher matcher = new ExtensionFileNameMatcher(ext);
        fileTypeManager.associate(fileType, matcher);
    }
}