Skip to content

Commit 1b6c7b5

Browse files
committed
Merge remote-tracking branch 'upstream/master'
* upstream/master: Bump mockito-core from 2.24.0 to 2.24.5 (#4663) Fix for #4628 - cant save new content selectors (#4658) Fix issues with double spaces. (#4662)
2 parents 22e9bf8 + 623718a commit 1b6c7b5

10 files changed

+470
-534
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ dependencies {
167167

168168
testRuntime 'org.apache.logging.log4j:log4j-core:2.11.1'
169169
testRuntime 'org.apache.logging.log4j:log4j-jul:2.11.2'
170-
testCompile 'org.mockito:mockito-core:2.24.0'
170+
testCompile 'org.mockito:mockito-core:2.24.5'
171171
testCompile 'com.github.tomakehurst:wiremock:2.21.0'
172172
testCompile 'org.assertj:assertj-swing-junit:3.9.2'
173173
testCompile 'org.reflections:reflections:0.9.11'

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

-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.jabref.gui.bibtexkeypattern.SearchFixDuplicateLabels;
4444
import org.jabref.gui.collab.DatabaseChangeMonitor;
4545
import org.jabref.gui.collab.FileUpdatePanel;
46-
import org.jabref.gui.contentselector.ContentSelectorDialog;
4746
import org.jabref.gui.desktop.JabRefDesktop;
4847
import org.jabref.gui.edit.ReplaceStringAction;
4948
import org.jabref.gui.entryeditor.EntryEditor;
@@ -399,11 +398,6 @@ private void setupActions() {
399398
actions.put(Actions.NEXT_PREVIEW_STYLE, this::nextPreviewStyle);
400399
actions.put(Actions.PREVIOUS_PREVIEW_STYLE, this::previousPreviewStyle);
401400

402-
actions.put(Actions.MANAGE_SELECTORS, () -> {
403-
ContentSelectorDialog csd = new ContentSelectorDialog(frame, BasePanel.this, false, null);
404-
csd.setVisible(true);
405-
});
406-
407401
actions.put(Actions.SEND_AS_EMAIL, new SendAsEMailAction(frame));
408402

409403
actions.put(Actions.WRITE_XMP, new WriteXMPAction(this)::execute);

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import org.jabref.gui.actions.EditExternalFileTypesAction;
6565
import org.jabref.gui.actions.ErrorConsoleAction;
6666
import org.jabref.gui.actions.LookupIdentifierAction;
67+
import org.jabref.gui.actions.ManageContentSelectorAction;
6768
import org.jabref.gui.actions.ManageCustomExportsAction;
6869
import org.jabref.gui.actions.ManageCustomImportsAction;
6970
import org.jabref.gui.actions.ManageJournalsAction;
@@ -941,7 +942,7 @@ private MenuBar createMenu() {
941942

942943
new SeparatorMenuItem(),
943944

944-
factory.createMenuItem(StandardActions.MANAGE_CONTENT_SELECTORS, new OldDatabaseCommandWrapper(Actions.MANAGE_SELECTORS, this, Globals.stateManager)),
945+
factory.createMenuItem(StandardActions.MANAGE_CONTENT_SELECTORS, new ManageContentSelectorAction(this)),
945946
factory.createMenuItem(StandardActions.CUSTOMIZE_ENTRY_TYPES, new CustomizeEntryAction(this)),
946947
factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new BibtexKeyPatternAction(this)));
947948

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.jabref.gui.actions;
2+
3+
import org.jabref.gui.BasePanel;
4+
import org.jabref.gui.JabRefFrame;
5+
import org.jabref.gui.contentselector.ContentSelectorDialogView;
6+
import org.jabref.logic.l10n.Localization;
7+
8+
public class ManageContentSelectorAction extends SimpleCommand {
9+
10+
private final JabRefFrame jabRefFrame;
11+
12+
public ManageContentSelectorAction(JabRefFrame jabRefFrame) {
13+
this.jabRefFrame = jabRefFrame;
14+
}
15+
16+
@Override
17+
public void execute() {
18+
BasePanel basePanel = jabRefFrame.getCurrentBasePanel();
19+
if (noActiveConnectionExists(basePanel)) {
20+
jabRefFrame.getDialogService().showErrorDialogAndWait(Localization.lang("Active database connection do not exists!"));
21+
return;
22+
}
23+
new ContentSelectorDialogView(basePanel).showAndWait();
24+
}
25+
26+
private boolean noActiveConnectionExists(BasePanel basePanel) {
27+
return basePanel == null || basePanel.getBibDatabaseContext() == null;
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.geometry.Insets?>
4+
<?import javafx.scene.control.Button?>
5+
<?import javafx.scene.control.ButtonType?>
6+
<?import javafx.scene.control.DialogPane?>
7+
<?import javafx.scene.control.Label?>
8+
<?import javafx.scene.control.ListView?>
9+
<?import javafx.scene.control.Separator?>
10+
<?import javafx.scene.layout.HBox?>
11+
<?import javafx.scene.layout.VBox?>
12+
13+
<DialogPane minHeight="450.0" minWidth="375.0" prefHeight="450.0" prefWidth="407.0" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.contentselector.ContentSelectorDialogView">
14+
<content>
15+
<VBox>
16+
<children>
17+
<Label prefHeight="27.0" prefWidth="108.0" text="Field names" />
18+
<HBox prefHeight="140.0" prefWidth="385.0">
19+
<children>
20+
<ListView fx:id="fieldNamesListView" prefHeight="140.0" prefWidth="297.0"/>
21+
<VBox alignment="TOP_CENTER" prefHeight="200.0" prefWidth="100.0">
22+
<children>
23+
<Button fx:id="addFieldNameButton" alignment="CENTER" mnemonicParsing="false" prefHeight="26.0" prefWidth="72.0" text="%Add" onAction="#addNewFieldName">
24+
<VBox.margin>
25+
<Insets top="5.0" />
26+
</VBox.margin>
27+
</Button>
28+
<Button fx:id="removeFieldNameButton" mnemonicParsing="false" text="%Remove" onAction="#removeFieldName">
29+
<VBox.margin>
30+
<Insets top="5.0" />
31+
</VBox.margin>
32+
</Button>
33+
</children>
34+
</VBox>
35+
</children>
36+
</HBox>
37+
<Separator prefWidth="200.0">
38+
<VBox.margin>
39+
<Insets top="20.0" />
40+
</VBox.margin>
41+
</Separator>
42+
<Label prefHeight="27.0" prefWidth="108.0" text="Keywords" />
43+
<HBox prefHeight="140.0" prefWidth="385.0">
44+
<children>
45+
<ListView fx:id="keywordsListView" prefHeight="140.0" prefWidth="297.0" />
46+
<VBox alignment="TOP_CENTER" prefHeight="200.0" prefWidth="100.0">
47+
<children>
48+
<Button fx:id="addKeywordButton" alignment="CENTER" mnemonicParsing="false" prefHeight="26.0" prefWidth="72.0" text="%Add" onAction="#addNewKeyword">
49+
<VBox.margin>
50+
<Insets top="5.0" />
51+
</VBox.margin>
52+
</Button>
53+
<Button fx:id="removeKeywordButton" mnemonicParsing="false" text="%Remove" onAction="#removeKeyword">
54+
<VBox.margin>
55+
<Insets top="5.0" />
56+
</VBox.margin>
57+
</Button>
58+
</children>
59+
</VBox>
60+
</children>
61+
</HBox>
62+
</children>
63+
</VBox>
64+
</content>
65+
<ButtonType fx:id="saveButton" buttonData="OK_DONE" text="%Save" />
66+
<ButtonType fx:constant="CANCEL" />
67+
</DialogPane>

0 commit comments

Comments
 (0)