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.
- Loading branch information
Showing
30 changed files
with
940 additions
and
91 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
Binary file not shown.
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
plugins { | ||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" | ||
} | ||
|
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/github/jozott00/wokwiintellij/actions/WokwiRestartAction.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,14 @@ | ||
package com.github.jozott00.wokwiintellij.actions | ||
|
||
import com.github.jozott00.wokwiintellij.services.WokwiProjectService | ||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.actionSystem.ToggleAction | ||
import com.intellij.openapi.components.service | ||
|
||
class WokwiRestartAction : AnAction() { | ||
override fun actionPerformed(p0: AnActionEvent) { | ||
p0.project?.service<WokwiProjectService>()?.restartSimulation() | ||
} | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/kotlin/com/github/jozott00/wokwiintellij/actions/WokwiStartAction.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,16 @@ | ||
package com.github.jozott00.wokwiintellij.actions | ||
|
||
|
||
import com.github.jozott00.wokwiintellij.services.WokwiComponentService | ||
import com.github.jozott00.wokwiintellij.services.WokwiProjectService | ||
import com.github.jozott00.wokwiintellij.services.WokwiSimulationService | ||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
|
||
class WokwiStartAction : AnAction() { | ||
override fun actionPerformed(event: AnActionEvent) { | ||
val s = event.project?.service<WokwiProjectService>() | ||
s?.startSimulator() | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/com/github/jozott00/wokwiintellij/actions/WokwiStopAction.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,18 @@ | ||
package com.github.jozott00.wokwiintellij.actions | ||
|
||
|
||
import com.github.jozott00.wokwiintellij.services.WokwiComponentService | ||
import com.github.jozott00.wokwiintellij.services.WokwiProjectService | ||
import com.github.jozott00.wokwiintellij.services.WokwiSimulationService | ||
import com.intellij.openapi.actionSystem.AnAction | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.components.service | ||
import com.intellij.openapi.ui.Messages | ||
|
||
class WokwiStopAction : AnAction() { | ||
override fun actionPerformed(event: AnActionEvent) { | ||
val s = event.project?.service<WokwiProjectService>() | ||
s?.stopSimulator() | ||
|
||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
src/main/kotlin/com/github/jozott00/wokwiintellij/actions/WokwiWatchAction.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,24 @@ | ||
package com.github.jozott00.wokwiintellij.actions | ||
|
||
import com.github.jozott00.wokwiintellij.services.WokwiProjectService | ||
import com.github.jozott00.wokwiintellij.states.WokwiConfigState | ||
import com.intellij.openapi.actionSystem.AnActionEvent | ||
import com.intellij.openapi.actionSystem.ToggleAction | ||
import com.intellij.openapi.components.service | ||
|
||
class WokwiWatchAction : ToggleAction() { | ||
|
||
override fun isSelected(p0: AnActionEvent): Boolean { | ||
return p0.project?.service<WokwiConfigState>()?.state?.watchElf ?: false | ||
} | ||
|
||
override fun setSelected(even: AnActionEvent, watchEnabled: Boolean) { | ||
even.project?.service<WokwiConfigState>()?.state?.watchElf = watchEnabled | ||
if (watchEnabled) { | ||
even.project?.service<WokwiProjectService>()?.watchStart() | ||
} else { | ||
even.project?.service<WokwiProjectService>()?.watchStop() | ||
} | ||
} | ||
|
||
} |
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
38 changes: 38 additions & 0 deletions
38
src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiElfFileListener.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,38 @@ | ||
package com.github.jozott00.wokwiintellij.listeners | ||
|
||
import com.github.jozott00.wokwiintellij.services.WokwiProjectService | ||
import com.github.jozott00.wokwiintellij.states.WokwiConfigState | ||
import com.intellij.openapi.components.Service | ||
import com.intellij.openapi.components.service | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.vfs.VirtualFileManager | ||
import com.intellij.openapi.vfs.newvfs.BulkFileListener | ||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent | ||
|
||
class WokwiElfFileListener(val project: Project) : BulkFileListener { | ||
|
||
|
||
override fun after(events: MutableList<out VFileEvent>) { | ||
val configState = project.service<WokwiConfigState>() | ||
|
||
if (!configState.watchElf) return | ||
|
||
val watchPath = configState.elfPath | ||
|
||
val result = events.find { | ||
if (it.file?.isInLocalFileSystem != true) | ||
return@find false | ||
|
||
if (it.file?.path == watchPath) | ||
return@find true | ||
|
||
false | ||
} | ||
|
||
val projectService = project.service<WokwiProjectService>() | ||
if (result != null) { | ||
projectService.elfFileUpdate() | ||
} | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiPostStartupActivity.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,14 @@ | ||
package com.github.jozott00.wokwiintellij.listeners | ||
|
||
import com.github.jozott00.wokwiintellij.services.WokwiProjectService | ||
import com.intellij.openapi.components.service | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.startup.ProjectActivity | ||
import com.intellij.openapi.startup.StartupActivity | ||
|
||
class WokwiPostStartupActivity : ProjectActivity { | ||
override suspend fun execute(project: Project) { | ||
val projectService = project.service<WokwiProjectService>() | ||
projectService.startup() | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiProjectManagerListener.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,11 @@ | ||
package com.github.jozott00.wokwiintellij.listeners | ||
|
||
import com.intellij.openapi.components.Service | ||
import com.intellij.openapi.diagnostic.thisLogger | ||
import com.intellij.openapi.project.Project | ||
import com.github.jozott00.wokwiintellij.MyBundle | ||
import com.intellij.openapi.project.ProjectManagerListener | ||
import com.intellij.openapi.project.impl.ProjectLifecycleListener | ||
|
||
|
||
|
17 changes: 0 additions & 17 deletions
17
src/main/kotlin/com/github/jozott00/wokwiintellij/services/MyProjectService.kt
This file was deleted.
Oops, something went wrong.
27 changes: 27 additions & 0 deletions
27
src/main/kotlin/com/github/jozott00/wokwiintellij/services/WokwiComponentService.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,27 @@ | ||
package com.github.jozott00.wokwiintellij.services | ||
|
||
import com.github.jozott00.wokwiintellij.states.WokwiConfigState | ||
import com.github.jozott00.wokwiintellij.toolWindow.SimulatorPanel | ||
import com.github.jozott00.wokwiintellij.toolWindow.WokwiToolWindow | ||
import com.github.jozott00.wokwiintellij.toolWindow.wokwiConfigPanel | ||
import com.intellij.openapi.components.Service | ||
import com.intellij.openapi.components.service | ||
import com.intellij.openapi.project.Project | ||
import javax.swing.JPanel | ||
|
||
|
||
@Service(Service.Level.PROJECT) | ||
class WokwiComponentService(val project: Project) { | ||
|
||
val wokwiConfigState = project.service<WokwiConfigState>() | ||
|
||
val simulatorPanel = SimulatorPanel() | ||
val configPanel = wokwiConfigPanel(wokwiConfigState.state) { | ||
onChangeAction = { | ||
println("Changes in model: ${wokwiConfigState.state}") | ||
} | ||
} | ||
|
||
val toolWindow = WokwiToolWindow(configPanel, simulatorPanel) | ||
|
||
} |
Oops, something went wrong.