Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Griefed/ServerPackCreator
1 result
Show changes
Commits on Source (7)
...@@ -67,14 +67,33 @@ jobs: ...@@ -67,14 +67,33 @@ jobs:
run: | run: |
cp checksum.txt continuous/ cp checksum.txt continuous/
- name: Upload to GitHub Releases # - name: Upload to GitHub Releases
uses: "slord399/action-automatic-releases@v1.0.1" # 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: with:
repo_token: "${{ secrets.GITHUB_TOKEN }}" tag_name: continuous
automatic_release_tag: "continuous" env:
prerelease: true GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
files: |
continuous/* - 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 # - name: Delete drafts
# uses: hugo19941994/delete-draft-releases@v1.0.1 # uses: hugo19941994/delete-draft-releases@v1.0.1
......
...@@ -37,6 +37,7 @@ import kotlinx.coroutines.swing.Swing ...@@ -37,6 +37,7 @@ import kotlinx.coroutines.swing.Swing
import org.apache.commons.io.monitor.FileAlterationListener import org.apache.commons.io.monitor.FileAlterationListener
import org.apache.commons.io.monitor.FileAlterationMonitor import org.apache.commons.io.monitor.FileAlterationMonitor
import org.apache.commons.io.monitor.FileAlterationObserver import org.apache.commons.io.monitor.FileAlterationObserver
import org.apache.commons.io.monitor.FileEntry
import org.apache.logging.log4j.kotlin.cachedLoggerOf import org.apache.logging.log4j.kotlin.cachedLoggerOf
import java.awt.datatransfer.DataFlavor import java.awt.datatransfer.DataFlavor
import java.awt.dnd.DnDConstants import java.awt.dnd.DnDConstants
...@@ -63,7 +64,7 @@ class TabbedConfigsTab( ...@@ -63,7 +64,7 @@ class TabbedConfigsTab(
private val choose = arrayOf(Translations.createserverpack_gui_quickselect_choose.toString()) private val choose = arrayOf(Translations.createserverpack_gui_quickselect_choose.toString())
private val noVersions = DefaultComboBoxModel(arrayOf(Translations.createserverpack_gui_createserverpack_forge_none.toString())) private val noVersions = DefaultComboBoxModel(arrayOf(Translations.createserverpack_gui_createserverpack_forge_none.toString()))
private val componentResizer = ComponentResizer() private val componentResizer = ComponentResizer()
private val timer = ConfigCheckTimer(500, guiProps, apiWrapper.configurationHandler,this) private val timer = ConfigCheckTimer(500, guiProps, apiWrapper,this)
val selectedEditor: ConfigEditor? val selectedEditor: ConfigEditor?
get() { get() {
return if (activeTab != null) { return if (activeTab != null) {
...@@ -277,7 +278,9 @@ class TabbedConfigsTab( ...@@ -277,7 +278,9 @@ class TabbedConfigsTab(
@Suppress("DuplicatedCode") @Suppress("DuplicatedCode")
private fun iconsDirectoryWatcher() { private fun iconsDirectoryWatcher() {
Executors.newSingleThreadExecutor().execute { Executors.newSingleThreadExecutor().execute {
val observer = FileAlterationObserver(apiWrapper.apiProperties.iconsDirectory) val observer = FileAlterationObserver.builder()
.setRootEntry(FileEntry(apiWrapper.apiProperties.iconsDirectory))
.get()
val alterations = object : FileAlterationListener { val alterations = object : FileAlterationListener {
override fun onStart(observer: FileAlterationObserver?) {} override fun onStart(observer: FileAlterationObserver?) {}
override fun onDirectoryCreate(directory: File?) {} override fun onDirectoryCreate(directory: File?) {}
...@@ -309,6 +312,7 @@ class TabbedConfigsTab( ...@@ -309,6 +312,7 @@ class TabbedConfigsTab(
} }
} }
} }
observer.addListener(alterations) observer.addListener(alterations)
val monitor = FileAlterationMonitor(2000) val monitor = FileAlterationMonitor(2000)
monitor.addObserver(observer) monitor.addObserver(observer)
...@@ -323,7 +327,9 @@ class TabbedConfigsTab( ...@@ -323,7 +327,9 @@ class TabbedConfigsTab(
@Suppress("DuplicatedCode") @Suppress("DuplicatedCode")
private fun propertiesDirectoryWatcher() { private fun propertiesDirectoryWatcher() {
Executors.newSingleThreadExecutor().execute { Executors.newSingleThreadExecutor().execute {
val observer = FileAlterationObserver(apiWrapper.apiProperties.propertiesDirectory) val observer = FileAlterationObserver.builder()
.setRootEntry(FileEntry(apiWrapper.apiProperties.propertiesDirectory))
.get()
val alterations = object : FileAlterationListener { val alterations = object : FileAlterationListener {
override fun onStart(observer: FileAlterationObserver?) {} override fun onStart(observer: FileAlterationObserver?) {}
override fun onDirectoryCreate(directory: File?) {} override fun onDirectoryCreate(directory: File?) {}
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
package de.griefed.serverpackcreator.app.gui.window.configs.components package de.griefed.serverpackcreator.app.gui.window.configs.components
import Translations 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.GuiProps
import de.griefed.serverpackcreator.app.gui.window.configs.ConfigEditor import de.griefed.serverpackcreator.app.gui.window.configs.ConfigEditor
import de.griefed.serverpackcreator.app.gui.window.configs.TabbedConfigsTab import de.griefed.serverpackcreator.app.gui.window.configs.TabbedConfigsTab
...@@ -35,7 +35,7 @@ import javax.swing.Timer ...@@ -35,7 +35,7 @@ import javax.swing.Timer
* @author Griefed * @author Griefed
*/ */
@OptIn(DelicateCoroutinesApi::class) @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 { ActionListener {
GlobalScope.launch(guiProps.configDispatcher, CoroutineStart.UNDISPATCHED) { GlobalScope.launch(guiProps.configDispatcher, CoroutineStart.UNDISPATCHED) {
var errorsEncountered = false var errorsEncountered = false
...@@ -47,7 +47,7 @@ class ConfigCheckTimer(delay: Int, guiProps: GuiProps, configHandler: Configurat ...@@ -47,7 +47,7 @@ class ConfigCheckTimer(delay: Int, guiProps: GuiProps, configHandler: Configurat
runBlocking { runBlocking {
launch { launch {
errors.addAll(editor.validateModpackDir()) errors.addAll(editor.validateModpackDir())
val name = configHandler.checkManifests(editor.getModpackDirectory(), pack) val name = apiWrapper.configurationHandler.checkManifests(editor.getModpackDirectory(), pack)
@Suppress("IfThenToElvis") @Suppress("IfThenToElvis")
editor.title.title = if (pack.name != null) { editor.title.title = if (pack.name != null) {
pack.name!! pack.name!!
......
...@@ -33,6 +33,7 @@ import org.apache.logging.log4j.kotlin.cachedLoggerOf ...@@ -33,6 +33,7 @@ import org.apache.logging.log4j.kotlin.cachedLoggerOf
import java.awt.BorderLayout import java.awt.BorderLayout
import java.awt.Dimension import java.awt.Dimension
import java.awt.datatransfer.DataFlavor import java.awt.datatransfer.DataFlavor
import java.awt.event.ActionListener
import java.awt.event.MouseAdapter import java.awt.event.MouseAdapter
import java.awt.event.MouseEvent import java.awt.event.MouseEvent
import java.io.File import java.io.File
...@@ -110,8 +111,7 @@ class InclusionsEditor( ...@@ -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 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 var selectedInclusion: InclusionSpecification? = null
private val delay = 250 private val tipUpdateTimer: TipUpdateTimer = TipUpdateTimer(500)
private val tipUpdateTimer: Timer = Timer(delay) { updateTip() }
private val sourceListener = object : DocumentChangeListener { private val sourceListener = object : DocumentChangeListener {
override fun update(e: DocumentEvent) { override fun update(e: DocumentEvent) {
...@@ -154,7 +154,7 @@ class InclusionsEditor( ...@@ -154,7 +154,7 @@ class InclusionsEditor(
val index = inclusionList.locationToIndex(e.point) val index = inclusionList.locationToIndex(e.point)
val bounds = inclusionList.getCellBounds(index, index) val bounds = inclusionList.getCellBounds(index, index)
if (bounds == null || !bounds.contains(e.point) || inclusionList.model.size <= 0) { if (bounds == null || !bounds.contains(e.point) || inclusionList.model.size <= 0) {
emtpySelection() emptySelection()
} else { } else {
enableInputs() enableInputs()
} }
...@@ -177,16 +177,13 @@ class InclusionsEditor( ...@@ -177,16 +177,13 @@ class InclusionsEditor(
fun checkSize() { fun checkSize() {
if (inclusionList.model.size <= 0 || inclusionList.isSelectionEmpty) { if (inclusionList.model.size <= 0 || inclusionList.isSelectionEmpty) {
emtpySelection() emptySelection()
} }
} }
} }
init { init {
source.isEditable = guiProps.allowManualEditing source.isEditable = guiProps.allowManualEditing
tipUpdateTimer.stop()
tipUpdateTimer.delay = delay
tipUpdateTimer.isRepeats = false
dividerLocation = 150 dividerLocation = 150
setLeftComponent(leftPanel) setLeftComponent(leftPanel)
setRightComponent(rightPanel) setRightComponent(rightPanel)
...@@ -234,11 +231,11 @@ class InclusionsEditor( ...@@ -234,11 +231,11 @@ class InclusionsEditor(
inclusionList.addMouseListener(listMouseAdapter) inclusionList.addMouseListener(listMouseAdapter)
inclusionList.model.addListDataListener(listModelDataAdapter) inclusionList.model.addListDataListener(listModelDataAdapter)
if (inclusionList.model.size <= 0) { if (inclusionList.model.size <= 0) {
emtpySelection() emptySelection()
} }
} }
private fun emtpySelection() { private fun emptySelection() {
if (inclusionList.model.size > 0 || inclusionList.valueIsAdjusting) { if (inclusionList.model.size > 0 || inclusionList.valueIsAdjusting) {
return return
} }
...@@ -324,7 +321,7 @@ class InclusionsEditor( ...@@ -324,7 +321,7 @@ class InclusionsEditor(
selectedInclusionDetailsScrollPanel.isEnabled = true selectedInclusionDetailsScrollPanel.isEnabled = true
inclusionList.isEnabled = true inclusionList.isEnabled = true
} else { } else {
updateTip() tipUpdateTimer.restart()
} }
} }
} }
...@@ -438,7 +435,7 @@ class InclusionsEditor( ...@@ -438,7 +435,7 @@ class InclusionsEditor(
inclusionList.valueIsAdjusting -> return inclusionList.valueIsAdjusting -> return
event.valueIsAdjusting -> return event.valueIsAdjusting -> return
inclusionList.selectedIndex == -1 || inclusionList.model.size <= 0 -> { inclusionList.selectedIndex == -1 || inclusionList.model.size <= 0 -> {
emtpySelection() emptySelection()
return return
} }
} }
...@@ -535,7 +532,7 @@ class InclusionsEditor( ...@@ -535,7 +532,7 @@ class InclusionsEditor(
inclusionList.selectedIndex = 0 inclusionList.selectedIndex = 0
} }
if (inclusionList.model.size <= 0) { if (inclusionList.model.size <= 0) {
emtpySelection() emptySelection()
} }
validate() validate()
return removed return removed
...@@ -682,4 +679,19 @@ class InclusionsEditor( ...@@ -682,4 +679,19 @@ class InclusionsEditor(
return true 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