Example #1
0
  public static void initAllExports(
      Map<String, ExportFormat> customFormats,
      LayoutFormatterPreferences layoutPreferences,
      SavePreferences savePreferences) {

    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);
    ef.setEncoding(StandardCharsets.UTF_8);
    ExportFormats.putFormat(ef);
    ExportFormats.putFormat(
        new ExportFormat(
            "MIS Quarterly", "misq", "misq", "misq", ".rtf", layoutPreferences, savePreferences));

    ExportFormats.putFormat(new BibTeXMLExportFormat());
    ExportFormats.putFormat(new OpenOfficeDocumentCreator());
    ExportFormats.putFormat(new OpenDocumentSpreadsheetCreator());
    ExportFormats.putFormat(new MSBibExportFormat());
    ExportFormats.putFormat(new ModsExportFormat());

    // Now add custom export formats
    for (IExportFormat format : customFormats.values()) {
      ExportFormats.putFormat(format);
    }
  }
Example #2
0
 private void updateAfterPreferenceChanges() {
   setValues();
   ExportFormats.initAllExports(Globals.prefs.customExports.getCustomExportFormats(Globals.prefs));
   frame.removeCachedEntryEditors();
   Globals.prefs.updateEntryEditorTabList();
 }
Example #3
0
  private static void start(String[] args) {
    JabRefPreferences preferences = JabRefPreferences.getInstance();

    ProxyPreferences proxyPreferences = ProxyPreferences.loadFromPreferences(preferences);
    ProxyRegisterer.register(proxyPreferences);
    if (proxyPreferences.isUseProxy() && proxyPreferences.isUseAuthentication()) {
      Authenticator.setDefault(new ProxyAuthenticator());
    }

    Globals.startBackgroundTasks();
    Globals.prefs = preferences;
    Localization.setLanguage(preferences.get(JabRefPreferences.LANGUAGE));
    Globals.prefs.setLanguageDependentDefaultValues();

    // Update which fields should be treated as numeric, based on preferences:
    InternalBibtexFields.setNumericFields(
        Globals.prefs.getStringList(JabRefPreferences.NUMERIC_FIELDS));

    /* Build list of Import and Export formats */
    Globals.IMPORT_FORMAT_READER.resetImportFormats();
    CustomEntryTypesManager.loadCustomEntryTypes(preferences);
    ExportFormats.initAllExports(Globals.prefs.customExports.getCustomExportFormats(Globals.prefs));

    // Read list(s) of journal names and abbreviations
    Globals.journalAbbreviationLoader = new JournalAbbreviationLoader();

    // Check for running JabRef
    RemotePreferences remotePreferences = new RemotePreferences(Globals.prefs);
    if (remotePreferences.useRemoteServer()) {
      Globals.REMOTE_LISTENER.open(new JabRefMessageHandler(), remotePreferences.getPort());

      if (!Globals.REMOTE_LISTENER.isOpen()) {
        // we are not alone, there is already a server out there, try to contact already running
        // JabRef:
        if (RemoteListenerClient.sendToActiveJabRefInstance(args, remotePreferences.getPort())) {
          // We have successfully sent our command line options through the socket to another JabRef
          // instance.
          // So we assume it's all taken care of, and quit.
          LOGGER.info(
              Localization.lang("Arguments passed on to running JabRef instance. Shutting down."));
          JabRefExecutorService.INSTANCE.shutdownEverything();
          return;
        }
      }
      // we are alone, we start the server
      Globals.REMOTE_LISTENER.start();
    }

    // override used newline character with the one stored in the preferences
    // The preferences return the system newline character sequence as default
    OS.NEWLINE = Globals.prefs.get(JabRefPreferences.NEWLINE);

    // Process arguments
    ArgumentProcessor argumentProcessor =
        new ArgumentProcessor(args, ArgumentProcessor.Mode.INITIAL_START);

    // See if we should shut down now
    if (argumentProcessor.shouldShutDown()) {
      JabRefExecutorService.INSTANCE.shutdownEverything();
      return;
    }

    // If not, start GUI
    SwingUtilities.invokeLater(
        () -> new JabRefGUI(argumentProcessor.getParserResults(), argumentProcessor.isBlank()));
  }