Skip to content

Commit 8520833

Browse files
authored
Remove old code for PDF import (#4634)
* Remove old code for PDF import * Fix tests * Update Docbook5ExportFormat.xml * Fix tests * Fix checkstyle
1 parent 8e7b1f9 commit 8520833

File tree

96 files changed

+970
-2882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+970
-2882
lines changed

src/main/java/org/jabref/gui/DuplicateResolverDialog.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private void init(BibEntry one, BibEntry two, DuplicateResolverType type) {
6868
second = new ButtonType(Localization.lang("Remove entry from import"), ButtonData.APPLY);
6969
both = new ButtonType(Localization.lang("Keep both"), ButtonData.APPLY);
7070
me = new MergeEntries(one, two, Localization.lang("Old entry"),
71-
Localization.lang("From import"), frame.getCurrentBasePanel().getBibDatabaseContext().getMode());
71+
Localization.lang("From import"), frame.getCurrentBasePanel().getBibDatabaseContext().getMode());
7272
break;
7373
case DUPLICATE_SEARCH_WITH_EXACT:
7474
first = new ButtonType(Localization.lang("Keep left"), ButtonData.APPLY);
@@ -84,7 +84,7 @@ private void init(BibEntry one, BibEntry two, DuplicateResolverType type) {
8484
second = new ButtonType(Localization.lang("Do not import entry"), ButtonData.APPLY);
8585
both = new ButtonType(Localization.lang("Import and keep old entry"), ButtonData.APPLY);
8686
me = new MergeEntries(one, two, Localization.lang("Old entry"),
87-
Localization.lang("From import"), frame.getCurrentBasePanel().getBibDatabaseContext().getMode());
87+
Localization.lang("From import"), frame.getCurrentBasePanel().getBibDatabaseContext().getMode());
8888
break;
8989
}
9090
if (removeExactVisible) {

src/main/java/org/jabref/gui/DuplicateSearch.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ private void askResolveStrategy(DuplicateSearchResult result, BibEntry first, Bi
127127
DuplicateResolverResult resolverResult = dialog.showAndWait().orElse(DuplicateResolverResult.BREAK);
128128

129129
if ((resolverResult == DuplicateResolverResult.KEEP_LEFT)
130-
|| (resolverResult == DuplicateResolverResult.AUTOREMOVE_EXACT)) {
130+
|| (resolverResult == DuplicateResolverResult.AUTOREMOVE_EXACT)) {
131131
result.remove(second);
132132
if (resolverResult == DuplicateResolverResult.AUTOREMOVE_EXACT) {
133133
autoRemoveExactDuplicates.set(true); // Remember choice
@@ -167,7 +167,7 @@ private void handleDuplicates(DuplicateSearchResult result) {
167167
}
168168

169169
dialogService.notify(Localization.lang("Duplicates found") + ": " + duplicateCount.get() + ' '
170-
+ Localization.lang("pairs processed") + ": " + result.getDuplicateCount());
170+
+ Localization.lang("pairs processed") + ": " + result.getDuplicateCount());
171171
compoundEdit.end();
172172
panel.getUndoManager().addEdit(compoundEdit);
173173

src/main/java/org/jabref/gui/EntryType.fxml

+39-37
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,43 @@
1212
<?import javafx.scene.layout.GridPane?>
1313
<?import javafx.scene.layout.RowConstraints?>
1414
<?import javafx.scene.layout.VBox?>
15-
16-
<DialogPane prefWidth="476.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.EntryTypeView">
17-
<buttonTypes>
18-
<ButtonType fx:constant="CANCEL" />
19-
<ButtonType fx:id="generateButton" buttonData="OK_DONE" text="%Generate" />
20-
</buttonTypes>
15+
<DialogPane xmlns:fx="http://javafx.com/fxml/1" prefWidth="476.0" xmlns="http://javafx.com/javafx/8.0.171"
16+
fx:controller="org.jabref.gui.EntryTypeView">
17+
<buttonTypes>
18+
<ButtonType fx:constant="CANCEL"/>
19+
<ButtonType fx:id="generateButton" buttonData="OK_DONE" text="%Generate"/>
20+
</buttonTypes>
2121
<content>
22-
<VBox prefHeight="200.0" prefWidth="400.0">
23-
<children>
24-
<TitledPane fx:id="biblatexTitlePane" animated="false" collapsible="false" text="Biblatex">
25-
<content>
26-
<FlowPane fx:id="biblatexPane" prefHeight="200.0" prefWidth="200.0" />
27-
</content>
28-
</TitledPane>
29-
<TitledPane fx:id="bibTexTitlePane" animated="false" collapsible="false" text="BibTeX">
30-
<content>
31-
<FlowPane fx:id="bibTexPane" prefHeight="200.0" prefWidth="200.0" />
32-
</content>
33-
</TitledPane>
34-
<TitledPane fx:id="ieeeTranTitlePane" animated="false" collapsible="false" text="IEEETran">
35-
<content>
36-
<FlowPane fx:id="ieeetranPane" prefHeight="200.0" prefWidth="200.0" />
37-
</content>
38-
</TitledPane>
39-
<TitledPane fx:id="customTitlePane" animated="false" collapsible="false" text="%Custom">
40-
<content>
41-
<FlowPane fx:id="customPane" prefHeight="200.0" prefWidth="200.0" />
42-
</content>
43-
</TitledPane>
44-
<GridPane alignment="CENTER">
22+
<VBox prefHeight="200.0" prefWidth="400.0">
23+
<children>
24+
<TitledPane fx:id="biblatexTitlePane" animated="false" collapsible="false" text="Biblatex">
25+
<content>
26+
<FlowPane fx:id="biblatexPane" prefHeight="200.0" prefWidth="200.0"/>
27+
</content>
28+
</TitledPane>
29+
<TitledPane fx:id="bibTexTitlePane" animated="false" collapsible="false" text="BibTeX">
30+
<content>
31+
<FlowPane fx:id="bibTexPane" prefHeight="200.0" prefWidth="200.0"/>
32+
</content>
33+
</TitledPane>
34+
<TitledPane fx:id="ieeeTranTitlePane" animated="false" collapsible="false" text="IEEETran">
35+
<content>
36+
<FlowPane fx:id="ieeetranPane" prefHeight="200.0" prefWidth="200.0"/>
37+
</content>
38+
</TitledPane>
39+
<TitledPane fx:id="customTitlePane" animated="false" collapsible="false" text="%Custom">
40+
<content>
41+
<FlowPane fx:id="customPane" prefHeight="200.0" prefWidth="200.0"/>
42+
</content>
43+
</TitledPane>
44+
<GridPane alignment="CENTER">
4545
<children>
46-
<Label text="%ID type"/>
47-
<ComboBox fx:id="idBasedFetchers" onAction="#focusTextField" prefHeight="30.0" prefWidth="300.0" GridPane.columnIndex="1" />
48-
<Label text="%ID" GridPane.rowIndex="1" />
49-
<TextField fx:id="idTextField" onAction="#runFetcherWorker" prefHeight="30.0" prefWidth="300.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
46+
<Label text="%ID type"/>
47+
<ComboBox fx:id="idBasedFetchers" onAction="#focusTextField" prefHeight="30.0" prefWidth="300.0"
48+
GridPane.columnIndex="1"/>
49+
<Label text="%ID" GridPane.rowIndex="1" />
50+
<TextField fx:id="idTextField" onAction="#runFetcherWorker" prefHeight="30.0" prefWidth="300.0"
51+
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
5052
</children>
5153
<columnConstraints>
5254
<ColumnConstraints hgrow="SOMETIMES" maxWidth="122.0" minWidth="10.0" prefWidth="100.0" />
@@ -56,11 +58,11 @@
5658
<Insets bottom="4.0" left="4.0" right="4.0" top="4.0" />
5759
</opaqueInsets>
5860
<rowConstraints>
59-
<RowConstraints minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
60-
<RowConstraints minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
61+
<RowConstraints minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES"/>
62+
<RowConstraints minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES"/>
6163
</rowConstraints>
6264
</GridPane>
63-
</children>
64-
</VBox>
65+
</children>
66+
</VBox>
6567
</content>
6668
</DialogPane>

src/main/java/org/jabref/gui/JabRefFrame.java

+13-13
Original file line numberDiff line numberDiff line change
@@ -923,23 +923,23 @@ private MenuBar createMenu() {
923923
);
924924

925925
options.getItems().addAll(
926-
factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(this, Globals.TASK_EXECUTOR)),
926+
factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(this, Globals.TASK_EXECUTOR)),
927927

928-
new SeparatorMenuItem(),
928+
new SeparatorMenuItem(),
929929

930-
factory.createMenuItem(StandardActions.SETUP_GENERAL_FIELDS, new SetupGeneralFieldsAction()),
931-
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_IMPORTS, new ManageCustomImportsAction()),
932-
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_EXPORTS, new ManageCustomExportsAction()),
933-
factory.createMenuItem(StandardActions.MANAGE_EXTERNAL_FILETYPES, new EditExternalFileTypesAction()),
934-
factory.createMenuItem(StandardActions.MANAGE_JOURNALS, new ManageJournalsAction()),
935-
factory.createMenuItem(StandardActions.CUSTOMIZE_KEYBINDING, new CustomizeKeyBindingAction()),
936-
factory.createMenuItem(StandardActions.MANAGE_PROTECTED_TERMS, new ManageProtectedTermsAction(this, Globals.protectedTermsLoader)),
930+
factory.createMenuItem(StandardActions.SETUP_GENERAL_FIELDS, new SetupGeneralFieldsAction()),
931+
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_IMPORTS, new ManageCustomImportsAction()),
932+
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_EXPORTS, new ManageCustomExportsAction()),
933+
factory.createMenuItem(StandardActions.MANAGE_EXTERNAL_FILETYPES, new EditExternalFileTypesAction()),
934+
factory.createMenuItem(StandardActions.MANAGE_JOURNALS, new ManageJournalsAction()),
935+
factory.createMenuItem(StandardActions.CUSTOMIZE_KEYBINDING, new CustomizeKeyBindingAction()),
936+
factory.createMenuItem(StandardActions.MANAGE_PROTECTED_TERMS, new ManageProtectedTermsAction(this, Globals.protectedTermsLoader)),
937937

938-
new SeparatorMenuItem(),
938+
new SeparatorMenuItem(),
939939

940-
factory.createMenuItem(StandardActions.MANAGE_CONTENT_SELECTORS, new OldDatabaseCommandWrapper(Actions.MANAGE_SELECTORS, this, Globals.stateManager)),
941-
factory.createMenuItem(StandardActions.CUSTOMIZE_ENTRY_TYPES, new CustomizeEntryAction(this)),
942-
factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new BibtexKeyPatternAction(this)));
940+
factory.createMenuItem(StandardActions.MANAGE_CONTENT_SELECTORS, new OldDatabaseCommandWrapper(Actions.MANAGE_SELECTORS, this, Globals.stateManager)),
941+
factory.createMenuItem(StandardActions.CUSTOMIZE_ENTRY_TYPES, new CustomizeEntryAction(this)),
942+
factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new BibtexKeyPatternAction(this)));
943943

944944
help.getItems().addAll(
945945
factory.createMenuItem(StandardActions.HELP, HelpAction.getMainHelpPageCommand()),

src/main/java/org/jabref/gui/PreviewPanel.java

+8-13
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import javafx.scene.web.WebView;
2525

2626
import org.jabref.Globals;
27-
import org.jabref.gui.externalfiles.NewDroppedFileHandler;
27+
import org.jabref.gui.externalfiles.ExternalFilesEntryLinker;
2828
import org.jabref.gui.externalfiletype.ExternalFileTypes;
2929
import org.jabref.gui.icon.IconTheme;
3030
import org.jabref.gui.keyboard.KeyBinding;
@@ -61,9 +61,9 @@ public class PreviewPanel extends ScrollPane implements SearchQueryHighlightList
6161
private final DialogService dialogService;
6262
private final KeyBindingRepository keyBindingRepository;
6363

64+
private final String defaultPreviewStyle = "Preview";
6465
private String previewStyle;
6566
private CitationStyle citationStyle;
66-
private final String defaultPreviewStyle = "Preview";
6767
private Optional<BasePanel> basePanel = Optional.empty();
6868

6969
private boolean fixedLayout;
@@ -80,7 +80,7 @@ public class PreviewPanel extends ScrollPane implements SearchQueryHighlightList
8080
private final WebView previewView;
8181
private Optional<Future<?>> citationStyleFuture = Optional.empty();
8282

83-
private final NewDroppedFileHandler fileHandler;
83+
private final ExternalFilesEntryLinker fileLinker;
8484

8585
/**
8686
* @param panel (may be null) Only set this if the preview is associated to the main window.
@@ -93,11 +93,7 @@ public PreviewPanel(BasePanel panel, BibDatabaseContext databaseContext, KeyBind
9393
this.clipBoardManager = Globals.clipboardManager;
9494
this.keyBindingRepository = keyBindingRepository;
9595

96-
fileHandler = new NewDroppedFileHandler(dialogService, databaseContext, externalFileTypes,
97-
Globals.prefs.getFilePreferences(),
98-
Globals.prefs.getImportFormatPreferences(),
99-
Globals.prefs.getUpdateFieldPreferences(),
100-
Globals.getFileUpdateMonitor());
96+
fileLinker = new ExternalFilesEntryLinker(externalFileTypes, Globals.prefs.getFilePreferences(), databaseContext);
10197

10298
// Set up scroll pane for preview pane
10399
setFitToHeight(true);
@@ -135,19 +131,18 @@ public PreviewPanel(BasePanel panel, BibDatabaseContext databaseContext, KeyBind
135131
List<Path> files = event.getDragboard().getFiles().stream().map(File::toPath).collect(Collectors.toList());
136132

137133
if (event.getTransferMode() == TransferMode.MOVE) {
138-
139134
LOGGER.debug("Mode MOVE"); //shift on win or no modifier
140-
fileHandler.addToEntryRenameAndMoveToFileDir(entry, files);
135+
fileLinker.moveFilesToFileDirAndAddToEntry(entry, files);
141136
}
142137
if (event.getTransferMode() == TransferMode.LINK) {
143138
LOGGER.debug("Node LINK"); //alt on win
144-
fileHandler.addToEntry(entry, files);
145-
139+
fileLinker.addFilesToEntry(entry, files);
146140
}
147141
if (event.getTransferMode() == TransferMode.COPY) {
148142
LOGGER.debug("Mode Copy"); //ctrl on win, no modifier on Xubuntu
149-
fileHandler.copyFilesToFileDirAndAddToEntry(entry, files);
143+
fileLinker.copyFilesToFileDirAndAddToEntry(entry, files);
150144
}
145+
success = true;
151146
}
152147

153148
event.setDropCompleted(success);

src/main/java/org/jabref/gui/SidePaneManager.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ public SidePaneManager(JabRefPreferences preferences, JabRefFrame frame) {
3131

3232
OpenOfficePreferences openOfficePreferences = preferences.getOpenOfficePreferences();
3333
Stream.of(
34-
new FileUpdatePanel(this),
35-
new GroupSidePane(this, preferences, frame.getDialogService()),
36-
new WebSearchPane(this, preferences, frame),
37-
new OpenOfficeSidePanel(this, preferences, frame))
34+
new FileUpdatePanel(this),
35+
new GroupSidePane(this, preferences, frame.getDialogService()),
36+
new WebSearchPane(this, preferences, frame),
37+
new OpenOfficeSidePanel(this, preferences, frame))
3838
.forEach(pane -> components.put(pane.getType(), pane));
3939

4040
if (preferences.getBoolean(JabRefPreferences.GROUP_SIDEPANE_VISIBLE)) {

src/main/java/org/jabref/gui/bibtexkeypattern/ResolveDuplicateLabelDialog.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public ResolveDuplicateLabelDialog(BasePanel panel, String key, List<BibEntry> e
4848
diag = new JDialog((JFrame) null, Localization.lang("Duplicate BibTeX key"), true);
4949

5050
FormBuilder b = FormBuilder.create().layout(new FormLayout(
51-
"left:pref, 4dlu, fill:pref", "p"));
51+
"left:pref, 4dlu, fill:pref", "p"));
5252
b.add(new JLabel(Localization.lang("Duplicate BibTeX key") + ": " + key)).xyw(1, 1, 3);
5353
b.getPanel().setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
5454

src/main/java/org/jabref/gui/copyfiles/CopyFilesTask.java

-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ protected List<CopyFilesResultItemViewModel> call() throws InterruptedException,
112112
writeLogMessage(newFile, bw, localizedErrorMessage);
113113
addResultToList(newFile, success, localizedErrorMessage);
114114
}
115-
116115
}
117116

118117
}

0 commit comments

Comments
 (0)