-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable triggering offline parsing explicitely (#11565)
* Enable triggering offline parsing explicitely - Refactor actions to inheritance instead of if-statements in a class - Solved "fun" with inheritance and FXML - Use %0 and offline/offline parameterization - Rename "GROBID" to "Grobid" * Add support to show clipboard contents * Add reference to CHANGELOG.md * "Inline" Localization.lang("offline") and Localization.lang("online") * Some intermediate result. Feels really bad, therefore migrating to if/then * Migrate to if/then * Remove "(online)" suffix from button in toolbar * Discard changes to build.gradle * Discard changes to src/main/java/org/jabref/gui/bibtexextractor/ExtractBibtexDialog.fxml * Remove obsolete .controller(this) * Fix checkstyle --------- Co-authored-by: Carl Christian Snethlage <[email protected]>
- Loading branch information
Showing
16 changed files
with
218 additions
and
125 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
30 changes: 0 additions & 30 deletions
30
src/main/java/org/jabref/gui/bibtexextractor/ExtractBibtexAction.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
src/main/java/org/jabref/gui/bibtexextractor/ExtractBibtexActionOffline.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,22 @@ | ||
package org.jabref.gui.bibtexextractor; | ||
|
||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.StateManager; | ||
import org.jabref.gui.actions.SimpleCommand; | ||
|
||
import static org.jabref.gui.actions.ActionHelper.needsDatabase; | ||
|
||
public class ExtractBibtexActionOffline extends SimpleCommand { | ||
|
||
private final DialogService dialogService; | ||
|
||
public ExtractBibtexActionOffline(DialogService dialogService, StateManager stateManager) { | ||
this.dialogService = dialogService; | ||
this.executable.bind(needsDatabase(stateManager)); | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
dialogService.showCustomDialogAndWait(new ExtractBibtexDialog(false)); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/org/jabref/gui/bibtexextractor/ExtractBibtexActionOnline.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,37 @@ | ||
package org.jabref.gui.bibtexextractor; | ||
|
||
import javafx.beans.binding.Bindings; | ||
|
||
import org.jabref.gui.DialogService; | ||
import org.jabref.gui.StateManager; | ||
import org.jabref.gui.actions.SimpleCommand; | ||
import org.jabref.gui.importer.GrobidOptInDialogHelper; | ||
import org.jabref.preferences.PreferencesService; | ||
|
||
import static org.jabref.gui.actions.ActionHelper.needsDatabase; | ||
|
||
public class ExtractBibtexActionOnline extends SimpleCommand { | ||
|
||
private final PreferencesService preferencesService; | ||
private final DialogService dialogService; | ||
|
||
public ExtractBibtexActionOnline(DialogService dialogService, PreferencesService preferencesService, StateManager stateManager, boolean requiresGrobid) { | ||
this.preferencesService = preferencesService; | ||
this.dialogService = dialogService; | ||
if (requiresGrobid) { | ||
this.executable.bind( | ||
Bindings.and( | ||
preferencesService.getGrobidPreferences().grobidEnabledProperty(), | ||
needsDatabase(stateManager) | ||
)); | ||
} else { | ||
this.executable.bind(needsDatabase(stateManager)); | ||
} | ||
} | ||
|
||
@Override | ||
public void execute() { | ||
boolean useGrobid = GrobidOptInDialogHelper.showAndWaitIfUserIsUndecided(dialogService, preferencesService.getGrobidPreferences()); | ||
dialogService.showCustomDialogAndWait(new ExtractBibtexDialog(useGrobid)); | ||
} | ||
} |
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.