in src/rider/main/kotlin/com/jetbrains/rider/plugins/trxplugin/handlers/TrxFileDropHandler.kt [17:43]
override suspend fun handleDrop(e: FileDropEvent): Boolean {
for (file in e.files) {
if (file.extension.equals("trx", ignoreCase = true)) {
val trxImportService = e.project.getService(TrxImportService::class.java)
ApplicationManager.getApplication().invokeAndWait {
CoroutineScope(Dispatchers.Main).launch {
val response = trxImportService.importTrx(file.path)
if (response.result == "Failed") {
Messages.showErrorDialog(
TrxPluginBundle.message(response.message),
TrxPluginBundle.message("import.message.error.title")
)
}
}
}
continue
}
val fileEditorManager = FileEditorManager.getInstance(e.project)
val virtualFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file)
ApplicationManager.getApplication().invokeLater {
virtualFile?.let { fileEditorManager.openFile(it, true) }
}
}
return true
}