Unify OpenDatabaseAction and Importer #1165
Labels
component: cleanup-ops
dev: code-quality
Issues related to code or architecture decisions
[outdated] type: question
I had a look at how to fix #1080 and #1153 and recognized that there is quite some overlap between the Importer package and some code in GUI (in particular, the class OpenDatabaseAction).
I propose to unify the code used to open or import a database.
List<BibEntry> importEntries(InputStream in, OutputPrinter status)
inImportFormat
to a methodParserResult import(InputStream in)
which might also return some metadata. The returnedParserResult
contains potential error messages (which in my opinion is cleaner than letting JabRefFrame implement OutputPrinter).import(Path file, Charset defaultEncoding)
to the importer interface which opens the file and passes the stream to the other import method.import(Path file, Charset defaultEncoding)
and use the logic fromOpenDatabaseAction.loadDatabase
to determine the correct encoding.importFromFile
methods inImportFormatReader
can be removed.isRecognizedFormat
: this method is only used directly before the import, soImportFormat.import
can just return a corresponding warning message.What do you think about the proposed changes?
The text was updated successfully, but these errors were encountered: