-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate NBT editor provider to newer async api
- Loading branch information
Showing
4 changed files
with
104 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Minecraft Development for IntelliJ | ||
* | ||
* https://mcdev.io/ | ||
* | ||
* Copyright (C) 2023 minecraft-dev | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation, version 3.0 only. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.demonwav.mcdev.nbt.lang | ||
|
||
import com.intellij.lang.Language | ||
import com.intellij.openapi.fileTypes.FileType | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.vfs.VirtualFile | ||
import com.intellij.psi.FileViewProvider | ||
import com.intellij.psi.FileViewProviderFactory | ||
import com.intellij.psi.PsiFile | ||
import com.intellij.psi.PsiManager | ||
import com.intellij.psi.SingleRootFileViewProvider | ||
|
||
class NbttFileViewProvider(manager: PsiManager, file: VirtualFile, eventSystemEnabled: Boolean) : | ||
SingleRootFileViewProvider(manager, file, eventSystemEnabled, NbttLanguage) { | ||
|
||
override fun createFile(project: Project, file: VirtualFile, fileType: FileType): PsiFile = NbttFile(this) | ||
|
||
override fun createFile(file: VirtualFile, fileType: FileType, language: Language): PsiFile = NbttFile(this) | ||
|
||
override fun createFile(lang: Language): PsiFile = NbttFile(this) | ||
} | ||
|
||
class NbttFileViewProviderFactory : FileViewProviderFactory { | ||
|
||
override fun createFileViewProvider( | ||
file: VirtualFile, | ||
language: Language?, | ||
manager: PsiManager, | ||
eventSystemEnabled: Boolean | ||
): FileViewProvider = NbttFileViewProvider(manager, file, eventSystemEnabled) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters