Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge entry buttons #12070

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8815445
add some change
jiaxin0103 Oct 16, 2024
c47544a
add some change
jiaxin0103 Oct 16, 2024
457cfff
added push check
koppor Oct 11, 2024
2fc75fb
Merge remote-tracking branch 'origin/main'
tohfas Oct 16, 2024
671a97c
merge the 4 button to one
jiaxin0103 Oct 20, 2024
4d39ce9
merge the 4 button to one again
jiaxin0103 Oct 20, 2024
61a74d1
Merge remote-tracking branch 'origin/main'
jiaxin0103 Oct 20, 2024
d71a453
change the language of the comment
jiaxin0103 Oct 20, 2024
da521e7
modify the checkstyleMain
jiaxin0103 Oct 21, 2024
ed86aca
added keybinding modification for "New entry from plain text"
tohfas Oct 22, 2024
8f33a72
added keybinding working modification.
tohfas Oct 24, 2024
ff9aeb9
Modified size of dialog box to 1000px
tohfas Oct 24, 2024
3458fcd
Updated spacing.
tohfas Oct 24, 2024
e746f55
modify comments
jiaxin0103 Oct 24, 2024
5020b65
Addressed feedback
jiaxin0103 Oct 24, 2024
9a21181
Addressed feedback(after passing the CI)
jiaxin0103 Oct 24, 2024
99fa545
Revert "Updated spacing."
jiaxin0103 Oct 25, 2024
dbdc3ce
Addressed feedback(after passing the CI)
jiaxin0103 Oct 25, 2024
8311358
Merge remote-tracking branch 'origin/merge-entry-buttons' into merge-…
jiaxin0103 Oct 25, 2024
788e939
Addressed feedback(after reverting and modofying the comments)
jiaxin0103 Oct 25, 2024
89a6974
Reduced the size of dialog box to 500px (halfof previous modification…
tohfas Oct 25, 2024
2b4a3a3
Merge branch 'merge-entry-buttons' of https://github.com/jiaxin0103/j…
tohfas Oct 25, 2024
c4208a5
Updated CHANGELOG.md
tohfas Oct 25, 2024
08a1077
Updated CHANGELOG.md
tohfas Oct 25, 2024
958a783
Added feedbacks with revert changes in md file
tohfas Oct 25, 2024
2c343a8
Added feedbacks.
tohfas Oct 26, 2024
83c11d2
Merge branch 'main' into merge-entry-buttons
tohfas Oct 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
open module org.jabref {
// Swing
requires java.desktop;

tohfas marked this conversation as resolved.
Show resolved Hide resolved
// JabRef codes
// review the code
tohfas marked this conversation as resolved.
Show resolved Hide resolved
// SQL
requires java.sql;
requires java.sql.rowset;
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/jabref/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
///
/// - Handle the command line arguments
/// - Start the JavaFX application (if not in CLI mode)

tohfas marked this conversation as resolved.
Show resolved Hide resolved
// jabref
tohfas marked this conversation as resolved.
Show resolved Hide resolved
// jabref
public class Launcher {

public static void main(String[] args) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public enum StandardActions implements Action {

NEW_ENTRY(Localization.lang("New entry"), IconTheme.JabRefIcons.ADD_ENTRY, KeyBinding.NEW_ENTRY),
NEW_ARTICLE(Localization.lang("New article"), IconTheme.JabRefIcons.ADD_ARTICLE),
NEW_ENTRY_FROM_PLAIN_TEXT(Localization.lang("New entry from plain text"), IconTheme.JabRefIcons.NEW_ENTRY_FROM_PLAIN_TEXT),
NEW_ENTRY_FROM_PLAIN_TEXT(Localization.lang("New entry from plain text"), IconTheme.JabRefIcons.NEW_ENTRY_FROM_PLAIN_TEXT, KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT),
LIBRARY_PROPERTIES(Localization.lang("Library properties")),
FIND_DUPLICATES(Localization.lang("Find duplicates"), IconTheme.JabRefIcons.FIND_DUPLICATES),
MERGE_ENTRIES(Localization.lang("Merge entries"), IconTheme.JabRefIcons.MERGE_ENTRIES, KeyBinding.MERGE_ENTRIES),
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/entrytype/EntryTypeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public EntryTypeView(LibraryTab libraryTab, DialogService dialogService, GuiPref
.load()
.setAsDialogPane(this);

this.setWidth(1000);
ControlHelper.setAction(generateButton, this.getDialogPane(), event -> viewModel.runFetcherWorker());
setOnCloseRequest(e -> viewModel.cancelFetcherWorker());

Expand Down Expand Up @@ -138,7 +139,6 @@ public void initialize() {
stateManager,
(UiTaskExecutor) taskExecutor,
fileUpdateMonitor);

idBasedFetchers.itemsProperty().bind(viewModel.fetcherItemsProperty());
idTextField.textProperty().bindBidirectional(viewModel.idTextProperty());
idBasedFetchers.valueProperty().bindBidirectional(viewModel.selectedItemProperty());
Expand Down
65 changes: 59 additions & 6 deletions src/main/java/org/jabref/gui/frame/MainToolBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import javafx.concurrent.Task;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.Group;
import javafx.scene.control.Button;
import javafx.scene.control.MenuButton;
import javafx.scene.control.MenuItem;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.Separator;
import javafx.scene.control.ToolBar;
Expand Down Expand Up @@ -119,12 +122,7 @@ private void createToolBar() {

rightSpacer,

new HBox(
factory.createIconButton(StandardActions.NEW_ARTICLE, new NewEntryAction(frame::getCurrentLibraryTab, StandardEntryType.Article, dialogService, preferences, stateManager)),
factory.createIconButton(StandardActions.NEW_ENTRY, new NewEntryAction(frame::getCurrentLibraryTab, dialogService, preferences, stateManager)),
createNewEntryFromIdButton(),
factory.createIconButton(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new PlainCitationParserAction(dialogService, stateManager)),
factory.createIconButton(StandardActions.DELETE_ENTRY, new EditAction(StandardActions.DELETE_ENTRY, frame::getCurrentLibraryTab, stateManager, undoManager))),
createNewEntryHBox(factory),

new Separator(Orientation.VERTICAL),

Expand Down Expand Up @@ -191,6 +189,46 @@ Button createNewEntryFromIdButton() {
return newEntryFromIdButton;
}

MenuItem createNewEntryFromIdMenuItem(ActionFactory factory, MenuButton menuButton) {
MenuItem newEntryFromIdItem = new MenuItem();
newEntryFromIdItem.setGraphic(IconTheme.JabRefIcons.IMPORT.getGraphicNode());
// 设置菜单项文本
newEntryFromIdItem.setText(Localization.lang("Import by ID"));
newEntryFromIdItem.disableProperty().bind(ActionHelper.needsDatabase(stateManager).not());

newEntryFromIdItem.setOnAction(event -> {
GenerateEntryFromIdDialog entryFromId = new GenerateEntryFromIdDialog(frame.getCurrentLibraryTab(), dialogService, preferences, taskExecutor, stateManager);

if (entryFromIdPopOver == null) {
entryFromIdPopOver = new PopOver(entryFromId.getDialogPane());
entryFromIdPopOver.setTitle(Localization.lang("Import by ID"));
entryFromIdPopOver.setArrowLocation(PopOver.ArrowLocation.TOP_CENTER);
entryFromIdPopOver.setContentNode(entryFromId.getDialogPane());
// 使用 MenuButton 作为锚点
entryFromIdPopOver.show(menuButton);
entryFromId.setEntryFromIdPopOver(entryFromIdPopOver);
} else if (entryFromIdPopOver.isShowing()) {
entryFromIdPopOver.hide();
} else {
entryFromIdPopOver.setContentNode(entryFromId.getDialogPane());
entryFromIdPopOver.show(menuButton);
entryFromId.setEntryFromIdPopOver(entryFromIdPopOver);
}
});

return newEntryFromIdItem;
}

HBox createNewEntryHBox(ActionFactory factory) {
HBox hBox = new HBox();
hBox.setAlignment(Pos.CENTER);
hBox.getChildren().addAll(
createNewEntryMenuButton(factory),
factory.createIconButton(StandardActions.DELETE_ENTRY, new EditAction(StandardActions.DELETE_ENTRY, frame::getCurrentLibraryTab, stateManager, undoManager))
);
return hBox;
}

Group createTaskIndicator() {
ProgressIndicator indicator = new ProgressIndicator();
indicator.getStyleClass().add("progress-indicatorToolbar");
Expand Down Expand Up @@ -245,4 +283,19 @@ Group createTaskIndicator() {

return new Group(indicator);
}

private MenuButton createNewEntryMenuButton(ActionFactory factory) {
MenuButton menuButton = new MenuButton();
// create button of menue
menuButton.setGraphic(IconTheme.JabRefIcons.NEW_GROUP.getGraphicNode());

// create menu
tohfas marked this conversation as resolved.
Show resolved Hide resolved
MenuItem newArticleItem = factory.createMenuItem(StandardActions.NEW_ARTICLE, new NewEntryAction(frame::getCurrentLibraryTab, StandardEntryType.Article, dialogService, preferences, stateManager));
MenuItem newEntryItem = factory.createMenuItem(StandardActions.NEW_ENTRY, new NewEntryAction(frame::getCurrentLibraryTab, dialogService, preferences, stateManager));
MenuItem newEntryFromIdItem = createNewEntryFromIdMenuItem(factory, menuButton);
MenuItem newEntryFromPlainTextItem = factory.createMenuItem(StandardActions.NEW_ENTRY_FROM_PLAIN_TEXT, new PlainCitationParserAction(dialogService, stateManager));
menuButton.getItems().addAll(newArticleItem, newEntryItem, newEntryFromIdItem, newEntryFromPlainTextItem);

return menuButton;
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/keyboard/KeyBinding.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public enum KeyBinding {
NEW_ARTICLE("New article", Localization.lang("New article"), "ctrl+shift+A", KeyBindingCategory.BIBTEX),
NEW_BOOK("New book", Localization.lang("New book"), "ctrl+shift+B", KeyBindingCategory.BIBTEX),
NEW_ENTRY("New entry", Localization.lang("New entry"), "ctrl+N", KeyBindingCategory.BIBTEX),
NEW_ENTRY_FROM_PLAIN_TEXT_ONLINE("New entry from plain text", Localization.lang("New entry from plain text (online)"), "ctrl+shift+N", KeyBindingCategory.BIBTEX),
NEW_ENTRY_FROM_PLAIN_TEXT("New entry from plain text", Localization.lang("New entry from plain text"), "ctrl+shift+N", KeyBindingCategory.BIBTEX),
NEW_INBOOK("New inbook", Localization.lang("New inbook"), "ctrl+shift+I", KeyBindingCategory.BIBTEX),
NEW_MASTERSTHESIS("New mastersthesis", Localization.lang("New mastersthesis"), "ctrl+shift+M", KeyBindingCategory.BIBTEX),
NEW_PHDTHESIS("New phdthesis", Localization.lang("New phdthesis"), "ctrl+shift+T", KeyBindingCategory.BIBTEX),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Map<KeyBinding, String> getKeyBindings() {
keyBindings.put(KeyBinding.NEW_ARTICLE, "ctrl+shift+A");
keyBindings.put(KeyBinding.NEW_BOOK, "ctrl+shift+B");
keyBindings.put(KeyBinding.NEW_ENTRY, "ctrl+N");
keyBindings.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT_ONLINE, "ctrl+shift+N");
keyBindings.put(KeyBinding.NEW_ENTRY_FROM_PLAIN_TEXT, "ctrl+shift+N");
keyBindings.put(KeyBinding.NEW_INBOOK, "ctrl+shift+I");
keyBindings.put(KeyBinding.NEW_INPROCEEDINGS, "ctrl+shift+C");
keyBindings.put(KeyBinding.NEW_MASTERSTHESIS, "ctrl+shift+M");
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2136,7 +2136,7 @@ Your\ text\ is\ being\ parsed...=Your text is being parsed...
LLM=LLM
Please\ verify\ any\ information\ provided.=Please verify any information provided.
Warning\:\ plain\ citation\ parsing\ may\ generate\ inaccurate\ or\ inappropriate\ responses.=Warning: plain citation parsing may generate inaccurate or inappropriate responses.
New\ entry\ from\ plain\ text\ (online)=New entry from plain text (online)

Parser\ choice=Parser choice
Plain\ Citations\ Parser=Plain Citations Parser
Please\ enter\ the\ plain\ citations\ to\ parse\ from\ separated\ by\ double\ empty\ lines.=Please enter the plain citations to parse from separated by double empty lines.
Expand Down
Loading