Skip to content

Commit

Permalink
Remove old code for PDF import (#4634)
Browse files Browse the repository at this point in the history
* Remove old code for PDF import

* Fix tests

* Update Docbook5ExportFormat.xml

* Fix tests

* Fix checkstyle
  • Loading branch information
tobiasdiez authored Feb 10, 2019
1 parent 8e7b1f9 commit 8520833
Show file tree
Hide file tree
Showing 96 changed files with 970 additions and 2,882 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/DuplicateResolverDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void init(BibEntry one, BibEntry two, DuplicateResolverType type) {
second = new ButtonType(Localization.lang("Remove entry from import"), ButtonData.APPLY);
both = new ButtonType(Localization.lang("Keep both"), ButtonData.APPLY);
me = new MergeEntries(one, two, Localization.lang("Old entry"),
Localization.lang("From import"), frame.getCurrentBasePanel().getBibDatabaseContext().getMode());
Localization.lang("From import"), frame.getCurrentBasePanel().getBibDatabaseContext().getMode());
break;
case DUPLICATE_SEARCH_WITH_EXACT:
first = new ButtonType(Localization.lang("Keep left"), ButtonData.APPLY);
Expand All @@ -84,7 +84,7 @@ private void init(BibEntry one, BibEntry two, DuplicateResolverType type) {
second = new ButtonType(Localization.lang("Do not import entry"), ButtonData.APPLY);
both = new ButtonType(Localization.lang("Import and keep old entry"), ButtonData.APPLY);
me = new MergeEntries(one, two, Localization.lang("Old entry"),
Localization.lang("From import"), frame.getCurrentBasePanel().getBibDatabaseContext().getMode());
Localization.lang("From import"), frame.getCurrentBasePanel().getBibDatabaseContext().getMode());
break;
}
if (removeExactVisible) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/DuplicateSearch.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private void askResolveStrategy(DuplicateSearchResult result, BibEntry first, Bi
DuplicateResolverResult resolverResult = dialog.showAndWait().orElse(DuplicateResolverResult.BREAK);

if ((resolverResult == DuplicateResolverResult.KEEP_LEFT)
|| (resolverResult == DuplicateResolverResult.AUTOREMOVE_EXACT)) {
|| (resolverResult == DuplicateResolverResult.AUTOREMOVE_EXACT)) {
result.remove(second);
if (resolverResult == DuplicateResolverResult.AUTOREMOVE_EXACT) {
autoRemoveExactDuplicates.set(true); // Remember choice
Expand Down Expand Up @@ -167,7 +167,7 @@ private void handleDuplicates(DuplicateSearchResult result) {
}

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

Expand Down
76 changes: 39 additions & 37 deletions src/main/java/org/jabref/gui/EntryType.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,43 @@
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>

<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">
<buttonTypes>
<ButtonType fx:constant="CANCEL" />
<ButtonType fx:id="generateButton" buttonData="OK_DONE" text="%Generate" />
</buttonTypes>
<DialogPane xmlns:fx="http://javafx.com/fxml/1" prefWidth="476.0" xmlns="http://javafx.com/javafx/8.0.171"
fx:controller="org.jabref.gui.EntryTypeView">
<buttonTypes>
<ButtonType fx:constant="CANCEL"/>
<ButtonType fx:id="generateButton" buttonData="OK_DONE" text="%Generate"/>
</buttonTypes>
<content>
<VBox prefHeight="200.0" prefWidth="400.0">
<children>
<TitledPane fx:id="biblatexTitlePane" animated="false" collapsible="false" text="Biblatex">
<content>
<FlowPane fx:id="biblatexPane" prefHeight="200.0" prefWidth="200.0" />
</content>
</TitledPane>
<TitledPane fx:id="bibTexTitlePane" animated="false" collapsible="false" text="BibTeX">
<content>
<FlowPane fx:id="bibTexPane" prefHeight="200.0" prefWidth="200.0" />
</content>
</TitledPane>
<TitledPane fx:id="ieeeTranTitlePane" animated="false" collapsible="false" text="IEEETran">
<content>
<FlowPane fx:id="ieeetranPane" prefHeight="200.0" prefWidth="200.0" />
</content>
</TitledPane>
<TitledPane fx:id="customTitlePane" animated="false" collapsible="false" text="%Custom">
<content>
<FlowPane fx:id="customPane" prefHeight="200.0" prefWidth="200.0" />
</content>
</TitledPane>
<GridPane alignment="CENTER">
<VBox prefHeight="200.0" prefWidth="400.0">
<children>
<TitledPane fx:id="biblatexTitlePane" animated="false" collapsible="false" text="Biblatex">
<content>
<FlowPane fx:id="biblatexPane" prefHeight="200.0" prefWidth="200.0"/>
</content>
</TitledPane>
<TitledPane fx:id="bibTexTitlePane" animated="false" collapsible="false" text="BibTeX">
<content>
<FlowPane fx:id="bibTexPane" prefHeight="200.0" prefWidth="200.0"/>
</content>
</TitledPane>
<TitledPane fx:id="ieeeTranTitlePane" animated="false" collapsible="false" text="IEEETran">
<content>
<FlowPane fx:id="ieeetranPane" prefHeight="200.0" prefWidth="200.0"/>
</content>
</TitledPane>
<TitledPane fx:id="customTitlePane" animated="false" collapsible="false" text="%Custom">
<content>
<FlowPane fx:id="customPane" prefHeight="200.0" prefWidth="200.0"/>
</content>
</TitledPane>
<GridPane alignment="CENTER">
<children>
<Label text="%ID type"/>
<ComboBox fx:id="idBasedFetchers" onAction="#focusTextField" prefHeight="30.0" prefWidth="300.0" GridPane.columnIndex="1" />
<Label text="%ID" GridPane.rowIndex="1" />
<TextField fx:id="idTextField" onAction="#runFetcherWorker" prefHeight="30.0" prefWidth="300.0" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<Label text="%ID type"/>
<ComboBox fx:id="idBasedFetchers" onAction="#focusTextField" prefHeight="30.0" prefWidth="300.0"
GridPane.columnIndex="1"/>
<Label text="%ID" GridPane.rowIndex="1" />
<TextField fx:id="idTextField" onAction="#runFetcherWorker" prefHeight="30.0" prefWidth="300.0"
GridPane.columnIndex="1" GridPane.rowIndex="1"/>
</children>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="122.0" minWidth="10.0" prefWidth="100.0" />
Expand All @@ -56,11 +58,11 @@
<Insets bottom="4.0" left="4.0" right="4.0" top="4.0" />
</opaqueInsets>
<rowConstraints>
<RowConstraints minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints>
</GridPane>
</children>
</VBox>
</children>
</VBox>
</content>
</DialogPane>
26 changes: 13 additions & 13 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -923,23 +923,23 @@ private MenuBar createMenu() {
);

options.getItems().addAll(
factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(this, Globals.TASK_EXECUTOR)),
factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(this, Globals.TASK_EXECUTOR)),

new SeparatorMenuItem(),
new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.SETUP_GENERAL_FIELDS, new SetupGeneralFieldsAction()),
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_IMPORTS, new ManageCustomImportsAction()),
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_EXPORTS, new ManageCustomExportsAction()),
factory.createMenuItem(StandardActions.MANAGE_EXTERNAL_FILETYPES, new EditExternalFileTypesAction()),
factory.createMenuItem(StandardActions.MANAGE_JOURNALS, new ManageJournalsAction()),
factory.createMenuItem(StandardActions.CUSTOMIZE_KEYBINDING, new CustomizeKeyBindingAction()),
factory.createMenuItem(StandardActions.MANAGE_PROTECTED_TERMS, new ManageProtectedTermsAction(this, Globals.protectedTermsLoader)),
factory.createMenuItem(StandardActions.SETUP_GENERAL_FIELDS, new SetupGeneralFieldsAction()),
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_IMPORTS, new ManageCustomImportsAction()),
factory.createMenuItem(StandardActions.MANAGE_CUSTOM_EXPORTS, new ManageCustomExportsAction()),
factory.createMenuItem(StandardActions.MANAGE_EXTERNAL_FILETYPES, new EditExternalFileTypesAction()),
factory.createMenuItem(StandardActions.MANAGE_JOURNALS, new ManageJournalsAction()),
factory.createMenuItem(StandardActions.CUSTOMIZE_KEYBINDING, new CustomizeKeyBindingAction()),
factory.createMenuItem(StandardActions.MANAGE_PROTECTED_TERMS, new ManageProtectedTermsAction(this, Globals.protectedTermsLoader)),

new SeparatorMenuItem(),
new SeparatorMenuItem(),

factory.createMenuItem(StandardActions.MANAGE_CONTENT_SELECTORS, new OldDatabaseCommandWrapper(Actions.MANAGE_SELECTORS, this, Globals.stateManager)),
factory.createMenuItem(StandardActions.CUSTOMIZE_ENTRY_TYPES, new CustomizeEntryAction(this)),
factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new BibtexKeyPatternAction(this)));
factory.createMenuItem(StandardActions.MANAGE_CONTENT_SELECTORS, new OldDatabaseCommandWrapper(Actions.MANAGE_SELECTORS, this, Globals.stateManager)),
factory.createMenuItem(StandardActions.CUSTOMIZE_ENTRY_TYPES, new CustomizeEntryAction(this)),
factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new BibtexKeyPatternAction(this)));

help.getItems().addAll(
factory.createMenuItem(StandardActions.HELP, HelpAction.getMainHelpPageCommand()),
Expand Down
21 changes: 8 additions & 13 deletions src/main/java/org/jabref/gui/PreviewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import javafx.scene.web.WebView;

import org.jabref.Globals;
import org.jabref.gui.externalfiles.NewDroppedFileHandler;
import org.jabref.gui.externalfiles.ExternalFilesEntryLinker;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.keyboard.KeyBinding;
Expand Down Expand Up @@ -61,9 +61,9 @@ public class PreviewPanel extends ScrollPane implements SearchQueryHighlightList
private final DialogService dialogService;
private final KeyBindingRepository keyBindingRepository;

private final String defaultPreviewStyle = "Preview";
private String previewStyle;
private CitationStyle citationStyle;
private final String defaultPreviewStyle = "Preview";
private Optional<BasePanel> basePanel = Optional.empty();

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

private final NewDroppedFileHandler fileHandler;
private final ExternalFilesEntryLinker fileLinker;

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

fileHandler = new NewDroppedFileHandler(dialogService, databaseContext, externalFileTypes,
Globals.prefs.getFilePreferences(),
Globals.prefs.getImportFormatPreferences(),
Globals.prefs.getUpdateFieldPreferences(),
Globals.getFileUpdateMonitor());
fileLinker = new ExternalFilesEntryLinker(externalFileTypes, Globals.prefs.getFilePreferences(), databaseContext);

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

if (event.getTransferMode() == TransferMode.MOVE) {

LOGGER.debug("Mode MOVE"); //shift on win or no modifier
fileHandler.addToEntryRenameAndMoveToFileDir(entry, files);
fileLinker.moveFilesToFileDirAndAddToEntry(entry, files);
}
if (event.getTransferMode() == TransferMode.LINK) {
LOGGER.debug("Node LINK"); //alt on win
fileHandler.addToEntry(entry, files);

fileLinker.addFilesToEntry(entry, files);
}
if (event.getTransferMode() == TransferMode.COPY) {
LOGGER.debug("Mode Copy"); //ctrl on win, no modifier on Xubuntu
fileHandler.copyFilesToFileDirAndAddToEntry(entry, files);
fileLinker.copyFilesToFileDirAndAddToEntry(entry, files);
}
success = true;
}

event.setDropCompleted(success);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/jabref/gui/SidePaneManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public SidePaneManager(JabRefPreferences preferences, JabRefFrame frame) {

OpenOfficePreferences openOfficePreferences = preferences.getOpenOfficePreferences();
Stream.of(
new FileUpdatePanel(this),
new GroupSidePane(this, preferences, frame.getDialogService()),
new WebSearchPane(this, preferences, frame),
new OpenOfficeSidePanel(this, preferences, frame))
new FileUpdatePanel(this),
new GroupSidePane(this, preferences, frame.getDialogService()),
new WebSearchPane(this, preferences, frame),
new OpenOfficeSidePanel(this, preferences, frame))
.forEach(pane -> components.put(pane.getType(), pane));

if (preferences.getBoolean(JabRefPreferences.GROUP_SIDEPANE_VISIBLE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ResolveDuplicateLabelDialog(BasePanel panel, String key, List<BibEntry> e
diag = new JDialog((JFrame) null, Localization.lang("Duplicate BibTeX key"), true);

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

Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/copyfiles/CopyFilesTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ protected List<CopyFilesResultItemViewModel> call() throws InterruptedException,
writeLogMessage(newFile, bw, localizedErrorMessage);
addResultToList(newFile, success, localizedErrorMessage);
}

}

}
Expand Down
Loading

0 comments on commit 8520833

Please sign in to comment.