Skip to content

Commit

Permalink
Convert "From Aux file" dialog to JavaFX (#4607)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasdiez committed Jan 24, 2019
1 parent 5d2b765 commit b66fa42
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 228 deletions.
24 changes: 2 additions & 22 deletions src/main/java/org/jabref/gui/actions/NewSubLibraryAction.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
package org.jabref.gui.actions;

import javax.swing.SwingUtilities;

import org.jabref.Globals;
import org.jabref.gui.BasePanel;
import org.jabref.gui.BasePanelPreferences;
import org.jabref.gui.JabRefFrame;
import org.jabref.gui.auximport.FromAuxDialog;
import org.jabref.gui.externalfiletype.ExternalFileTypes;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.Defaults;
import org.jabref.model.database.BibDatabaseContext;

/**
* The action concerned with generate a new (sub-)database from latex AUX file.
Expand All @@ -25,18 +16,7 @@ public NewSubLibraryAction(JabRefFrame jabRefFrame) {

@Override
public void execute() {
SwingUtilities.invokeLater(() -> {
FromAuxDialog dialog = new FromAuxDialog(jabRefFrame, "", true, jabRefFrame.getTabbedPane());

dialog.setVisible(true);

if (dialog.generatePressed()) {
Defaults defaults = new Defaults(Globals.prefs.getDefaultBibDatabaseMode());
BasePanel bp = new BasePanel(jabRefFrame, BasePanelPreferences.from(Globals.prefs), new BibDatabaseContext(dialog.getGenerateDB(), defaults), ExternalFileTypes.getInstance());
jabRefFrame.addTab(bp, true);
jabRefFrame.output(Localization.lang("New library created."));
}
});
FromAuxDialog dialog = new FromAuxDialog(jabRefFrame);
dialog.showAndWait();
}

}
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public enum StandardActions implements Action {
TOOGLE_OO(Localization.lang("OpenOffice/LibreOffice connection"), IconTheme.JabRefIcons.FILE_OPENOFFICE, KeyBinding.OPEN_OPEN_OFFICE_LIBRE_OFFICE_CONNECTION),
TOGGLE_WEB_SEARCH(Localization.lang("Web search"), Localization.lang("Toggle web search interface"), IconTheme.JabRefIcons.WWW, KeyBinding.WEB_SEARCH),

NEW_SUB_LIBRARY_FROM_AUX(Localization.lang("New sublibrary based on AUX file") + "...", Localization.lang("New BibTeX sublibrary"), IconTheme.JabRefIcons.NEW),
NEW_SUB_LIBRARY_FROM_AUX(Localization.lang("New sublibrary based on AUX file") + "...", Localization.lang("New BibTeX sublibrary") + Localization.lang("This feature generates a new library based on which entries are needed in an existing LaTeX document."), IconTheme.JabRefIcons.NEW),
WRITE_XMP(Localization.lang("Write XMP-metadata to PDFs"), Localization.lang("Will write XMP-metadata to the PDFs linked from selected entries."), KeyBinding.WRITE_XMP),
OPEN_FOLDER(Localization.lang("Open folder"), Localization.lang("Open folder"), KeyBinding.OPEN_FOLDER),
OPEN_FILE(Localization.lang("Open file"), Localization.lang("Open file"), IconTheme.JabRefIcons.FILE, KeyBinding.OPEN_FILE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ public String getInformation(boolean includeMissingEntries) {
StringBuilder result = new StringBuilder();

result.append(Localization.lang("keys in library")).append(' ').append(this.auxParserResult.getMasterDatabase().getEntryCount()).append('\n')
.append(Localization.lang("found in AUX file")).append(' ').append(this.auxParserResult.getFoundKeysInAux()).append('\n')
.append(Localization.lang("resolved")).append(' ').append(this.auxParserResult.getResolvedKeysCount()).append('\n')
.append(Localization.lang("not found")).append(' ').append(this.auxParserResult.getUnresolvedKeysCount()).append('\n')
.append(Localization.lang("crossreferenced entries included")).append(' ')
.append(this.auxParserResult.getCrossRefEntriesCount()).append(Localization.lang("strings included")).append(' ')
.append(this.auxParserResult.getInsertedStrings()).append('\n');
.append(Localization.lang("found in AUX file")).append(' ').append(this.auxParserResult.getFoundKeysInAux()).append('\n')
.append(Localization.lang("resolved")).append(' ').append(this.auxParserResult.getResolvedKeysCount()).append('\n')
.append(Localization.lang("not found")).append(' ').append(this.auxParserResult.getUnresolvedKeysCount()).append('\n')
.append(Localization.lang("crossreferenced entries included")).append(' ').append(this.auxParserResult.getCrossRefEntriesCount()).append('\n')
.append(Localization.lang("strings included")).append(' ').append(this.auxParserResult.getInsertedStrings()).append('\n');

if (includeMissingEntries && (this.auxParserResult.getUnresolvedKeysCount() > 0)) {
for (String entry : this.auxParserResult.getUnresolvedKeys()) {
Expand Down
39 changes: 39 additions & 0 deletions src/main/java/org/jabref/gui/auximport/FromAuxDialog.fxml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.scene.control.Button?>
<?import javafx.scene.control.ButtonType?>
<?import javafx.scene.control.DialogPane?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<DialogPane xmlns:fx="http://javafx.com/fxml/1" prefHeight="650.0" prefWidth="500.0"
xmlns="http://javafx.com/javafx/8.0.121" fx:controller="org.jabref.gui.auximport.FromAuxDialog">
<content>
<VBox spacing="30">
<VBox spacing="5.0">
<Label text="%LaTeX AUX file:"/>
<HBox spacing="10">
<TextField fx:id="auxFileField" HBox.hgrow="ALWAYS"/>
<Button onAction="#browseButtonClicked" text="%Browse"/>
</HBox>
<Button defaultButton="true" onAction="#parseActionPerformed" text="%Parse"/>
</VBox>
<VBox spacing="5">
<Label text="%Result">
<font>
<Font name="System Bold"/>
</font>
</Label>
<TextArea fx:id="statusInfos" editable="false" prefHeight="300.0"/>
<Label text="%Unknown BibTeX entries:"/>
<ListView fx:id="notFoundList" prefHeight="200"/>
</VBox>
</VBox>
</content>
<ButtonType fx:id="generateButtonType" buttonData="OK_DONE" text="%Generate"/>
<ButtonType fx:constant="CLOSE"/>
</DialogPane>
Loading

0 comments on commit b66fa42

Please sign in to comment.