[Editor] Improve Java classes tree appearance and add Rebuild & run item to build menu

This commit is contained in:
2021-03-03 14:45:28 +01:00
parent 07d546b7d0
commit 5f26c88601
5 changed files with 28 additions and 7 deletions

View File

@@ -94,7 +94,7 @@ class DefaultBuildPipelineService : BuildPipelineService {
projectAssembler.assembly(project, outputFile)
val buildingTime = (System.currentTimeMillis() - startTime) / 1000.0
eventbus.fire(AppendBuildLogsEvent(Severity.INFO, "Done [${buildingTime}s]", tag = TAG))
eventbus.fire(AppendBuildLogsEvent(Severity.INFO, "Build done [${buildingTime}s]", tag = TAG))
}
private fun prepareBuildDirectory(project: Project) {
@@ -107,6 +107,7 @@ class DefaultBuildPipelineService : BuildPipelineService {
override fun clean() {
projectContext.project?.apply { buildDirectory.deleteRecursively() }
eventbus.fire(AppendBuildLogsEvent(Severity.INFO, "Cleaning done", tag = TAG))
}
companion object {

View File

@@ -34,7 +34,7 @@ class ScriptFilesView : View() {
treeView.root = TreeItem(rootNode)
treeView.populate { item -> item.value?.children }
root.root.expandAll()
root.root.children[1].expandAll()
}
}
}

View File

@@ -22,7 +22,8 @@ class SelectJavaClassFragment : Fragment("Select Java Class") {
private val selectJavaClassView = find<SelectJavaClassView>(
SelectJavaClassView::rootNode to rootNode,
SelectJavaClassView::selection to selection
SelectJavaClassView::selection to selection,
SelectJavaClassView::expandedRootChildren to arrayOf(1)
)
private val isFile = createBooleanBinding({ selection.value?.type == FileType.FILE }, selection)

View File

@@ -10,6 +10,7 @@ import tornadofx.*
class SelectJavaClassView : View() {
val rootNode: FileNode by param()
val selection: Property<FileNode> by param()
val expandedRootChildren: Array<Int> by param()
private val treeView = treeview<FileNode> {
root = TreeItem(rootNode)
@@ -31,7 +32,7 @@ class SelectJavaClassView : View() {
}
init {
treeView.root.expandAll()
treeView.root.children.filterIndexed { index, _ -> index in expandedRootChildren }.forEach { it.expandAll() }
}
override val root = treeView

View File

@@ -4,6 +4,7 @@ import com.bartlomiejpluta.base.editor.code.build.pipeline.BuildPipelineService
import com.bartlomiejpluta.base.editor.main.controller.MainController
import com.bartlomiejpluta.base.editor.process.runner.app.ApplicationRunner
import com.bartlomiejpluta.base.editor.project.context.ProjectContext
import org.kordamp.ikonli.javafx.FontIcon
import tornadofx.*
class MainMenuView : View() {
@@ -62,7 +63,9 @@ class MainMenuView : View() {
menu("Build") {
enableWhen(projectContext.projectProperty.isNotNull)
item("Compile") {
item("Build project") {
graphic = FontIcon("fa-gavel")
enableWhen(buildPipelineService.isRunningProperty.not().and(applicationRunner.isRunningProperty.not()))
action {
@@ -71,14 +74,27 @@ class MainMenuView : View() {
}
item("Run") {
enableWhen(applicationRunner.isRunningProperty.not())
graphic = FontIcon("fa-play")
enableWhen(buildPipelineService.isRunningProperty.not().and(applicationRunner.isRunningProperty.not()))
action {
applicationRunner.run()
}
}
item("Rebuild & Run") {
enableWhen(buildPipelineService.isRunningProperty.not().and(applicationRunner.isRunningProperty.not()))
action {
buildPipelineService.clean()
applicationRunner.run()
}
}
item("Terminate") {
graphic = FontIcon("fa-stop")
enableWhen(applicationRunner.processProperty.isNotNull)
action {
@@ -86,7 +102,9 @@ class MainMenuView : View() {
}
}
item("Clean") {
item("Clean build") {
graphic = FontIcon("fa-trash")
action {
buildPipelineService.clean()
}