-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Added keybinding for renaming group with F2 #12159
Open
Rydzard
wants to merge
15
commits into
JabRef:main
Choose a base branch
from
Rydzard:renameGroup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
42616e2
Added keybinding for renaming group with F2
ea811f1
fix group size changes
8144433
fix checkstyleTest
20c387a
Discard changes to src/main/java/org/jabref/gui/DialogService.java
koppor 67a5d5f
remove comments etc.
5dcc5a2
Merge branch 'renameGroup' of https://github.com/Rydzard/jabref into …
487754a
remove comments etc.
a3e8599
try CI
bfa8228
Merge branch 'main' into renameGroup
Rydzard 645693b
DeleteTest
Rydzard 75f84bc
return FetcherTest
Rydzard 068253c
Update JabRef_en.properties
Rydzard d905fde
Update RenameGroupView.java
Rydzard 8bb211e
Update JabRef_en.properties
Rydzard 27f5690
Update GroupTreeViewModel.java
Rydzard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package org.jabref.gui.groups; | ||
|
||
import java.util.Optional; | ||
|
||
import javafx.fxml.FXML; | ||
import javafx.scene.control.ButtonType; | ||
import javafx.scene.control.Label; | ||
import javafx.scene.control.TextField; | ||
import javafx.scene.layout.VBox; | ||
|
||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.util.BaseDialog; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.model.database.BibDatabaseContext; | ||
import org.jabref.model.groups.AbstractGroup; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
public class RenameGroupView extends BaseDialog<AbstractGroup> { | ||
@FXML | ||
private TextField nameField; | ||
@Inject | ||
private DialogService dialogService; | ||
private final BibDatabaseContext currentDatabase; | ||
private final AbstractGroup editedGroup; | ||
|
||
public RenameGroupView(BibDatabaseContext currentDatabase, | ||
AbstractGroup editedGroup) { | ||
this.currentDatabase = currentDatabase; | ||
this.editedGroup = editedGroup; | ||
|
||
setWidth(400); | ||
setHeight(150); | ||
|
||
setTitle(Localization.lang("Rename group")); | ||
getDialogPane().getButtonTypes().setAll(ButtonType.OK, ButtonType.CANCEL); | ||
|
||
nameField = new TextField(); | ||
nameField.setPromptText(Localization.lang("Name")); | ||
|
||
VBox vbox = new VBox(new Label(Localization.lang("New group")), nameField); | ||
getDialogPane().setContent(vbox); | ||
|
||
setResultConverter(buttonType -> { | ||
if (buttonType == ButtonType.OK) { | ||
return resultConverter(ButtonType.OK).orElse(null); | ||
} else { | ||
return null; | ||
} | ||
}); | ||
} | ||
|
||
protected Optional<AbstractGroup> resultConverter(ButtonType button) { | ||
if (button != ButtonType.OK) { | ||
return Optional.empty(); | ||
} | ||
try { | ||
String newGroupName = nameField.getText().trim(); | ||
if (editedGroup != null) { | ||
editedGroup.nameProperty().setValue(newGroupName); | ||
return Optional.of(editedGroup); | ||
} | ||
return Optional.empty(); | ||
} catch (Exception exception) { | ||
dialogService.showErrorDialogAndWait(exception.getLocalizedMessage(), exception); | ||
return Optional.empty(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be comment why this is necessary. At first guess, I would have thought that there must not be any other group with the same name. Why is one other group with the same name OK?