Skip to content

Commit

Permalink
fix "Alt + keyboard shortcuts do not work"
Browse files Browse the repository at this point in the history
  • Loading branch information
Fu188 committed Jan 31, 2021
1 parent 12dad55 commit bb6f643
Showing 1 changed file with 20 additions and 21 deletions.
41 changes: 20 additions & 21 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,8 @@ public class JabRefFrame extends BorderPane {

private final FileHistoryMenu fileHistory;

@SuppressWarnings({"FieldCanBeLocal"}) private EasyObservableList<BibDatabaseContext> openDatabaseList;
@SuppressWarnings({"FieldCanBeLocal"})
private EasyObservableList<BibDatabaseContext> openDatabaseList;

private final Stage mainStage;
private final StateManager stateManager;
Expand Down Expand Up @@ -315,7 +316,7 @@ private void showTrackingNotification() {
}

Globals.prefs.storeTelemetryPreferences(telemetryPreferences.withCollectTelemetry(shouldCollect)
.withAskToCollectTelemetry(false));
.withAskToCollectTelemetry(false));
}

/**
Expand Down Expand Up @@ -350,11 +351,11 @@ private void tearDownJabRef(List<String> filenames) {
prefs.clearEditedFiles();
} else {
Path focusedDatabase = getCurrentLibraryTab().getBibDatabaseContext()
.getDatabasePath()
.orElse(null);
.getDatabasePath()
.orElse(null);
prefs.storeGuiPreferences(prefs.getGuiPreferences()
.withLastFilesOpened(filenames)
.withLastFocusedFile(focusedDatabase));
.withLastFilesOpened(filenames)
.withLastFocusedFile(focusedDatabase));
}
}

Expand Down Expand Up @@ -463,7 +464,7 @@ private void setDividerPosition() {
if (!splitPane.getDividers().isEmpty()) {
EasyBind.subscribe(splitPane.getDividers().get(0).positionProperty(),
position -> prefs.storeGuiPreferences(prefs.getGuiPreferences()
.withSidePaneWidth(position.doubleValue())));
.withSidePaneWidth(position.doubleValue())));
}
}

Expand Down Expand Up @@ -555,8 +556,8 @@ public LibraryTab getLibraryTabAt(int i) {
*/
public List<LibraryTab> getLibraryTabs() {
return tabbedPane.getTabs().stream()
.map(tab -> (LibraryTab) tab)
.collect(Collectors.toList());
.map(tab -> (LibraryTab) tab)
.collect(Collectors.toList());
}

public void showLibraryTabAt(int i) {
Expand Down Expand Up @@ -587,8 +588,8 @@ public void init() {
stateManager.activeDatabaseProperty().bind(
EasyBind.map(tabbedPane.getSelectionModel().selectedItemProperty(),
selectedTab -> Optional.ofNullable(selectedTab)
.map(tab -> (LibraryTab) tab)
.map(LibraryTab::getBibDatabaseContext)));
.map(tab -> (LibraryTab) tab)
.map(LibraryTab::getBibDatabaseContext)));

// Subscribe to the search
EasyBind.subscribe(stateManager.activeSearchQueryProperty(),
Expand Down Expand Up @@ -829,8 +830,6 @@ private MenuBar createMenu() {
SidePaneComponent groups = sidePaneManager.getComponent(SidePaneType.GROUPS);
SidePaneComponent openOffice = sidePaneManager.getComponent(SidePaneType.OPEN_OFFICE);

view.getItems().add(new SeparatorMenuItem());
view.getItems().clear();
view.getItems().addAll(
factory.createCheckMenuItem(webSearch.getToggleAction(), webSearch.getToggleCommand(), sidePaneManager.isComponentVisible(SidePaneType.WEB_SEARCH)),
factory.createCheckMenuItem(groups.getToggleAction(), groups.getToggleCommand(), sidePaneManager.isComponentVisible(SidePaneType.GROUPS)),
Expand Down Expand Up @@ -980,10 +979,10 @@ public void addParserResult(ParserResult parserResult, boolean focusPanel) {
} else {
// only add tab if DB is not already open
Optional<LibraryTab> libraryTab = getLibraryTabs().stream()
.filter(p -> p.getBibDatabaseContext()
.getDatabasePath()
.equals(parserResult.getPath()))
.findFirst();
.filter(p -> p.getBibDatabaseContext()
.getDatabasePath()
.equals(parserResult.getPath()))
.findFirst();

if (libraryTab.isPresent()) {
tabbedPane.getSelectionModel().select(libraryTab.get());
Expand Down Expand Up @@ -1101,10 +1100,10 @@ public FileHistoryMenu getFileHistory() {
*/
private boolean confirmClose(LibraryTab libraryTab) {
String filename = libraryTab.getBibDatabaseContext()
.getDatabasePath()
.map(Path::toAbsolutePath)
.map(Path::toString)
.orElse(Localization.lang("untitled"));
.getDatabasePath()
.map(Path::toAbsolutePath)
.map(Path::toString)
.orElse(Localization.lang("untitled"));

ButtonType saveChanges = new ButtonType(Localization.lang("Save changes"), ButtonBar.ButtonData.YES);
ButtonType discardChanges = new ButtonType(Localization.lang("Discard changes"), ButtonBar.ButtonData.NO);
Expand Down

0 comments on commit bb6f643

Please sign in to comment.