Skip to content

Commit

Permalink
fixed small bug related to saving
Browse files Browse the repository at this point in the history
  • Loading branch information
justADeni committed Apr 9, 2023
1 parent 0a270d6 commit 3cebe70
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
8 changes: 5 additions & 3 deletions src/main/kotlin/actions/ListActions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ class ListActions : ListSelectionListener {

//this part is due to list selecting last value even tho it is hidden
if (Inst.right.text.isNotBlank()) {
if (!Inst.right.list.selectedValue.contains(Inst.right.text, true)) {
Inst.right.list.selectedIndex = -1
return
if (Inst.right.list.selectedValue != null) {
if (!Inst.right.list.selectedValue.contains(Inst.right.text, true)) {
Inst.right.list.selectedIndex = -1
return
}
}
}

Expand Down
32 changes: 9 additions & 23 deletions src/main/kotlin/misc/Saver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import java.nio.file.Path
import java.nio.file.Paths
import javax.swing.JOptionPane
import javax.swing.SwingUtilities
import kotlin.io.path.isDirectory


object Saver {
Expand Down Expand Up @@ -109,29 +110,14 @@ object Saver {
Files.walk(Paths.get(Inst.loader.recipeFolder.path)).use {
paths -> paths.filter { Files.isRegularFile(it) }
.forEach {
val recipeName = it.fileName.toString().split(".chemrecipe")[0]
Inst.right.demoList.addElement(recipeName)
compoundLoadCheck(it)
/*
val cLine : String = Files.lines(it).use { lines -> lines.skip(10).findFirst().get() }
if (cLine == "S:")
return@forEach
val parts = cLine.split(":")
if (!parts[1].contains("Compound"))
return@forEach
if (recipeName.contains("New Recipe"))
return@forEach
for (compound in Inst.left.listchemassets)
if (compound.info == parts[1])
compound.toolTipText = recipeName
for (compound in Inst.left.chemassetpanel.components)
if ((compound as CustomLabel).info == parts[1])
compound.toolTipText = recipeName
*/

if (it.fileName.toString().endsWith(".chemrecipe", true)) {

val recipeName = it.fileName.toString().split(".chemrecipe")[0]
Inst.right.demoList.addElement(recipeName)
compoundLoadCheck(it)

}
}
}
SwingUtilities.updateComponentTreeUI(Inst.right.list)
Expand Down

0 comments on commit 3cebe70

Please sign in to comment.