Skip to content

Commit

Permalink
#52 migrate java toolbar to kotlin (#58)
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Timofte <dantimofte@proton.me>
  • Loading branch information
dantimofte and Dan Timofte authored Nov 30, 2024
1 parent 3a052cf commit 0eb4eb9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 49 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package ac.quant.quickfixspec.toolbar

import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.editor.toolbar.floating.AbstractFloatingToolbarProvider
import com.intellij.openapi.editor.toolbar.floating.FloatingToolbarComponent
import com.intellij.openapi.fileEditor.FileEditor
import com.intellij.openapi.project.Project
import java.awt.FlowLayout
import javax.swing.JLabel
import javax.swing.JPanel

class QuickfixFloatingToolbar : AbstractFloatingToolbarProvider("Fix.Floating"), Disposable {

override fun register(dataContext: DataContext, component: FloatingToolbarComponent, parentDisposable: Disposable) {

val fileEditor = dataContext.getData<FileEditor?>(PlatformDataKeys.FILE_EDITOR)
if (fileEditor == null || fileEditor.getFile() == null) {
return
}
val project = dataContext.getData<Project?>(PlatformDataKeys.PROJECT)
if (project == null) {
return
}
// Create a new toolbar panel
val panel = JPanel(FlowLayout(FlowLayout.LEFT))
panel.add(JLabel("Quickfix Toolbar"))

// Set the toolbar component to the panel
component.scheduleShow()
}

override val autoHideable: Boolean
get() = false

override fun dispose() {
}
}

0 comments on commit 0eb4eb9

Please sign in to comment.