FileEditorProvider.accept - readAction should be taken by extension if needed (part 2)

GitOrigin-RevId: 2f58d7bd0aaa2a95bea61dff8496044eccf7aef6
This commit is contained in:
Vladimir Krivosheev
2023-07-13 22:30:37 +00:00
committed by intellij-monorepo-bot
parent df0d37bcb9
commit 16c9cd96c7
33 changed files with 316 additions and 219 deletions
@@ -45,6 +45,11 @@ final class ImageFileEditorProvider implements FileEditorProvider, DumbAware {
return ImageFileTypeManager.getInstance().isImage(file);
}
@Override
public boolean acceptRequiresReadAction() {
return false;
}
@Override
@NotNull
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
@@ -4,6 +4,6 @@
<extensions defaultExtensionNs="com.intellij">
<httpRequestHandler implementation="org.jetbrains.plugins.notebooks.jupyter.preview.viewOnly.JupyterViewOnlyHandler"/>
<fileEditorProvider implementation="org.jetbrains.plugins.notebooks.jupyter.preview.viewOnly.JupyterViewOnlyProvider"/>
<fileEditorProvider implementation="org.jetbrains.plugins.notebooks.jupyter.preview.viewOnly.JupyterViewOnlyProvider" fileType="Jupyter"/>
</extensions>
</idea-plugin>
@@ -10,10 +10,11 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.plugins.notebooks.jupyter.JupyterFileType
class JupyterViewOnlyProvider : FileEditorProvider, DumbAware {
internal class JupyterViewOnlyProvider : FileEditorProvider, DumbAware {
override fun accept(project: Project, file: VirtualFile): Boolean = FileTypeRegistry.getInstance().isFileOfType(file, JupyterFileType)
override fun acceptRequiresReadAction() = false
override fun createEditor(project: Project, file: VirtualFile): FileEditor = JupyterViewOnlyFileEditor.create(file)
override fun getEditorTypeId(): String = "jupyter-view-only-provider"
@@ -29,9 +29,9 @@ public interface FileEditorProvider {
*/
boolean accept(@NotNull Project project, @NotNull VirtualFile file);
default boolean acceptRequiresReadAction() {
return false;
}
default boolean acceptRequiresReadAction() {
return true;
}
/**
* Creates editor for the specified file.
@@ -198,7 +198,7 @@ public class SingleRootFileViewProvider extends AbstractFileViewProvider impleme
public static boolean fileSizeIsGreaterThan(@NotNull VirtualFile vFile, long maxBytes) {
if (vFile instanceof LightVirtualFile && !vFile.getFileType().isBinary()) {
// This is optimization in order to avoid conversion of [large] file contents to bytes
// this is an optimization in order to avoid conversion of [large] file contents to bytes
int lengthInChars = ((LightVirtualFile)vFile).getContent().length();
if (lengthInChars < maxBytes / 2) {
return false;
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.diff.editor
import com.intellij.diff.tools.combined.CombinedDiffComponentFactoryProvider
@@ -17,7 +17,7 @@ import com.intellij.openapi.util.Disposer
import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.annotations.NonNls
class DiffEditorProvider : DefaultPlatformFileEditorProvider, StructureViewFileEditorProvider, DumbAware {
internal class DiffEditorProvider : DefaultPlatformFileEditorProvider, StructureViewFileEditorProvider, DumbAware {
companion object {
@NonNls
const val DIFF_EDITOR_PROVIDER_ID = "DiffEditor"
@@ -27,6 +27,8 @@ class DiffEditorProvider : DefaultPlatformFileEditorProvider, StructureViewFileE
return file is CombinedDiffVirtualFile || file is DiffVirtualFile
}
override fun acceptRequiresReadAction() = false
override fun createEditor(project: Project, file: VirtualFile): FileEditor {
if (file is CombinedDiffVirtualFile) {
val sourceId = file.sourceId
@@ -44,6 +46,8 @@ class DiffEditorProvider : DefaultPlatformFileEditorProvider, StructureViewFileE
}
override fun getEditorTypeId(): String = DIFF_EDITOR_PROVIDER_ID
override fun getPolicy(): FileEditorPolicy = FileEditorPolicy.NONE
override fun getStructureViewBuilder(project: Project, file: VirtualFile): StructureViewBuilder? = null
}
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.largeFilesEditor.editor;
import com.intellij.openapi.application.Experiments;
@@ -32,21 +32,23 @@ public final class LargeFileEditorProvider implements DefaultPlatformFileEditorP
&& file.isInLocalFileSystem());
}
@NotNull
@Override
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
public boolean acceptRequiresReadAction() {
return false;
}
@Override
public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
return new LargeFileEditorImpl(project, file);
}
@NotNull
@Override
public String getEditorTypeId() {
public @NotNull String getEditorTypeId() {
return PROVIDER_ID;
}
@NotNull
@Override
public FileEditorPolicy getPolicy() {
public @NotNull FileEditorPolicy getPolicy() {
return FileEditorPolicy.NONE;
}
@@ -60,9 +62,8 @@ public final class LargeFileEditorProvider implements DefaultPlatformFileEditorP
}
}
@NotNull
@Override
public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
public @NotNull FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
LargeFileEditorState state = new LargeFileEditorState();
if (JDOMUtil.isEmpty(sourceElement)) {
return state;
@@ -47,20 +47,24 @@ internal class TestEditorManagerImpl(private val project: Project) : FileEditorM
private val LOG = logger<TestEditorManagerImpl>()
private val LIGHT_VIRTUAL_FILE = MyLightVirtualFile()
private val stubProvider: FileEditorProvider
get() = object : FileEditorProvider {
override fun accept(project: Project, file: VirtualFile) = false
get() {
return object : FileEditorProvider {
override fun accept(project: Project, file: VirtualFile) = false
override fun createEditor(project: Project, file: VirtualFile): FileEditor = throw IncorrectOperationException()
override fun acceptRequiresReadAction() = false
override fun disposeEditor(editor: FileEditor) = Disposer.dispose(editor)
override fun createEditor(project: Project, file: VirtualFile): FileEditor = throw IncorrectOperationException()
override fun readState(sourceElement: Element, project: Project, file: VirtualFile): FileEditorState {
throw IncorrectOperationException()
override fun disposeEditor(editor: FileEditor) = Disposer.dispose(editor)
override fun readState(sourceElement: Element, project: Project, file: VirtualFile): FileEditorState {
throw IncorrectOperationException()
}
override fun getEditorTypeId() = ""
override fun getPolicy(): FileEditorPolicy = throw IncorrectOperationException()
}
override fun getEditorTypeId() = ""
override fun getPolicy(): FileEditorPolicy = throw IncorrectOperationException()
}
}
@@ -123,7 +127,7 @@ internal class TestEditorManagerImpl(private val project: Project) : FileEditorM
private fun openFileImpl3(openFileDescriptor: FileEditorNavigatable): FileEditorComposite {
val file = openFileDescriptor.file
if (!isCurrentlyUnderLocalId) {
clientFileEditorManager?.openFile(file, false, true) ?: return FileEditorComposite.EMPTY
clientFileEditorManager?.openFile(file = file, forceCreate = false, requestFocus = true) ?: return FileEditorComposite.EMPTY
}
val isNewEditor = !virtualFileToEditor.containsKey(file)
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.ide.browsers.actions;
import com.intellij.openapi.fileEditor.FileEditor;
@@ -12,12 +12,17 @@ import org.jetbrains.annotations.NotNull;
/**
* @author Konstantin Bulenkov
*/
public class WebPreviewEditorProvider implements FileEditorProvider, DumbAware {
final class WebPreviewEditorProvider implements FileEditorProvider, DumbAware {
@Override
public boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
return file instanceof WebPreviewVirtualFile;
}
@Override
public boolean acceptRequiresReadAction() {
return false;
}
@NotNull
@Override
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
@@ -18,6 +18,11 @@ final class UIComponentEditorProvider implements FileEditorProvider, DumbAware {
return file instanceof UIComponentVirtualFile;
}
@Override
public boolean acceptRequiresReadAction() {
return false;
}
@Override
public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
return new UIComponentFileEditor((UIComponentVirtualFile)file);
@@ -8,7 +8,9 @@ import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.readAction
import com.intellij.openapi.components.*
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.diagnostic.debug
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.extensions.impl.findByIdOrFromInstance
import com.intellij.openapi.fileEditor.FileEditorPolicy
import com.intellij.openapi.fileEditor.FileEditorProvider
@@ -18,12 +20,10 @@ import com.intellij.openapi.fileTypes.FileTypeRegistry
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFile
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.*
import kotlinx.serialization.Serializable
import org.jetbrains.annotations.TestOnly
import kotlin.time.Duration.Companion.seconds
private val LOG: Logger
get() = logger<FileEditorProviderManagerImpl>()
@@ -38,29 +38,6 @@ data class FileEditorProviderManagerState(@JvmField val selectedProviders: Map<S
class FileEditorProviderManagerImpl : FileEditorProviderManager,
SerializablePersistentStateComponent<FileEditorProviderManagerState>(
FileEditorProviderManagerState()) {
private fun checkProvider(project: Project,
file: VirtualFile,
provider: FileEditorProvider,
suppressors: List<FileEditorProviderSuppressor>): Boolean {
if (!DumbService.isDumbAware(provider) && DumbService.isDumb(project)) {
return false
}
if (!provider.accept(project, file)) {
return false
}
for (suppressor in suppressors) {
if (suppressor.isSuppressed(project, file, provider)) {
LOG.info("FileEditorProvider ${provider.javaClass} for VirtualFile $file " +
"was suppressed by FileEditorProviderSuppressor ${suppressor.javaClass}")
return false
}
}
return true
}
@Suppress("DuplicatedCode")
override fun getProviderList(project: Project, file: VirtualFile): List<FileEditorProvider> {
// collect all possible editors
@@ -70,6 +47,10 @@ class FileEditorProviderManagerImpl : FileEditorProviderManager,
val suppressors = FileEditorProviderSuppressor.EP_NAME.extensionList
for (provider in FileEditorProvider.EP_FILE_EDITOR_PROVIDER.extensionList) {
if (!DumbService.isDumbAware(provider) && DumbService.isDumb(project)) {
continue
}
if (ApplicationManager.getApplication().runReadAction<Boolean, RuntimeException> {
checkProvider(project = project, file = file, provider = provider, suppressors = suppressors)
}) {
@@ -98,40 +79,31 @@ class FileEditorProviderManagerImpl : FileEditorProviderManager,
val sharedProviders = coroutineScope {
FileEditorProvider.EP_FILE_EDITOR_PROVIDER.filterableLazySequence().map { item ->
async {
val providerFileTypeName = item.getCustomAttribute("fileType")
// VcsLogFileType is not registered in FileTypeRegistry - we should check also by name
if (providerFileTypeName != null && fileType.name != providerFileTypeName) {
val fileTypeRegistry = FileTypeRegistry.getInstance()
val providerFileType = fileTypeRegistry.findFileTypeByName(providerFileTypeName)
if (providerFileType == null || !fileTypeRegistry.isFileOfType(file, providerFileType)) {
return@async null
}
}
val provider = item.instance ?: return@async null
try {
if (provider.acceptRequiresReadAction()) {
if (!readAction {
checkProvider(project = project, file = file, provider = provider, suppressors = suppressors)
}) {
return@async null
withTimeout(30.seconds) {
val providerFileTypeName = item.getCustomAttribute("fileType")
// VcsLogFileType is not registered in FileTypeRegistry - we should check also by name
if (providerFileTypeName != null && fileType.name != providerFileTypeName) {
val fileTypeRegistry = FileTypeRegistry.getInstance()
val providerFileType = fileTypeRegistry.findFileTypeByName(providerFileTypeName)
if (providerFileType == null || !fileTypeRegistry.isFileOfType(file, providerFileType)) {
return@withTimeout null
}
}
}
else if (!checkProvider(project = project, file = file, provider = provider, suppressors = suppressors)) {
return@async null
}
hideDefaultEditor = hideDefaultEditor or (provider.policy == FileEditorPolicy.HIDE_DEFAULT_EDITOR)
hasHighPriorityEditors = hasHighPriorityEditors or (provider.policy == FileEditorPolicy.HIDE_OTHER_EDITORS)
checkPolicy(provider)
val provider = getProviderIfApplicable(item = item, project = project, file = file, suppressors = suppressors)
?: return@withTimeout null
hideDefaultEditor = hideDefaultEditor or (provider.policy == FileEditorPolicy.HIDE_DEFAULT_EDITOR)
hasHighPriorityEditors = hasHighPriorityEditors or (provider.policy == FileEditorPolicy.HIDE_OTHER_EDITORS)
checkPolicy(provider)
provider
}
}
catch (e: CancellationException) {
throw e
catch (e: TimeoutCancellationException) {
LOG.error(PluginException("Cannot check provider ${item.implementationClassName}", e, item.pluginDescriptor.pluginId))
null
}
catch (e: Throwable) {
LOG.error(PluginException(e, item.pluginDescriptor.pluginId))
}
provider
}
}.toList()
}.mapNotNullTo(mutableListOf()) { it.getCompleted() }
@@ -189,6 +161,63 @@ class FileEditorProviderManagerImpl : FileEditorProviderManager,
}
}
private suspend fun getProviderIfApplicable(item: ExtensionPointName.LazyExtension<FileEditorProvider>,
project: Project,
file: VirtualFile,
suppressors: List<FileEditorProviderSuppressor>): FileEditorProvider? {
val provider = item.instance ?: return null
if (!DumbService.isDumbAware(provider)) {
LOG.debug { "Please make ${provider.javaClass} dumb-aware" }
if (DumbService.isDumb(project)) {
return null
}
}
try {
if (provider.acceptRequiresReadAction()) {
if (!readAction {
checkProvider(project = project, file = file, provider = provider, suppressors = suppressors)
}) {
return null
}
}
else {
//println("TO CHECK: " + item.implementationClassName)
if (!checkProvider(project = project, file = file, provider = provider, suppressors = suppressors)) {
//println("FAIL: " + item.implementationClassName)
return null
}
//println("PASS: " + item.implementationClassName)
}
return provider
}
catch (e: CancellationException) {
throw e
}
catch (e: Throwable) {
LOG.error(PluginException(e, item.pluginDescriptor.pluginId))
return null
}
}
private fun checkProvider(project: Project,
file: VirtualFile,
provider: FileEditorProvider,
suppressors: List<FileEditorProviderSuppressor>): Boolean {
if (!provider.accept(project, file)) {
return false
}
for (suppressor in suppressors) {
if (suppressor.isSuppressed(project, file, provider)) {
LOG.info("FileEditorProvider ${provider.javaClass} for VirtualFile $file " +
"was suppressed by FileEditorProviderSuppressor ${suppressor.javaClass}")
return false
}
}
return true
}
private object MyComparator : Comparator<FileEditorProvider> {
private fun getWeight(provider: FileEditorProvider): Double {
return if (provider is WeighedFileEditorProvider) provider.weight else Double.MAX_VALUE
@@ -17,12 +17,16 @@ import com.intellij.testFramework.LightVirtualFile
import com.intellij.ui.jcef.JBCefApp
class HTMLEditorProvider : FileEditorProvider, DumbAware {
override fun createEditor(project: Project, file: VirtualFile): FileEditor =
file.getUserData(EDITOR_KEY) ?:
HTMLFileEditor(project, file as LightVirtualFile, REQUEST_KEY.get(file)!!).also { file.putUserData(EDITOR_KEY, it) }
override fun createEditor(project: Project, file: VirtualFile): FileEditor {
return file.getUserData(EDITOR_KEY) ?: HTMLFileEditor(project, file as LightVirtualFile,
REQUEST_KEY.get(file)!!).also { file.putUserData(EDITOR_KEY, it) }
}
override fun accept(project: Project, file: VirtualFile): Boolean =
JBCefApp.isSupported() && file.getUserData(REQUEST_KEY) != null
override fun accept(project: Project, file: VirtualFile): Boolean {
return JBCefApp.isSupported() && file.getUserData(REQUEST_KEY) != null
}
override fun acceptRequiresReadAction() = false
override fun getEditorTypeId(): String = "html-editor"
@@ -70,8 +74,10 @@ class HTMLEditorProvider : FileEditorProvider, DumbAware {
}
companion object {
@JvmStatic fun html(html: String): Request = Request(html, null)
@JvmStatic fun url(url: String): Request = Request(null, url)
@JvmStatic
fun html(html: String): Request = Request(html, null)
@JvmStatic
fun url(url: String): Request = Request(null, url)
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileEditor.impl
import com.intellij.openapi.fileEditor.FileEditor
@@ -26,7 +26,7 @@ import javax.swing.JComponent
* JComponentEditorProvider.openEditor(project, "Title", jComponent, fileType)
* }</pre>
*/
class JComponentEditorProvider : FileEditorProvider, DumbAware {
internal class JComponentEditorProvider : FileEditorProvider, DumbAware {
override fun createEditor(project: Project, file: VirtualFile): FileEditor {
val fileEditor = file.getUserData(EDITOR_KEY)
return if (fileEditor != null) {
@@ -42,6 +42,8 @@ class JComponentEditorProvider : FileEditorProvider, DumbAware {
override fun accept(project: Project, file: VirtualFile): Boolean = isJComponentFile(file)
override fun acceptRequiresReadAction() = false
override fun getEditorTypeId(): String = "jcomponent-editor"
override fun getPolicy(): FileEditorPolicy = FileEditorPolicy.HIDE_DEFAULT_EDITOR
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileEditor.impl.http;
import com.intellij.openapi.fileEditor.FileEditor;
@@ -13,12 +13,17 @@ import com.intellij.openapi.vfs.impl.http.HttpVirtualFile;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
class HttpFileEditorProvider implements FileEditorProvider, DumbAware {
final class HttpFileEditorProvider implements FileEditorProvider, DumbAware {
@Override
public boolean accept(@NotNull final Project project, @NotNull final VirtualFile file) {
return file instanceof HttpVirtualFile && !file.isDirectory();
}
@Override
public boolean acceptRequiresReadAction() {
return false;
}
@Override
@NotNull
public FileEditor createEditor(@NotNull final Project project, @NotNull final VirtualFile file) {
@@ -4,6 +4,8 @@ package com.intellij.openapi.fileEditor.impl.text
import com.intellij.concurrency.captureThreadContext
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.EDT
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.asContextElement
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.ex.EditorEx
import com.intellij.openapi.fileEditor.FileEditorStateLevel
@@ -46,7 +48,7 @@ class AsyncEditorLoader internal constructor(private val project: Project,
internal suspend fun waitForLoaded(editor: Editor) {
if (editor.getUserData(ASYNC_LOADER) != null) {
withContext(Dispatchers.EDT) {
withContext(Dispatchers.EDT + ModalityState.any().asContextElement()) {
suspendCoroutine {
performWhenLoaded(editor) { it.resume(Unit) }
}
@@ -184,7 +186,7 @@ private fun CoroutineScope.showLoadingIndicator(startDelay: Duration, addUi: (co
delay((startDelay.inWholeMilliseconds - (System.currentTimeMillis() - scheduleTime)).coerceAtLeast(0))
val processIcon = withContext(Dispatchers.EDT) {
val processIcon = AsyncProcessIcon.createBig(this@launch)
val processIcon = AsyncProcessIcon.createBig(/* coroutineScope = */ this@launch)
addUi(processIcon)
processIcon
}
@@ -84,6 +84,8 @@ open class TextEditorProvider : DefaultPlatformFileEditorProvider, TextBasedFile
return isTextFile(file) && !SingleRootFileViewProvider.isTooLargeForContentLoading(file)
}
override fun acceptRequiresReadAction() = false
override fun createEditor(project: Project, file: VirtualFile): FileEditor {
return TextEditorImpl(project, file, this, createTextEditor(project, file))
}
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.openapi.fileEditor;
import com.intellij.ide.ui.UISettings;
@@ -472,9 +472,8 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
myPolicy = policy;
}
@NotNull
@Override
public String getEditorTypeId() {
public @NotNull String getEditorTypeId() {
return myEditorTypeId;
}
@@ -483,19 +482,21 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
return true;
}
@NotNull
@Override
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
public boolean acceptRequiresReadAction() {
return false;
}
@Override
public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
return new Mock.MyFileEditor() {
@NotNull
@Override
public JComponent getComponent() {
public @NotNull JComponent getComponent() {
return new JLabel();
}
@NotNull
@Override
public String getName() {
public @NotNull String getName() {
return myFileEditorName;
}
@@ -510,9 +511,8 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
public void disposeEditor(@NotNull FileEditor editor) {
}
@NotNull
@Override
public FileEditorPolicy getPolicy() {
public @NotNull FileEditorPolicy getPolicy() {
return myPolicy;
}
}
@@ -547,21 +547,23 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
return true;
}
@NotNull
@Override
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
public boolean acceptRequiresReadAction() {
return false;
}
@Override
public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
return new MyTextEditor(file, FileDocumentManager.getInstance().getDocument(file), myId, myTargetOffset);
}
@NotNull
@Override
public String getEditorTypeId() {
public @NotNull String getEditorTypeId() {
return myId;
}
@NotNull
@Override
public FileEditorPolicy getPolicy() {
public @NotNull FileEditorPolicy getPolicy() {
return FileEditorPolicy.HIDE_DEFAULT_EDITOR;
}
}
@@ -592,21 +594,18 @@ public class FileEditorManagerTest extends FileEditorManagerTestCase {
}
}
@NotNull
@Override
public JComponent getComponent() {
public @NotNull JComponent getComponent() {
return new JLabel();
}
@NotNull
@Override
public String getName() {
public @NotNull String getName() {
return myName;
}
@NotNull
@Override
public Editor getEditor() {
public @NotNull Editor getEditor() {
return myEditor;
}
@@ -456,6 +456,11 @@ public final class Mock {
return false;
}
@Override
public boolean acceptRequiresReadAction() {
return false;
}
@Override
public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
throw new UnsupportedOperationException();
@@ -61,9 +61,9 @@ class VcsLogEditor(private val project: Project, private val vcsLogFile: VcsLogF
private class VcsLogEditorProvider : FileEditorProvider, StructureViewFileEditorProvider, DumbAware {
override fun accept(project: Project, file: VirtualFile): Boolean = file is VcsLogFile
override fun createEditor(project: Project, file: VirtualFile): FileEditor {
return VcsLogEditor(project, file as VcsLogFile)
}
override fun acceptRequiresReadAction() = false
override fun createEditor(project: Project, file: VirtualFile) = VcsLogEditor(project, file as VcsLogFile)
override fun getEditorTypeId(): String = "VcsLogEditor"
override fun getPolicy(): FileEditorPolicy = FileEditorPolicy.HIDE_DEFAULT_EDITOR
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.devkit.testAssistant;
import com.intellij.openapi.fileEditor.FileEditor;
@@ -10,28 +10,29 @@ import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.devkit.testAssistant.vfs.TestDataGroupVirtualFile;
public class TestDataGroupEditorProvider implements FileEditorProvider, DumbAware {
final class TestDataGroupEditorProvider implements FileEditorProvider, DumbAware {
@Override
public boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
return file instanceof TestDataGroupVirtualFile;
}
@Override
@NotNull
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
public boolean acceptRequiresReadAction() {
return false;
}
@Override
public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
return new TestDataGroupFileEditor(project, (TestDataGroupVirtualFile) file);
}
@Override
@NotNull
public String getEditorTypeId() {
public @NotNull String getEditorTypeId() {
return "TestDataGroup";
}
@Override
@NotNull
public FileEditorPolicy getPolicy() {
public @NotNull FileEditorPolicy getPolicy() {
return FileEditorPolicy.HIDE_DEFAULT_EDITOR;
}
}
@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.idea.devkit.testAssistant.vfs;
import com.intellij.ide.presentation.Presentation;
@@ -9,13 +9,11 @@ import com.intellij.util.ArrayUtilRt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.idea.devkit.testAssistant.TestDataUtil;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@Presentation(icon = "AllIcons.Nodes.TestSourceFolder")
public class TestDataGroupVirtualFile extends VirtualFile {
public final class TestDataGroupVirtualFile extends VirtualFile {
private final VirtualFile myBeforeFile;
private final VirtualFile myAfterFile;
@@ -24,31 +22,26 @@ public class TestDataGroupVirtualFile extends VirtualFile {
myAfterFile = afterFile;
}
@NotNull
@Override
public String getName() {
public @NotNull String getName() {
return TestDataUtil.getGroupDisplayName(myBeforeFile.getName(), myAfterFile.getName());
}
@NotNull
public VirtualFile getBeforeFile() {
public @NotNull VirtualFile getBeforeFile() {
return myBeforeFile;
}
@NotNull
public VirtualFile getAfterFile() {
public @NotNull VirtualFile getAfterFile() {
return myAfterFile;
}
@NotNull
@Override
public VirtualFileSystem getFileSystem() {
public @NotNull VirtualFileSystem getFileSystem() {
return TestDataGroupFileSystem.getTestDataGroupFileSystem();
}
@NotNull
@Override
public String getPath() {
public @NotNull String getPath() {
return TestDataGroupFileSystem.getPath(myBeforeFile, myAfterFile);
}
@@ -76,14 +69,14 @@ public class TestDataGroupVirtualFile extends VirtualFile {
public VirtualFile[] getChildren() {
return EMPTY_ARRAY;
}
@NotNull
@Override
public OutputStream getOutputStream(Object requestor, long newModificationStamp, long newTimeStamp) throws IOException {
public @NotNull OutputStream getOutputStream(Object requestor, long newModificationStamp, long newTimeStamp) {
throw new UnsupportedOperationException();
}
@Override
public byte @NotNull [] contentsToByteArray() throws IOException {
public byte @NotNull [] contentsToByteArray() {
return ArrayUtilRt.EMPTY_BYTE_ARRAY;
}
@@ -107,13 +100,12 @@ public class TestDataGroupVirtualFile extends VirtualFile {
}
@Override
public @NotNull InputStream getInputStream() throws IOException {
public @NotNull InputStream getInputStream() {
throw new UnsupportedOperationException();
}
@NotNull
@Override
public FileType getFileType() {
public @NotNull FileType getFileType() {
return myBeforeFile.getFileType();
}
@@ -38,7 +38,7 @@ For more information, check the documentation for <a href="https://editorconfig.
<codeStyleSettingsModifier implementation="org.editorconfig.configmanagement.extended.EditorConfigCodeStyleSettingsModifier" order="first"/>
<fileIndentOptionsProvider implementation="org.editorconfig.configmanagement.EditorConfigIndentOptionsProvider" order="first"/>
<trailingSpacesOptionsProvider implementation="org.editorconfig.configmanagement.EditorConfigTrailingSpacesOptionsProvider" id="editorConfigTrailingSpacesOptionsProvider"/>
<fileEditorProvider implementation="org.editorconfig.configmanagement.editor.EditorConfigEditorProvider"/>
<fileEditorProvider implementation="org.editorconfig.configmanagement.editor.EditorConfigEditorProvider" fileType="EditorConfig"/>
<codeInsight.lineMarkerProvider language="" implementationClass="org.editorconfig.configmanagement.editor.EditorConfigPreviewMarkerProvider"/>
<projectService serviceImplementation="org.editorconfig.configmanagement.editor.EditorConfigPreviewManager"/>
<gotoFileContributor implementation="org.editorconfig.configmanagement.finder.EditorConfigGotoFileContributor"/>
@@ -11,11 +11,12 @@ import com.intellij.openapi.vfs.VirtualFile
import org.jetbrains.plugins.gitlab.api.GitLabProjectConnectionManager
internal class GitLabFileEditorProvider : FileEditorProvider, DumbAware {
override fun accept(project: Project, file: VirtualFile): Boolean {
return file is GitLabProjectVirtualFile && project.service<GitLabProjectConnectionManager>().connectionState.value != null
}
override fun acceptRequiresReadAction() = false
override fun createEditor(project: Project, file: VirtualFile): FileEditor {
file as GitLabProjectVirtualFile
val ctx = file.findContext() ?: error("Not context for $this")
@@ -26,5 +27,6 @@ internal class GitLabFileEditorProvider : FileEditorProvider, DumbAware {
}
override fun getEditorTypeId(): String = "GitLab"
override fun getPolicy(): FileEditorPolicy = FileEditorPolicy.HIDE_DEFAULT_EDITOR
}
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.javaFX.sceneBuilder;
import com.intellij.openapi.fileEditor.FileEditor;
@@ -25,21 +25,23 @@ public class SceneBuilderEditorProvider implements FileEditorProvider, DumbAware
return JavaFxFileTypeFactory.FXML_EXTENSION.equalsIgnoreCase(file.getExtension()) && Registry.is("embed.scene.builder");
}
@NotNull
@Override
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
public boolean acceptRequiresReadAction() {
return false;
}
@Override
public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
return new SceneBuilderEditor(project, file);
}
@NotNull
@Override
public String getEditorTypeId() {
public @NotNull String getEditorTypeId() {
return "JavaFX-Scene-Builder";
}
@NotNull
@Override
public FileEditorPolicy getPolicy() {
public @NotNull FileEditorPolicy getPolicy() {
return FileEditorPolicy.PLACE_AFTER_DEFAULT_EDITOR;
}
}
@@ -47,6 +47,8 @@ private class KtScratchFileEditorProvider : FileEditorProvider, DumbAware {
return ScratchFileLanguageProvider.get(psiFile.fileType) != null
}
override fun acceptRequiresReadAction(): Boolean = false
override fun createEditor(project: Project, file: VirtualFile): FileEditor {
val scratchFile = createScratchFile(project, file) ?: return TextEditorProvider.getInstance().createEditor(project, file)
return KtScratchFileEditorWithPreview.create(scratchFile)
@@ -15,27 +15,32 @@ import org.jetbrains.annotations.NotNull;
final class MarkdownPreviewFileEditorProvider extends WeighedFileEditorProvider {
@Override
public boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
if (!MarkdownHtmlPanelProvider.hasAvailableProviders()) return false;
if (!MarkdownHtmlPanelProvider.hasAvailableProviders()) {
return false;
}
FileType fileType = file.getFileType();
return fileType == MarkdownFileType.INSTANCE ||
ScratchUtil.isScratch(file) && LanguageUtil.getLanguageForPsi(project, file, fileType) == MarkdownLanguage.INSTANCE;
}
@NotNull
@Override
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
public boolean acceptRequiresReadAction() {
return true;
}
@Override
public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
return new MarkdownPreviewFileEditor(project, file);
}
@NotNull
@Override
public String getEditorTypeId() {
public @NotNull String getEditorTypeId() {
return "markdown-preview-editor";
}
@NotNull
@Override
public FileEditorPolicy getPolicy() {
public @NotNull FileEditorPolicy getPolicy() {
return FileEditorPolicy.PLACE_AFTER_DEFAULT_EDITOR;
}
}
@@ -13,7 +13,7 @@ import org.jdom.Element
import org.jetbrains.annotations.ApiStatus
@ApiStatus.Internal
class MarkdownSplitEditorProvider: SplitTextEditorProvider(PsiAwareTextEditorProvider(), MarkdownPreviewFileEditorProvider()) {
class MarkdownSplitEditorProvider : SplitTextEditorProvider(PsiAwareTextEditorProvider(), MarkdownPreviewFileEditorProvider()) {
override fun createSplitEditor(firstEditor: FileEditor, secondEditor: FileEditor): FileEditor {
require(firstEditor is TextEditor) { "Main editor should be TextEditor" }
require(secondEditor is MarkdownPreviewFileEditor) { "Secondary editor should be MarkdownPreviewFileEditor" }
@@ -27,13 +27,10 @@ public abstract class SplitTextEditorProvider implements AsyncFileEditorProvider
protected static final String SECOND_EDITOR = "second_editor";
protected static final String SPLIT_LAYOUT = "split_layout";
@NotNull
protected final FileEditorProvider myFirstProvider;
@NotNull
protected final FileEditorProvider mySecondProvider;
protected final @NotNull FileEditorProvider myFirstProvider;
protected final @NotNull FileEditorProvider mySecondProvider;
@NotNull
private final String myEditorTypeId;
private final @NotNull String myEditorTypeId;
public SplitTextEditorProvider(@NotNull FileEditorProvider firstProvider, @NotNull FileEditorProvider secondProvider) {
myFirstProvider = firstProvider;
@@ -43,38 +40,39 @@ public abstract class SplitTextEditorProvider implements AsyncFileEditorProvider
}
@Override
public boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
public final boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
return myFirstProvider.accept(project, file) && mySecondProvider.accept(project, file);
}
@NotNull
@Override
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
public final boolean acceptRequiresReadAction() {
return myFirstProvider.acceptRequiresReadAction() || mySecondProvider.acceptRequiresReadAction();
}
@Override
public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
return createEditorAsync(project, file).build();
}
@NotNull
@Override
public String getEditorTypeId() {
public @NotNull String getEditorTypeId() {
return myEditorTypeId;
}
@NotNull
@Override
public Builder createEditorAsync(@NotNull final Project project, @NotNull final VirtualFile file) {
public @NotNull Builder createEditorAsync(final @NotNull Project project, final @NotNull VirtualFile file) {
final Builder firstBuilder = getBuilderFromEditorProvider(myFirstProvider, project, file);
final Builder secondBuilder = getBuilderFromEditorProvider(mySecondProvider, project, file);
return new Builder() {
@Override
public FileEditor build() {
public @NotNull FileEditor build() {
return createSplitEditor(firstBuilder.build(), secondBuilder.build());
}
};
}
@Nullable
protected FileEditorState readFirstProviderState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
protected @Nullable FileEditorState readFirstProviderState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
final var child = sourceElement.getChild(FIRST_EDITOR);
if (child != null) {
return myFirstProvider.readState(child, project, file);
@@ -82,8 +80,7 @@ public abstract class SplitTextEditorProvider implements AsyncFileEditorProvider
return null;
}
@Nullable
protected FileEditorState readSecondProviderState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
protected @Nullable FileEditorState readSecondProviderState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
final var child = sourceElement.getChild(SECOND_EDITOR);
if (child != null) {
return mySecondProvider.readState(child, project, file);
@@ -91,8 +88,7 @@ public abstract class SplitTextEditorProvider implements AsyncFileEditorProvider
return null;
}
@Nullable
protected String readSplitLayoutState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
protected @Nullable String readSplitLayoutState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
final var attribute = sourceElement.getAttribute(SPLIT_LAYOUT);
String layoutName = null;
if (attribute != null) {
@@ -101,9 +97,8 @@ public abstract class SplitTextEditorProvider implements AsyncFileEditorProvider
return layoutName;
}
@NotNull
@Override
public FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
public @NotNull FileEditorState readState(@NotNull Element sourceElement, @NotNull Project project, @NotNull VirtualFile file) {
final var firstState = readFirstProviderState(sourceElement, project, file);
final var secondState = readSecondProviderState(sourceElement, project, file);
final var layoutName = readSplitLayoutState(sourceElement, project, file);
@@ -144,16 +139,14 @@ public abstract class SplitTextEditorProvider implements AsyncFileEditorProvider
protected abstract FileEditor createSplitEditor(@NotNull FileEditor firstEditor, @NotNull FileEditor secondEditor);
@NotNull
@Override
public FileEditorPolicy getPolicy() {
public @NotNull FileEditorPolicy getPolicy() {
return FileEditorPolicy.HIDE_DEFAULT_EDITOR;
}
@NotNull
public static Builder getBuilderFromEditorProvider(@NotNull final FileEditorProvider provider,
@NotNull final Project project,
@NotNull final VirtualFile file) {
public static @NotNull Builder getBuilderFromEditorProvider(final @NotNull FileEditorProvider provider,
final @NotNull Project project,
final @NotNull VirtualFile file) {
if (provider instanceof AsyncFileEditorProvider) {
return ((AsyncFileEditorProvider)provider).createEditorAsync(project, file);
}
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.lang.properties.editor;
import com.intellij.lang.properties.PropertiesFileType;
@@ -23,10 +23,16 @@ import org.jetbrains.annotations.NotNull;
public final class ResourceBundleEditorProvider implements FileEditorProvider, DumbAware {
@Override
public boolean accept(final @NotNull Project project, final @NotNull VirtualFile file){
if (file instanceof ResourceBundleAsVirtualFile) return true;
if (!file.isValid()) return false;
final FileType type = file.getFileType();
if (type != PropertiesFileType.INSTANCE && type != StdFileTypes.XML) return false;
if (file instanceof ResourceBundleAsVirtualFile) {
return true;
}
if (!file.isValid()) {
return false;
}
FileType type = file.getFileType();
if (type != PropertiesFileType.INSTANCE && type != StdFileTypes.XML) {
return false;
}
return ReadAction.compute(() -> {
if (project.isDisposed()) return Boolean.FALSE;
@@ -36,6 +42,11 @@ public final class ResourceBundleEditorProvider implements FileEditorProvider, D
});
}
@Override
public boolean acceptRequiresReadAction() {
return false;
}
@Override
public @NotNull FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
ResourceBundle resourceBundle;
@@ -1,4 +1,4 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.plugins.terminal.vfs;
import com.intellij.openapi.Disposable;
@@ -17,12 +17,17 @@ import org.jetbrains.plugins.terminal.ShellStartupOptions;
import org.jetbrains.plugins.terminal.ShellStartupOptionsKt;
import org.jetbrains.plugins.terminal.arrangement.TerminalWorkingDirectoryManager;
public class TerminalSessionEditorProvider implements FileEditorProvider, DumbAware {
final class TerminalSessionEditorProvider implements FileEditorProvider, DumbAware {
@Override
public boolean accept(@NotNull Project project, @NotNull VirtualFile file) {
return file instanceof TerminalSessionVirtualFileImpl;
}
@Override
public boolean acceptRequiresReadAction() {
return false;
}
@NotNull
@Override
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {
@@ -1,4 +1,4 @@
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.uiDesigner.editor;
import com.intellij.openapi.diagnostic.Logger;
@@ -17,11 +17,11 @@ import com.intellij.util.ArrayUtilRt;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
public final class UIFormEditorProvider implements FileEditorProvider, DumbAware {
final class UIFormEditorProvider implements FileEditorProvider, DumbAware {
private static final Logger LOG = Logger.getInstance(UIFormEditorProvider.class);
@Override
public boolean accept(@NotNull final Project project, @NotNull final VirtualFile file){
public boolean accept(final @NotNull Project project, final @NotNull VirtualFile file){
return
FileTypeRegistry.getInstance().isFileOfType(file, GuiFormFileType.INSTANCE) &&
!GuiFormFileType.INSTANCE.isBinary() &&
@@ -29,25 +29,29 @@ public final class UIFormEditorProvider implements FileEditorProvider, DumbAware
}
@Override
@NotNull public FileEditor createEditor(@NotNull final Project project, @NotNull final VirtualFile file){
public boolean acceptRequiresReadAction() {
return true;
}
@Override
public @NotNull FileEditor createEditor(final @NotNull Project project, final @NotNull VirtualFile file){
LOG.assertTrue(accept(project, file));
return new UIFormEditor(project, file);
}
@Override
@NotNull
public FileEditorState readState(@NotNull Element element, @NotNull final Project project, @NotNull final VirtualFile file){
public @NotNull FileEditorState readState(@NotNull Element element, final @NotNull Project project, final @NotNull VirtualFile file){
//TODO[anton,vova] implement
return new MyEditorState(-1, ArrayUtilRt.EMPTY_STRING_ARRAY);
}
@Override
@NotNull public String getEditorTypeId(){
public @NotNull String getEditorTypeId(){
return "ui-designer";
}
@Override
@NotNull public FileEditorPolicy getPolicy() {
public @NotNull FileEditorPolicy getPolicy() {
return FileEditorPolicy.HIDE_DEFAULT_EDITOR;
}
}
+1 -1
View File
@@ -32,7 +32,7 @@
<indexPatternBuilder implementation="com.jetbrains.rest.RestIndexPatternBuilder" />
<todoIndexer filetype="ReST" implementationClass="com.jetbrains.rest.RestTodoIndexer" />
<fileEditorProvider implementation="com.jetbrains.rest.editor.RestSplitEditorProvider"/>
<fileEditorProvider implementation="com.jetbrains.rest.editor.RestSplitEditorProvider" fileType="ReST"/>
<applicationConfigurable groupId="language" instance="com.jetbrains.rest.editor.RestConfigurable"
id="restructured.text.topic" bundle="messages.RestBundle" key="configurable.RestConfigurable.display.name"/>
<applicationService serviceImplementation="com.jetbrains.rest.editor.RestSettings"/>
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains.rest.editor;
import com.intellij.openapi.fileEditor.*;
@@ -10,8 +10,8 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.jetbrains.rest.RestFileType;
import org.jetbrains.annotations.NotNull;
public class RestSplitEditorProvider implements FileEditorProvider, DumbAware {
public RestSplitEditorProvider() {
final class RestSplitEditorProvider implements FileEditorProvider, DumbAware {
RestSplitEditorProvider() {
}
@Override
@@ -19,6 +19,11 @@ public class RestSplitEditorProvider implements FileEditorProvider, DumbAware {
return FileTypeRegistry.getInstance().isFileOfType(file, RestFileType.INSTANCE);
}
@Override
public boolean acceptRequiresReadAction() {
return false;
}
@NotNull
@Override
public FileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file) {