[Editor] Improve Java classes tree appearance and add Rebuild & run item to build menu
This commit is contained in:
@@ -94,7 +94,7 @@ class DefaultBuildPipelineService : BuildPipelineService {
|
|||||||
projectAssembler.assembly(project, outputFile)
|
projectAssembler.assembly(project, outputFile)
|
||||||
|
|
||||||
val buildingTime = (System.currentTimeMillis() - startTime) / 1000.0
|
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) {
|
private fun prepareBuildDirectory(project: Project) {
|
||||||
@@ -107,6 +107,7 @@ class DefaultBuildPipelineService : BuildPipelineService {
|
|||||||
|
|
||||||
override fun clean() {
|
override fun clean() {
|
||||||
projectContext.project?.apply { buildDirectory.deleteRecursively() }
|
projectContext.project?.apply { buildDirectory.deleteRecursively() }
|
||||||
|
eventbus.fire(AppendBuildLogsEvent(Severity.INFO, "Cleaning done", tag = TAG))
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class ScriptFilesView : View() {
|
|||||||
|
|
||||||
treeView.root = TreeItem(rootNode)
|
treeView.root = TreeItem(rootNode)
|
||||||
treeView.populate { item -> item.value?.children }
|
treeView.populate { item -> item.value?.children }
|
||||||
root.root.expandAll()
|
root.root.children[1].expandAll()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ class SelectJavaClassFragment : Fragment("Select Java Class") {
|
|||||||
|
|
||||||
private val selectJavaClassView = find<SelectJavaClassView>(
|
private val selectJavaClassView = find<SelectJavaClassView>(
|
||||||
SelectJavaClassView::rootNode to rootNode,
|
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)
|
private val isFile = createBooleanBinding({ selection.value?.type == FileType.FILE }, selection)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import tornadofx.*
|
|||||||
class SelectJavaClassView : View() {
|
class SelectJavaClassView : View() {
|
||||||
val rootNode: FileNode by param()
|
val rootNode: FileNode by param()
|
||||||
val selection: Property<FileNode> by param()
|
val selection: Property<FileNode> by param()
|
||||||
|
val expandedRootChildren: Array<Int> by param()
|
||||||
|
|
||||||
private val treeView = treeview<FileNode> {
|
private val treeView = treeview<FileNode> {
|
||||||
root = TreeItem(rootNode)
|
root = TreeItem(rootNode)
|
||||||
@@ -31,7 +32,7 @@ class SelectJavaClassView : View() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
treeView.root.expandAll()
|
treeView.root.children.filterIndexed { index, _ -> index in expandedRootChildren }.forEach { it.expandAll() }
|
||||||
}
|
}
|
||||||
|
|
||||||
override val root = treeView
|
override val root = treeView
|
||||||
|
|||||||
@@ -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.main.controller.MainController
|
||||||
import com.bartlomiejpluta.base.editor.process.runner.app.ApplicationRunner
|
import com.bartlomiejpluta.base.editor.process.runner.app.ApplicationRunner
|
||||||
import com.bartlomiejpluta.base.editor.project.context.ProjectContext
|
import com.bartlomiejpluta.base.editor.project.context.ProjectContext
|
||||||
|
import org.kordamp.ikonli.javafx.FontIcon
|
||||||
import tornadofx.*
|
import tornadofx.*
|
||||||
|
|
||||||
class MainMenuView : View() {
|
class MainMenuView : View() {
|
||||||
@@ -62,7 +63,9 @@ class MainMenuView : View() {
|
|||||||
menu("Build") {
|
menu("Build") {
|
||||||
enableWhen(projectContext.projectProperty.isNotNull)
|
enableWhen(projectContext.projectProperty.isNotNull)
|
||||||
|
|
||||||
item("Compile") {
|
item("Build project") {
|
||||||
|
graphic = FontIcon("fa-gavel")
|
||||||
|
|
||||||
enableWhen(buildPipelineService.isRunningProperty.not().and(applicationRunner.isRunningProperty.not()))
|
enableWhen(buildPipelineService.isRunningProperty.not().and(applicationRunner.isRunningProperty.not()))
|
||||||
|
|
||||||
action {
|
action {
|
||||||
@@ -71,14 +74,27 @@ class MainMenuView : View() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
item("Run") {
|
item("Run") {
|
||||||
enableWhen(applicationRunner.isRunningProperty.not())
|
graphic = FontIcon("fa-play")
|
||||||
|
|
||||||
|
enableWhen(buildPipelineService.isRunningProperty.not().and(applicationRunner.isRunningProperty.not()))
|
||||||
|
|
||||||
action {
|
action {
|
||||||
applicationRunner.run()
|
applicationRunner.run()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item("Rebuild & Run") {
|
||||||
|
enableWhen(buildPipelineService.isRunningProperty.not().and(applicationRunner.isRunningProperty.not()))
|
||||||
|
|
||||||
|
action {
|
||||||
|
buildPipelineService.clean()
|
||||||
|
applicationRunner.run()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
item("Terminate") {
|
item("Terminate") {
|
||||||
|
graphic = FontIcon("fa-stop")
|
||||||
|
|
||||||
enableWhen(applicationRunner.processProperty.isNotNull)
|
enableWhen(applicationRunner.processProperty.isNotNull)
|
||||||
|
|
||||||
action {
|
action {
|
||||||
@@ -86,7 +102,9 @@ class MainMenuView : View() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
item("Clean") {
|
item("Clean build") {
|
||||||
|
graphic = FontIcon("fa-trash")
|
||||||
|
|
||||||
action {
|
action {
|
||||||
buildPipelineService.clean()
|
buildPipelineService.clean()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user