Skip to content

Commit 29d5adc

Browse files
committed
feat: store icons to use
1 parent 4a2e08e commit 29d5adc

File tree

7 files changed

+33
-6
lines changed

7 files changed

+33
-6
lines changed

src/main/kotlin/com/github/xepozz/php_dump/PhpDumpIcons.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ object PhpDumpIcons {
77
val POT = IconLoader.getIcon("/icons/pot.svg", PhpDumpIcons::class.java)
88
@JvmStatic
99
val POT_DARK = IconLoader.getIcon("/icons/pot_dark.svg", PhpDumpIcons::class.java)
10+
@JvmStatic
11+
val RERUN_AUTOMATICALLY = IconLoader.getIcon("/icons/rerunAutomatically/rerunAutomatically.svg", PhpDumpIcons::class.java)
12+
@JvmStatic
13+
val RESTART_STOP = IconLoader.getIcon("/icons/restartStop/restartStop.svg", PhpDumpIcons::class.java)
1014
}

src/main/kotlin/com/github/xepozz/php_dump/panel/OpcodesTerminalPanel.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.xepozz.php_dump.panel
22

3+
import com.github.xepozz.php_dump.PhpDumpIcons
34
import com.github.xepozz.php_dump.actions.RunDumpTokensCommandAction
45
import com.github.xepozz.php_dump.services.DebugLevelState
56
import com.github.xepozz.php_dump.services.OpcodesDumperService
@@ -51,7 +52,7 @@ class OpcodesTerminalPanel(
5152
})
5253
add(object : AnAction(
5354
"Enable Auto Refresh", "Turns on or off auto refresh of panel context",
54-
if (state.autoRefresh) AllIcons.Actions.RestartStop else AllIcons.Actions.RerunAutomatically
55+
if (state.autoRefresh) PhpDumpIcons.RESTART_STOP else PhpDumpIcons.RERUN_AUTOMATICALLY
5556
) {
5657
override fun actionPerformed(e: AnActionEvent) {
5758
state.autoRefresh = !state.autoRefresh
@@ -60,10 +61,10 @@ class OpcodesTerminalPanel(
6061
override fun update(e: AnActionEvent) {
6162
if (state.autoRefresh) {
6263
e.presentation.text = "Disable Auto Refresh"
63-
e.presentation.icon = AllIcons.Actions.RestartStop
64+
e.presentation.icon = PhpDumpIcons.RESTART_STOP
6465
} else {
6566
e.presentation.text = "Enable Auto Refresh"
66-
e.presentation.icon = AllIcons.Actions.RerunAutomatically
67+
e.presentation.icon = PhpDumpIcons.RERUN_AUTOMATICALLY
6768
}
6869
}
6970
})

src/main/kotlin/com/github/xepozz/php_dump/services/OpcodesDumperService.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ import com.intellij.openapi.project.Project
1313
import com.intellij.openapi.util.Key
1414
import com.jetbrains.php.config.PhpProjectConfigurationFacade
1515
import com.jetbrains.php.config.interpreters.PhpInterpretersManagerImpl
16-
import fleet.util.max
1716
import kotlinx.coroutines.CoroutineScope
1817
import kotlinx.coroutines.Dispatchers
1918
import kotlinx.coroutines.launch
2019
import kotlinx.coroutines.withContext
21-
import kotlin.math.min
2220

2321
@Service(Service.Level.PROJECT)
2422
class OpcodesDumperService(var project: Project) : Disposable, DumperServiceInterface {
@@ -46,7 +44,7 @@ class OpcodesDumperService(var project: Project) : Disposable, DumperServiceInte
4644
// 1>/dev/null
4745

4846
val interpreterPath = interpreter.pathToPhpExecutable ?: return
49-
val debugLevel = max(1, min(2, state.debugLevel))
47+
val debugLevel = maxOf(1, minOf(2, state.debugLevel))
5048
val preloadFile = state.preloadFile
5149

5250
val commandArgs = buildList {
Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 7 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)