Skip to content
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #34 from d-wojciechowski/dev
Browse files Browse the repository at this point in the history
0.8.0 release
  • Loading branch information
d-wojciechowski authored Jun 4, 2020
2 parents 836113f + 9e1fc1a commit 6a9f32c
Show file tree
Hide file tree
Showing 43 changed files with 451 additions and 257 deletions.
25 changes: 0 additions & 25 deletions .github/workflows/master.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/plugin-verification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This is a basic workflow to help you get started with Actions

name: Plugin Verification

# on:
# pull_request:
# branches: [ master, dev ]

on: push

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: submodules-init
uses: snickerbockers/submodules-init@v4

- name: Build with Gradle
run: ./gradlew build

- name: Verify Plugin on IntelliJ Platforms
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master'
id: verify
uses: ChrisCarini/[email protected]
with:
ide-versions: |
ideaIC:2020.1
ideaIC:LATEST-EAP-SNAPSHOT
- name: Get log file path and print contents
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master'
run: |
echo "The verifier log file [${{steps.verify.outputs.verification-output-log-filename}}] contents : " ;
cat ${{steps.verify.outputs.verification-output-log-filename}}
32 changes: 13 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import com.google.protobuf.gradle.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

group = "pl.dwojciechowski"
version = "0.7.1"
val protobufVersion = "3.12.1"
version = "0.8.0"
val protobufVersion = "3.12.2"
val rsocketRpcVersion = "0.2.18"
val rsocketVersion = "1.0.0-RC7"
val coroutinesVersion = "1.3.7"
Expand Down Expand Up @@ -60,20 +60,22 @@ intellij {

tasks {

withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

runIde {
systemProperty("idea.auto.reload.plugins", false)
}

register("myClean", Delete::class) {
delete("src/generated")
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}

clean {
dependsOn("myClean")
delete("src/generated")
}

patchPluginXml {
changeNotes(htmlFixer("src/main/resources/META-INF/change-notes.html"))
pluginDescription(htmlFixer("src/main/resources/META-INF/description.html"))
sinceBuild("200")
}

}
Expand Down Expand Up @@ -116,15 +118,7 @@ fun htmlFixer(filename: String): String {
if (!File(filename).exists()) {
logger.error("File $filename not found.")
} else {
return File(filename).readText().replace("<html>", "").replace("</html>", "")
return File(filename).readText().replace("(</?html>)".toRegex(), "")
}
return ""
}

tasks {
named<org.jetbrains.intellij.tasks.PatchPluginXmlTask>("patchPluginXml") {
changeNotes(htmlFixer("src/main/resources/META-INF/change-notes.html"))
pluginDescription(htmlFixer("src/main/resources/META-INF/description.html"))
sinceBuild("200")
}
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Sat Apr 25 20:42:58 CEST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
26 changes: 10 additions & 16 deletions src/main/kotlin/pl/dwojciechowski/action/LoadFromFileAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,19 @@ class LoadFromFileAction : AnAction() {

override fun actionPerformed(e: AnActionEvent) {
val project = e.project ?: throw Exception("Project not defined exception")
val flatMap = PlatformDataKeys.VIRTUAL_FILE_ARRAY.getData(e.dataContext)?.flatMap {
if (it.isDirectory) {
collectNestedFiles(it)
} else {
listOf(it)
}
}?.toList() ?: throw Exception("No files selected exception")

val flatMap = PlatformDataKeys.VIRTUAL_FILE_ARRAY
.getData(e.dataContext)
?.flatMap(this::collectNested)
?.toList() ?: throw Exception("No files selected exception")
LoadFromFileDialog(project, flatMap).showAndGet()
}

private fun collectNestedFiles(vFile: VirtualFile): List<VirtualFile> {
return vFile.children.flatMap {
if (it.isDirectory) {
collectNestedFiles(it)
} else {
listOf(it)
}
}.toList()
private fun collectNested(it: VirtualFile): List<VirtualFile> {
return if (it.isDirectory) {
it.children.flatMap(this::collectNested).toList()
} else {
listOf(it)
}
}

}
1 change: 0 additions & 1 deletion src/main/kotlin/pl/dwojciechowski/action/PLMActionGroup.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.intellij.openapi.components.ServiceManager
import pl.dwojciechowski.configuration.PluginConfiguration
import pl.dwojciechowski.model.ActionPresentationOption


class PLMActionGroup : DefaultActionGroup() {

override fun update(event: AnActionEvent) {
Expand Down
34 changes: 34 additions & 0 deletions src/main/kotlin/pl/dwojciechowski/action/RemoteCommandAction.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package pl.dwojciechowski.action

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.project.Project
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import pl.dwojciechowski.action.utils.ActionSubscription
import pl.dwojciechowski.model.ServerStatus

abstract class RemoteCommandAction : DumbAwareAction() {

private val actionSubscription = ActionSubscription()
private var isEnabled = false

abstract fun action(project: Project)
abstract fun isEnabled(status: ServerStatus, statusControlled: Boolean): Boolean

override fun update(e: AnActionEvent) {
actionSubscription.subscriptionRoutine(e) { status, statusControlled ->
isEnabled = isEnabled(status, statusControlled)
}
e.presentation.isEnabled = isEnabled
}

override fun actionPerformed(e: AnActionEvent) {
GlobalScope.launch {
e.project?.let {
action(it)
}
}
}

}
20 changes: 5 additions & 15 deletions src/main/kotlin/pl/dwojciechowski/action/RestartWncAction.kt
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
package pl.dwojciechowski.action

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import pl.dwojciechowski.action.utils.ActionSubscription
import com.intellij.openapi.project.Project
import pl.dwojciechowski.model.ServerStatus
import pl.dwojciechowski.service.RemoteService

class RestartWncAction : DumbAwareAction() {

private val actionSubscription = ActionSubscription()
class RestartWncAction : RemoteCommandAction() {

private val enabledStatusList = listOf(ServerStatus.RUNNING)
private var isEnabled = false

override fun update(e: AnActionEvent) {
actionSubscription.subscriptionRoutine(e) { status, statusControlled ->
isEnabled = !statusControlled || status == ServerStatus.NOT_SCANNING || enabledStatusList.contains(status)
}
e.presentation.isEnabled = isEnabled
}
override fun action(project: Project) = RemoteService.getInstance(project).restartWnc()

override fun actionPerformed(e: AnActionEvent) {
e.project?.let { RemoteService.getInstance(it).restartWnc() }
override fun isEnabled(status: ServerStatus, statusControlled: Boolean): Boolean {
return !statusControlled || status == ServerStatus.NOT_SCANNING || enabledStatusList.contains(status)
}

}
20 changes: 5 additions & 15 deletions src/main/kotlin/pl/dwojciechowski/action/StartWncAction.kt
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
package pl.dwojciechowski.action

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import pl.dwojciechowski.action.utils.ActionSubscription
import com.intellij.openapi.project.Project
import pl.dwojciechowski.model.ServerStatus
import pl.dwojciechowski.service.RemoteService

class StartWncAction : DumbAwareAction() {

private val actionSubscription = ActionSubscription()
class StartWncAction : RemoteCommandAction() {

private val disabledStatusList = listOf(ServerStatus.RUNNING)
private var isEnabled = false

override fun update(e: AnActionEvent) {
actionSubscription.subscriptionRoutine(e) { status, statusControlled ->
isEnabled = !statusControlled || status == ServerStatus.NOT_SCANNING || !disabledStatusList.contains(status)
}
e.presentation.isEnabled = isEnabled
}
override fun action(project: Project) = RemoteService.getInstance(project).startWnc()

override fun actionPerformed(e: AnActionEvent) {
e.project?.let { RemoteService.getInstance(it).startWnc() }
override fun isEnabled(status: ServerStatus, statusControlled: Boolean): Boolean {
return !statusControlled || status == ServerStatus.NOT_SCANNING || !disabledStatusList.contains(status)
}

}
20 changes: 5 additions & 15 deletions src/main/kotlin/pl/dwojciechowski/action/StopWncAction.kt
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
package pl.dwojciechowski.action

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import pl.dwojciechowski.action.utils.ActionSubscription
import com.intellij.openapi.project.Project
import pl.dwojciechowski.model.ServerStatus
import pl.dwojciechowski.service.RemoteService

class StopWncAction : DumbAwareAction() {

private val actionSubscription = ActionSubscription()
class StopWncAction : RemoteCommandAction() {

private val enabledStatusList = listOf(ServerStatus.RUNNING)
private var isEnabled = false

override fun update(e: AnActionEvent) {
actionSubscription.subscriptionRoutine(e) { status, statusControlled ->
isEnabled = !statusControlled || status == ServerStatus.NOT_SCANNING || enabledStatusList.contains(status)
}
e.presentation.isEnabled = isEnabled
}
override fun action(project: Project) = RemoteService.getInstance(project).stopWnc()

override fun actionPerformed(e: AnActionEvent) {
e.project?.let { RemoteService.getInstance(it).stopWnc() }
override fun isEnabled(status: ServerStatus, statusControlled: Boolean): Boolean {
return !statusControlled || status == ServerStatus.NOT_SCANNING || enabledStatusList.contains(status)
}

}
20 changes: 5 additions & 15 deletions src/main/kotlin/pl/dwojciechowski/action/XConfReloadWncAction.kt
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
package pl.dwojciechowski.action

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.project.DumbAwareAction
import pl.dwojciechowski.action.utils.ActionSubscription
import com.intellij.openapi.project.Project
import pl.dwojciechowski.model.ServerStatus
import pl.dwojciechowski.service.RemoteService

class XConfReloadWncAction : DumbAwareAction() {

private val actionSubscription = ActionSubscription()
class XConfReloadWncAction : RemoteCommandAction() {

private val enabledStatusList = listOf(ServerStatus.RUNNING)
private var isEnabled = false

override fun update(e: AnActionEvent) {
actionSubscription.subscriptionRoutine(e) { status, statusControlled ->
isEnabled = !statusControlled || status == ServerStatus.NOT_SCANNING || enabledStatusList.contains(status)
}
e.presentation.isEnabled = isEnabled
}
override fun action(project: Project) = RemoteService.getInstance(project).xconf()

override fun actionPerformed(e: AnActionEvent) {
e.project?.let { RemoteService.getInstance(it).xconf() }
override fun isEnabled(status: ServerStatus, statusControlled: Boolean): Boolean {
return !statusControlled || status == ServerStatus.NOT_SCANNING || enabledStatusList.contains(status)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class ActionSubscription {
}
subscription = StatusService.getInstance(project!!).getOutputSubject().subscribe { status ->
project.onValid {
val statCtrld = ServiceManager.getService(it, PluginConfiguration::class.java).statusControlled
method(status, statCtrld)
method(status, ServiceManager.getService(it, PluginConfiguration::class.java).statusControlled)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class PluginConfiguration : PersistentStateComponent<PluginConfiguration> {

var scanWindchill: Boolean = false
var statusControlled: Boolean = true
var wrapLogPane: Boolean = true
var autoOpenCommandPane: Boolean = false

var port: Int = 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.intellij.execution.configurations.ConfigurationFactory
import com.intellij.execution.configurations.ConfigurationType
import com.intellij.openapi.project.Project


class RemoteCommandFactory(configurationType: ConfigurationType) : ConfigurationFactory(configurationType) {

override fun createTemplateConfiguration(project: Project) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,4 @@ class RemoteCommandProcessHandler(
}
}


}
Loading

0 comments on commit 6a9f32c

Please sign in to comment.