Skip to content

Commit

Permalink
Fixes missing library properties context menu on library tab
Browse files Browse the repository at this point in the history
fixes issue JabRef#6485 to implement context menu on library tabs
with the "Library properties" menu item.
  • Loading branch information
Oltman-B committed May 22, 2020
1 parent d2f8252 commit 61453d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
## [Unreleased]

### Added

- We added the Library properties to a context menu on the library tabs [#6485](https://github.com/JabRef/jabref/issues/6485)
- We added a new field in the preferences in 'BibTeX key generator' for unwanted characters that can be user-specified. [#6295](https://github.com/JabRef/jabref/issues/6295)
- We added support for searching ShortScience for an entry through the user's browser. [#6018](https://github.com/JabRef/jabref/pull/6018)
- We updated EditionChecker to permit edition to start with a number. [#6144](https://github.com/JabRef/jabref/issues/6144)
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
Expand Down Expand Up @@ -97,6 +98,7 @@
import org.jabref.gui.journals.ManageJournalsAction;
import org.jabref.gui.keyboard.CustomizeKeyBindingAction;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.gui.keyboard.KeyBindingRepository;
import org.jabref.gui.libraryproperties.LibraryPropertiesAction;
import org.jabref.gui.menus.FileHistoryMenu;
import org.jabref.gui.mergeentries.MergeEntriesAction;
Expand Down Expand Up @@ -1077,6 +1079,15 @@ public void updateAllTabTitles() {
}
}

private static ContextMenu createTabContextMenu(KeyBindingRepository keyBindingRepository, BasePanel panel, StateManager stateManager){
ContextMenu contextMenu = new ContextMenu();
ActionFactory factory = new ActionFactory(keyBindingRepository);

contextMenu.getItems().add(factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(panel.frame(), stateManager)));

return contextMenu;
}

public void addTab(BasePanel basePanel, boolean raisePanel) {
// add tab
Tab newTab = new Tab(basePanel.getTabTitle(), basePanel);
Expand All @@ -1086,6 +1097,9 @@ public void addTab(BasePanel basePanel, boolean raisePanel) {
event.consume();
});

// add tab context menu
newTab.setContextMenu(createTabContextMenu(Globals.getKeyPrefs(), basePanel, stateManager));

// update all tab titles
updateAllTabTitles();

Expand Down

0 comments on commit 61453d8

Please sign in to comment.