Skip to content

Commit abb6397

Browse files
committed
Hide toolbar for diff view
1 parent 5691020 commit abb6397

File tree

2 files changed

+7
-3
lines changed
  • plugin/src/main

2 files changed

+7
-3
lines changed

plugin/src/main/kotlin/com/firsttimeinforever/intellij/pdf/viewer/actions/PdfAction.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,14 @@ abstract class PdfAction(protected val viewModeAwareness: ViewModeAwareness = Vi
5151
* is possible that there is a PDF open somewhere, but it is not in view.
5252
*/
5353
fun findEditorInView(event: AnActionEvent): PdfFileEditor? {
54-
val focusedEditor = event.getData(PlatformDataKeys.FILE_EDITOR) as? PdfFileEditor
54+
val focusedEditor = event.getData(PlatformDataKeys.FILE_EDITOR)
5555

56-
return focusedEditor ?: run {
56+
if (focusedEditor?.javaClass?.simpleName == "BackendDiffRequestProcessorEditor") {
57+
// This is a diff view, which we cannot control, so don't do anything
58+
return null
59+
}
60+
61+
return focusedEditor as? PdfFileEditor ?: run {
5762
val project = event.project ?: return null
5863
FileEditorManager.getInstance(project).selectedEditors.firstOrNull {it is PdfFileEditor} as? PdfFileEditor
5964
}

plugin/src/main/resources/META-INF/plugin.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<extensions defaultExtensionNs="com.intellij">
1313
<fileType name="PDF"
1414
extensions="pdf"
15-
language="PDF"
1615
fieldName="INSTANCE"
1716
implementationClass="com.firsttimeinforever.intellij.pdf.viewer.lang.PdfFileType"/>
1817
<fileEditorProvider implementation="com.firsttimeinforever.intellij.pdf.viewer.ui.editor.PdfFileEditorProvider"/>

0 commit comments

Comments
 (0)