use of com.intellij.openapi.fileTypes.ExactFileNameMatcher in project intellij-community by JetBrains.
the class DGMFileTypeFactory method createFileTypes.
@Override
public void createFileTypes(@NotNull FileTypeConsumer consumer) {
ExactFileNameMatcher matcher = new ExactFileNameMatcher(DGMUtil.ORG_CODEHAUS_GROOVY_RUNTIME_EXTENSION_MODULE, !SystemInfo.isFileSystemCaseSensitive);
consumer.consume(PropertiesFileType.INSTANCE, matcher);
}
use of com.intellij.openapi.fileTypes.ExactFileNameMatcher in project intellij-community by JetBrains.
the class FileTypeAssocTable method findAssociatedFileType.
@Nullable
T findAssociatedFileType(@NotNull FileNameMatcher matcher) {
if (matcher instanceof ExtensionFileNameMatcher) {
return myExtensionMappings.get(((ExtensionFileNameMatcher) matcher).getExtension());
}
if (matcher instanceof ExactFileNameMatcher) {
final ExactFileNameMatcher exactFileNameMatcher = (ExactFileNameMatcher) matcher;
Map<CharSequence, T> mapToUse = exactFileNameMatcher.isIgnoreCase() ? myExactFileNameAnyCaseMappings : myExactFileNameMappings;
return mapToUse.get(exactFileNameMatcher.getFileName());
}
for (Pair<FileNameMatcher, T> mapping : myMatchingMappings) {
if (matcher.equals(mapping.getFirst()))
return mapping.getSecond();
}
return null;
}
use of com.intellij.openapi.fileTypes.ExactFileNameMatcher in project intellij-community by JetBrains.
the class FileTypeAssocTable method removeAssociation.
boolean removeAssociation(@NotNull FileNameMatcher matcher, @NotNull T type) {
if (matcher instanceof ExtensionFileNameMatcher) {
String extension = ((ExtensionFileNameMatcher) matcher).getExtension();
if (myExtensionMappings.get(extension) == type) {
myExtensionMappings.remove(extension);
return true;
}
return false;
}
if (matcher instanceof ExactFileNameMatcher) {
final ExactFileNameMatcher exactFileNameMatcher = (ExactFileNameMatcher) matcher;
String fileName = exactFileNameMatcher.getFileName();
final Map<CharSequence, T> mapToUse = exactFileNameMatcher.isIgnoreCase() ? myExactFileNameAnyCaseMappings : myExactFileNameMappings;
if (mapToUse.get(fileName) == type) {
mapToUse.remove(fileName);
return true;
}
return false;
}
List<Pair<FileNameMatcher, T>> copy = new ArrayList<>(myMatchingMappings);
for (Pair<FileNameMatcher, T> assoc : copy) {
if (matcher.equals(assoc.getFirst())) {
myMatchingMappings.remove(assoc);
return true;
}
}
return false;
}
Aggregations