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

Refactor unlinked files #7209

Merged
merged 91 commits into from
Jan 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
57f210e
[WIP] Refactor unlinked files
Siedlerchr Dec 20, 2020
803c56e
add controller
Siedlerchr Dec 20, 2020
3685516
inject stuff
Siedlerchr Dec 20, 2020
2cb8a2d
empty line
Siedlerchr Dec 20, 2020
8d429cd
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Dec 21, 2020
6bdb2c6
add progreess indicator
Siedlerchr Dec 21, 2020
98770bb
finish export implementation
Siedlerchr Dec 21, 2020
f3d2cca
prepare background task for import
Siedlerchr Dec 21, 2020
10db39a
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Dec 22, 2020
9e89c91
prepare eception handling
Siedlerchr Dec 22, 2020
eb44469
add further logging
Siedlerchr Dec 22, 2020
1a732cb
add progrees indicator linkage
Siedlerchr Dec 22, 2020
f0b3f79
Fix threading issues, report progress
Siedlerchr Dec 22, 2020
a05ba1f
remove useless undo stuff
Siedlerchr Dec 22, 2020
1d25e30
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Dec 23, 2020
3f93cef
wire buttons to the viewModel
Siedlerchr Dec 23, 2020
e7dddd4
show import results dialog view
Siedlerchr Dec 23, 2020
b7fcd2f
better error messages
Siedlerchr Dec 23, 2020
ad50cc9
Rename files, fix cancel, fix gui
Siedlerchr Dec 24, 2020
082580c
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Dec 25, 2020
4e37d44
Cleanup
Siedlerchr Dec 26, 2020
6f61e8e
checkstyle
Siedlerchr Dec 26, 2020
2ae183d
fix checkstyle in md
Siedlerchr Dec 26, 2020
27cf98d
Make table columns more wider
Siedlerchr Dec 26, 2020
98c6a7f
preapre localization
Siedlerchr Dec 26, 2020
6219364
fix typo
Siedlerchr Dec 26, 2020
ebd0457
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Dec 26, 2020
f722286
fix md errors
Siedlerchr Dec 26, 2020
a1da392
fix l10n key
Siedlerchr Dec 26, 2020
e2fd3ba
add l10n
Siedlerchr Dec 26, 2020
bee42c6
further l10n fixes
Siedlerchr Dec 26, 2020
5cdfa69
further l10n fixs to reuse
Siedlerchr Dec 26, 2020
15bbee1
remove one dot
Siedlerchr Dec 26, 2020
a6d17f9
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Dec 28, 2020
1918893
idea extend filenode wrapper
Siedlerchr Dec 28, 2020
37f6b5b
Remove extra dialog
Siedlerchr Dec 28, 2020
6b69465
fix progressIndicator still visible
Siedlerchr Dec 28, 2020
babad73
replace with spaces
Siedlerchr Dec 28, 2020
1d9bf7c
fix checkstyle
Siedlerchr Dec 28, 2020
a1dc057
add titled pane
Siedlerchr Dec 29, 2020
3683a2c
fix checkstyle
Siedlerchr Dec 29, 2020
ce21003
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Dec 29, 2020
78cf06b
fix duplicate method
Siedlerchr Dec 29, 2020
7f776b2
Merge and remove unceessary dependencies
Siedlerchr Jan 2, 2021
b036f11
align browse button
Siedlerchr Jan 2, 2021
82ae9ea
adjust combobox display
Siedlerchr Jan 2, 2021
380f4d1
Fixed whitespaces, fxml and refactored for some readability
calixtus Jan 3, 2021
fe59fb9
Fixed accordion and l10n
calixtus Jan 3, 2021
4b3a922
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Jan 4, 2021
e9b38ab
Add changelog
Siedlerchr Jan 4, 2021
e046637
fix link in changelog
Siedlerchr Jan 4, 2021
0d439a8
fix changelog
Siedlerchr Jan 4, 2021
408f6e6
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Jan 4, 2021
6bc4acb
fix wrong loop var
Siedlerchr Jan 4, 2021
9e7544a
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Jan 5, 2021
e059988
refactor
Siedlerchr Jan 5, 2021
179c349
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Jan 7, 2021
c52f0d7
create viewModel for filter model
Siedlerchr Jan 7, 2021
266a8c3
wip refactor like in parse latex
Siedlerchr Jan 7, 2021
81e7b44
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Jan 8, 2021
b5b21f2
fix view model stuff
Siedlerchr Jan 10, 2021
d50a9d6
add validator
Siedlerchr Jan 10, 2021
0cd75e5
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Jan 10, 2021
aebd602
fix selection and export
Siedlerchr Jan 10, 2021
0e8cfbb
fix bug using wrong parameter
Siedlerchr Jan 10, 2021
950655c
Refactored some style issues and a minor suggestions of IntelliJ
calixtus Jan 10, 2021
4503d1e
l10n
calixtus Jan 10, 2021
0426fd2
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Jan 13, 2021
3d1dd90
only show results after import
Siedlerchr Jan 13, 2021
2bc1ddc
Merge branch 'importerbackgroundtask' of github.com:JabRef/jabref int…
Siedlerchr Jan 13, 2021
b8e4e35
Add custom skin for putting arrow to the right
Siedlerchr Jan 14, 2021
9778d01
add checkstyle exception
Siedlerchr Jan 14, 2021
c3acb2b
only change import order
Siedlerchr Jan 14, 2021
473aac7
checkstyle
Siedlerchr Jan 14, 2021
bbe2210
load custom skin only on accordion
Siedlerchr Jan 14, 2021
35fcac9
Add arrow rotation hack
Siedlerchr Jan 15, 2021
e21a060
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Jan 15, 2021
7ec2651
Fix merge conflict
Siedlerchr Jan 15, 2021
c11d0c3
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Jan 17, 2021
686af8f
Set disable instead of visible
Siedlerchr Jan 17, 2021
ef0cc31
Fixed jumping arrow
calixtus Jan 17, 2021
b1ef474
Refactored for mvvm pattern and optics
calixtus Jan 18, 2021
9b28692
Remove obsolete language key
koppor Jan 20, 2021
2fec815
Merge remote-tracking branch 'upstream/master' into importerbackgroun…
Siedlerchr Jan 22, 2021
4efa5b9
refactor
Siedlerchr Jan 22, 2021
7ec8e38
Merge remote-tracking branch 'upstream/importerbackgroundtask' into i…
Siedlerchr Jan 22, 2021
7c41e9a
cleanup
Siedlerchr Jan 22, 2021
bc6c9e1
fix checkstyle
Siedlerchr Jan 22, 2021
443c14c
move vars down to background task
Siedlerchr Jan 23, 2021
ecaa23a
Made treeRootProperty a property of Optional
calixtus Jan 24, 2021
6362584
l10n
calixtus Jan 24, 2021
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: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Changed

- We improved the "Find unlinked files" dialog to show import results for each file. [#7209](https://github.com/JabRef/jabref/pull/7209)
- The content of the field `timestamp` is migrated to `creationdate`. In case one configured "udpate timestampe", it is migrated to `modificationdate`. [koppor#130](https://github.com/koppor/jabref/issues/130)
- The JabRef specific meta-data content in the main field such as priorities (prio1, prio2, ...) are migrated to their respective fields. They are removed from the keywords. [#6840](https://github.com/jabref/jabref/issues/6840)
- We fixed an issue where groups generated from authors' last names did not include all entries of the authors' [#5833](https://github.com/JabRef/jabref/issues/5833)
Expand All @@ -30,6 +31,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
- We fixed an issue with the style of highlighted check boxes while searching in preferences. [#7226](https://github.com/JabRef/jabref/issues/7226)
- We fixed an issue where the option "Move file to file directory" was disabled in the entry editor for all files [#7194](https://github.com/JabRef/jabref/issues/7194)
- We fixed an issue where application dialogs were opening in the wrong display when using multiple screens [#7273](https://github.com/JabRef/jabref/pull/7273)
- We fixed an issue where the "Find unlinked files" dialog would freeze JabRef on importing. [#7205](https://github.com/JabRef/jabref/issues/7205)
- We fixed an issue where the "Find unlinked files" would stop importing when importing a single file failed. [#7206](https://github.com/JabRef/jabref/issues/7206)
- We fixed an issue where an exception would be displayed for previewing and preferences when a custom theme has been configured but is missing [#7177](https://github.com/JabRef/jabref/issues/7177)
- We fixed an issue where the Harvard RTF exporter used the wrong default file extension. [4508](https://github.com/JabRef/jabref/issues/4508)
- We fixed an issue where the Harvard RTF exporter did not use the new authors formatter and therefore did not export "organization" authors correctly. [4508](https://github.com/JabRef/jabref/issues/4508)
Expand Down
2 changes: 2 additions & 0 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@

<suppressions>
<suppress checks="[a-zA-Z0-9]*" files="[\\/]generated[\\/]" />
<!-- We ignore this file because it's a modification of the original java code https://github.com/openjdk/jfx/blob/jfx15/modules/javafx.controls/src/main/java/javafx/scene/control/skin/TitledPaneSkin.java -->
<suppress checks="[a-zA-Z0-9]*" files="CustomTitledPaneSkin.java" />
Siedlerchr marked this conversation as resolved.
Show resolved Hide resolved
</suppressions>
4 changes: 2 additions & 2 deletions docs/getting-into-the-code/code-howtos.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Many times there is a need to provide an object on many locations simultaneously

### Register to the `EventBus`

Any listening method has to be annotated with `@Subscribe` keyword and must have only one accepting parameter. Furthermore the object which contains such listening method\(s\) has to be registered using the `register(Object)` method provided by `EventBus`. The listening methods can be overloaded by using different parameter types.
Any listening method has to be annotated with `@Subscribe` keyword and must have only one accepting parameter. Furthermore, the object which contains such listening method\(s\) has to be registered using the `register(Object)` method provided by `EventBus`. The listening methods can be overloaded by using different parameter types.

### Posting an object

Expand Down Expand Up @@ -190,7 +190,7 @@ If the language is a variant of a language `zh_CN` or `pt_BR` it is necessary to

## Cleanup and Formatters

We try to build a cleanup mechanism based on formatters. The idea is that we can register these actions in arbitrary places, e.g., onSave, onImport, onExport, cleanup, etc. and apply them to different fields. The formatters themself are independent of any logic and therefore easy to test.
We try to build a cleanup mechanism based on formatters. The idea is that we can register these actions in arbitrary places, e.g., onSave, onImport, onExport, cleanup, etc. and apply them to different fields. The formatters themselves are independent of any logic and therefore easy to test.

Example: [NormalizePagesFormatter](https://github.com/JabRef/jabref/blob/master/src/main/java/org/jabref/logic/formatter/bibtexfields/NormalizePagesFormatter.java)

Expand Down
25 changes: 25 additions & 0 deletions src/main/java/org/jabref/gui/Base.css
Original file line number Diff line number Diff line change
Expand Up @@ -690,6 +690,31 @@
-fx-padding: 0;
}

.accordion .titled-pane {
-fx-skin: "org.jabref.gui.util.CustomTitledPaneSkin";
-fx-arrow-side: right;
}

.accordion .titled-pane .title {
-fx-background-color: transparent;
-fx-border-color: transparent;
-fx-background-insets: 5 5 5 5;
}

.accordion .titled-pane > *.content {
-fx-background-color: transparent;
-fx-border-color: transparent;
}

/*
* The arrow button has some right padding that's added
* by "modena.css". This simply puts the padding on the
* left since the arrow is positioned on the right.
*/
.titled-pane > .title > .arrow-button {
-fx-padding: 0.0em 0.0em 0.0em 0.583em;
}

.text-input {
-fx-background-color: -fx-outer-border, -fx-control-inner-background;
-fx-background-insets: 0, 1;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ private MenuBar createMenu() {

new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.FIND_UNLINKED_FILES, new FindUnlinkedFilesAction(dialogService, prefs, undoManager, stateManager))
factory.createMenuItem(StandardActions.FIND_UNLINKED_FILES, new FindUnlinkedFilesAction(dialogService, stateManager))
);

// PushToApplication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public class BibtexExtractorViewModel {
private static final Logger LOGGER = LoggerFactory.getLogger(BibtexExtractorViewModel.class);

private final StringProperty inputTextProperty = new SimpleStringProperty("");
private DialogService dialogService;
private GrobidCitationFetcher currentCitationfetcher;
private TaskExecutor taskExecutor;
private ImportHandler importHandler;
private final DialogService dialogService;
private final GrobidCitationFetcher currentCitationfetcher;
private final TaskExecutor taskExecutor;
private final ImportHandler importHandler;

public BibtexExtractorViewModel(BibDatabaseContext bibdatabaseContext,
DialogService dialogService,
Expand All @@ -48,7 +48,6 @@ public BibtexExtractorViewModel(BibDatabaseContext bibdatabaseContext,
currentCitationfetcher = new GrobidCitationFetcher(preferencesService.getImportFormatPreferences());
this.taskExecutor = taskExecutor;
this.importHandler = new ImportHandler(
dialogService,
bibdatabaseContext,
ExternalFileTypes.getInstance(),
preferencesService,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.jabref.gui.externalfiles;

import java.nio.file.DirectoryStream.Filter;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Collectors;

import org.jabref.gui.externalfiletype.ExternalFileType;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.gui.util.FileFilterConverter;
import org.jabref.logic.l10n.Localization;
import org.jabref.logic.util.FileType;

public class FileExtensionViewModel {

private final String description;
private final List<String> extensions;
private final ExternalFileTypes externalFileTypes;

FileExtensionViewModel(FileType fileType, ExternalFileTypes externalFileTypes) {
this.description = Localization.lang("%0 file", fileType.toString());
this.extensions = fileType.getExtensionsWithDot();
this.externalFileTypes = externalFileTypes;
}

public String getDescription() {
return this.description + extensions.stream().collect(Collectors.joining(", ", " (", ")"));
}

public JabRefIcon getIcon() {
return externalFileTypes.getExternalFileTypeByExt(extensions.get(0))
.map(ExternalFileType::getIcon)
.orElse(null);
}

public Filter<Path> dirFilter() {
return FileFilterConverter.toDirFilter(extensions);
}
}
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
package org.jabref.gui.externalfiles;

import javax.swing.undo.UndoManager;

import org.jabref.gui.DialogService;
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.preferences.PreferencesService;

import static org.jabref.gui.actions.ActionHelper.needsDatabase;

public class FindUnlinkedFilesAction extends SimpleCommand {

private final DialogService dialogService;
private final PreferencesService preferencesService;
private final UndoManager undoManager;
private final StateManager stateManager;

public FindUnlinkedFilesAction(DialogService dialogService, PreferencesService preferencesService, UndoManager undoManager, StateManager stateManager) {
public FindUnlinkedFilesAction(DialogService dialogService, StateManager stateManager) {
this.dialogService = dialogService;
this.preferencesService = preferencesService;
this.undoManager = undoManager;
this.stateManager = stateManager;

this.executable.bind(needsDatabase(this.stateManager));
}

@Override
public void execute() {
BibDatabaseContext database = stateManager.getActiveDatabase().orElseThrow(() -> new NullPointerException("Database null"));
dialogService.showCustomDialogAndWait(new FindUnlinkedFilesDialog(database, dialogService, preferencesService, undoManager));
dialogService.showCustomDialogAndWait(new UnlinkedFilesDialogView());
}
}
Loading