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 #40 from d-wojciechowski/dev
Browse files Browse the repository at this point in the history
0.9.0 Release
  • Loading branch information
d-wojciechowski authored Jul 12, 2020
2 parents 6a9f32c + 7cd0d50 commit fcc0b9b
Show file tree
Hide file tree
Showing 22 changed files with 409 additions and 174 deletions.
97 changes: 97 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Changelog

## [0.9.0]
### Added
- Wrapping enable/disable option on command pane
- Auto-scroll option for log panes and command pane
- In command list under RMB added "Rerun" option.
- Validation in RemoteFilePicker for situations where expected is fileOnly.
- Double click selection in RemoteFilePicker.
### Changed
- Introduced better [changelog format](https://github.com/JetBrains/gradle-changelog-plugin)
- By default, website scanning is turned on (was turned off).
- Order of icons next to panes ( according to user feedback )
- Navigation bar actions, Load from file action and Buttons in right pane may now automatically open command panel (may be switched off in settings)
- Xconfmanager may now be executed regardless of windchill status.
- Bottom pane buttons unification.
### Fixed
- [Issue](https://github.com/d-wojciechowski/plm-companion/issues/27) with encoding when, addon is on Windows system, and Intellij is running on MacOS

## [0.8.0]
### Added
- Rerun button on command pane, it allows to quickly rerun the selected command.
- MS/BMS/Custom log pane supports line wrapping
### Changed
- Changed connection method with the addon, added retry mechanism, calls are now non-blocking
- Command log panel is now initialized early, so that commands are visible on every call

## [0.7.1]
### Added
- Option to wait until the finish of remote command
- Option to immediately switch to command pane

### Fixed
- Issue with linking run configurations.
- Shared command between run configurations.
- Alias not being saved

## [0.7.0]
### Added
- Button group to navigation bar with an option to disable it in the configuration.
- Combobox to LoadFromFile dialog which presents all run configurations, if one is selected it will be run before loading from file.
- "Remote command run" configuration, which allows other run configurations to be run before.
- Option to control actions such as wcstop/wcstart... to be controlled via System status.
- If addon is not available, easier to read message is shown.
### Changed
- Modified settings dialog to be easier to read.

## [0.6.1]
### Added
- Config for the port on which communication will be running with addon.
### Fixed
- Saving execution time for commands.

## [0.6.0]
### Added
- Load from file action under right click menu in project pane.
- Support for Intellij 2020.1

## [0.5.0]
### Changed
- Communication library changed from GRPC to RSocket.

## [0.4.0]
### Added
- Custom command execution
- Custom file remote tailing
- Remote file picker
### Changed
- Communication library changed from GRPC to RSocket.
- Icons from Intellij IDEA now being used, to unify look with OOTB.

## [0.3.2]
### Added
- Compatibility with 2019.3

## [0.3.0]
### Added
- Tailing log files
- Xconfmanager reload

## [0.2.1]
### Added
- Timeout configuration
### Changed
- Configuration moved to separate window.

## [0.1.3]
### Added
- Basic error handling.

## [0.1.2]
### Added
- Windchill basic control (stop/start/restart) with server add-on

## [0.1.1]
### Added
- Windchill status scanner
18 changes: 15 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
import com.google.protobuf.gradle.*
import org.jetbrains.changelog.closure
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

group = "pl.dwojciechowski"
version = "0.8.0"
version = "0.9.0"
val protobufVersion = "3.12.2"
val rsocketRpcVersion = "0.2.18"
val rsocketVersion = "1.0.0-RC7"
val coroutinesVersion = "1.3.7"
val fuelVersion = "2.2.2"
val fuelVersion = "2.2.3"
val rxJavaVersion = "3.0.4"

plugins {
id("org.jetbrains.changelog") version "0.4.0"
id("com.github.ben-manes.versions") version "0.28.0"
id("org.jetbrains.intellij") version "0.4.21"
id("com.google.protobuf") version "0.8.12"
Expand Down Expand Up @@ -73,13 +75,23 @@ tasks {
}

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

}

changelog {
version = "${project.version}"
path = "${project.projectDir}/CHANGELOG.md"
headerFormat = "[{0}]"
headerArguments = listOf("${project.version}")
itemPrefix = "-"
unreleasedTerm = "[Unreleased]"
groups = listOf("Added", "Changed", "Fixed")
}

idea {
module {
sourceDirs.add(file("src/main/kotlin"))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package pl.dwojciechowski.action

import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.components.ServiceManager
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
import pl.dwojciechowski.service.IdeControlService

abstract class RemoteCommandAction : DumbAwareAction() {

Expand All @@ -24,8 +24,8 @@ abstract class RemoteCommandAction : DumbAwareAction() {
}

override fun actionPerformed(e: AnActionEvent) {
GlobalScope.launch {
e.project?.let {
e.project?.let {
ServiceManager.getService(it, IdeControlService::class.java).withAutoOpen {
action(it)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ import pl.dwojciechowski.service.RemoteService

class XConfReloadWncAction : RemoteCommandAction() {

private val enabledStatusList = listOf(ServerStatus.RUNNING)

override fun action(project: Project) = RemoteService.getInstance(project).xconf()

override fun isEnabled(status: ServerStatus, statusControlled: Boolean): Boolean {
return !statusControlled || status == ServerStatus.NOT_SCANNING || enabledStatusList.contains(status)
}
override fun isEnabled(status: ServerStatus, statusControlled: Boolean) = true

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ class PluginConfiguration : PersistentStateComponent<PluginConfiguration> {
var logFileLocation: String = ""
var actionPresentation: String = ActionPresentationOption.NAVIGATION_AND_PANE

var scanWindchill: Boolean = false
var scanWindchill: Boolean = true
var statusControlled: Boolean = true
var wrapLogPane: Boolean = true
var wrapCommandPane: Boolean = false
var commandAutoScroll: Boolean = true
var logPanelAutoScroll: Boolean = true
var autoOpenCommandPane: Boolean = false

var port: Int = 80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ interface IdeControlService {
fun initCommandTab()
fun getToolWindow(id: String?): ToolWindow?
fun withCommandTab(doWith: (ToolWindow, ContentManager, Content) -> Unit)
fun withAutoOpen(action: () -> Unit)

}
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
package pl.dwojciechowski.service.impl

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.ToolWindow
import com.intellij.openapi.wm.ToolWindowManager
import com.intellij.ui.content.Content
import com.intellij.ui.content.ContentManager
import pl.dwojciechowski.configuration.PluginConfiguration
import pl.dwojciechowski.model.PluginConstants
import pl.dwojciechowski.service.IdeControlService

class IdeControlServiceImpl(private val project: Project) : IdeControlService {

private val config = ServiceManager.getService(project, PluginConfiguration::class.java)

override fun initCommandTab() {
getToolWindow(PluginConstants.LOG_TAB_ID)?.let { toolWindow ->
ApplicationManager.getApplication().invokeLater {
Expand All @@ -24,8 +28,11 @@ class IdeControlServiceImpl(private val project: Project) : IdeControlService {

override fun switchToCommandTab() {
withCommandTab { toolWindow, contentManager, content ->
toolWindow.show()
contentManager.setSelectedContent(content, true, false)
ApplicationManager.getApplication().invokeLater {
toolWindow.show()
contentManager.setSelectedContent(content, true, true)
}

}
}

Expand All @@ -36,6 +43,15 @@ class IdeControlServiceImpl(private val project: Project) : IdeControlService {
}
}

override fun withAutoOpen(action: () -> Unit) {
ApplicationManager.getApplication().invokeLater {
if (config.autoOpenCommandPane) {
switchToCommandTab()
}
action.invoke()
}
}

override fun getToolWindow(id: String?) = ToolWindowManager.getInstance(project).getToolWindow(id)

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ class RemoteServiceImpl(private val project: Project) : RemoteService {
private val ideService = IdeControlService.getInstance(project)
private val commandSubject = PublishSubject.create<CommandBean>()

private val isMacOs: Boolean

init {
val osName = System.getProperty("os.name") ?: ""
isMacOs = osName.contains("mac", true) || osName.contains("darwin", true)
}

override fun restartWnc(doFinally: () -> Unit) {
executeStreaming(CommandBean("Windchill Restart", "windchill stop && windchill start"), doFinally)
}
Expand Down Expand Up @@ -77,7 +84,11 @@ class RemoteServiceImpl(private val project: Project) : RemoteService {
.executeStreaming(command)
.retryWhen(Retry.maxInARow(0))
.doOnNext {
commandBean.response.onNext(it.message)
if (isMacOs) {
commandBean.response.onNext(it.message.replace("\u0000", ""))
} else {
commandBean.response.onNext(it.message)
}
if (it.status == Status.FAILED) {
commandBean.status = ExecutionStatus.STOPPED
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class LogViewerPanelFactory : ToolWindowFactory, DumbAware {
return object :
DumbAwareAction("New Window", "Create new log window", AllIcons.General.Add) {
override fun actionPerformed(e: AnActionEvent) {
val logFileDialog = LogFileLocationDialog(project)
val logFileDialog = LogFileLocationDialog(project, fileOnlySelection = true)
if (!logFileDialog.showAndGet()) {
return
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package pl.dwojciechowski.ui.component.button

import com.intellij.icons.AllIcons
import javax.swing.JToggleButton
import javax.swing.text.JTextComponent

class AutoScrollButton : JToggleButton() {

init {
icon = AllIcons.General.ZoomOut
selectedIcon = AllIcons.General.AutoscrollFromSource
}

fun link(startValue: Boolean, textComponent: JTextComponent, onEvent: (isSelected: Boolean) -> Unit) {
isSelected = startValue
textComponent.autoscrolls = isSelected
addActionListener {
textComponent.autoscrolls = isSelected
onEvent(isSelected)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package pl.dwojciechowski.ui.component.button

import com.intellij.icons.AllIcons
import javax.swing.JTextArea
import javax.swing.JToggleButton

class LineWrapButton : JToggleButton() {

init {
icon = AllIcons.General.LayoutEditorOnly
selectedIcon = AllIcons.Actions.ToggleSoftWrap
}

fun link(startValue: Boolean, textComponent: JTextArea, onEvent: (isSelected: Boolean) -> Unit) {
isSelected = startValue
textComponent.lineWrap = isSelected
addActionListener {
textComponent.lineWrap = isSelected
onEvent(isSelected)
}
}

}
14 changes: 10 additions & 4 deletions src/main/kotlin/pl/dwojciechowski/ui/dialog/LoadFromFileDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import com.intellij.openapi.vfs.VirtualFile
import com.intellij.ui.components.JBList
import pl.dwojciechowski.configuration.PluginConfiguration
import pl.dwojciechowski.model.CommandBean
import pl.dwojciechowski.service.IdeControlService
import pl.dwojciechowski.service.RemoteService
import pl.dwojciechowski.ui.component.CustomVirtualFileListCellRenderer
import pl.dwojciechowski.ui.component.RunConfigurationComboBox
Expand All @@ -26,8 +27,9 @@ class LoadFromFileDialog(
private val vFiles: List<VirtualFile>
) : DialogWrapper(project), Disposable {

private val config: PluginConfiguration = ServiceManager.getService(project, PluginConfiguration::class.java)
private val commandService: RemoteService = ServiceManager.getService(project, RemoteService::class.java)
private val config = ServiceManager.getService(project, PluginConfiguration::class.java)
private val commandService = ServiceManager.getService(project, RemoteService::class.java)
private val ideControlService = ServiceManager.getService(project, IdeControlService::class.java)

lateinit var content: JPanel

Expand Down Expand Up @@ -139,7 +141,9 @@ class LoadFromFileDialog(
private fun runCommand(finalCommand: String) {
val runConfig = runConfigurationComboBox.getSelectedConfiguration().value
if (runConfig == null) {
commandService.executeStreaming(CommandBean("Load from file", finalCommand))
ideControlService.withAutoOpen {
commandService.executeStreaming(CommandBean("Load from file", finalCommand))
}
} else {
val executor = DefaultRunExecutor.getRunExecutorInstance()
val builder = ExecutionEnvironmentBuilder.create(executor, runConfig)
Expand All @@ -157,7 +161,9 @@ class LoadFromFileDialog(
it.processHandler?.addProcessListener(object : ProcessAdapter() {
override fun processTerminated(event: ProcessEvent) {
super.processTerminated(event)
commandService.executeStreaming(CommandBean("Load from file", finalCommand))
ideControlService.withAutoOpen {
commandService.executeStreaming(CommandBean("Load from file", finalCommand))
}
}
})
}
Expand Down
Loading

0 comments on commit fcc0b9b

Please sign in to comment.