本文整理汇总了Java中com.intellij.openapi.fileTypes.FileNameMatcher.equals方法的典型用法代码示例。如果您正苦于以下问题:Java FileNameMatcher.equals方法的具体用法?Java FileNameMatcher.equals怎么用?Java FileNameMatcher.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.fileTypes.FileNameMatcher
的用法示例。
在下文中一共展示了FileNameMatcher.equals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findAssociatedFileType
import com.intellij.openapi.fileTypes.FileNameMatcher; //导入方法依赖的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: findAssociatedFileType
import com.intellij.openapi.fileTypes.FileNameMatcher; //导入方法依赖的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;
}
示例3: isAssociatedWith
import com.intellij.openapi.fileTypes.FileNameMatcher; //导入方法依赖的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;
}
示例4: removeAssociation
import com.intellij.openapi.fileTypes.FileNameMatcher; //导入方法依赖的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;
}
示例5: isAssociatedWith
import com.intellij.openapi.fileTypes.FileNameMatcher; //导入方法依赖的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;
}
示例6: removeAssociation
import com.intellij.openapi.fileTypes.FileNameMatcher; //导入方法依赖的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;
}
示例7: removeAssociation
import com.intellij.openapi.fileTypes.FileNameMatcher; //导入方法依赖的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;
}