Skip to content

Commit

Permalink
Running thing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jozott00 committed Jan 3, 2024
1 parent 557260a commit 1b64ddd
Show file tree
Hide file tree
Showing 30 changed files with 940 additions and 91 deletions.
16 changes: 0 additions & 16 deletions .idea/gradle.xml

This file was deleted.

29 changes: 26 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,23 @@ plugins {
alias(libs.plugins.changelog) // Gradle Changelog Plugin
alias(libs.plugins.qodana) // Gradle Qodana Plugin
alias(libs.plugins.kover) // Gradle Kover Plugin
kotlin("plugin.serialization") version "1.9.22"
}

group = properties("pluginGroup").get()
version = properties("pluginVersion").get()

// Configure project's dependencies
repositories {
mavenLocal()
mavenCentral()
}

// Dependencies are managed with Gradle version catalog - read more: https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog
dependencies {
// implementation(libs.annotations)
implementation(files("libs/espimg-0.1.0.jar"))
implementation("org.java-websocket:Java-WebSocket:1.5.4")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.0")
}

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
Expand Down Expand Up @@ -73,6 +77,24 @@ tasks {
gradleVersion = properties("gradleVersion").get()
}

runIde {
autoReloadPlugins.set(true)
}

// to allow hot reload of sandbox using buildPlugin
buildSearchableOptions {
enabled = false
}

// Set the JVM compatibility versions
withType<JavaCompile> {
sourceCompatibility = "17"
targetCompatibility = "17"
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}

patchPluginXml {
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
Expand All @@ -83,7 +105,7 @@ tasks {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with (it.lines()) {
with(it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
Expand Down Expand Up @@ -126,6 +148,7 @@ tasks {
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
channels =
properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pluginUntilBuild = 233.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC
platformVersion = 2022.3.3
platformVersion = 2023.3.2

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
Expand Down
Binary file added libs/espimg-0.1.0.jar
Binary file not shown.
1 change: 1 addition & 0 deletions settings.gradle.kts
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"
}
Expand Down
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

Check warning on line 6 in src/main/kotlin/com/github/jozott00/wokwiintellij/actions/WokwiRestartAction.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import com.intellij.openapi.components.service

class WokwiRestartAction : AnAction() {
override fun actionPerformed(p0: AnActionEvent) {
p0.project?.service<WokwiProjectService>()?.restartSimulation()
}

}
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

Check warning on line 4 in src/main/kotlin/com/github/jozott00/wokwiintellij/actions/WokwiStartAction.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import com.github.jozott00.wokwiintellij.services.WokwiProjectService
import com.github.jozott00.wokwiintellij.services.WokwiSimulationService

Check warning on line 6 in src/main/kotlin/com/github/jozott00/wokwiintellij/actions/WokwiStartAction.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
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()
}
}
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

Check warning on line 4 in src/main/kotlin/com/github/jozott00/wokwiintellij/actions/WokwiStopAction.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import com.github.jozott00.wokwiintellij.services.WokwiProjectService
import com.github.jozott00.wokwiintellij.services.WokwiSimulationService

Check warning on line 6 in src/main/kotlin/com/github/jozott00/wokwiintellij/actions/WokwiStopAction.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.components.service
import com.intellij.openapi.ui.Messages

Check warning on line 10 in src/main/kotlin/com/github/jozott00/wokwiintellij/actions/WokwiStopAction.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive

class WokwiStopAction : AnAction() {
override fun actionPerformed(event: AnActionEvent) {
val s = event.project?.service<WokwiProjectService>()
s?.stopSimulator()

}
}
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()
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.intellij.openapi.application.ApplicationActivationListener
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.wm.IdeFrame

internal class MyApplicationActivationListener : ApplicationActivationListener {
internal class WokwiActivationListener : ApplicationActivationListener {

override fun applicationActivated(ideFrame: IdeFrame) {
thisLogger().warn("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.")
Expand Down
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

Check warning on line 5 in src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiElfFileListener.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.intellij.openapi.vfs.VirtualFileManager

Check warning on line 8 in src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiElfFileListener.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
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()
}
}

}
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

Check warning on line 7 in src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiPostStartupActivity.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive

class WokwiPostStartupActivity : ProjectActivity {
override suspend fun execute(project: Project) {
val projectService = project.service<WokwiProjectService>()
projectService.startup()
}
}
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

Check warning on line 3 in src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiProjectManagerListener.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import com.intellij.openapi.diagnostic.thisLogger

Check warning on line 4 in src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiProjectManagerListener.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import com.intellij.openapi.project.Project

Check warning on line 5 in src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiProjectManagerListener.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import com.github.jozott00.wokwiintellij.MyBundle

Check warning on line 6 in src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiProjectManagerListener.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import com.intellij.openapi.project.ProjectManagerListener

Check warning on line 7 in src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiProjectManagerListener.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive
import com.intellij.openapi.project.impl.ProjectLifecycleListener

Check warning on line 8 in src/main/kotlin/com/github/jozott00/wokwiintellij/listeners/WokwiProjectManagerListener.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive



This file was deleted.

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

Check warning on line 10 in src/main/kotlin/com/github/jozott00/wokwiintellij/services/WokwiComponentService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused import directive

Unused import directive


@Service(Service.Level.PROJECT)
class WokwiComponentService(val project: Project) {

val wokwiConfigState = project.service<WokwiConfigState>()

Check notice on line 16 in src/main/kotlin/com/github/jozott00/wokwiintellij/services/WokwiComponentService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'wokwiConfigState' could be private

val simulatorPanel = SimulatorPanel()

Check notice on line 18 in src/main/kotlin/com/github/jozott00/wokwiintellij/services/WokwiComponentService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'simulatorPanel' could be private
val configPanel = wokwiConfigPanel(wokwiConfigState.state) {

Check notice on line 19 in src/main/kotlin/com/github/jozott00/wokwiintellij/services/WokwiComponentService.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Class member can have 'private' visibility

Property 'configPanel' could be private
onChangeAction = {
println("Changes in model: ${wokwiConfigState.state}")
}
}

val toolWindow = WokwiToolWindow(configPanel, simulatorPanel)

}
Loading

0 comments on commit 1b64ddd

Please sign in to comment.