// Ok, we have a single new entry that has been selected. Now decide what to do with it:
final BibtexEntry toShow = (BibtexEntry) newSelected;
final int mode = panel.getMode(); // What is the panel already showing?
if ((mode == BasePanel.WILL_SHOW_EDITOR) || (mode == BasePanel.SHOWING_EDITOR)) {
// An entry is currently being edited.
EntryEditor oldEditor = panel.getCurrentEditor();
String visName = null;
if (oldEditor != null) {
visName = oldEditor.getVisiblePanelName();
}
// Get an old or new editor for the entry to edit:
EntryEditor newEditor = panel.getEntryEditor(toShow);
if ((oldEditor != null))// && (oldEditor != newEditor))
oldEditor.setMovingToDifferentEntry();
// Show the new editor unless it was already visible:
if ((newEditor != oldEditor) || (mode != BasePanel.SHOWING_EDITOR)) {
if (visName != null)
newEditor.setVisiblePanel(visName);
panel.showEntryEditor(newEditor);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
table.ensureVisible(table.getSelectedRow());
}