当前位置: 首页>>代码示例>>Java>>正文


Java ExactFileNameMatcher类代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FileTypeAssocTable.java

示例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));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:FileTypeAssocTable.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:FileTypeAssocTable.java

示例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);
    }
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:27,代码来源:IgnoreManager.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:FileNameMatcherFactoryImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileTypeAssocTable.java

示例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));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:FileTypeAssocTable.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:FileTypeAssocTable.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:FileTypeAssocTable.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:38,代码来源:FileTypeAssocTable.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:38,代码来源:FileTypeAssocTable.java

示例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"));
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:5,代码来源:CoffigYamlFileTypeFactory.java

示例13: createFileTypes

import com.intellij.openapi.fileTypes.ExactFileNameMatcher; //导入依赖的package包/类
public void createFileTypes(@NotNull FileTypeConsumer consumer) {
    consumer.consume(StylintConfigFileType.INSTANCE, new ExactFileNameMatcher(StylintConfigFileType.STYLINTRC));
}
 
开发者ID:sertae,项目名称:stylint-plugin,代码行数:4,代码来源:StylintConfigFileTypeFactory.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:BuildoutCfgFileTypeFactory.java

示例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"));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:GitFileTypeFactory.java


注:本文中的com.intellij.openapi.fileTypes.ExactFileNameMatcher类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。