Skip to content

Commit 22bb71d

Browse files
committed
Fix the build
1 parent f86e96e commit 22bb71d

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies {
4040
}
4141
}
4242

43-
// Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
43+
// Set the JVM language level used to build the project.
4444
kotlin {
4545
jvmToolchain(21)
4646
}

src/main/kotlin/com/github/igr/sexyeditor/ui/EditorConfigUI.kt

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -389,23 +389,28 @@ open class EditorConfigUI {
389389
}
390390
scrollPane.setViewportView(fileList)
391391

392-
fileList.dropTarget = object : DropTarget() {
393-
@Synchronized
394-
override fun drop(evt: DropTargetDropEvent) {
395-
try {
396-
evt.acceptDrop(DnDConstants.ACTION_COPY)
397-
val droppedFiles = evt.transferable.getTransferData(DataFlavor.javaFileListFlavor) as List<File>
398-
for (file in droppedFiles) {
399-
fileListModel.addElement(
400-
ImageFile(
401-
file.absolutePath
392+
try {
393+
fileList.dropTarget = object : DropTarget() {
394+
@Synchronized
395+
override fun drop(evt: DropTargetDropEvent) {
396+
try {
397+
evt.acceptDrop(DnDConstants.ACTION_COPY)
398+
val droppedFiles = evt.transferable.getTransferData(DataFlavor.javaFileListFlavor) as List<File>
399+
for (file in droppedFiles) {
400+
fileListModel.addElement(
401+
ImageFile(
402+
file.absolutePath
403+
)
402404
)
403-
)
405+
}
406+
} catch (ex: Exception) {
407+
// this is a workaround to make Intellij build work
408+
ex.printStackTrace()
404409
}
405-
} catch (ex: Exception) {
406-
ex.printStackTrace()
407410
}
408411
}
412+
} catch (ignore: java.awt.HeadlessException) {
413+
// Ignore, this is a headless exception
409414
}
410415
return fileList
411416
}

0 commit comments

Comments
 (0)