-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Right click create group #11476
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
Right click create group #11476
Changes from 15 commits
910c857
cbc0d7d
f126974
e4c2281
9b4d2db
9631067
d4222a7
faca154
ca5e69f
3a6037e
8dd474a
12dedd4
2c87cda
f3011ed
53f1544
ec9b081
aabb4a3
f654aba
d772aaa
d3e1f1e
e4ec775
fd088d1
e2ad784
cf33b73
85d42b9
ea49e46
00de24b
a1dfe75
77f927b
f80e515
c5241f0
bba0522
1912281
4931eac
f928a36
93f2df5
0367f7b
e87af8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ | |
| import java.util.function.Supplier; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import javafx.collections.FXCollections; | ||
| import javafx.stage.FileChooser; | ||
| import javafx.util.Duration; | ||
|
|
||
|
|
@@ -111,7 +112,7 @@ private void export(Path file, FileChooser.ExtensionFilter selectedExtensionFilt | |
| // All entries | ||
| entries = stateManager.getActiveDatabase() | ||
| .map(BibDatabaseContext::getEntries) | ||
| .orElse(Collections.emptyList()); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change needed? I checked the caller - and it seems it is passed to I would even try to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe I just did this because the function signature changed (from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will just revert and see if the CI is green. Reason: BibDatbase context code: public List<BibEntry> getEntries() {
return database.getEntries();
}There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did my revert go through, because I did not see it? Please double check that this file is not changed! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Per my earlier comment -
|
||
| .orElse(FXCollections.emptyObservableList()); | ||
| } | ||
|
|
||
| List<Path> fileDirForDatabase = stateManager.getActiveDatabase() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| import org.jabref.logic.util.io.FileUtil; | ||
| import org.jabref.model.database.BibDatabase; | ||
| import org.jabref.model.database.BibDatabaseContext; | ||
| import org.jabref.model.entry.BibEntry; | ||
| import org.jabref.model.entry.Keyword; | ||
| import org.jabref.model.entry.field.FieldFactory; | ||
| import org.jabref.model.groups.AbstractGroup; | ||
|
|
@@ -76,6 +77,7 @@ public class GroupDialogViewModel { | |
| private final BooleanProperty typeSearchProperty = new SimpleBooleanProperty(); | ||
| private final BooleanProperty typeAutoProperty = new SimpleBooleanProperty(); | ||
| private final BooleanProperty typeTexProperty = new SimpleBooleanProperty(); | ||
| private final BooleanProperty typeSelectionProperty = new SimpleBooleanProperty(); | ||
|
|
||
| // Option Groups | ||
|
||
| private final StringProperty keywordGroupSearchTermProperty = new SimpleStringProperty(""); | ||
|
|
@@ -94,6 +96,7 @@ public class GroupDialogViewModel { | |
| private final StringProperty autoGroupPersonsFieldProperty = new SimpleStringProperty(""); | ||
|
|
||
| private final StringProperty texGroupFilePathProperty = new SimpleStringProperty(""); | ||
| private final BooleanProperty entriesAreSelected = new SimpleBooleanProperty(false); | ||
|
|
||
| private Validator nameValidator; | ||
| private Validator nameContainsDelimiterValidator; | ||
|
|
@@ -112,24 +115,41 @@ public class GroupDialogViewModel { | |
| private final AbstractGroup editedGroup; | ||
| private final GroupTreeNode parentNode; | ||
| private final FileUpdateMonitor fileUpdateMonitor; | ||
| private final List<BibEntry> selectedEntries; | ||
| private final boolean useSelectedEntries; | ||
|
|
||
| public GroupDialogViewModel(DialogService dialogService, | ||
| BibDatabaseContext currentDatabase, | ||
| PreferencesService preferencesService, | ||
| @Nullable AbstractGroup editedGroup, | ||
| @Nullable GroupTreeNode parentNode, | ||
| FileUpdateMonitor fileUpdateMonitor) { | ||
| FileUpdateMonitor fileUpdateMonitor, | ||
| List<BibEntry> selectedEntries, | ||
| boolean useSelectedEntries) { | ||
| this.dialogService = dialogService; | ||
| this.preferencesService = preferencesService; | ||
| this.currentDatabase = currentDatabase; | ||
| this.editedGroup = editedGroup; | ||
| this.parentNode = parentNode; | ||
| this.fileUpdateMonitor = fileUpdateMonitor; | ||
| this.selectedEntries = selectedEntries; | ||
| this.useSelectedEntries = useSelectedEntries; | ||
|
|
||
| setupValidation(); | ||
| setValues(); | ||
| } | ||
|
|
||
| public GroupDialogViewModel( | ||
| DialogService dialogService, | ||
| BibDatabaseContext currentDatabase, | ||
| PreferencesService preferencesService, | ||
| @Nullable AbstractGroup editedGroup, | ||
| @Nullable GroupTreeNode parentNode, | ||
| FileUpdateMonitor fileUpdateMonitor | ||
| ) { | ||
| this(dialogService, currentDatabase, preferencesService, editedGroup, parentNode, fileUpdateMonitor, new ArrayList<>(), false); | ||
| } | ||
|
|
||
| private void setupValidation() { | ||
| validator = new CompositeValidator(); | ||
|
|
||
|
|
@@ -246,7 +266,7 @@ private void setupValidation() { | |
| return false; | ||
| } | ||
| return FileUtil.getFileExtension(input) | ||
| .map(extension -> "aux".equalsIgnoreCase(extension)) | ||
| .map("aux"::equalsIgnoreCase) | ||
| .orElse(false); | ||
| } | ||
| }, | ||
|
|
@@ -371,6 +391,14 @@ public AbstractGroup resultConverter(ButtonType button) { | |
| new DefaultAuxParser(new BibDatabase()), | ||
| fileUpdateMonitor, | ||
| currentDatabase.getMetaData()); | ||
| } else if (typeSelectionProperty.getValue()) { | ||
| ExplicitGroup tempResultingGroup = new ExplicitGroup( | ||
| groupName, | ||
| groupHierarchySelectedProperty.getValue(), | ||
| preferencesService.getBibEntryPreferences().getKeywordSeparator() | ||
| ); | ||
| tempResultingGroup.add(selectedEntries); | ||
| resultingGroup = tempResultingGroup; | ||
| } | ||
|
|
||
| if (resultingGroup != null) { | ||
|
|
@@ -405,7 +433,16 @@ public void setValues() { | |
| .ifPresent(iconProperty::setValue); | ||
| parentNode.getGroup().getColor().ifPresent(color -> colorUseProperty.setValue(true)); | ||
| } | ||
| typeExplicitProperty.setValue(true); | ||
| if (!selectedEntries.isEmpty()) { | ||
| entriesAreSelected.setValue(true); | ||
| if (selectedEntries.size() > 1 || useSelectedEntries) { | ||
| typeSelectionProperty.setValue(true); | ||
| } else { | ||
| typeExplicitProperty.setValue(true); | ||
| } | ||
| } else { | ||
| typeExplicitProperty.setValue(true); | ||
| } | ||
| groupHierarchySelectedProperty.setValue(preferencesService.getGroupsPreferences().getDefaultHierarchicalContext()); | ||
| autoGroupKeywordsOptionProperty.setValue(Boolean.TRUE); | ||
| } else { | ||
|
|
@@ -535,7 +572,7 @@ public ValidationStatus keywordSearchTermEmptyValidationStatus() { | |
| return keywordSearchTermEmptyValidator.getValidationStatus(); | ||
| } | ||
|
|
||
| public ValidationStatus texGroupFilePathValidatonStatus() { | ||
| public ValidationStatus texGroupFilePathValidationStatus() { | ||
| return texGroupFilePathValidator.getValidationStatus(); | ||
| } | ||
|
|
||
|
|
@@ -587,6 +624,10 @@ public BooleanProperty typeTexProperty() { | |
| return typeTexProperty; | ||
| } | ||
|
|
||
| public BooleanProperty typeSelectionProperty() { | ||
| return typeSelectionProperty; | ||
| } | ||
|
|
||
| public StringProperty keywordGroupSearchTermProperty() { | ||
| return keywordGroupSearchTermProperty; | ||
| } | ||
|
|
@@ -638,4 +679,8 @@ public StringProperty autoGroupPersonsFieldProperty() { | |
| public StringProperty texGroupFilePathProperty() { | ||
| return texGroupFilePathProperty; | ||
| } | ||
|
|
||
| public BooleanProperty entriesAreSelectedProperty() { | ||
| return entriesAreSelected; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.