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 #53 from d-wojciechowski/dev
Browse files Browse the repository at this point in the history
R1.0.2
  • Loading branch information
d-wojciechowski authored Dec 21, 2020
2 parents 314fc10 + 7b8eda2 commit 36e2673
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [1.0.2]
### Added
- Persistable custom tabs [loosing custom opened logs after IDE restart #51](https://github.com/d-wojciechowski/plm-companion/issues/51)

## [1.0.1]
### Fixed
- Compatibility with Intellij 2020.3
Expand Down
11 changes: 4 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import org.jetbrains.changelog.closure
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

group = "pl.dwojciechowski"
version = "1.0.1"
version = "1.0.2"
val protobufVersion = "3.12.4"
val rSocketRpcVersion = "0.2.18"
val rSocketVersion = "1.0.0-RC7"
val coroutinesVersion = "1.4.2"
val fuelVersion = "2.3.0"
val rxJavaVersion = "3.0.7"
val fuelVersion = "2.3.1"
val rxJavaVersion = "3.0.8"

plugins {
id("org.jetbrains.changelog") version "0.6.2"
id("com.github.ben-manes.versions") version "0.36.0"
id("org.jetbrains.intellij") version "0.6.5"
id("com.google.protobuf") version "0.8.14"
kotlin("jvm") version "1.4.10"
kotlin("jvm") version "1.4.21"
java
idea
}
Expand All @@ -39,9 +39,6 @@ dependencies {
implementation("io.rsocket:rsocket-transport-local:$rSocketVersion")
implementation("io.rsocket:rsocket-transport-netty:$rSocketVersion")
implementation("io.rsocket.rpc:rsocket-rpc-core:$rSocketRpcVersion")
//Do not use implementation here, compile is needed :
// https://github.com/JetBrains/gradle-intellij-plugin/issues/239
// https://github.com/JetBrains/gradle-intellij-plugin/issues/456
implementation("com.google.protobuf:protobuf-java:$protobufVersion")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ProjectPluginConfiguration : PersistentStateComponent<ProjectPluginConfigu
var commandAutoScroll: Boolean = true
var logPanelAutoScroll: Boolean = true
var autoOpenCommandPane: Boolean = false
var persistCustomTabs: Boolean = false

var port: Int = 80
var addonPort: Int = 4040
Expand All @@ -34,6 +35,7 @@ class ProjectPluginConfiguration : PersistentStateComponent<ProjectPluginConfigu

var commandsHistory = mutableListOf<String>()
var propertiesHistory = mutableListOf<String>()
var customTabs = mutableListOf<String>()

// Load From file
var lffFolder: String = ""
Expand Down
25 changes: 21 additions & 4 deletions src/main/kotlin/pl/dwojciechowski/ui/LogViewerPanelFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.ToolWindow
import com.intellij.openapi.wm.ToolWindowFactory
import com.intellij.openapi.wm.ex.ToolWindowEx
import com.intellij.ui.content.Content
import com.intellij.ui.content.ContentFactory
import pl.dwojciechowski.configuration.ProjectPluginConfiguration
import pl.dwojciechowski.i18n.PluginBundle.getMessage
Expand Down Expand Up @@ -48,6 +49,11 @@ class LogViewerPanelFactory : ToolWindowFactory, DumbAware {
toolWindow.contentManager.addContent(content)
toolWindow.contentManager.addContent(content2)
toolWindow.contentManager.addContent(commandContentPanel)
if (config.persistCustomTabs) {
config.customTabs.toList().forEach { customTab ->
toolWindow.contentManager.addContent(createCustomTabContent(project, contentFactory, customTab))
}
}
(toolWindow as ToolWindowEx).setTabActions(createNewTabAction(project, contentFactory, toolWindow))
}

Expand All @@ -67,14 +73,25 @@ class LogViewerPanelFactory : ToolWindowFactory, DumbAware {
if (!logFileDialog.showAndGet()) {
return
}
val newPanel = LogViewerPanel(project, SourceEnum.CUSTOM, logFileDialog.result)
val newContent = contentFactory.createContent(newPanel, logFileDialog.result, false)
newPanel.parentContent = newContent
newContent.preferredFocusableComponent = newPanel
val newContent = createCustomTabContent(project, contentFactory, logFileDialog.result)
toolWindow.contentManager.addContent(newContent)
if (config.persistCustomTabs) {
config.customTabs.add(logFileDialog.result)
}
toolWindow.contentManager.setSelectedContent(newContent)
}
}
}

private fun createCustomTabContent(project: Project, contentFactory: ContentFactory, tabName: String): Content {
val newPanel = LogViewerPanel(project, SourceEnum.CUSTOM, tabName)
val newContent = contentFactory.createContent(newPanel, tabName, false)
newPanel.parentContent = newContent
newContent.preferredFocusableComponent = newPanel
newContent.setDisposer {
config.customTabs = config.customTabs.filter { it != tabName }.toMutableList()
}
return newContent
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@
<text resource-bundle="i18n/PluginBundle" key="ui.config.ps.other.autoopen"/>
</properties>
</component>
<component id="46f8d" class="javax.swing.JCheckBox" binding="persistCustomTabs">
<constraints/>
<properties>
<text resource-bundle="i18n/PluginBundle" key="ui.config.tabs.persist"/>
<toolTipText resource-bundle="i18n/PluginBundle" key="ui.config.tabs.persist.tooltip"/>
</properties>
</component>
</children>
</grid>
</children>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class PluginSettingsDialog(private val project: Project) : DialogWrapper(project
private lateinit var actionPresentationCB: JComboBox<String>
private lateinit var statusControlled: JCheckBox
private lateinit var autoOpenCommandPane: JCheckBox
private lateinit var persistCustomTabs: JCheckBox

fun createUIComponents() {
actionPresentationCB = ComboBox(ActionPresentationOption.ALL_OPTIONS.toArray(arrayOf()))
Expand Down Expand Up @@ -123,6 +124,7 @@ class PluginSettingsDialog(private val project: Project) : DialogWrapper(project
folderPathTextFile.text = config.lffFolder
statusControlled.isSelected = config.statusControlled
autoOpenCommandPane.isSelected = config.autoOpenCommandPane
persistCustomTabs.isSelected = config.persistCustomTabs

resultingTextField.composeURL()
}
Expand All @@ -143,6 +145,7 @@ class PluginSettingsDialog(private val project: Project) : DialogWrapper(project
config.lffFolder = folderPathTextFile.text
config.statusControlled = statusControlled.isSelected
config.autoOpenCommandPane = autoOpenCommandPane.isSelected
config.persistCustomTabs = persistCustomTabs.isSelected
}

private fun JTextField.composeURL() {
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/PluginBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,5 @@ ui.dpd.error.empty.message=No property provided to be described.
ui.dpd.error.empty.title=No property provided
ui.dpd.error.duplicate.message=Given property already exists. Add anyway?
ui.dpd.error.duplicate.title=Duplicated property
ui.config.tabs.persist=Persist custom tabs
ui.config.tabs.persist.tooltip=If selected custom tabs would be persisted, and after startup added to bottom pane tabs.

0 comments on commit 36e2673

Please sign in to comment.