use of org.jabref.logic.importer.fileformat.FreeCiteImporter in project jabref by JabRef.
the class BasicAction method parseWithFreeCiteAndAddEntries.
/**
* tries to parse the pasted reference with freecite
*
* @return true if successful, false otherwise
*/
private boolean parseWithFreeCiteAndAddEntries() {
FreeCiteImporter fimp = new FreeCiteImporter(Globals.prefs.getImportFormatPreferences());
String text = textPane.getText();
// we have to remove line breaks (but keep empty lines)
// otherwise, the result is broken
text = text.replace(OS.NEWLINE.concat(OS.NEWLINE), "##NEWLINE##");
// possible URL line breaks are removed completely.
text = text.replace("/".concat(OS.NEWLINE), "/");
text = text.replace(OS.NEWLINE, " ");
text = text.replace("##NEWLINE##", OS.NEWLINE);
ParserResult importerResult = fimp.importEntries(text);
if (importerResult.hasWarnings()) {
frame.showMessage(importerResult.getErrorMessage());
}
List<BibEntry> importedEntries = importerResult.getDatabase().getEntries();
if (importedEntries.isEmpty()) {
return false;
} else {
UpdateField.setAutomaticFields(importedEntries, false, false, Globals.prefs.getUpdateFieldPreferences());
boolean markEntries = EntryMarker.shouldMarkEntries();
for (BibEntry e : importedEntries) {
if (markEntries) {
EntryMarker.markEntry(entry, EntryMarker.IMPORT_MARK_LEVEL, false, new NamedCompound(""));
}
frame.getCurrentBasePanel().insertEntry(e);
}
return true;
}
}
use of org.jabref.logic.importer.fileformat.FreeCiteImporter in project jabref by JabRef.
the class ImporterTest method instancesToTest.
@Parameters(name = "{index}: {0}")
public static Collection<Object[]> instancesToTest() {
// all classes implementing {@link Importer}
// sorted alphabetically
ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class);
XMPPreferences xmpPreferences = mock(XMPPreferences.class);
// @formatter:off
return Arrays.asList(new Object[] { new BiblioscapeImporter() }, new Object[] { new BibtexImporter(importFormatPreferences) }, new Object[] { new BibTeXMLImporter() }, new Object[] { new CopacImporter() }, new Object[] { new EndnoteImporter(importFormatPreferences) }, new Object[] { new FreeCiteImporter(importFormatPreferences) }, new Object[] { new InspecImporter() }, new Object[] { new IsiImporter() }, new Object[] { new MedlineImporter() }, new Object[] { new MedlinePlainImporter() }, new Object[] { new ModsImporter() }, new Object[] { new MsBibImporter() }, new Object[] { new OvidImporter() }, new Object[] { new PdfContentImporter(importFormatPreferences) }, new Object[] { new PdfXmpImporter(xmpPreferences) }, new Object[] { new RepecNepImporter(importFormatPreferences) }, new Object[] { new RisImporter() }, new Object[] { new SilverPlatterImporter() });
// @formatter:on
}
use of org.jabref.logic.importer.fileformat.FreeCiteImporter in project jabref by JabRef.
the class ImportFormatReader method resetImportFormats.
public void resetImportFormats(ImportFormatPreferences newImportFormatPreferences, XMPPreferences xmpPreferences) {
this.importFormatPreferences = newImportFormatPreferences;
formats.clear();
formats.add(new BiblioscapeImporter());
formats.add(new BibtexImporter(importFormatPreferences));
formats.add(new BibTeXMLImporter());
formats.add(new CopacImporter());
formats.add(new EndnoteImporter(importFormatPreferences));
formats.add(new FreeCiteImporter(importFormatPreferences));
formats.add(new InspecImporter());
formats.add(new IsiImporter());
formats.add(new MedlineImporter());
formats.add(new MedlinePlainImporter());
formats.add(new ModsImporter());
formats.add(new MsBibImporter());
formats.add(new OvidImporter());
formats.add(new PdfContentImporter(importFormatPreferences));
formats.add(new PdfXmpImporter(xmpPreferences));
formats.add(new RepecNepImporter(importFormatPreferences));
formats.add(new RisImporter());
formats.add(new SilverPlatterImporter());
// Get custom import formats
for (CustomImporter importer : importFormatPreferences.getCustomImportList()) {
formats.add(importer);
}
}
Aggregations