Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into storeColumnSortOrder
Browse files Browse the repository at this point in the history
* upstream/master:
  Fix export of corporate author to MSOffice (#4337)
  Added new keyboard shortcut "ctrl+E" for closing the entry editor. (#4222) (#4338)
  Remove GlobalFocusListener and old TextField entry editor (#4336)
  • Loading branch information
Siedlerchr committed Sep 13, 2018
2 parents 2a8296b + b991648 commit 3f28f72
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 358 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We removed the redundant new lines of markings and wrapped the summary in the File annotation tab. [#3823](https://github.com/JabRef/jabref/issues/3823)
- We add auto url formatting when user paste link to URL field in entry editor. [#254](https://github.com/koppor/jabref/issues/254)
- We added a minimal height for the entry editor so that it can no longer be hidden by accident. [#4279](https://github.com/JabRef/jabref/issues/4279)
- We added a new keyboard shortcut so that the entry editor could be closed by <kbd>Ctrl<kbd> + <kbd>E<kbd>. [#4222] (https://github.com/JabRef/jabref/issues/4222)



Expand Down
9 changes: 0 additions & 9 deletions src/main/java/org/jabref/Globals.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import javafx.stage.Screen;

import org.jabref.gui.ClipBoardManager;
import org.jabref.gui.GlobalFocusListener;
import org.jabref.gui.StateManager;
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.util.DefaultFileUpdateMonitor;
Expand Down Expand Up @@ -60,8 +59,6 @@ public class Globals {
public static ExporterFactory exportFactory;
// Key binding preferences
private static KeyBindingRepository keyBindingRepository;
// Background tasks
private static GlobalFocusListener focusListener;
private static DefaultFileUpdateMonitor fileUpdateMonitor;
private static ThemeLoader themeLoader;
private static TelemetryClient telemetryClient;
Expand All @@ -79,8 +76,6 @@ public static synchronized KeyBindingRepository getKeyPrefs() {

// Background tasks
public static void startBackgroundTasks() {
Globals.focusListener = new GlobalFocusListener();

Globals.fileUpdateMonitor = new DefaultFileUpdateMonitor();
JabRefExecutorService.INSTANCE.executeInterruptableTask(Globals.fileUpdateMonitor, "FileUpdateMonitor");

Expand Down Expand Up @@ -117,10 +112,6 @@ private static void startTelemetryClient() {
telemetryClient.trackSessionState(SessionState.Start);
}

public static GlobalFocusListener getFocusListener() {
return focusListener;
}

public static FileUpdateMonitor getFileUpdateMonitor() {
return fileUpdateMonitor;
}
Expand Down
18 changes: 15 additions & 3 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ private void setupActions() {
actions.put(Actions.SAVE_SELECTED_AS_PLAIN, new SaveSelectedAction(SavePreferences.DatabaseSaveType.PLAIN_BIBTEX));

// The action for copying selected entries.
actions.put(Actions.COPY, mainTable::copy);
actions.put(Actions.COPY, this::copy);

actions.put(Actions.PRINT_PREVIEW, new PrintPreviewAction());

actions.put(Actions.CUT, mainTable::cut);
actions.put(Actions.CUT, this::cut);

actions.put(Actions.DELETE, () -> delete(false));

Expand All @@ -319,7 +319,7 @@ private void setupActions() {
// This allows you to (a) paste entire bibtex entries from a text editor, web browser, etc
// (b) copy and paste entries between multiple instances of JabRef (since
// only the text representation seems to get as far as the X clipboard, at least on my system)
actions.put(Actions.PASTE, mainTable::paste);
actions.put(Actions.PASTE, this::paste);

actions.put(Actions.SELECT_ALL, mainTable.getSelectionModel()::selectAll);

Expand Down Expand Up @@ -1379,6 +1379,18 @@ public Path getTempFile() {
return changeMonitor.map(DatabaseChangeMonitor::getTempFile).orElse(null);
}

public void copy() {
mainTable.copy();
}

public void paste() {
mainTable.paste();
}

public void cut() {
mainTable.cut();
}

private static class SearchAndOpenFile {

private final BibEntry entry;
Expand Down
31 changes: 0 additions & 31 deletions src/main/java/org/jabref/gui/GlobalFocusListener.java

This file was deleted.

44 changes: 36 additions & 8 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.awt.Component;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
Expand All @@ -18,7 +17,6 @@
import java.util.stream.Collectors;

import javax.swing.Action;
import javax.swing.JComponent;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
Expand All @@ -39,6 +37,7 @@
import javafx.scene.control.SplitPane;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextInputControl;
import javafx.scene.control.ToolBar;
import javafx.scene.control.Tooltip;
import javafx.scene.input.DataFormat;
Expand Down Expand Up @@ -284,8 +283,7 @@ private void init() {
//previewToggle.setSelected(Globals.prefs.getPreviewPreferences().isPreviewPanelEnabled());
//generalFetcher.getToggleCommand().setSelected(sidePaneManager.isComponentVisible(WebSearchPane.class));
//openOfficePanel.getToggleCommand().setSelected(sidePaneManager.isComponentVisible(OpenOfficeSidePanel.class));
// TODO: Can't notify focus listener since it is expecting a swing component
//Globals.getFocusListener().setFocused(currentBasePanel.getMainTable());

setWindowTitle();
// Update search autocompleter with information for the correct database:
currentBasePanel.updateSearchManager();
Expand Down Expand Up @@ -1442,10 +1440,40 @@ public EditAction(Actions command) {

@Override
public void execute() {
JComponent source = Globals.getFocusListener().getFocused();
Action action = source.getActionMap().get(command);
if (action != null) {
action.actionPerformed(new ActionEvent(source, 0, command.name()));
Node focusOwner = mainStage.getScene().getFocusOwner();
if (focusOwner != null) {
if (focusOwner instanceof TextInputControl) {
// Focus is on text field -> copy/paste/cut selected text
TextInputControl textInput = (TextInputControl) focusOwner;
switch (command) {
case COPY:
textInput.copy();
break;
case CUT:
textInput.cut();
break;
case PASTE:
textInput.paste();
break;
default:
throw new IllegalStateException("Only cut/copy/paste supported but got " + command);
}
} else {
// Not sure what is selected -> copy/paste/cut selected entries
switch (command) {
case COPY:
getCurrentBasePanel().copy();
break;
case CUT:
getCurrentBasePanel().cut();
break;
case PASTE:
getCurrentBasePanel().paste();
break;
default:
throw new IllegalStateException("Only cut/copy/paste supported but got " + command);
}
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ private void setupKeyBindings() {
close();
event.consume();
break;
case CLOSE_ENTRY:
close();
event.consume();
break;
default:
// Pass other keys to parent
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
import javafx.fxml.Initializable;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;

import com.sun.javafx.scene.control.skin.TextFieldSkin;

public class EditorTextField extends javafx.scene.control.TextField implements Initializable, ContextMenuAddable {
public class EditorTextField extends TextField implements Initializable, ContextMenuAddable {

public EditorTextField() {
this("");
Expand Down
72 changes: 0 additions & 72 deletions src/main/java/org/jabref/gui/fieldeditors/FieldEditor.java

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3f28f72

Please sign in to comment.