diff --git a/lib/customjfx-1.0.0.jar b/lib/customjfx-1.0.0.jar deleted file mode 100644 index 4636cdd8975..00000000000 Binary files a/lib/customjfx-1.0.0.jar and /dev/null differ diff --git a/src/main/java/org/jabref/gui/BasePanel.java b/src/main/java/org/jabref/gui/BasePanel.java index 41fdfffe226..e5e947cc9c6 100644 --- a/src/main/java/org/jabref/gui/BasePanel.java +++ b/src/main/java/org/jabref/gui/BasePanel.java @@ -23,7 +23,6 @@ import java.util.Set; import java.util.stream.Collectors; -import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.JTextArea; import javax.swing.SwingUtilities; @@ -61,7 +60,6 @@ import org.jabref.gui.externalfiletype.ExternalFileMenuItem; import org.jabref.gui.externalfiletype.ExternalFileType; import org.jabref.gui.externalfiletype.ExternalFileTypes; -import org.jabref.gui.fieldeditors.FieldEditor; import org.jabref.gui.filelist.AttachFileAction; import org.jabref.gui.filelist.FileListEntry; import org.jabref.gui.filelist.FileListTableModel; @@ -177,9 +175,6 @@ public class BasePanel extends StackPane implements ClipboardOwner { // Used to track whether the base has changed since last save. private BibEntry showing; - // in switching between entries. - private PreambleEditor preambleEditor; - // Keeps track of the preamble dialog if it is open. private StringDialog stringDialog; private SuggestionProviders suggestionProviders; @@ -361,17 +356,6 @@ private void setupActions() { actions.put(Actions.SELECT_ALL, (BaseAction) mainTable.getSelectionModel()::selectAll); - // The action for opening the preamble editor - actions.put(Actions.EDIT_PREAMBLE, (BaseAction) () -> { - if (preambleEditor == null) { - PreambleEditor form = new PreambleEditor(frame, BasePanel.this, bibDatabaseContext.getDatabase()); - form.setVisible(true); - preambleEditor = form; - } else { - preambleEditor.setVisible(true); - } - }); - // The action for opening the string editor actions.put(Actions.EDIT_STRINGS, (BaseAction) () -> { if (stringDialog == null) { @@ -519,7 +503,8 @@ public void update() { .openConsole(frame.getCurrentBasePanel().getBibDatabaseContext().getDatabaseFile().orElse(null))); actions.put(Actions.PULL_CHANGES_FROM_SHARED_DATABASE, (BaseAction) () -> { - DatabaseSynchronizer dbmsSynchronizer = frame.getCurrentBasePanel().getBibDatabaseContext() + DatabaseSynchronizer dbmsSynchronizer = frame.getCurrentBasePanel() + .getBibDatabaseContext() .getDBMSSynchronizer(); dbmsSynchronizer.pullChanges(); }); @@ -875,7 +860,8 @@ private boolean saveDatabase(File file, boolean selectedOnly, Charset enc, SaveSession session; final String SAVE_DATABASE = Localization.lang("Save library"); try { - SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs).withEncoding(enc) + SavePreferences prefs = SavePreferences.loadForSaveFromPreferences(Globals.prefs) + .withEncoding(enc) .withSaveType(saveType); BibtexDatabaseWriter databaseWriter = new BibtexDatabaseWriter<>( FileSaveSession::new); @@ -1066,7 +1052,8 @@ private void createMainTable() { mainTable.addSelectionListener(listEvent -> Globals.stateManager.setSelectedEntries(mainTable.getSelectedEntries())); // Update entry editor and preview according to selected entries - mainTable.addSelectionListener(event -> mainTable.getSelectedEntries().stream() + mainTable.addSelectionListener(event -> mainTable.getSelectedEntries() + .stream() .findFirst() .ifPresent(entry -> { preview.setEntry(entry); @@ -1231,12 +1218,6 @@ private void instantiateSearchAutoCompleter() { } } - public void updatePreamble() { - if (preambleEditor != null) { - preambleEditor.updatePreamble(); - } - } - public void assureStringDialogNotEditing() { if (stringDialog != null) { stringDialog.assureNotEditing(); @@ -1478,10 +1459,6 @@ public BibDatabase getDatabase() { return bibDatabaseContext.getDatabase(); } - public void preambleEditorClosing() { - preambleEditor = null; - } - public void stringsClosing() { stringDialog = null; } @@ -1844,16 +1821,6 @@ private class UndoAction implements BaseAction { @Override public void action() { try { - JComponent focused = Globals.getFocusListener().getFocused(); - if ((focused != null) && (focused instanceof FieldEditor) && focused.hasFocus()) { - // User is currently editing a field: - // Check if it is the preamble: - - FieldEditor fieldEditor = (FieldEditor) focused; - if ((preambleEditor != null) && (fieldEditor.equals(preambleEditor.getFieldEditor()))) { - preambleEditor.storeCurrentEdit(); - } - } getUndoManager().undo(); markBaseChanged(); frame.output(Localization.lang("Undo")); @@ -1891,9 +1858,11 @@ public void action() { List files = bes.get(0).getFiles(); - Optional linkedFile = files.stream().filter(file -> (FieldName.URL.equalsIgnoreCase(file.getFileType()) - || FieldName.PS.equalsIgnoreCase(file.getFileType()) - || FieldName.PDF.equalsIgnoreCase(file.getFileType()))).findFirst(); + Optional linkedFile = files.stream() + .filter(file -> (FieldName.URL.equalsIgnoreCase(file.getFileType()) + || FieldName.PS.equalsIgnoreCase(file.getFileType()) + || FieldName.PDF.equalsIgnoreCase(file.getFileType()))) + .findFirst(); if (linkedFile.isPresent()) { @@ -1954,7 +1923,8 @@ public void action() throws SaveException { FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder() .withDefaultExtension(FileType.BIBTEX_DB) .addExtensionFilter(FileType.BIBTEX_DB) - .withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build(); + .withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)) + .build(); Optional chosenFile = dialogService.showFileSaveDialog(fileDialogConfiguration); if (chosenFile.isPresent()) { diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 55719e04a5f..22495817dba 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -905,7 +905,7 @@ private MenuBar createMenu() { new SeparatorMenuItem(), factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(this)), - factory.createMenuItem(StandardActions.EDIT_PREAMBLE, new OldDatabaseCommandWrapper(Actions.EDIT_PREAMBLE, this, Globals.stateManager)), + factory.createMenuItem(StandardActions.EDIT_PREAMBLE, new PreambleEditor(this)), factory.createMenuItem(StandardActions.EDIT_STRINGS, new OldDatabaseCommandWrapper(Actions.EDIT_STRINGS, this, Globals.stateManager)) ); diff --git a/src/main/java/org/jabref/gui/PreambleEditor.java b/src/main/java/org/jabref/gui/PreambleEditor.java index 72a65a7e474..821b46088dd 100644 --- a/src/main/java/org/jabref/gui/PreambleEditor.java +++ b/src/main/java/org/jabref/gui/PreambleEditor.java @@ -1,214 +1,56 @@ package org.jabref.gui; -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Container; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.FocusAdapter; -import java.awt.event.FocusEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; - -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.JPanel; -import javax.swing.LayoutFocusTraversalPolicy; -import javax.swing.text.JTextComponent; - -import org.jabref.Globals; -import org.jabref.gui.actions.Actions; -import org.jabref.gui.fieldeditors.FieldEditor; -import org.jabref.gui.fieldeditors.TextArea; -import org.jabref.gui.keyboard.KeyBinding; +import java.util.Optional; + +import javafx.scene.control.ButtonType; +import javafx.scene.control.DialogPane; +import javafx.scene.control.TextArea; + +import org.jabref.gui.actions.SimpleCommand; import org.jabref.gui.undo.UndoablePreambleChange; -import org.jabref.gui.util.WindowLocation; import org.jabref.logic.l10n.Localization; import org.jabref.model.database.BibDatabase; -import org.jabref.preferences.JabRefPreferences; - -class PreambleEditor extends JabRefDialog { - // A reference to the entry this object works on. - private final BibDatabase database; - private final BasePanel panel; - - private final FieldEditor editor; - - private final UndoAction undoAction = new UndoAction(); - private final StoreFieldAction storeFieldAction = new StoreFieldAction(); - private final RedoAction redoAction = new RedoAction(); - // The action concerned with closing the window. - private final CloseAction closeAction = new CloseAction(); - - public PreambleEditor(JabRefFrame baseFrame, BasePanel panel, BibDatabase database) { - super(null, PreambleEditor.class); - this.panel = panel; - this.database = database; - - addWindowListener(new WindowAdapter() { - - @Override - public void windowClosing(WindowEvent e) { - closeAction.actionPerformed(null); - } - - @Override - public void windowOpened(WindowEvent e) { - editor.requestFocus(); - } - }); - setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() { - - @Override - protected boolean accept(Component c) { - return super.accept(c) && (c instanceof FieldEditor); - } - }); - JPanel pan = new JPanel(); - GridBagLayout gbl = new GridBagLayout(); - pan.setLayout(gbl); - GridBagConstraints con = new GridBagConstraints(); - con.fill = GridBagConstraints.BOTH; - con.weighty = 1; - con.insets = new Insets(10, 5, 10, 5); +class PreambleEditor extends SimpleCommand { - editor = new TextArea(Localization.lang("Preamble"), database.getPreamble().orElse("")); - - // TODO: Reenable this - //setupJTextComponent((TextArea) editor); - - //gbl.setConstraints(editor.getLabel(), con); - //pan.add(editor.getLabel()); - - con.weightx = 1; - - gbl.setConstraints(editor.getPane(), con); - pan.add(editor.getPane()); - - Container conPane = getContentPane(); - conPane.add(pan, BorderLayout.CENTER); - setTitle(Localization.lang("Edit preamble")); - - WindowLocation pw = new WindowLocation(this, JabRefPreferences.PREAMBLE_POS_X, JabRefPreferences.PREAMBLE_POS_Y, - JabRefPreferences.PREAMBLE_SIZE_X, JabRefPreferences.PREAMBLE_SIZE_Y); - pw.displayWindowAtStoredLocation(); - } - - private void setupJTextComponent(JTextComponent ta) { - // Set up key bindings and focus listener for the FieldEditor. - ta.getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.CLOSE_DIALOG), "close"); - ta.getActionMap().put("close", closeAction); - ta.getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.PREAMBLE_EDITOR_STORE_CHANGES), "store"); - ta.getActionMap().put("store", storeFieldAction); - - ta.getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.UNDO), "undo"); - ta.getActionMap().put(Actions.UNDO, undoAction); - ta.getInputMap().put(Globals.getKeyPrefs().getKey(KeyBinding.REDO), "redo"); - ta.getActionMap().put(Actions.REDO, redoAction); - - ta.addFocusListener(new FieldListener()); - } - - public void updatePreamble() { - editor.setText(database.getPreamble().orElse("")); - } + private final TextArea editor = new TextArea(); - public FieldEditor getFieldEditor() { - return editor; - } + private final JabRefFrame frame; - public void storeCurrentEdit() { - storeFieldAction.actionPerformed(null); + public PreambleEditor(JabRefFrame frame) { + this.frame = frame; } - private class FieldListener extends FocusAdapter { + @Override + public void execute() { + BasePanel panel = frame.getCurrentBasePanel(); + BibDatabase database = frame.getCurrentBasePanel().getDatabase(); - /* - * Focus listener that fires the storeFieldAction when a TextArea - * loses focus. - */ - @Override - public void focusLost(FocusEvent e) { - if (!e.isTemporary()) { - storeFieldAction.actionPerformed(new ActionEvent(e.getSource(), 0, "")); - } - } + DialogPane pane = new DialogPane(); - } + editor.setText(frame.getCurrentBasePanel() + .getDatabase() + .getPreamble() + .orElse("")); + pane.setContent(editor); - class StoreFieldAction extends AbstractAction { + Optional pressedButton = frame.getDialogService().showCustomDialogAndWait(Localization.lang("Edit Preamble"), pane, ButtonType.APPLY, ButtonType.CANCEL); - public StoreFieldAction() { - super("Store field value"); - putValue(Action.SHORT_DESCRIPTION, "Store field value"); - } - - @Override - public void actionPerformed(ActionEvent e) { + if (pressedButton.isPresent() && pressedButton.get().equals(ButtonType.APPLY)) { String toSet = editor.getText(); // We check if the field has changed, since we don't want to mark the // base as changed unless we have a real change. if (!database.getPreamble().orElse("").equals(toSet)) { + panel.getUndoManager().addEdit( - new UndoablePreambleChange(database, panel, database.getPreamble().orElse(null), toSet)); + new UndoablePreambleChange(database, database.getPreamble().orElse(null), toSet)); database.setPreamble(toSet); - //if ((toSet == null) || toSet.isEmpty()) { - // editor.setLabelColor(GUIGlobals.NULL_FIELD_COLOR); - //} else { - // editor.setLabelColor(GUIGlobals.ENTRY_EDITOR_LABEL_COLOR); - //} - editor.setValidBackgroundColor(); - if (editor.hasFocus()) { - editor.setActiveBackgroundColor(); - } + panel.markBaseChanged(); } - - } - } - - class UndoAction extends AbstractAction { - - public UndoAction() { - super("Undo", IconTheme.JabRefIcons.UNDO.getIcon()); - putValue(Action.SHORT_DESCRIPTION, "Undo"); } - @Override - public void actionPerformed(ActionEvent e) { - panel.runCommand(Actions.UNDO); - } - } - - class RedoAction extends AbstractAction { - - public RedoAction() { - super("Redo", IconTheme.JabRefIcons.REDO.getIcon()); - putValue(Action.SHORT_DESCRIPTION, "Redo"); - } - - @Override - public void actionPerformed(ActionEvent e) { - panel.runCommand(Actions.REDO); - } - } - - class CloseAction extends AbstractAction { - - public CloseAction() { - super(Localization.lang("Close window")); - } - - @Override - public void actionPerformed(ActionEvent e) { - storeFieldAction.actionPerformed(null); - panel.preambleEditorClosing(); - dispose(); - } } } diff --git a/src/main/java/org/jabref/gui/collab/PreambleChangeViewModel.java b/src/main/java/org/jabref/gui/collab/PreambleChangeViewModel.java index 47946d0196e..a3f707b5cd5 100644 --- a/src/main/java/org/jabref/gui/collab/PreambleChangeViewModel.java +++ b/src/main/java/org/jabref/gui/collab/PreambleChangeViewModel.java @@ -18,7 +18,6 @@ class PreambleChangeViewModel extends ChangeViewModel { private final InfoPane tp = new InfoPane(); private final JScrollPane sp = new JScrollPane(tp); - public PreambleChangeViewModel(String mem, PreambleDiff diff) { super(Localization.lang("Changed preamble")); this.disk = diff.getNewPreamble(); @@ -43,7 +42,7 @@ public PreambleChangeViewModel(String mem, PreambleDiff diff) { @Override public boolean makeChange(BasePanel panel, BibDatabase secondary, NamedCompound undoEdit) { panel.getDatabase().setPreamble(disk); - undoEdit.addEdit(new UndoablePreambleChange(panel.getDatabase(), panel, mem, disk)); + undoEdit.addEdit(new UndoablePreambleChange(panel.getDatabase(), mem, disk)); secondary.setPreamble(disk); return true; } diff --git a/src/main/java/org/jabref/gui/customjfx/CustomJFXPanel.java b/src/main/java/org/jabref/gui/customjfx/CustomJFXPanel.java index 0dbd2da2000..07279a55d91 100644 --- a/src/main/java/org/jabref/gui/customjfx/CustomJFXPanel.java +++ b/src/main/java/org/jabref/gui/customjfx/CustomJFXPanel.java @@ -1,44 +1,15 @@ package org.jabref.gui.customjfx; -import java.awt.event.InputMethodEvent; -import java.lang.reflect.Field; - import javafx.embed.swing.JFXPanel; import javafx.scene.Scene; import org.jabref.gui.AbstractView; -import org.jabref.gui.customjfx.support.InputMethodSupport; import org.jabref.gui.util.DefaultTaskExecutor; -import org.jabref.logic.util.OS; - -import com.sun.javafx.embed.EmbeddedSceneInterface; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -/*** - * WARNING: THIS IS A CUSTOM HACK TO PREVENT A BUG WITH ACCENTED CHARACTERS PRODUCING AN NPE IN LINUX
- * So far the bug has only been resolved in openjfx10: https://bugs.openjdk.java.net/browse/JDK-8185792 - * +/** + * Remove as soon as possible */ -public class CustomJFXPanel extends JFXPanel { - - private static final Logger LOGGER = LoggerFactory.getLogger(CustomJFXPanel.class); - private Field scenePeerField = null; - - private CustomJFXPanel() { - super(); - try { - scenePeerField = this.getClass().getSuperclass().getDeclaredField("scenePeer"); - scenePeerField.setAccessible(true); - } catch (NoSuchFieldException | SecurityException e) { - LOGGER.error("Could not access scenePeer Field", e); - - } - } - - public static JFXPanel create() { - return OS.LINUX ? new CustomJFXPanel() : new JFXPanel(); - } +public class CustomJFXPanel { public static JFXPanel wrap(Scene scene) { JFXPanel container = new JFXPanel(); @@ -47,34 +18,4 @@ public static JFXPanel wrap(Scene scene) { return container; } - @Override - protected void processInputMethodEvent(InputMethodEvent e) { - if (e.getID() == InputMethodEvent.INPUT_METHOD_TEXT_CHANGED) { - sendInputMethodEventToFX(e); - } - - } - - private void sendInputMethodEventToFX(InputMethodEvent e) { - String t = InputMethodSupport.getTextForEvent(e); - - int insertionIndex = 0; - if (e.getCaret() != null) { - insertionIndex = e.getCaret().getInsertionIndex(); - } - - EmbeddedSceneInterface myScencePeer = null; - try { - //the variable must be named different to the original, otherwise reflection does not find the right ones - myScencePeer = (EmbeddedSceneInterface) scenePeerField.get(this); - } catch (IllegalArgumentException | IllegalAccessException ex) { - LOGGER.error("Could not access scenePeer Field", ex); - } - - myScencePeer.inputMethodEvent( - javafx.scene.input.InputMethodEvent.INPUT_METHOD_TEXT_CHANGED, - InputMethodSupport.inputMethodEventComposed(t, e.getCommittedCharacterCount()), - t.substring(0, e.getCommittedCharacterCount()), - insertionIndex); - } } diff --git a/src/main/java/org/jabref/gui/fieldeditors/TextArea.java b/src/main/java/org/jabref/gui/fieldeditors/TextArea.java deleted file mode 100644 index 958c0f9a21e..00000000000 --- a/src/main/java/org/jabref/gui/fieldeditors/TextArea.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.jabref.gui.fieldeditors; - -import java.awt.Color; -import java.lang.reflect.InvocationTargetException; - -import javax.swing.JComponent; -import javax.swing.SwingUtilities; - -import javafx.embed.swing.JFXPanel; -import javafx.scene.Scene; - -import org.jabref.gui.GUIGlobals; -import org.jabref.gui.customjfx.CustomJFXPanel; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * An implementation of the FieldEditor backed by a {@link EditorTextArea}. - * Used for multi-line input, currently all BibTexFields except Bibtex key! - */ -public class TextArea implements FieldEditor { - - private static final Logger LOGGER = LoggerFactory.getLogger(TextArea.class); - - private final JFXPanel swingPanel; - - private final EditorTextArea textArea; - private String fieldName; - - public TextArea(String fieldName, String content) { - this(fieldName, content, ""); - } - - public TextArea(String fieldName, String content, String title) { - textArea = new EditorTextArea(content); - textArea.setPromptText(title); - - swingPanel = CustomJFXPanel.wrap(new Scene(textArea)); - swingPanel.setBackground(GUIGlobals.activeBackgroundColor); - - - /* - // Add the global focus listener, so a menu item can see if this field - // was focused when an action was called. - addFocusListener(Globals.getFocusListener()); - addFocusListener(new FieldEditorFocusListener()); - */ - - this.fieldName = fieldName; - - /* - FieldTextMenu popMenu = new FieldTextMenu(this); - this.addMouseListener(popMenu); - label.addMouseListener(popMenu); - */ - } - - @Override - public String getFieldName() { - return fieldName; - } - - public void setFieldName(String newName) { - fieldName = newName; - } - - @Override - public void setBackground(Color color) { - //not needed - } - - @Override - public JComponent getPane() { - return swingPanel; - } - - @Override - public JComponent getTextComponent() { - return null; - } - - @Override - public boolean hasFocus() { - return false; - } - - @Override - public void setActiveBackgroundColor() { - setBackgroundColor(GUIGlobals.activeBackgroundColor); - } - - @Override - public void setValidBackgroundColor() { - setBackgroundColor(GUIGlobals.validFieldBackgroundColor); - } - - @Override - public void setInvalidBackgroundColor() { - setBackgroundColor(GUIGlobals.invalidFieldBackgroundColor); - } - - private void setBackgroundColor(Color color) { - if (SwingUtilities.isEventDispatchThread()) { - setBackground(color); - } else { - try { - SwingUtilities.invokeAndWait(() -> setBackground(color)); - } catch (InvocationTargetException | InterruptedException e) { - LOGGER.info("Problem setting background color", e); - } - } - } - - @Override - public String getText() { - return textArea.getText(); - } - - @Override - public void setText(String newText) { - textArea.setText(newText); - } - - @Override - public void append(String text) { - // not needed - } - - @Override - public void setEnabled(boolean enabled) { - // not needed - } - - @Override - public void paste(String textToInsert) { - /* - replaceSelection(textToInsert); - */ - } - - @Override - public String getSelectedText() { - return null; - } - - @Override - public void undo() { - // Nothing - } - - @Override - public void redo() { - // Nothing - } - - @Override - public void requestFocus() { - // not needed - } -} diff --git a/src/main/java/org/jabref/gui/openoffice/StyleSelectDialog.java b/src/main/java/org/jabref/gui/openoffice/StyleSelectDialog.java index 09824d81494..799cf4fe015 100644 --- a/src/main/java/org/jabref/gui/openoffice/StyleSelectDialog.java +++ b/src/main/java/org/jabref/gui/openoffice/StyleSelectDialog.java @@ -132,9 +132,11 @@ private void init() { // Create a preview panel for previewing styles // Must be done before creating the table to avoid NPEs - preview = new PreviewPanel(null, null, Globals.getKeyPrefs(), Globals.prefs.getPreviewPreferences(), frame.getDialogService()); - // Use the test entry from the Preview settings tab in Preferences: - preview.setEntry(prevEntry); + DefaultTaskExecutor.runInJavaFXThread(() -> { + preview = new PreviewPanel(null, null, Globals.getKeyPrefs(), Globals.prefs.getPreviewPreferences(), frame.getDialogService()); + // Use the test entry from the Preview settings tab in Preferences: + preview.setEntry(prevEntry); + }); setupTable(); updateStyles(); diff --git a/src/main/java/org/jabref/gui/undo/UndoablePreambleChange.java b/src/main/java/org/jabref/gui/undo/UndoablePreambleChange.java index d7416aba252..1f8bb920ccc 100644 --- a/src/main/java/org/jabref/gui/undo/UndoablePreambleChange.java +++ b/src/main/java/org/jabref/gui/undo/UndoablePreambleChange.java @@ -1,6 +1,5 @@ package org.jabref.gui.undo; -import org.jabref.gui.BasePanel; import org.jabref.logic.l10n.Localization; import org.jabref.model.database.BibDatabase; @@ -14,15 +13,12 @@ public class UndoablePreambleChange extends AbstractUndoableJabRefEdit { private final BibDatabase base; private final String oldValue; private final String newValue; - private final BasePanel panel; - - public UndoablePreambleChange(BibDatabase base, BasePanel panel, + public UndoablePreambleChange(BibDatabase base, String oldValue, String newValue) { this.base = base; this.oldValue = oldValue; this.newValue = newValue; - this.panel = panel; } @Override @@ -38,8 +34,6 @@ public void undo() { // Revert the change. base.setPreamble(oldValue); - // If the preamble editor is open, update it. - panel.updatePreamble(); } @Override @@ -49,9 +43,6 @@ public void redo() { // Redo the change. base.setPreamble(newValue); - // If the preamble editor is open, update it. - panel.updatePreamble(); - } }