Skip to content

Commit

Permalink
[ menu ] Add items
Browse files Browse the repository at this point in the history
  • Loading branch information
ice1000 committed Apr 17, 2018
1 parent 2643ea0 commit 9cd6c3a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion common/src/org/ice1000/devkt/config/settings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ object GlobalSettings {
var shortcutOpen = ShortCut(true, false, false, Key.O)
// Build | Run As | Class, force to use ctrl + R even though it is in Mac.
var shortcutBuildRunAsClass = ShortCut(true, false, true, Key.F10)
var shortcutRunAsScript = ShortCut(true, false, false, Key.R)
var shortcutRunAsScript = ShortCut(true, false, false, Key.F9)
var shortcutNextLine = ShortCut(false, false, true, Key.ENTER)
var shortcutSplitLine = ShortCut(true, false, false, Key.ENTER)
var shortcutNewLineBefore = ShortCut(true, true, false, Key.ENTER)
Expand Down
1 change: 1 addition & 0 deletions common/src/org/ice1000/devkt/ui/ui.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ abstract class UIBase<TextAttributes> {
fun clion() = browse("https://www.jetbrains.com/clion/download/")
fun eclipse() = browse("http://marketplace.eclipse.org/content/kotlin-plugin-eclipse")
fun emacs() = browse("https://melpa.org/#/kotlin-mode")
fun viewSource() = browse("https://github.com/ice1000/dev-kt")
fun psiFile(): PsiFile? = document.psiFile
fun nextLine() = document.nextLine()
fun splitLine() = document.splitLine()
Expand Down
18 changes: 6 additions & 12 deletions swing/src/org/ice1000/devkt/ui/swing/menu.kt
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package org.ice1000.devkt.ui.swing

import charlie.gensokyo.item
import charlie.gensokyo.onAction
import charlie.gensokyo.separator
import charlie.gensokyo.subMenu
import charlie.gensokyo.*
import org.ice1000.devkt.config.GlobalSettings
import org.ice1000.devkt.ui.DevKtIcons
import org.jetbrains.kotlin.com.intellij.openapi.util.SystemInfo
import java.awt.event.KeyEvent
import javax.swing.JFrame
import javax.swing.JMenuBar
import javax.swing.JOptionPane

/**
* DSL that initializes [menuBar]
Expand Down Expand Up @@ -192,13 +188,10 @@ fun UIImpl.mainMenu(menuBar: JMenuBar, frame: JFrame) {
onAction { buildClassAndRun() }
}
}
subMenu("Run As") {
icon = DevKtIcons.EXECUTE
item("Kotlin Script") {
icon = DevKtIcons.KOTLIN_FILE
keyMap(GlobalSettings.shortcutRunAsScript)
onAction { runScript() }
}
item("Run As KtScript") {
icon = DevKtIcons.KOTLIN_FILE
keyMap(GlobalSettings.shortcutRunAsScript)
onAction { runScript() }
}
}
menuBar.subMenu("Help") {
Expand All @@ -207,6 +200,7 @@ fun UIImpl.mainMenu(menuBar: JMenuBar, frame: JFrame) {
icon = DevKtIcons.DUMP
onAction { viewPsi() }
}
item("Source Code") { onAction { viewSource() } }
subMenu("Alternatives") {
item("IntelliJ IDEA") {
icon = DevKtIcons.IDEA
Expand Down

0 comments on commit 9cd6c3a

Please sign in to comment.