Skip to content
Snippets Groups Projects
Commit 52ff0ab6 authored by Griefed's avatar Griefed :joystick:
Browse files

Merge branch 'develop' into 'main'

Develop

See merge request !641
parents cf8b00eb 715c01ff
No related branches found
No related tags found
1 merge request!641Develop
Pipeline #9246 passed
......@@ -67,14 +67,33 @@ jobs:
run: |
cp checksum.txt continuous/
- name: Upload to GitHub Releases
uses: "slord399/action-automatic-releases@v1.0.1"
# - name: Upload to GitHub Releases
# uses: "slord399/action-automatic-releases@v1.0.1"
# with:
# repo_token: "${{ secrets.GITHUB_TOKEN }}"
# automatic_release_tag: "continuous"
# prerelease: true
# files: |
# continuous/*
- name: Update develop
uses: richardsimko/update-tag@v1
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "continuous"
prerelease: true
files: |
continuous/*
tag_name: continuous
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: ncipollo/release-action@v1
with:
allowUpdates: 'true'
artifacts: "continuous/*"
body: "Continuous dev-build release.<br>Updated every time changes are pushed to develop.<br>Do not use unless you have been told to, or are curious about the contents of the dev build.<br>Do not link to this release."
commit: "${{ github.sha }}"
name: "continuous"
prerelease: 'true'
removeArtifacts: 'true'
replacesArtifacts: 'true'
tag: 'continuous'
# - name: Delete drafts
# uses: hugo19941994/delete-draft-releases@v1.0.1
......
......@@ -37,6 +37,7 @@ import kotlinx.coroutines.swing.Swing
import org.apache.commons.io.monitor.FileAlterationListener
import org.apache.commons.io.monitor.FileAlterationMonitor
import org.apache.commons.io.monitor.FileAlterationObserver
import org.apache.commons.io.monitor.FileEntry
import org.apache.logging.log4j.kotlin.cachedLoggerOf
import java.awt.datatransfer.DataFlavor
import java.awt.dnd.DnDConstants
......@@ -63,7 +64,7 @@ class TabbedConfigsTab(
private val choose = arrayOf(Translations.createserverpack_gui_quickselect_choose.toString())
private val noVersions = DefaultComboBoxModel(arrayOf(Translations.createserverpack_gui_createserverpack_forge_none.toString()))
private val componentResizer = ComponentResizer()
private val timer = ConfigCheckTimer(500, guiProps, apiWrapper.configurationHandler,this)
private val timer = ConfigCheckTimer(500, guiProps, apiWrapper,this)
val selectedEditor: ConfigEditor?
get() {
return if (activeTab != null) {
......@@ -277,7 +278,9 @@ class TabbedConfigsTab(
@Suppress("DuplicatedCode")
private fun iconsDirectoryWatcher() {
Executors.newSingleThreadExecutor().execute {
val observer = FileAlterationObserver(apiWrapper.apiProperties.iconsDirectory)
val observer = FileAlterationObserver.builder()
.setRootEntry(FileEntry(apiWrapper.apiProperties.iconsDirectory))
.get()
val alterations = object : FileAlterationListener {
override fun onStart(observer: FileAlterationObserver?) {}
override fun onDirectoryCreate(directory: File?) {}
......@@ -309,6 +312,7 @@ class TabbedConfigsTab(
}
}
}
observer.addListener(alterations)
val monitor = FileAlterationMonitor(2000)
monitor.addObserver(observer)
......@@ -323,7 +327,9 @@ class TabbedConfigsTab(
@Suppress("DuplicatedCode")
private fun propertiesDirectoryWatcher() {
Executors.newSingleThreadExecutor().execute {
val observer = FileAlterationObserver(apiWrapper.apiProperties.propertiesDirectory)
val observer = FileAlterationObserver.builder()
.setRootEntry(FileEntry(apiWrapper.apiProperties.propertiesDirectory))
.get()
val alterations = object : FileAlterationListener {
override fun onStart(observer: FileAlterationObserver?) {}
override fun onDirectoryCreate(directory: File?) {}
......
......@@ -20,7 +20,7 @@
package de.griefed.serverpackcreator.app.gui.window.configs.components
import Translations
import de.griefed.serverpackcreator.api.config.ConfigurationHandler
import de.griefed.serverpackcreator.api.ApiWrapper
import de.griefed.serverpackcreator.app.gui.GuiProps
import de.griefed.serverpackcreator.app.gui.window.configs.ConfigEditor
import de.griefed.serverpackcreator.app.gui.window.configs.TabbedConfigsTab
......@@ -35,7 +35,7 @@ import javax.swing.Timer
* @author Griefed
*/
@OptIn(DelicateCoroutinesApi::class)
class ConfigCheckTimer(delay: Int, guiProps: GuiProps, configHandler: ConfigurationHandler, tabbedConfigsTab: TabbedConfigsTab) : Timer(delay,
class ConfigCheckTimer(delay: Int, guiProps: GuiProps, apiWrapper: ApiWrapper, tabbedConfigsTab: TabbedConfigsTab) : Timer(delay,
ActionListener {
GlobalScope.launch(guiProps.configDispatcher, CoroutineStart.UNDISPATCHED) {
var errorsEncountered = false
......@@ -47,7 +47,7 @@ class ConfigCheckTimer(delay: Int, guiProps: GuiProps, configHandler: Configurat
runBlocking {
launch {
errors.addAll(editor.validateModpackDir())
val name = configHandler.checkManifests(editor.getModpackDirectory(), pack)
val name = apiWrapper.configurationHandler.checkManifests(editor.getModpackDirectory(), pack)
@Suppress("IfThenToElvis")
editor.title.title = if (pack.name != null) {
pack.name!!
......
......@@ -33,6 +33,7 @@ import org.apache.logging.log4j.kotlin.cachedLoggerOf
import java.awt.BorderLayout
import java.awt.Dimension
import java.awt.datatransfer.DataFlavor
import java.awt.event.ActionListener
import java.awt.event.MouseAdapter
import java.awt.event.MouseEvent
import java.io.File
......@@ -110,8 +111,7 @@ class InclusionsEditor(
private val inclusionsReset = BalloonTipButton(null, guiProps.resetIcon, Translations.createserverpack_gui_buttoncopydirs_reset_tip.toString(), guiProps) { setInclusionsFromStringList(apiWrapper.apiProperties.directoriesToInclude.toMutableList()) }
private var selectedInclusion: InclusionSpecification? = null
private val delay = 250
private val tipUpdateTimer: Timer = Timer(delay) { updateTip() }
private val tipUpdateTimer: TipUpdateTimer = TipUpdateTimer(500)
private val sourceListener = object : DocumentChangeListener {
override fun update(e: DocumentEvent) {
......@@ -154,7 +154,7 @@ class InclusionsEditor(
val index = inclusionList.locationToIndex(e.point)
val bounds = inclusionList.getCellBounds(index, index)
if (bounds == null || !bounds.contains(e.point) || inclusionList.model.size <= 0) {
emtpySelection()
emptySelection()
} else {
enableInputs()
}
......@@ -177,16 +177,13 @@ class InclusionsEditor(
fun checkSize() {
if (inclusionList.model.size <= 0 || inclusionList.isSelectionEmpty) {
emtpySelection()
emptySelection()
}
}
}
init {
source.isEditable = guiProps.allowManualEditing
tipUpdateTimer.stop()
tipUpdateTimer.delay = delay
tipUpdateTimer.isRepeats = false
dividerLocation = 150
setLeftComponent(leftPanel)
setRightComponent(rightPanel)
......@@ -234,11 +231,11 @@ class InclusionsEditor(
inclusionList.addMouseListener(listMouseAdapter)
inclusionList.model.addListDataListener(listModelDataAdapter)
if (inclusionList.model.size <= 0) {
emtpySelection()
emptySelection()
}
}
private fun emtpySelection() {
private fun emptySelection() {
if (inclusionList.model.size > 0 || inclusionList.valueIsAdjusting) {
return
}
......@@ -324,7 +321,7 @@ class InclusionsEditor(
selectedInclusionDetailsScrollPanel.isEnabled = true
inclusionList.isEnabled = true
} else {
updateTip()
tipUpdateTimer.restart()
}
}
}
......@@ -438,7 +435,7 @@ class InclusionsEditor(
inclusionList.valueIsAdjusting -> return
event.valueIsAdjusting -> return
inclusionList.selectedIndex == -1 || inclusionList.model.size <= 0 -> {
emtpySelection()
emptySelection()
return
}
}
......@@ -535,7 +532,7 @@ class InclusionsEditor(
inclusionList.selectedIndex = 0
}
if (inclusionList.model.size <= 0) {
emtpySelection()
emptySelection()
}
validate()
return removed
......@@ -682,4 +679,19 @@ class InclusionsEditor(
return true
}
}
/**
* Timer responsible for updating the tip in the inclusions-editor.
*
* @author Griefed
*/
inner class TipUpdateTimer(delay: Int) :
Timer(delay, ActionListener {
updateTip()
}) {
init {
stop()
isRepeats = false
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment