Java 类com.intellij.openapi.fileTypes.ex.FakeFileType 实例源码

项目:intellij-ce-playground    文件:FileTypeIndexTest.java   
static void addAndRemoveFileType() {
  FileType foo = new FakeFileType() {
    @Override
    public boolean isMyFileType(@NotNull VirtualFile file) {
      return true;
    }

    @NotNull
    @Override
    public String getName() {
      return "foo";
    }

    @NotNull
    @Override
    public String getDescription() {
      return "";
    }
  };
  FileTypeIndex index = new FileTypeIndex(FileTypeManager.getInstance());
  int version = index.getVersion();

  try {
    FileTypeManagerEx.getInstanceEx().registerFileType(foo);
    assertNotSame(version, index.getVersion());
  }
  finally {
    FileTypeManagerEx.getInstanceEx().unregisterFileType(foo);
  }
}
项目:tools-idea    文件:FileTypeIndexTest.java   
static void addAndRemoveFileType() {
  FileType foo = new FakeFileType() {
    @Override
    public boolean isMyFileType(VirtualFile file) {
      return true;
    }

    @NotNull
    @Override
    public String getName() {
      return "foo";
    }

    @NotNull
    @Override
    public String getDescription() {
      return "";
    }
  };
  FileTypeIndex index = new FileTypeIndex(FileTypeManager.getInstance());
  int version = index.getVersion();

  try {
    FileTypeManagerEx.getInstanceEx().registerFileType(foo);
    assertNotSame(version, index.getVersion());
  }
  finally {
    FileTypeManagerEx.getInstanceEx().unregisterFileType(foo);
  }
}
项目:consulo    文件:FileTypeIndexTest.java   
public void testAddFileType() throws Exception {
  FileType foo = new FakeFileType() {
    @Override
    public boolean isMyFileType(VirtualFile file) {
      return true;
    }

    @Nonnull
    @Override
    public String getName() {
      return "foo";
    }

    @Nonnull
    @Override
    public String getDescription() {
      return "";
    }
  };
  FileTypeIndex index = new FileTypeIndex(FileTypeManager.getInstance());
  int version = index.getVersion();

  try {
    FileTypeManagerEx.getInstanceEx().registerFileType(foo);
    assertNotSame(version, index.getVersion());
  }
  finally {
    FileTypeManagerEx.getInstanceEx().unregisterFileType(foo);
  }
}