Package net.sf.jabref.undo

Examples of net.sf.jabref.undo.UndoableFieldChange


        if (isKnownName(text) && !isAbbreviatedName(text)) {
            String newText = getAbbreviatedName(text, withDots);
            if (newText == null)
                return false;
            entry.setField(fieldName, newText);
            ce.addEdit(new UndoableFieldChange(entry, fieldName, text, newText));
            return true;
        } else {
            String unabbr = getFullName(text);
            if (unabbr != null) {
                String newText = getAbbreviatedName(unabbr, withDots);
                if (newText == null)
                    return false;
                entry.setField(fieldName, newText);
                ce.addEdit(new UndoableFieldChange(entry, fieldName, text, newText));
                return true;
            } else
                return false;
        }
    }
View Full Code Here


        if (isKnownName(text) && isAbbreviatedName(text)) {
            String newText = getFullName(text);
            if (newText == null)
                return false;
            entry.setField(fieldName, newText);
            ce.addEdit(new UndoableFieldChange(entry, fieldName, text, newText));
            return true;
        } else
            return false;
    }
View Full Code Here

                    }

                    if (s != null) {
                        editor.setText(s);
                        entryEditor.storeFieldAction.actionPerformed(new ActionEvent(editor, 0, ""));
                        undoManager.addEdit(new UndoableFieldChange(entryEditor.getEntry(), editor.getFieldName(),
                                text, s));
                    }
                }
            }
        });
View Full Code Here

            }

            for (String field : entry.getAllFields()){
                if (BibtexFields.isDisplayableField(field.toString())) {
                    if (nu.getField(field.toString()) == null) {
                        compound.addEdit(new UndoableFieldChange(entry, field.toString(), entry
                            .getField(field.toString()), null));
                        entry.clearField(field.toString());
                        anyChanged = true;
                    }
                }
            }

            // Then set all fields that have been set by the user.
            for (String field : nu.getAllFields()){
                if (entry.getField(field.toString()) != nu.getField(field.toString())) {
                    String toSet = nu.getField(field.toString());

                    // Test if the field is legally set.
                    (new LatexFieldFormatter()).format(toSet, field.toString());

                    compound.addEdit(new UndoableFieldChange(entry, field.toString(), entry
                        .getField(field.toString()), toSet));
                    entry.setField(field.toString(), toSet);
                    anyChanged = true;
                }
            }
View Full Code Here

                        if (aComp != null)
                            aComp.addBibtexEntry(entry);

                        // Add an UndoableFieldChange to the baseframe's
                        // undoManager.
                        panel.undoManager.addEdit(new UndoableFieldChange(entry, fe.getFieldName(),
                            oldValue, toSet));
                        updateSource();
                        panel.markBaseChanged();

                    } catch (IllegalArgumentException ex) {
View Full Code Here

        FileListEntryEditor editor = new FileListEntryEditor(frame, flEntry, false, true, metaData);
        editor.setVisible(true, false);
        if (editor.okPressed()) {
            // Store the changes and add an undo edit:
            String newValue = tModel.getStringRepresentation();
            UndoableFieldChange ce = new UndoableFieldChange(entry, GUIGlobals.FILE_FIELD,
                    oldValue, newValue);
            entry.setField(GUIGlobals.FILE_FIELD, newValue);
            frame.basePanel().undoManager.addEdit(ce);
            frame.basePanel().markBaseChanged();
            // Finally, open the link:
View Full Code Here

                        FileListEntry flEntry = new FileListEntry(f.getName(), s,
                                Globals.prefs.getExternalFileTypeByExt(fields[j]));
                        tableModel.addEntry(tableModel.getRowCount(), flEntry);
                       
                        entry.clearField(fields[j]);
                        ce.addEdit(new UndoableFieldChange(entry, fields[j], o, null));
                    }
                }
            }
            if (tableModel.getRowCount() != oldRowCount) {
                String newValue = tableModel.getStringRepresentation();
                entry.setField(GUIGlobals.FILE_FIELD, newValue);
                ce.addEdit(new UndoableFieldChange(entry, GUIGlobals.FILE_FIELD, oldFileContent, newValue));
            }
        }
        ce.end();
        return ce;
    }
View Full Code Here

      StringBuffer sb = new StringBuffer(o.toString());
      // sb.append(' ');
      sb.append(Globals.prefs.WRAPPED_USERNAME);
      newValue = sb.toString();
    }
    ce.addEdit(new UndoableFieldChange(be, BibtexFields.MARKED, be
      .getField(BibtexFields.MARKED), newValue));
    be.setField(BibtexFields.MARKED, newValue);
  }
View Full Code Here

      }
      if (piv < s.length() - 1) {
        sb.append(s.substring(piv));
      }
      String newVal = sb.length() > 0 ? sb.toString() : null;
      ce.addEdit(new UndoableFieldChange(be, BibtexFields.MARKED, be
        .getField(BibtexFields.MARKED), newVal));
      be.setField(BibtexFields.MARKED, newVal);
    }
  }
View Full Code Here

      sb.append(']');
    }
    String newVal = sb.toString();
    if (newVal.length() == 0)
      newVal = null;
    ce.addEdit(new UndoableFieldChange(be, BibtexFields.MARKED, be
      .getField(BibtexFields.MARKED), newVal));
    be.setField(BibtexFields.MARKED, newVal);

  }
View Full Code Here

TOP

Related Classes of net.sf.jabref.undo.UndoableFieldChange

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.