-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into restapi
* upstream/main: (26 commits) Remove bibtexml.xsd (We don't support BibTeXML any more) Rewrite code of MedlineImporter (#9673) Rename variable and add more documentation Fix checkstyle Add hanling of "field = {content\}" Add link to PR Add link to PR. JabRef writes a new backup file only if there is a change. Add debug output to log.txt Refine logging howto Change log level for non-found files during PDF indexing Initial ImportHandlerTest Streamline AppDirs paths add a clear history button in sub-menu Removed redundant list add for en.properties add Localization.lang for string correct changelog add test for getLastSearchHistory and change HashLinkedSet to ArrayList fix the checkstlye ...
- Loading branch information
Showing
37 changed files
with
2,135 additions
and
1,794 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/main/java/org/jabref/gui/search/SearchFieldRightClickMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package org.jabref.gui.search; | ||
|
||
import javafx.scene.control.ContextMenu; | ||
import javafx.scene.control.Menu; | ||
import javafx.scene.control.MenuItem; | ||
import javafx.scene.control.SeparatorMenuItem; | ||
|
||
import org.jabref.gui.StateManager; | ||
import org.jabref.gui.actions.ActionFactory; | ||
import org.jabref.gui.actions.SimpleCommand; | ||
import org.jabref.gui.actions.StandardActions; | ||
import org.jabref.gui.edit.EditAction; | ||
import org.jabref.gui.keyboard.KeyBindingRepository; | ||
import org.jabref.logic.l10n.Localization; | ||
|
||
import org.controlsfx.control.textfield.CustomTextField; | ||
|
||
public class SearchFieldRightClickMenu { | ||
public static ContextMenu create(KeyBindingRepository keyBindingRepository, | ||
StateManager stateManager, | ||
CustomTextField searchField) { | ||
ActionFactory factory = new ActionFactory(keyBindingRepository); | ||
ContextMenu contextMenu = new ContextMenu(); | ||
|
||
contextMenu.getItems().addAll( | ||
factory.createMenuItem(StandardActions.UNDO, new EditAction(StandardActions.UNDO, null, stateManager)), | ||
factory.createMenuItem(StandardActions.REDO, new EditAction(StandardActions.REDO, null, stateManager)), | ||
factory.createMenuItem(StandardActions.CUT, new EditAction(StandardActions.CUT, null, stateManager)), | ||
factory.createMenuItem(StandardActions.COPY, new EditAction(StandardActions.COPY, null, stateManager)), | ||
factory.createMenuItem(StandardActions.PASTE, new EditAction(StandardActions.PASTE, null, stateManager)), | ||
factory.createMenuItem(StandardActions.DELETE, new EditAction(StandardActions.DELETE, null, stateManager)), | ||
|
||
new SeparatorMenuItem(), | ||
|
||
factory.createMenuItem(StandardActions.SELECT_ALL, new EditAction(StandardActions.SELECT_ALL, null, stateManager)), | ||
createSearchFromHistorySubMenu(factory, stateManager, searchField) | ||
); | ||
|
||
return contextMenu; | ||
} | ||
|
||
private static Menu createSearchFromHistorySubMenu(ActionFactory factory, | ||
StateManager stateManager, | ||
CustomTextField searchField) { | ||
Menu searchFromHistorySubMenu = factory.createMenu(() -> Localization.lang("Search from history...")); | ||
|
||
int num = stateManager.getLastSearchHistory(10).size(); | ||
if (num == 0) { | ||
MenuItem item = new MenuItem(Localization.lang("your search history is empty")); | ||
searchFromHistorySubMenu.getItems().addAll(item); | ||
} else { | ||
for (int i = 0; i < num; i++) { | ||
int finalI = i; | ||
MenuItem item = factory.createMenuItem(() -> stateManager.getLastSearchHistory(10).get(finalI), new SimpleCommand() { | ||
@Override | ||
public void execute() { | ||
searchField.setText(stateManager.getLastSearchHistory(10).get(finalI)); | ||
} | ||
}); | ||
searchFromHistorySubMenu.getItems().addAll(item); | ||
} | ||
MenuItem clear = factory.createMenuItem(() -> Localization.lang("Clear history"), new SimpleCommand() { | ||
@Override | ||
public void execute() { | ||
stateManager.clearSearchHistory(); | ||
} | ||
}); | ||
searchFromHistorySubMenu.getItems().addAll(new SeparatorMenuItem(), clear); | ||
} | ||
return searchFromHistorySubMenu; | ||
} | ||
} |
Oops, something went wrong.