generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Dan Timofte <dantimofte@proton.me>
- Loading branch information
1 parent
3a052cf
commit 0eb4eb9
Showing
2 changed files
with
40 additions
and
49 deletions.
There are no files selected for viewing
49 changes: 0 additions & 49 deletions
49
src/main/java/ac/quant/quickfixspec/toolbar/QuickfixFloatingToolbar.java
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
src/main/kotlin/ac/quant/quickfixspec/toolbar/QuickfixFloatingToolbar.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,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() { | ||
} | ||
} | ||
|