RefactorInsight-master/plugin/src/main/java/org/jetbrains/research/refactorinsight/pullrequests/PRFileEditorProvider.java
package org.jetbrains.research.refactorinsight.pullrequests;

import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorPolicy;
import com.intellij.openapi.fileEditor.FileEditorProvider;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;

public class PRFileEditorProvider implements FileEditorProvider, DumbAware {
  @Override
  public boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
    return file instanceof PRVirtualFile;
  }

  @Override
  public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
    PRVirtualFile prVirtualFile = (PRVirtualFile) file;
    return new PRFileEditor(project, prVirtualFile);
  }

  @Override
  public @NotNull String getEditorTypeId() {
    return "RefactorInsight";
  }

  @Override
  public @NotNull FileEditorPolicy getPolicy() {
    return FileEditorPolicy.HIDE_DEFAULT_EDITOR;
  }
}
