Search in sources :

Example 6 with EntryEditor

use of org.jabref.gui.entryeditor.EntryEditor in project jabref by JabRef.

the class BasePanel method updateEntryEditorIfShowing.

public void updateEntryEditorIfShowing() {
    if (mode == BasePanelMode.SHOWING_EDITOR) {
        if (currentEditor.getDisplayedBibEntryType().equals(currentEditor.getEntry().getType())) {
            currentEditor.updateSource();
        } else {
            // The entry has changed type, so we must get a new editor.
            newEntryShowing(null);
            final EntryEditor newEditor = getEntryEditor(currentEditor.getEntry());
            showEntryEditor(newEditor);
        }
    }
}
Also used : EntryEditor(org.jabref.gui.entryeditor.EntryEditor)

Example 7 with EntryEditor

use of org.jabref.gui.entryeditor.EntryEditor in project jabref by JabRef.

the class BasePanel method showEntry.

public void showEntry(final BibEntry be) {
    if (getShowing() == be) {
        if (splitPane.getBottomComponent() == null) {
            // This is the special occasion when showing is set to an
            // entry, but no entry editor is in fact shown. This happens
            // after Preferences dialog is closed, and it means that we
            // must make sure the same entry is shown again. We do this by
            // setting showing to null, and recursively calling this method.
            newEntryShowing(null);
            showEntry(be);
        }
        return;
    }
    String visName = null;
    if ((getShowing() != null) && isShowingEditor()) {
        visName = ((EntryEditor) splitPane.getBottomComponent()).getVisiblePanelName();
    }
    // We must instantiate a new editor.
    EntryEditor entryEditor = new EntryEditor(frame, BasePanel.this, be);
    if (visName != null) {
        entryEditor.setVisiblePanel(visName);
    }
    showEntryEditor(entryEditor);
    newEntryShowing(be);
}
Also used : EntryEditor(org.jabref.gui.entryeditor.EntryEditor)

Example 8 with EntryEditor

use of org.jabref.gui.entryeditor.EntryEditor in project jabref by JabRef.

the class SharedDatabaseUIManager method listen.

@Subscribe
public void listen(SharedEntryNotPresentEvent event) {
    BasePanel panel = jabRefFrame.getCurrentBasePanel();
    EntryEditor entryEditor = panel.getCurrentEditor();
    panel.getUndoManager().addEdit(new UndoableRemoveEntry(panel.getDatabase(), event.getBibEntry(), panel));
    if (Objects.nonNull(entryEditor) && (entryEditor.getEntry() == event.getBibEntry())) {
        JOptionPane.showMessageDialog(jabRefFrame, Localization.lang("The BibEntry you currently work on has been deleted on the shared side.") + "\n" + Localization.lang("You can restore the entry using the \"Undo\" operation."), Localization.lang("Shared entry is no longer present"), JOptionPane.INFORMATION_MESSAGE);
        SwingUtilities.invokeLater(() -> panel.hideBottomComponent());
    }
}
Also used : EntryEditor(org.jabref.gui.entryeditor.EntryEditor) BasePanel(org.jabref.gui.BasePanel) UndoableRemoveEntry(org.jabref.gui.undo.UndoableRemoveEntry) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

EntryEditor (org.jabref.gui.entryeditor.EntryEditor)8 BibEntry (org.jabref.model.entry.BibEntry)4 Subscribe (com.google.common.eventbus.Subscribe)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 BasePanel (org.jabref.gui.BasePanel)1 BasePanelMode (org.jabref.gui.BasePanelMode)1 DroppedFileHandler (org.jabref.gui.externalfiles.DroppedFileHandler)1 UndoableInsertEntry (org.jabref.gui.undo.UndoableInsertEntry)1 UndoableRemoveEntry (org.jabref.gui.undo.UndoableRemoveEntry)1 ParserResult (org.jabref.logic.importer.ParserResult)1 PdfContentImporter (org.jabref.logic.importer.fileformat.PdfContentImporter)1 KeyCollisionException (org.jabref.model.database.KeyCollisionException)1 EntryType (org.jabref.model.entry.EntryType)1