-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [WIP] Refactor unlinked files create dialog in fxml and use a background task for import * add controller * inject stuff * empty line * add progreess indicator copy over some methods * finish export implementation TODO: Import Button does not yet work, always null * prepare background task for import * prepare eception handling * add further logging * add progrees indicator linkage TODO: Progress not yet shown * Fix threading issues, report progress * remove useless undo stuff * wire buttons to the viewModel adjust dialog * show import results dialog view * better error messages * Rename files, fix cancel, fix gui * Cleanup checkstyle * checkstyle * fix checkstyle in md * Make table columns more wider disable import button * preapre localization * fix typo * fix md errors * fix l10n key * add l10n * further l10n fixes * further l10n fixs to reuse * remove one dot * idea extend filenode wrapper * Remove extra dialog * fix progressIndicator still visible * replace with spaces * fix checkstyle * add titled pane * fix checkstyle * fix duplicate method * align browse button * adjust combobox display * Fixed whitespaces, fxml and refactored for some readability * Fixed accordion and l10n * Add changelog * fix link in changelog * fix changelog * fix wrong loop var fix dnd * refactor only call pdf import when xmp did not find a result * create viewModel for filter model * wip refactor like in parse latex * fix view model stuff adapt to check View model * add validator * fix selection and export move file node view model * fix bug using wrong parameter remove l10n keys * Refactored some style issues and a minor suggestions of IntelliJ * l10n * only show results after import * Add custom skin for putting arrow to the right * add checkstyle exception * only change import order * checkstyle * load custom skin only on accordion * Add arrow rotation hack * Fix merge conflict * Set disable instead of visible * Fixed jumping arrow * Refactored for mvvm pattern and optics * Remove obsolete language key * refactor * cleanup * fix checkstyle and l10n * move vars down to background task add explaination to checkstyle * Made treeRootProperty a property of Optional * l10n Co-authored-by: Carl Christian Snethlage <[email protected]>
- Loading branch information
1 parent
fac0a23
commit 86d52cd
Showing
32 changed files
with
1,268 additions
and
651 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
40 changes: 40 additions & 0 deletions
40
src/main/java/org/jabref/gui/externalfiles/FileExtensionViewModel.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,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); | ||
} | ||
} |
13 changes: 2 additions & 11 deletions
13
src/main/java/org/jabref/gui/externalfiles/FindUnlinkedFilesAction.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 |
---|---|---|
@@ -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()); | ||
} | ||
} |
Oops, something went wrong.