-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from liudongmiao/cwm
code with me support, should close #52
- Loading branch information
Showing
8 changed files
with
75 additions
and
2 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
29 changes: 29 additions & 0 deletions
29
...com/firsttimeinforever/intellij/pdf/viewer/ui/editor/PdfFrontendFileEditorModelHandler.kt
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,29 @@ | ||
package com.firsttimeinforever.intellij.pdf.viewer.ui.editor | ||
|
||
import com.firsttimeinforever.intellij.pdf.viewer.lang.PdfFileType | ||
import com.intellij.openapi.diagnostic.logger | ||
import com.intellij.openapi.fileEditor.ex.FileEditorWithProvider | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.vfs.VirtualFile | ||
import com.jetbrains.rd.ide.model.FileEditorModel | ||
import com.jetbrains.rd.util.lifetime.Lifetime | ||
import com.jetbrains.rdclient.fileEditors.FrontendFileEditorModelHandler | ||
|
||
/** | ||
* Created by liudongmiao on 2024-09-30. | ||
*/ | ||
class PdfFrontendFileEditorModelHandler : FrontendFileEditorModelHandler { | ||
override fun accept(project: Project, file: VirtualFile, model: FileEditorModel): Boolean { | ||
logger.debug("check accept, file: $file") | ||
return file.fileType == PdfFileType; | ||
} | ||
|
||
override fun createEditorWithProvider(project: Project, lifetime: Lifetime, file: VirtualFile, model: FileEditorModel): FileEditorWithProvider { | ||
val provider = PdfFileEditorProvider() | ||
return FileEditorWithProvider(provider.createEditor(project, file), provider) | ||
} | ||
|
||
companion object { | ||
private val logger = logger<PdfFrontendFileEditorModelHandler>() | ||
} | ||
} |
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
8 changes: 8 additions & 0 deletions
8
plugin/src/main/kotlin/com/jetbrains/rd/ide/model/FileEditorModel.kt
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,8 @@ | ||
package com.jetbrains.rd.ide.model | ||
|
||
/** | ||
* hidden api of code with me client | ||
* <br> | ||
* Created by liudongmiao on 2024-09-30. | ||
*/ | ||
class FileEditorModel |
17 changes: 17 additions & 0 deletions
17
plugin/src/main/kotlin/com/jetbrains/rdclient/fileEditors/FrontendFileEditorModelHandler.kt
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,17 @@ | ||
package com.jetbrains.rdclient.fileEditors | ||
|
||
import com.intellij.openapi.fileEditor.ex.FileEditorWithProvider | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.vfs.VirtualFile | ||
import com.jetbrains.rd.ide.model.FileEditorModel | ||
import com.jetbrains.rd.util.lifetime.Lifetime | ||
|
||
/** | ||
* hidden api of code with me client | ||
* <br> | ||
* Created by liudongmiao on 2024-09-30. | ||
*/ | ||
interface FrontendFileEditorModelHandler { | ||
fun accept(project: Project, file: VirtualFile, model: FileEditorModel): Boolean | ||
fun createEditorWithProvider(project: Project, lifetime: Lifetime, file: VirtualFile, model: FileEditorModel): FileEditorWithProvider | ||
} |
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,5 @@ | ||
<idea-plugin> | ||
<extensions defaultExtensionNs="com.intellij"> | ||
<rdclient.fileEditorModelHandler implementation="com.firsttimeinforever.intellij.pdf.viewer.ui.editor.PdfFrontendFileEditorModelHandler" order="first" /> | ||
</extensions> | ||
</idea-plugin> |
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