forked from JabRef/jabref
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor to use exiting journal info fetcher
- Loading branch information
1 parent
1e1347e
commit b74f5d1
Showing
8 changed files
with
62 additions
and
81 deletions.
There are no files selected for viewing
20 changes: 16 additions & 4 deletions
20
src/main/java/org/jabref/gui/fieldeditors/identifier/ISSNIdentifierEditorViewModel.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,24 +1,36 @@ | ||
package org.jabref.gui.fieldeditors.identifier; | ||
|
||
import javax.swing.undo.UndoManager; | ||
|
||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.JabRefGUI; | ||
import org.jabref.gui.StateManager; | ||
import org.jabref.gui.autocompleter.SuggestionProvider; | ||
import org.jabref.gui.mergeentries.FetchAndMergeEntry; | ||
import org.jabref.gui.util.TaskExecutor; | ||
import org.jabref.logic.integrity.FieldCheckers; | ||
import org.jabref.logic.l10n.Localization; | ||
import org.jabref.model.entry.BibEntry; | ||
import org.jabref.model.entry.field.StandardField; | ||
import org.jabref.model.entry.identifier.ISSN; | ||
import org.jabref.preferences.PreferencesService; | ||
|
||
public class ISSNIdentifierEditorViewModel extends BaseIdentifierEditorViewModel<ISSN> { | ||
public ISSNIdentifierEditorViewModel(SuggestionProvider<?> suggestionProvider, FieldCheckers fieldCheckers, DialogService dialogService, TaskExecutor taskExecutor, PreferencesService preferences) { | ||
super(StandardField.ISSN, suggestionProvider, fieldCheckers, dialogService, taskExecutor, preferences); | ||
private final StateManager stateManager; | ||
private final UndoManager undoManager; | ||
|
||
public ISSNIdentifierEditorViewModel(SuggestionProvider<?> suggestionProvider, FieldCheckers fieldCheckers, DialogService dialogService, TaskExecutor taskExecutor, PreferencesService preferences, UndoManager undoManager, StateManager stateManager) { | ||
super(StandardField.ISBN, suggestionProvider, fieldCheckers, dialogService, taskExecutor, preferences, undoManager); | ||
this.undoManager = undoManager; | ||
this.stateManager = stateManager; | ||
configure(true, false); | ||
} | ||
|
||
@Override | ||
public void fetchBibliographyInformation(BibEntry bibEntry) { | ||
new FetchAndMergeEntry(JabRefGUI.getMainFrame().getCurrentLibraryTab(), taskExecutor, preferences, dialogService).fetchAndMerge(entry, field); | ||
stateManager.getActiveDatabase().ifPresentOrElse( | ||
databaseContext -> new FetchAndMergeEntry(databaseContext, taskExecutor, preferences, dialogService, undoManager) | ||
.fetchAndMerge(entry, field), | ||
() -> dialogService.notify(Localization.lang("No library selected")) | ||
); | ||
} | ||
} |
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
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