From 348c4e9bfc5afdd87bd9fbcb30cb68369fddad75 Mon Sep 17 00:00:00 2001 From: pjozeph Date: Tue, 19 Dec 2017 20:57:28 +0100 Subject: [PATCH 1/6] #2772 issue fixed --- .../jabref/logic/exporter/ExportFormat.java | 13 ++--- .../jabref/logic/exporter/ExportFormats.java | 47 +++++++------------ .../jabref/logic/exporter/IExportFormat.java | 3 +- .../exporter/OpenOfficeDocumentCreator.java | 3 +- .../org/jabref/logic/util/FileExtensions.java | 6 ++- 5 files changed, 32 insertions(+), 40 deletions(-) diff --git a/src/main/java/org/jabref/logic/exporter/ExportFormat.java b/src/main/java/org/jabref/logic/exporter/ExportFormat.java index 031b315d5c6..04c50f7fb7a 100644 --- a/src/main/java/org/jabref/logic/exporter/ExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/ExportFormat.java @@ -20,6 +20,7 @@ import org.jabref.logic.layout.Layout; import org.jabref.logic.layout.LayoutFormatterPreferences; import org.jabref.logic.layout.LayoutHelper; +import org.jabref.logic.util.FileExtensions; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; @@ -38,7 +39,7 @@ public class ExportFormat implements IExportFormat { private String consoleName; private String lfFileName; private String directory; - private String extension; + private FileExtensions extension; private Charset encoding; // If this value is set, it will be used to override // the default encoding for the getCurrentBasePanel. private LayoutFormatterPreferences layoutPreferences; @@ -56,7 +57,7 @@ public class ExportFormat implements IExportFormat { * @param directory Directory in which to find the layout file. * @param extension Should contain the . (for instance .txt). */ - public ExportFormat(String displayName, String consoleName, String lfFileName, String directory, String extension) { + public ExportFormat(String displayName, String consoleName, String lfFileName, String directory, FileExtensions extension) { this.displayName = displayName; this.consoleName = consoleName; this.lfFileName = lfFileName; @@ -76,8 +77,8 @@ public ExportFormat(String displayName, String consoleName, String lfFileName, S * @param layoutPreferences Preferences for layout * @param savePreferences Preferences for saving */ - public ExportFormat(String displayName, String consoleName, String lfFileName, String directory, String extension, - LayoutFormatterPreferences layoutPreferences, SavePreferences savePreferences) { + public ExportFormat(String displayName, String consoleName, String lfFileName, String directory, + FileExtensions extension, LayoutFormatterPreferences layoutPreferences, SavePreferences savePreferences) { this(displayName, consoleName, lfFileName, directory, extension); this.layoutPreferences = layoutPreferences; this.savePreferences = savePreferences; @@ -131,7 +132,7 @@ public void setEncoding(Charset encoding) { * @see IExportFormat#getExtension() */ @Override - public String getExtension() { + public FileExtensions getExtension() { return extension; } @@ -239,7 +240,7 @@ public void performExport(final BibDatabaseContext databaseContext, final String Layout defLayout; LayoutHelper layoutHelper; try (Reader reader = getReader(lfFileName + ".layout")) { - layoutHelper = new LayoutHelper(reader,layoutPreferences); + layoutHelper = new LayoutHelper(reader, layoutPreferences); defLayout = layoutHelper.getLayoutFromText(); } if (defLayout != null) { diff --git a/src/main/java/org/jabref/logic/exporter/ExportFormats.java b/src/main/java/org/jabref/logic/exporter/ExportFormats.java index c24a165c694..60aae96a4d5 100644 --- a/src/main/java/org/jabref/logic/exporter/ExportFormats.java +++ b/src/main/java/org/jabref/logic/exporter/ExportFormats.java @@ -7,6 +7,7 @@ import org.jabref.logic.l10n.Localization; import org.jabref.logic.layout.LayoutFormatterPreferences; +import org.jabref.logic.util.FileExtensions; public class ExportFormats { @@ -24,38 +25,23 @@ public static void initAllExports(Map customFormats, ExportFormats.EXPORT_FORMATS.clear(); // Initialize Build-In Export Formats - ExportFormats - .putFormat(new ExportFormat("HTML", "html", "html", null, ".html", layoutPreferences, savePreferences)); - ExportFormats.putFormat(new ExportFormat(Localization.lang("Simple HTML"), "simplehtml", "simplehtml", null, - ".html", layoutPreferences, savePreferences)); - ExportFormats.putFormat(new ExportFormat("DocBook 4.4", "docbook", "docbook", null, ".xml", layoutPreferences, - savePreferences)); - ExportFormats.putFormat(new ExportFormat("DIN 1505", "din1505", "din1505winword", "din1505", ".rtf", - layoutPreferences, savePreferences)); - ExportFormats.putFormat( - new ExportFormat("BibO RDF", "bibordf", "bibordf", null, ".rdf", layoutPreferences, savePreferences)); - ExportFormats.putFormat(new ExportFormat(Localization.lang("HTML table"), "tablerefs", "tablerefs", "tablerefs", - ".html", layoutPreferences, savePreferences)); - ExportFormats.putFormat(new ExportFormat(Localization.lang("HTML list"), "listrefs", "listrefs", "listrefs", - ".html", layoutPreferences, savePreferences)); - ExportFormats.putFormat(new ExportFormat(Localization.lang("HTML table (with Abstract & BibTeX)"), - "tablerefsabsbib", "tablerefsabsbib", "tablerefsabsbib", ".html", layoutPreferences, savePreferences)); - ExportFormats.putFormat(new ExportFormat("Harvard RTF", "harvard", "harvard", "harvard", ".rtf", - layoutPreferences, savePreferences)); - ExportFormats.putFormat(new ExportFormat("ISO 690 RTF", "iso690rtf", "iso690RTF", "iso690rtf", ".rtf", - layoutPreferences, savePreferences)); - ExportFormats.putFormat(new ExportFormat("ISO 690", "iso690txt", "iso690", "iso690txt", ".txt", - layoutPreferences, savePreferences)); - ExportFormats.putFormat(new ExportFormat("Endnote", "endnote", "EndNote", "endnote", ".txt", layoutPreferences, - savePreferences)); - ExportFormats.putFormat(new ExportFormat("OpenOffice/LibreOffice CSV", "oocsv", "openoffice-csv", "openoffice", - ".csv", layoutPreferences, savePreferences)); - ExportFormat ef = new ExportFormat("RIS", "ris", "ris", "ris", ".ris", layoutPreferences, savePreferences); + putFormat(new ExportFormat("HTML", "html", "html", null, FileExtensions.HTML, layoutPreferences, savePreferences)); + putFormat(new ExportFormat(Localization.lang("Simple HTML"), "simplehtml", "simplehtml", null, FileExtensions.HTML, layoutPreferences, savePreferences)); + putFormat(new ExportFormat("DocBook 4.4", "docbook", "docbook", "", FileExtensions.XML, layoutPreferences, savePreferences)); + putFormat(new ExportFormat("DIN 1505", "din1505", "din1505winword", "din1505", FileExtensions.RTF, layoutPreferences, savePreferences)); + putFormat(new ExportFormat("BibO RDF", "bibordf", "bibordf", null, FileExtensions.RDF, layoutPreferences, savePreferences)); + putFormat(new ExportFormat(Localization.lang("HTML table"), "tablerefs", "tablerefs", "tablerefs", FileExtensions.HTML, layoutPreferences, savePreferences)); + putFormat(new ExportFormat(Localization.lang("HTML list"), "listrefs", "listrefs", "listrefs", FileExtensions.HTML, layoutPreferences, savePreferences)); + putFormat(new ExportFormat(Localization.lang("HTML table (with Abstract & BibTeX)"), "tablerefsabsbib", "tablerefsabsbib", "tablerefsabsbib", FileExtensions.HTML, layoutPreferences, savePreferences)); + putFormat(new ExportFormat("Harvard RTF", "harvard", "harvard", "harvard", FileExtensions.RTF, layoutPreferences, savePreferences)); + putFormat(new ExportFormat("ISO 690 RTF", "iso690rtf", "iso690RTF", "iso690rtf", FileExtensions.RTF, layoutPreferences, savePreferences)); + putFormat(new ExportFormat("ISO 690", "iso690txt", "iso690", "iso690txt", FileExtensions.TXT, layoutPreferences, savePreferences)); + putFormat(new ExportFormat("Endnote", "endnote", "EndNote", "endnote", FileExtensions.TXT, layoutPreferences, savePreferences)); + putFormat(new ExportFormat("OpenOffice/LibreOffice CSV", "oocsv", "openoffice-csv", "openoffice", FileExtensions.CSV, layoutPreferences, savePreferences)); + ExportFormat ef = new ExportFormat("RIS", "ris", "ris", "ris", FileExtensions.RIS, layoutPreferences, savePreferences); ef.setEncoding(StandardCharsets.UTF_8); ExportFormats.putFormat(ef); - ExportFormats.putFormat( - new ExportFormat("MIS Quarterly", "misq", "misq", "misq", ".rtf", layoutPreferences, savePreferences)); - + putFormat(new ExportFormat("MIS Quarterly", "misq", "misq", "misq", FileExtensions.RTF, layoutPreferences, savePreferences)); ExportFormats.putFormat(new BibTeXMLExportFormat()); ExportFormats.putFormat(new OpenOfficeDocumentCreator()); ExportFormats.putFormat(new OpenDocumentSpreadsheetCreator()); @@ -120,5 +106,4 @@ public static IExportFormat getExportFormat(String consoleName) { private static void putFormat(IExportFormat format) { ExportFormats.EXPORT_FORMATS.put(format.getConsoleName(), format); } - } diff --git a/src/main/java/org/jabref/logic/exporter/IExportFormat.java b/src/main/java/org/jabref/logic/exporter/IExportFormat.java index b2f5a9b781a..cdb700a6adf 100644 --- a/src/main/java/org/jabref/logic/exporter/IExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/IExportFormat.java @@ -3,6 +3,7 @@ import java.nio.charset.Charset; import java.util.List; +import org.jabref.logic.util.FileExtensions; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; @@ -19,7 +20,7 @@ public interface IExportFormat { */ String getDisplayName(); - String getExtension(); + FileExtensions getExtension(); /** * Perform the export. diff --git a/src/main/java/org/jabref/logic/exporter/OpenOfficeDocumentCreator.java b/src/main/java/org/jabref/logic/exporter/OpenOfficeDocumentCreator.java index 9ff44af698f..e729d2e4726 100644 --- a/src/main/java/org/jabref/logic/exporter/OpenOfficeDocumentCreator.java +++ b/src/main/java/org/jabref/logic/exporter/OpenOfficeDocumentCreator.java @@ -24,6 +24,7 @@ import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; +import org.jabref.logic.util.FileExtensions; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; @@ -43,7 +44,7 @@ public class OpenOfficeDocumentCreator extends ExportFormat { * Creates a new instance of OpenOfficeDocumentCreator */ public OpenOfficeDocumentCreator() { - super("OpenOffice/LibreOffice Calc", "oocalc", null, null, ".sxc"); + super("OpenOffice/LibreOffice Calc", "oocalc", null, null, FileExtensions.CSV); } @Override diff --git a/src/main/java/org/jabref/logic/util/FileExtensions.java b/src/main/java/org/jabref/logic/util/FileExtensions.java index 9f4a5c2173d..38e1d449968 100644 --- a/src/main/java/org/jabref/logic/util/FileExtensions.java +++ b/src/main/java/org/jabref/logic/util/FileExtensions.java @@ -42,7 +42,11 @@ public enum FileExtensions { CLASS(Localization.lang("%0 file", "CLASS"), "class"), JAR(Localization.lang("%0 file", "JAR"), "jar"), XML(Localization.lang("%0 file", "XML"), "xml"), - ZIP(Localization.lang("%0 file", "ZIP"), "zip"); + ZIP(Localization.lang("%0 file", "ZIP"), "zip"), + HTML(Localization.lang("%0 file", "HTML"), "html"), + RTF(Localization.lang("%0 file", "RTF"), "rtf"), + CSV(Localization.lang("%0 file", "CSV"), "csv"), + RDF(Localization.lang("%0 file", "RDF"), "rdf"); private final String[] extension; private final String description; From 11f477625eaa80c99af56aee6c102662a4c23b32 Mon Sep 17 00:00:00 2001 From: pjozeph Date: Wed, 20 Dec 2017 09:44:23 +0100 Subject: [PATCH 2/6] #2772 issue fixed --- .../org/jabref/gui/exporter/ExportAction.java | 2 +- .../jabref/gui/exporter/ExportFileFilter.java | 9 +++--- .../logic/exporter/BibTeXMLExportFormat.java | 19 ++--------- .../jabref/logic/exporter/ExportFormat.java | 2 +- .../jabref/logic/exporter/ExportFormats.java | 8 ++++- .../jabref/logic/exporter/IExportFormat.java | 3 +- .../logic/exporter/MSBibExportFormat.java | 3 +- .../logic/exporter/ModsExportFormat.java | 32 ++----------------- .../OpenDocumentSpreadsheetCreator.java | 4 ++- .../jabref/preferences/CustomExportList.java | 5 ++- 10 files changed, 27 insertions(+), 60 deletions(-) diff --git a/src/main/java/org/jabref/gui/exporter/ExportAction.java b/src/main/java/org/jabref/gui/exporter/ExportAction.java index 306aff7d677..f0f1d5c735d 100644 --- a/src/main/java/org/jabref/gui/exporter/ExportAction.java +++ b/src/main/java/org/jabref/gui/exporter/ExportAction.java @@ -82,7 +82,7 @@ public void actionPerformed(ActionEvent e) { ExportFileFilter eff = (ExportFileFilter) ff; String path = file.getPath(); - if (!path.endsWith(eff.getExtension())) { + if (!path.endsWith(eff.getExtension().toString())) { path = path + eff.getExtension(); } file = new File(path); diff --git a/src/main/java/org/jabref/gui/exporter/ExportFileFilter.java b/src/main/java/org/jabref/gui/exporter/ExportFileFilter.java index 88022ce77b3..ea81ee92b89 100644 --- a/src/main/java/org/jabref/gui/exporter/ExportFileFilter.java +++ b/src/main/java/org/jabref/gui/exporter/ExportFileFilter.java @@ -6,6 +6,7 @@ import javax.swing.filechooser.FileFilter; import org.jabref.logic.exporter.IExportFormat; +import org.jabref.logic.util.FileExtensions; /** * File filter that lets the user choose export format while choosing file to @@ -14,13 +15,13 @@ public class ExportFileFilter extends FileFilter implements Comparable { private final IExportFormat format; - private final String extension; + private final FileExtensions extension; private final String name; public ExportFileFilter(IExportFormat format) { this.format = format; - this.extension = format.getExtension(); + this.extension = format.getFileExtension(); this.name = format.getDisplayName() + " (*" + extension + ')'; } @@ -29,7 +30,7 @@ public IExportFormat getExportFormat() { return format; } - public String getExtension() { + public FileExtensions getExtension() { return extension; } @@ -38,7 +39,7 @@ public boolean accept(File file) { if (file.isDirectory()) { return true; } else { - return file.getPath().toLowerCase(Locale.ROOT).endsWith(extension); + return file.getPath().toLowerCase(Locale.ROOT).endsWith(extension.toString()); } } diff --git a/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java b/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java index 5aaacfd7d3c..42a7786fbe9 100644 --- a/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java @@ -20,22 +20,7 @@ import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; -import org.jabref.logic.importer.fileformat.bibtexml.Article; -import org.jabref.logic.importer.fileformat.bibtexml.Book; -import org.jabref.logic.importer.fileformat.bibtexml.Booklet; -import org.jabref.logic.importer.fileformat.bibtexml.Conference; -import org.jabref.logic.importer.fileformat.bibtexml.Entry; -import org.jabref.logic.importer.fileformat.bibtexml.File; -import org.jabref.logic.importer.fileformat.bibtexml.Inbook; -import org.jabref.logic.importer.fileformat.bibtexml.Incollection; -import org.jabref.logic.importer.fileformat.bibtexml.Inproceedings; -import org.jabref.logic.importer.fileformat.bibtexml.Manual; -import org.jabref.logic.importer.fileformat.bibtexml.Mastersthesis; -import org.jabref.logic.importer.fileformat.bibtexml.Misc; -import org.jabref.logic.importer.fileformat.bibtexml.Phdthesis; -import org.jabref.logic.importer.fileformat.bibtexml.Proceedings; -import org.jabref.logic.importer.fileformat.bibtexml.Techreport; -import org.jabref.logic.importer.fileformat.bibtexml.Unpublished; +import org.jabref.logic.util.FileExtensions; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; @@ -54,7 +39,7 @@ public class BibTeXMLExportFormat extends ExportFormat { public BibTeXMLExportFormat() { - super("BibTeXML", "bibtexml", null, null, ".xml"); + super("BibTeXML", "bibtexml", null, null, FileExtensions.XML); } @Override diff --git a/src/main/java/org/jabref/logic/exporter/ExportFormat.java b/src/main/java/org/jabref/logic/exporter/ExportFormat.java index 04c50f7fb7a..a8adbd7e7e6 100644 --- a/src/main/java/org/jabref/logic/exporter/ExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/ExportFormat.java @@ -132,7 +132,7 @@ public void setEncoding(Charset encoding) { * @see IExportFormat#getExtension() */ @Override - public FileExtensions getExtension() { + public FileExtensions getFileExtension() { return extension; } diff --git a/src/main/java/org/jabref/logic/exporter/ExportFormats.java b/src/main/java/org/jabref/logic/exporter/ExportFormats.java index 60aae96a4d5..6c82f707318 100644 --- a/src/main/java/org/jabref/logic/exporter/ExportFormats.java +++ b/src/main/java/org/jabref/logic/exporter/ExportFormats.java @@ -22,7 +22,7 @@ private ExportFormats() { public static void initAllExports(Map customFormats, LayoutFormatterPreferences layoutPreferences, SavePreferences savePreferences) { - ExportFormats.EXPORT_FORMATS.clear(); + EXPORT_FORMATS.clear(); // Initialize Build-In Export Formats putFormat(new ExportFormat("HTML", "html", "html", null, FileExtensions.HTML, layoutPreferences, savePreferences)); @@ -106,4 +106,10 @@ public static IExportFormat getExportFormat(String consoleName) { private static void putFormat(IExportFormat format) { ExportFormats.EXPORT_FORMATS.put(format.getConsoleName(), format); } + + // getExtension from ExportFormat map + public static FileExtensions getFileExtension(String extension) { + ExportFormat exportFormat = (ExportFormat) EXPORT_FORMATS.get(extension); + return exportFormat.getFileExtension(); + } } diff --git a/src/main/java/org/jabref/logic/exporter/IExportFormat.java b/src/main/java/org/jabref/logic/exporter/IExportFormat.java index cdb700a6adf..e634c8f2c43 100644 --- a/src/main/java/org/jabref/logic/exporter/IExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/IExportFormat.java @@ -20,7 +20,8 @@ public interface IExportFormat { */ String getDisplayName(); - FileExtensions getExtension(); + FileExtensions getFileExtension(); + /** * Perform the export. diff --git a/src/main/java/org/jabref/logic/exporter/MSBibExportFormat.java b/src/main/java/org/jabref/logic/exporter/MSBibExportFormat.java index 1aafd5436e3..1f1bd7394ce 100644 --- a/src/main/java/org/jabref/logic/exporter/MSBibExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/MSBibExportFormat.java @@ -16,6 +16,7 @@ import javax.xml.transform.stream.StreamResult; import org.jabref.logic.msbib.MSBibDatabase; +import org.jabref.logic.util.FileExtensions; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; @@ -25,7 +26,7 @@ class MSBibExportFormat extends ExportFormat { public MSBibExportFormat() { - super("MS Office 2007", "MSBib", null, null, ".xml"); + super("MS Office 2007", "MSBib", null, null, FileExtensions.XML); } @Override diff --git a/src/main/java/org/jabref/logic/exporter/ModsExportFormat.java b/src/main/java/org/jabref/logic/exporter/ModsExportFormat.java index 45055f5d25f..5781d7aaa19 100644 --- a/src/main/java/org/jabref/logic/exporter/ModsExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/ModsExportFormat.java @@ -14,35 +14,7 @@ import javax.xml.bind.Marshaller; import javax.xml.namespace.QName; -import org.jabref.logic.importer.fileformat.mods.AbstractDefinition; -import org.jabref.logic.importer.fileformat.mods.CodeOrText; -import org.jabref.logic.importer.fileformat.mods.DateDefinition; -import org.jabref.logic.importer.fileformat.mods.DetailDefinition; -import org.jabref.logic.importer.fileformat.mods.ExtentDefinition; -import org.jabref.logic.importer.fileformat.mods.GenreDefinition; -import org.jabref.logic.importer.fileformat.mods.IdentifierDefinition; -import org.jabref.logic.importer.fileformat.mods.IssuanceDefinition; -import org.jabref.logic.importer.fileformat.mods.LanguageDefinition; -import org.jabref.logic.importer.fileformat.mods.LanguageTermDefinition; -import org.jabref.logic.importer.fileformat.mods.LocationDefinition; -import org.jabref.logic.importer.fileformat.mods.ModsCollectionDefinition; -import org.jabref.logic.importer.fileformat.mods.ModsDefinition; -import org.jabref.logic.importer.fileformat.mods.NameDefinition; -import org.jabref.logic.importer.fileformat.mods.NamePartDefinition; -import org.jabref.logic.importer.fileformat.mods.NoteDefinition; -import org.jabref.logic.importer.fileformat.mods.OriginInfoDefinition; -import org.jabref.logic.importer.fileformat.mods.PartDefinition; -import org.jabref.logic.importer.fileformat.mods.PhysicalLocationDefinition; -import org.jabref.logic.importer.fileformat.mods.PlaceDefinition; -import org.jabref.logic.importer.fileformat.mods.PlaceTermDefinition; -import org.jabref.logic.importer.fileformat.mods.RelatedItemDefinition; -import org.jabref.logic.importer.fileformat.mods.StringPlusLanguage; -import org.jabref.logic.importer.fileformat.mods.StringPlusLanguagePlusAuthority; -import org.jabref.logic.importer.fileformat.mods.StringPlusLanguagePlusSupplied; -import org.jabref.logic.importer.fileformat.mods.SubjectDefinition; -import org.jabref.logic.importer.fileformat.mods.TitleInfoDefinition; -import org.jabref.logic.importer.fileformat.mods.TypeOfResourceDefinition; -import org.jabref.logic.importer.fileformat.mods.UrlDefinition; +import org.jabref.logic.util.FileExtensions; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.FieldName; @@ -61,7 +33,7 @@ class ModsExportFormat extends ExportFormat { public ModsExportFormat() { - super("MODS", "mods", null, null, ".xml"); + super("MODS", "mods", null, null, FileExtensions.XML); } @Override diff --git a/src/main/java/org/jabref/logic/exporter/OpenDocumentSpreadsheetCreator.java b/src/main/java/org/jabref/logic/exporter/OpenDocumentSpreadsheetCreator.java index dd44fe3ee00..195eb0b2379 100644 --- a/src/main/java/org/jabref/logic/exporter/OpenDocumentSpreadsheetCreator.java +++ b/src/main/java/org/jabref/logic/exporter/OpenDocumentSpreadsheetCreator.java @@ -26,6 +26,7 @@ import javax.xml.transform.stream.StreamResult; import org.jabref.logic.l10n.Localization; +import org.jabref.logic.util.FileExtensions; import org.jabref.model.database.BibDatabase; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; @@ -45,7 +46,8 @@ public class OpenDocumentSpreadsheetCreator extends ExportFormat { * Creates a new instance of OpenOfficeDocumentCreator */ public OpenDocumentSpreadsheetCreator() { - super(Localization.lang("OpenDocument spreadsheet"), "ods", null, null, ".ods"); + super(Localization.lang("OpenDocument spreadsheet"), "ods", null, null, FileExtensions.CSV); + } @Override diff --git a/src/main/java/org/jabref/preferences/CustomExportList.java b/src/main/java/org/jabref/preferences/CustomExportList.java index db63efc8366..92a9faa9366 100644 --- a/src/main/java/org/jabref/preferences/CustomExportList.java +++ b/src/main/java/org/jabref/preferences/CustomExportList.java @@ -8,10 +8,10 @@ import java.util.TreeMap; import org.jabref.logic.exporter.ExportFormat; +import org.jabref.logic.exporter.ExportFormats; import org.jabref.logic.exporter.SavePreferences; import org.jabref.logic.journals.JournalAbbreviationLoader; import org.jabref.logic.layout.LayoutFormatterPreferences; - import ca.odell.glazedlists.BasicEventList; import ca.odell.glazedlists.EventList; import ca.odell.glazedlists.SortedList; @@ -90,8 +90,7 @@ private Optional createFormat(List s, LayoutFormatterPrefe } else { lfFileName = s.get(1); } - ExportFormat format = new ExportFormat(s.get(0), s.get(0), lfFileName, null, s.get(2), layoutPreferences, - savePreferences); + ExportFormat format = new ExportFormat(s.get(0), s.get(0), lfFileName, null, ExportFormats.getFileExtension(s.get(2)), layoutPreferences, savePreferences); format.setCustomExport(true); return Optional.of(format); } From c92b0f65f55a889bb2fb5fe30486d70d3419231d Mon Sep 17 00:00:00 2001 From: pjozeph Date: Wed, 20 Dec 2017 11:05:52 +0100 Subject: [PATCH 3/6] imports --- .../logic/exporter/BibTeXMLExportFormat.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java b/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java index 42a7786fbe9..2ca3ba378f4 100644 --- a/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java @@ -1,5 +1,6 @@ package org.jabref.logic.exporter; +import java.io.File; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.math.BigInteger; @@ -19,13 +20,27 @@ import javax.xml.datatype.DatatypeFactory; import javax.xml.datatype.XMLGregorianCalendar; import javax.xml.namespace.QName; - import org.jabref.logic.util.FileExtensions; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry; - import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.jabref.logic.importer.fileformat.bibtexml.Article; +import org.jabref.logic.importer.fileformat.bibtexml.Book; +import org.jabref.logic.importer.fileformat.bibtexml.Booklet; +import org.jabref.logic.importer.fileformat.bibtexml.Conference; +import org.jabref.logic.importer.fileformat.bibtexml.Entry; +import org.jabref.logic.importer.fileformat.bibtexml.File; +import org.jabref.logic.importer.fileformat.bibtexml.Inbook; +import org.jabref.logic.importer.fileformat.bibtexml.Incollection; +import org.jabref.logic.importer.fileformat.bibtexml.Inproceedings; +import org.jabref.logic.importer.fileformat.bibtexml.Manual; +import org.jabref.logic.importer.fileformat.bibtexml.Mastersthesis; +import org.jabref.logic.importer.fileformat.bibtexml.Misc; +import org.jabref.logic.importer.fileformat.bibtexml.Phdthesis; +import org.jabref.logic.importer.fileformat.bibtexml.Proceedings; +import org.jabref.logic.importer.fileformat.bibtexml.Techreport; +import org.jabref.logic.importer.fileformat.bibtexml.Unpublished; /** * Export format for the BibTeXML format. From 4a54175c57d9be7a3c3bcd1db96a968ec4e8e1ba Mon Sep 17 00:00:00 2001 From: pjozeph Date: Wed, 20 Dec 2017 18:34:55 +0100 Subject: [PATCH 4/6] after patch --- src/main/java/org/jabref/gui/fieldeditors/EditorTextArea.java | 2 +- .../java/org/jabref/logic/exporter/BibTeXMLExportFormat.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/jabref/gui/fieldeditors/EditorTextArea.java b/src/main/java/org/jabref/gui/fieldeditors/EditorTextArea.java index 19a98457601..17e4e4d3ff1 100644 --- a/src/main/java/org/jabref/gui/fieldeditors/EditorTextArea.java +++ b/src/main/java/org/jabref/gui/fieldeditors/EditorTextArea.java @@ -11,7 +11,7 @@ import javafx.scene.input.KeyCode; import javafx.scene.input.KeyEvent; -import com.sun.javafx.scene.control.skin.TextAreaSkin; +//import com.sun.javafx.scene.control.skin.TextAreaSkin; public class EditorTextArea extends javafx.scene.control.TextArea implements Initializable { diff --git a/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java b/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java index 2ca3ba378f4..466aed95446 100644 --- a/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java @@ -41,7 +41,6 @@ import org.jabref.logic.importer.fileformat.bibtexml.Proceedings; import org.jabref.logic.importer.fileformat.bibtexml.Techreport; import org.jabref.logic.importer.fileformat.bibtexml.Unpublished; - /** * Export format for the BibTeXML format. */ From abe3408c6e4e8ea419c82a7cba80bebcf139bc41 Mon Sep 17 00:00:00 2001 From: pjozeph Date: Wed, 20 Dec 2017 19:21:52 +0100 Subject: [PATCH 5/6] java.io.File removed --- .../java/org/jabref/logic/exporter/BibTeXMLExportFormat.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java b/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java index 466aed95446..4c073c8aae4 100644 --- a/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/BibTeXMLExportFormat.java @@ -1,6 +1,5 @@ package org.jabref.logic.exporter; -import java.io.File; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.math.BigInteger; From e04fd20617903b364d7dbdfde702bcf236443878 Mon Sep 17 00:00:00 2001 From: pjozeph Date: Wed, 20 Dec 2017 19:22:19 +0100 Subject: [PATCH 6/6] java.io.File removed --- .../logic/exporter/ModsExportFormat.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jabref/logic/exporter/ModsExportFormat.java b/src/main/java/org/jabref/logic/exporter/ModsExportFormat.java index 5781d7aaa19..3fc8fc769c7 100644 --- a/src/main/java/org/jabref/logic/exporter/ModsExportFormat.java +++ b/src/main/java/org/jabref/logic/exporter/ModsExportFormat.java @@ -1,6 +1,5 @@ package org.jabref.logic.exporter; -import java.io.File; import java.io.IOException; import java.math.BigInteger; import java.nio.charset.Charset; @@ -14,6 +13,36 @@ import javax.xml.bind.Marshaller; import javax.xml.namespace.QName; +import org.jabref.logic.importer.fileformat.bibtexml.File; +import org.jabref.logic.importer.fileformat.mods.AbstractDefinition; +import org.jabref.logic.importer.fileformat.mods.CodeOrText; +import org.jabref.logic.importer.fileformat.mods.DateDefinition; +import org.jabref.logic.importer.fileformat.mods.DetailDefinition; +import org.jabref.logic.importer.fileformat.mods.ExtentDefinition; +import org.jabref.logic.importer.fileformat.mods.GenreDefinition; +import org.jabref.logic.importer.fileformat.mods.IdentifierDefinition; +import org.jabref.logic.importer.fileformat.mods.IssuanceDefinition; +import org.jabref.logic.importer.fileformat.mods.LanguageDefinition; +import org.jabref.logic.importer.fileformat.mods.LanguageTermDefinition; +import org.jabref.logic.importer.fileformat.mods.LocationDefinition; +import org.jabref.logic.importer.fileformat.mods.ModsCollectionDefinition; +import org.jabref.logic.importer.fileformat.mods.ModsDefinition; +import org.jabref.logic.importer.fileformat.mods.NameDefinition; +import org.jabref.logic.importer.fileformat.mods.NamePartDefinition; +import org.jabref.logic.importer.fileformat.mods.NoteDefinition; +import org.jabref.logic.importer.fileformat.mods.OriginInfoDefinition; +import org.jabref.logic.importer.fileformat.mods.PartDefinition; +import org.jabref.logic.importer.fileformat.mods.PhysicalLocationDefinition; +import org.jabref.logic.importer.fileformat.mods.PlaceDefinition; +import org.jabref.logic.importer.fileformat.mods.PlaceTermDefinition; +import org.jabref.logic.importer.fileformat.mods.RelatedItemDefinition; +import org.jabref.logic.importer.fileformat.mods.StringPlusLanguage; +import org.jabref.logic.importer.fileformat.mods.StringPlusLanguagePlusAuthority; +import org.jabref.logic.importer.fileformat.mods.StringPlusLanguagePlusSupplied; +import org.jabref.logic.importer.fileformat.mods.SubjectDefinition; +import org.jabref.logic.importer.fileformat.mods.TitleInfoDefinition; +import org.jabref.logic.importer.fileformat.mods.TypeOfResourceDefinition; +import org.jabref.logic.importer.fileformat.mods.UrlDefinition; import org.jabref.logic.util.FileExtensions; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.entry.BibEntry;