Package net.sf.jabref.imports

Examples of net.sf.jabref.imports.OpenDatabaseAction


   *            The names of the files to open.
   * @param dropRow success status for the operation
   */
  private void loadOrImportFiles(String[] fileNames, int dropRow) {

    OpenDatabaseAction openAction = new OpenDatabaseAction(frame, false);
    ArrayList<String> notBibFiles = new ArrayList<String>();
    String encoding = Globals.prefs.get("defaultEncoding");
    for (int i = 0; i < fileNames.length; i++) {
      // Find the file's extension, if any:
            String extension = "";
      ExternalFileType fileType = null;
      int index = fileNames[i].lastIndexOf('.');
      if ((index >= 0) && (index < fileNames[i].length())) {
        extension = fileNames[i].substring(index + 1).toLowerCase();
        fileType = Globals.prefs.getExternalFileTypeByExt(extension);
      }
      if (extension.equals("bib")) {
        File f = new File(fileNames[i]);
        try {
          ParserResult pr = OpenDatabaseAction.loadDatabase(f, encoding);
          if ((pr == null) || (pr == ParserResult.INVALID_FORMAT)) {
            notBibFiles.add(fileNames[i]);
          } else {
            openAction.addNewDatabase(pr, f, true);
                        frame.getFileHistory().newFile(fileNames[i]);
                    }
        } catch (IOException e) {
          notBibFiles.add(fileNames[i]);
          // No error message, since we want to try importing the
View Full Code Here

TOP

Related Classes of net.sf.jabref.imports.OpenDatabaseAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.