本文整理汇总了Java中com.intellij.openapi.fileTypes.ExactFileNameMatcher类的典型用法代码示例。如果您正苦于以下问题:Java ExactFileNameMatcher类的具体用法?Java ExactFileNameMatcher怎么用?Java ExactFileNameMatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExactFileNameMatcher类属于com.intellij.openapi.fileTypes包,在下文中一共展示了ExactFileNameMatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAssociatedFileType
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
@Nullable
public 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;
}
示例2: addAssociation
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
public void addAssociation(FileNameMatcher matcher, T type) {
if (matcher instanceof ExtensionFileNameMatcher) {
myExtensionMappings.put(((ExtensionFileNameMatcher)matcher).getExtension(), type);
}
else if (matcher instanceof ExactFileNameMatcher) {
final ExactFileNameMatcher exactFileNameMatcher = (ExactFileNameMatcher)matcher;
if (exactFileNameMatcher.isIgnoreCase()) {
myExactFileNameAnyCaseMappings.put(exactFileNameMatcher.getFileName(), type);
} else {
myExactFileNameMappings.put(exactFileNameMatcher.getFileName(), type);
}
} else {
myMatchingMappings.add(new Pair<FileNameMatcher, T>(matcher, type));
}
}
示例3: findAssociatedFileType
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
@Nullable
public T findAssociatedFileType(final FileNameMatcher matcher) {
if (matcher instanceof ExtensionFileNameMatcher) {
return myExtensionMappings.get(((ExtensionFileNameMatcher)matcher).getExtension());
}
if (matcher instanceof ExactFileNameMatcher) {
final ExactFileNameMatcher exactFileNameMatcher = (ExactFileNameMatcher)matcher;
if (exactFileNameMatcher.isIgnoreCase()) {
return myExactFileNameAnyCaseMappings.get(exactFileNameMatcher.getFileName());
} else {
return myExactFileNameMappings.get(exactFileNameMatcher.getFileName());
}
}
for (Pair<FileNameMatcher, T> mapping : myMatchingMappings) {
if (matcher.equals(mapping.getFirst())) return mapping.getSecond();
}
return null;
}
示例4: associateFileType
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
/**
* Associates given file with proper {@link IgnoreFileType}.
*
* @param fileName to associate
* @param fileType file type to bind with pattern
*/
public static void associateFileType(@NotNull final String fileName, @NotNull final IgnoreFileType fileType) {
final Application application = ApplicationManager.getApplication();
if (application.isDispatchThread()) {
final FileTypeManager fileTypeManager = FileTypeManager.getInstance();
application.invokeLater(new Runnable() {
@Override
public void run() {
application.runWriteAction(new Runnable() {
@Override
public void run() {
fileTypeManager.associate(fileType, new ExactFileNameMatcher(fileName));
FILE_TYPES_ASSOCIATION_QUEUE.remove(fileName);
}
});
}
}, ModalityState.NON_MODAL);
} else if (!FILE_TYPES_ASSOCIATION_QUEUE.containsKey(fileName)) {
FILE_TYPES_ASSOCIATION_QUEUE.put(fileName, fileType);
}
}
示例5: createMatcher
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
@NotNull
public FileNameMatcher createMatcher(@NotNull String pattern) {
if (pattern.startsWith("*.") &&
pattern.indexOf('*', 2) < 0 &&
pattern.indexOf('.', 2) < 0 &&
pattern.indexOf('?', 2) < 0) {
return new ExtensionFileNameMatcher(pattern.substring(2).toLowerCase());
}
if (pattern.contains("*") || pattern.contains("?")) {
return new WildcardFileNameMatcher(pattern);
}
return new ExactFileNameMatcher(pattern);
}
示例6: isAssociatedWith
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
public boolean isAssociatedWith(@NotNull T type, @NotNull FileNameMatcher matcher) {
if (matcher instanceof ExtensionFileNameMatcher || matcher instanceof ExactFileNameMatcher) {
return findAssociatedFileType(matcher) == type;
}
for (Pair<FileNameMatcher, T> mapping : myMatchingMappings) {
if (matcher.equals(mapping.getFirst()) && type == mapping.getSecond()) return true;
}
return false;
}
示例7: addAssociation
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
public void addAssociation(FileNameMatcher matcher, T type) {
if (matcher instanceof ExtensionFileNameMatcher) {
myExtensionMappings.put(((ExtensionFileNameMatcher)matcher).getExtension(), type);
}
else if (matcher instanceof ExactFileNameMatcher) {
final ExactFileNameMatcher exactFileNameMatcher = (ExactFileNameMatcher)matcher;
Map<CharSequence, T> mapToUse = exactFileNameMatcher.isIgnoreCase() ? myExactFileNameAnyCaseMappings : myExactFileNameMappings;
mapToUse.put(exactFileNameMatcher.getFileName(), type);
}
else {
myMatchingMappings.add(Pair.create(matcher, type));
}
}
示例8: removeAssociation
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
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<Pair<FileNameMatcher, T>>(myMatchingMappings);
for (Pair<FileNameMatcher, T> assoc : copy) {
if (matcher.equals(assoc.getFirst())) {
myMatchingMappings.remove(assoc);
return true;
}
}
return false;
}
示例9: isAssociatedWith
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
public boolean isAssociatedWith(T type, FileNameMatcher matcher) {
if (matcher instanceof ExtensionFileNameMatcher || matcher instanceof ExactFileNameMatcher) {
return findAssociatedFileType(matcher) == type;
}
for (Pair<FileNameMatcher, T> mapping : myMatchingMappings) {
if (matcher.equals(mapping.getFirst()) && type == mapping.getSecond()) return true;
}
return false;
}
示例10: removeAssociation
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
public boolean removeAssociation(FileNameMatcher matcher, 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;
final Map<String, T> mapToUse;
String fileName = exactFileNameMatcher.getFileName();
if (exactFileNameMatcher.isIgnoreCase()) {
mapToUse = myExactFileNameAnyCaseMappings;
} else {
mapToUse = myExactFileNameMappings;
}
if(mapToUse.get(fileName) == type) {
mapToUse.remove(fileName);
return true;
}
return false;
}
List<Pair<FileNameMatcher, T>> copy = new ArrayList<Pair<FileNameMatcher, T>>(myMatchingMappings);
for (Pair<FileNameMatcher, T> assoc : copy) {
if (matcher.equals(assoc.getFirst())) {
myMatchingMappings.remove(assoc);
return true;
}
}
return false;
}
示例11: removeAssociation
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
public boolean removeAssociation(FileNameMatcher matcher, 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;
final Map<CharSequence, T> mapToUse;
String fileName = exactFileNameMatcher.getFileName();
if (exactFileNameMatcher.isIgnoreCase()) {
mapToUse = myExactFileNameAnyCaseMappings;
} else {
mapToUse = myExactFileNameMappings;
}
if(mapToUse.get(fileName) == type) {
mapToUse.remove(fileName);
return true;
}
return false;
}
List<Pair<FileNameMatcher, T>> copy = new ArrayList<Pair<FileNameMatcher, T>>(myMatchingMappings);
for (Pair<FileNameMatcher, T> assoc : copy) {
if (matcher.equals(assoc.getFirst())) {
myMatchingMappings.remove(assoc);
return true;
}
}
return false;
}
示例12: createFileTypes
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
@Override
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
fileTypeConsumer.consume(CoffigYamlFileType.INSTANCE, new ExactFileNameMatcher("application.yaml"), new ExactFileNameMatcher("application.yml"));
}
示例13: createFileTypes
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
public void createFileTypes(@NotNull FileTypeConsumer consumer) {
consumer.consume(StylintConfigFileType.INSTANCE, new ExactFileNameMatcher(StylintConfigFileType.STYLINTRC));
}
示例14: createFileTypes
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
public void createFileTypes(final @NotNull FileTypeConsumer consumer) {
consumer.consume(BuildoutCfgFileType.INSTANCE, new ExactFileNameMatcher(BuildoutFacet.BUILDOUT_CFG, true));
}
示例15: createFileTypes
import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void createFileTypes(@NotNull FileTypeConsumer consumer) {
consumer.consume(PlainTextFileType.INSTANCE, new ExactFileNameMatcher(".gitignore"), new ExactFileNameMatcher(".gitmodules"));
}