Package net.sf.jabref

Examples of net.sf.jabref.BibtexEntry


    // forall bibtex keys (found in aux-file) try to find an equivalent
    // entry into reference database
    while (it.hasNext())
    {
      String str = it.next() ;
      BibtexEntry entry = db.getEntryByKey(str);

      if (entry == null)
      {
        notFoundList.add(str) ;
      } else
      {
          insertEntry(auxDB, entry);
          // Check if the entry we just found references another entry which
          // we don't already have in our list of entries to include. If so,
          // pull in that entry as well:
          String crossref = entry.getField("crossref");
          if ((crossref != null) && (!mySet.contains(crossref))) {
              BibtexEntry refEntry = db.getEntryByKey(crossref);
              /**
               * [ 1717849 ] Patch for aux import by Kai Eckert
               */
              if (refEntry == null) {
                  notFoundList.add(crossref);
View Full Code Here


     * @param auxDB The database to insert into.
     * @param entry The entry to insert a copy of.
     */
    private void insertEntry(BibtexDatabase auxDB, BibtexEntry entry) {
        try {
            BibtexEntry clonedEntry = (BibtexEntry)entry.clone();
            clonedEntry.setId(Util.createNeutralId());
            auxDB.insertEntry(clonedEntry);
        } catch (KeyCollisionException e) {
            e.printStackTrace();
        }
    }
View Full Code Here

    /*
     * If this panel belongs in an entry editor, note which entry is
     * currently shown:
     */
    final BibtexEntry targetEntry;
    if (entryEditor != null)
      targetEntry = entryEditor.getEntry();
    else
      targetEntry = entry;

    (new Thread() {

      public String getPlannedFileName(String res) {
        String suffix = off.getSuffix(res);
        if (suffix == null)
          suffix = "." + fieldName.toLowerCase();

        String plannedName = null;
        if (getKey() != null)
          plannedName = getKey() + suffix;
        else {
          plannedName = JOptionPane.showInputDialog(parent, Globals
            .lang("BibTeX key not set. Enter a name for the downloaded file"));
          if (plannedName != null && !off.accept(plannedName))
            plannedName += suffix;
        }

        /*
         * [ 1548875 ] download pdf produces unsupported filename
         *
         * http://sourceforge.net/tracker/index.php?func=detail&aid=1548875&group_id=92314&atid=600306
         *
         */
        if (Globals.ON_WIN) {
          plannedName = plannedName.replaceAll(
            "\\?|\\*|\\<|\\>|\\||\\\"|\\:|\\.$|\\[|\\]", "");
        } else if (Globals.ON_MAC) {
          plannedName = plannedName.replaceAll(":", "");
        }

        return plannedName;
      }

      public void run() {
        String originalText = fieldEditor.getText();
        fieldEditor.setEnabled(false);
        boolean updateEditor = true;

        try {
          fieldEditor.setText(Globals.lang("Downloading..."));
          output(Globals.lang("Downloading..."));
          String plannedName = getPlannedFileName(res);

          // Find the default directory for this field type:
          String directory = metaData.getFileDirectory(fieldName);

          if (!new File(directory).exists()) {
            JOptionPane.showMessageDialog(parent, Globals.lang(
              "Could not find directory for %0-files: %1", fieldName, directory),
              Globals.lang("Download file"), JOptionPane.ERROR_MESSAGE);
            Globals.logger(Globals.lang("Could not find directory for %0-files: %1",
              fieldName, directory));
            return;
          }
          File file = new File(new File(directory), plannedName);

          URL url = new URL(res);

          URLDownload udl = new URLDownload(parent, url, file);
          try {
            udl.download();
          } catch (IOException e2) {
            JOptionPane.showMessageDialog(parent, Globals.lang("Invalid URL")+": "
              + e2.getMessage(), Globals.lang("Download file"),
              JOptionPane.ERROR_MESSAGE);
            Globals.logger("Error while downloading " + url.toString());
            return;
          }
          output(Globals.lang("Download completed"));

          String textToSet = file.getPath();
          if (textToSet.startsWith(directory)) {
            // Construct path relative to pdf base dir
            textToSet = textToSet.substring(directory.length(), textToSet.length());

            // Remove leading path separator
            if (textToSet.startsWith(File.separator)) {
              textToSet = textToSet.substring(File.separator.length());
            }
          }

          /*
           * Check if we should update the editor text field, or
           * update the target entry directly:
           */
                    if (entryEditor == null || entryEditor.getEntry() != targetEntry) {
            /*
             * Editor has probably changed to show a different
             * entry. So we must update the target entry directly
             * and not set the text of the editor.
             */
            targetEntry.setField(fieldName, textToSet);
                        fieldEditor.setText(textToSet);
                        fieldEditor.setEnabled(true);
                        updateEditor = false;
          } else {
            /*
 
View Full Code Here

            int i=0;
            for (String cit : citations) {
                if (stopFetching)
                    break;
                BibtexEntry entry = getSingleCitation(cit);
                if (entry != null)
                    dialog.addEntry(entry);
                dialog.setProgress(++i, citations.size());
            }
View Full Code Here

                                    Type = tmp[1];
                        }
            }
        }

        BibtexEntry b = new BibtexEntry(BibtexFields.DEFAULT_BIBTEXENTRY_ID, Globals
                        .getEntryType(Type)); // id assumes an existing database so don't
        // create one here
        b.setField(hm);
        if (journal != null) {
            if (Type.equals("conference"))
                b.setField("booktitle", journal);
            else
                b.setField("journal", journal);
        }
        bibitems.add(b);

    }
    return bibitems;
View Full Code Here

  public int populate(BibtexDatabase newDatabase, BibtexDatabase targetDatabase) {
    int errorCode = 0;
    Iterator<String> targetIterator = targetDatabase.getKeySet().iterator();
    boolean abortOperation = false;
    String currentKey;
    BibtexEntry currentEntry;
    Map<String, Boolean> citationHashTable = new HashMap<String, Boolean>();
    Hashtable<Integer, BibtexEntry> rejectedEntries = new Hashtable<Integer, BibtexEntry>();
    InitializeProgressBar initializeProgressBar = new InitializeProgressBar();
    InitializeProgressBarTwo initializeProgressBarTwo = new InitializeProgressBarTwo();
    UpdateProgressBarMaximum updateMaximum = new UpdateProgressBarMaximum(targetDatabase.getEntryCount());   
View Full Code Here

      BooleanAssign dummyBoolean = new BooleanAssign(false);
      if ((citationHashTable != null) && (citationHashTable.size() > 0)) {
          int citationCounter=0;
          for (String key : citationHashTable.keySet()){
            String id = Util.createNeutralId();
          BibtexEntry newEntry = new BibtexEntry(id);
          StringBuffer citeseerURLString = new StringBuffer();
          citeseerURLString.append(OAI_URL);
          citeseerURLString.append(OAI_ACTION);
          citeseerURLString.append("&" + OAI_METADATAPREFIX);
                    citeseerURLString.append("&" + "identifier=").append(key);
View Full Code Here

    BooleanAssign overwriteNone = new BooleanAssign(false);

    while (clickedIterator.hasNext() && !abortOperation) {
      int currentIndex = clickedIterator.next().intValue();
      BooleanAssign newValue = new BooleanAssign(false);
      BibtexEntry be = panel.mainTable.getEntryAt(currentIndex);
      abortOperation = importCiteSeerEntry(be, citeseerNamedCompound, overwriteAll, overwriteNone, newValue, rejectedEntries);
      if (newValue.getValue())
        newValues = true;
    }
    if (rejectedEntries.size() > 0) {
View Full Code Here

                if (iterator.hasNext())
                    sb.append(KEYWORD_SEPARATOR);
            }
            keywords = sb.toString();
           
      BibtexEntry b=new BibtexEntry(Util.createNeutralId(),//Globals.DEFAULT_BIBTEXENTRY_ID,
                      Globals.getEntryType("article")); // id assumes an existing database so don't create one here
      if (!author.equals("")) {
          b.setField("author",ImportFormatReader.expandAuthorInitials(author));
          author = "";
      }
      if (!title.equals("")) b.setField("title",title);
      if (!journal.equals("")) b.setField("journal",journal);
      if (!year.equals("")) b.setField("year",year);
                        // PENDING jeffrey.kuhn@yale.edu 2005-05-27 : added call to fixPageRange
      if (!page.equals("")) b.setField("pages",fixPageRange(page));
      if (!volume.equals("")) b.setField("volume",volume);
            if (!language.equals("")) b.setField("language",language);
            if (!pst.equals("")) b.setField("medline-pst", pst);
      if (!abstractText.equals("")) b.setField("abstract",abstractText.replaceAll("%","\\\\%"));
      if (!keywords.equals("")) b.setField("keywords",keywords);
      if (!month.equals("")) b.setField("month",month);
      //if (!url.equals("")) b.setField("url",url);
      if (!number.equals("")) b.setField("number",number);

      if(!doi.equals("")){
          b.setField("doi",doi);
          b.setField("url","http://dx.doi.org/"+doi);
      }
      if(!pii.equals(""))
          b.setField("pii",pii);
            if(!affiliation.equals("")) {
                b.setField("institution",affiliation.replaceAll("#", "\\\\#"));
            }

            // PENDING jeffrey.kuhn@yale.edu 2005-05-27 : added "pmid" bibtex field
            // Older references do not have doi entries, but every
            // medline entry has a unique pubmed ID (aka primary ID).
            // Add a bibtex field for the pubmed ID for future use.
            if (!pubmedid.equals(""))
                b.setField("pmid",pubmedid);
                       
      bibitems.add( );

      abstractText = "";
      author = "";
View Full Code Here

                }

            }

            BibtexEntry b = new BibtexEntry(BibtexFields.DEFAULT_BIBTEXENTRY_ID, Globals
                                            .getEntryType(Type)); // id assumes an existing database so don't
            // create one here
            b.setField(h);

            bibitems.add(b);

        }
View Full Code Here

TOP

Related Classes of net.sf.jabref.BibtexEntry

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.