Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fixtest
Browse files Browse the repository at this point in the history
* upstream/master:
  single line text fields (#4138)
  Make it easier to rename and move files (#4200)
  Fix that swing dialogs are hidden behind main window (#4205)
  Fixed: #4166 add move & rename file (#4217)
  • Loading branch information
Siedlerchr committed Jul 23, 2018
2 parents ca429f3 + f9799d4 commit e01e445
Show file tree
Hide file tree
Showing 53 changed files with 271 additions and 192 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
## [Unreleased]

### Changed
- We added a "Move file to file directory and rename file" option for simultaneously moving and renaming of document file. [#4166](https://github.com/JabRef/jabref/issues/4166)
- Use integrated graphics card instead of discrete on macOS [#4070](https://github.com/JabRef/jabref/issues/4070)
- We changed the minimum required version of Java to 1.8.0_171, as this is the latest release for which the automatic Java update works. [4093](https://github.com/JabRef/jabref/issues/4093)
- The special fields like `Printed` and `Read status` now show gray icons when the row is hovered.
Expand All @@ -24,7 +25,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We changed the default keyboard shortcuts for moving between entries when the entry editor is active to ̀<kbd>alt</kbd> + <kbd>up/down</kbd>.
- Opening a new file now prompts the directory of the currently selected file, instead of the directory of the last opened file.
- Window state is saved on close and restored on start.

- We streamlined the process to rename and move files by removing the confirmation dialogs.



Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ private void setupActions() {
actions.put(Actions.PREVIOUS_PREVIEW_STYLE, this::previousPreviewStyle);

actions.put(Actions.MANAGE_SELECTORS, () -> {
ContentSelectorDialog csd = new ContentSelectorDialog(null, frame, BasePanel.this, false, null);
ContentSelectorDialog csd = new ContentSelectorDialog(frame, BasePanel.this, false, null);
csd.setVisible(true);
});

Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/DuplicateResolverDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;

import org.jabref.gui.help.HelpAction;
Expand Down Expand Up @@ -46,7 +45,7 @@ public enum DuplicateResolverResult {
private MergeEntries me;

public DuplicateResolverDialog(JabRefFrame frame, BibEntry one, BibEntry two, DuplicateResolverType type) {
super((JFrame) null, Localization.lang("Possible duplicate entries"), true, DuplicateResolverDialog.class);
super(Localization.lang("Possible duplicate entries"), true, DuplicateResolverDialog.class);
this.frame = frame;
init(one, two, type);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/EntryTypeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class EntryTypeDialog extends JabRefDialog implements ActionListener {

public EntryTypeDialog(JabRefFrame frame) {
// modal dialog
super(null, true, EntryTypeDialog.class);
super(true, EntryTypeDialog.class);

this.frame = frame;

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/jabref/gui/FindUnlinkedFilesDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
Expand Down Expand Up @@ -158,8 +157,8 @@ public class FindUnlinkedFilesDialog extends JabRefDialog {

private boolean checkBoxWhyIsThereNoGetSelectedStupidSwing;

public FindUnlinkedFilesDialog(Frame owner, JabRefFrame frame) {
super(owner, Localization.lang("Find unlinked files"), true, FindUnlinkedFilesDialog.class);
public FindUnlinkedFilesDialog(JabRefFrame frame) {
super(Localization.lang("Find unlinked files"), true, FindUnlinkedFilesDialog.class);
this.frame = frame;

restoreSizeOfDialog();
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/GenFieldsCustomizer.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import javax.swing.InputMap;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
Expand Down Expand Up @@ -51,7 +50,7 @@ public class GenFieldsCustomizer extends JabRefDialog {
private final JButton revert = new JButton();

public GenFieldsCustomizer(JabRefFrame frame) {
super((JFrame) null, Localization.lang("Set general fields"), false, GenFieldsCustomizer.class);
super(Localization.lang("Set general fields"), false, GenFieldsCustomizer.class);
helpBut = new HelpAction(HelpFile.GENERAL_FIELDS).getHelpButton();
jbInit();
setSize(new Dimension(650, 300));
Expand Down
43 changes: 19 additions & 24 deletions src/main/java/org/jabref/gui/JabRefDialog.java
Original file line number Diff line number Diff line change
@@ -1,38 +1,27 @@
package org.jabref.gui;

import java.awt.Frame;
import java.awt.Window;

import javax.swing.JDialog;

import org.jabref.Globals;

public class JabRefDialog extends JDialog {

public <T extends JabRefDialog> JabRefDialog(Frame owner, boolean modal, Class<T> clazz) {
super(owner, modal);

trackDialogOpening(clazz);
public <T extends JabRefDialog> JabRefDialog(boolean modal, Class<T> clazz) {
this("JabRef", modal, clazz);
}

public <T extends JabRefDialog> JabRefDialog(Class<T> clazz) {
super();

trackDialogOpening(clazz);
this(true, clazz);
}

public <T extends JabRefDialog> JabRefDialog(Frame owner, Class<T> clazz) {
super(owner);

trackDialogOpening(clazz);
public <T extends JabRefDialog> JabRefDialog(String title, Class<T> clazz) {
this(title, true, clazz);
}

public <T extends JabRefDialog> JabRefDialog(Frame owner, String title, Class<T> clazz) {
this(owner, title, true, clazz);
}

public <T extends JabRefDialog> JabRefDialog(Frame owner, String title, boolean modal, Class<T> clazz) {
super(owner, title, modal);
public <T extends JabRefDialog> JabRefDialog(String title, boolean modal, Class<T> clazz) {
super((Frame) null, title, modal);

trackDialogOpening(clazz);
}
Expand All @@ -47,13 +36,19 @@ public <T extends JabRefDialog> JabRefDialog(java.awt.Dialog owner, String titl
trackDialogOpening(clazz);
}

public <T extends JabRefDialog> JabRefDialog(Window owner, String title, Class<T> clazz) {
super(owner, title);

trackDialogOpening(clazz);
}

private <T extends JabRefDialog> void trackDialogOpening(Class<T> clazz) {
Globals.getTelemetryClient().ifPresent(client -> client.trackPageView(clazz.getName()));
}

@Override
public void setVisible(boolean visible) {
super.setVisible(visible);

if (visible) {
// FIXME: Ugly hack to ensure that new dialogs are not hidden behind the main window
setAlwaysOnTop(true);
requestFocus();
setAlwaysOnTop(false);
}
}
}
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/MergeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;

import org.jabref.Globals;
Expand Down Expand Up @@ -41,7 +40,7 @@ public class MergeDialog extends JabRefDialog {
private boolean okPressed;

public MergeDialog(JabRefFrame frame, String title, boolean modal) {
super((JFrame) null, title, modal, MergeDialog.class);
super(title, modal, MergeDialog.class);
jbInit();
pack();
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/ReplaceStringDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
Expand Down Expand Up @@ -48,7 +47,7 @@ class ReplaceStringDialog extends JabRefDialog {


public ReplaceStringDialog(JabRefFrame parent) {
super((JFrame) null, Localization.lang("Replace string"), true, ReplaceStringDialog.class);
super(Localization.lang("Replace string"), true, ReplaceStringDialog.class);

ButtonGroup bg = new ButtonGroup();
bg.add(allFi);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/StringDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class StringDialog extends JabRefDialog {


public StringDialog(JabRefFrame frame, BasePanel panel, BibDatabase base) {
super(null, StringDialog.class);
super(StringDialog.class);
this.panel = panel;
this.base = base;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public DatabasePropertiesAction(JabRefFrame frame) {

@Override
public void execute() {
DatabasePropertiesDialog propertiesDialog = new DatabasePropertiesDialog(null, frame.getCurrentBasePanel());
DatabasePropertiesDialog propertiesDialog = new DatabasePropertiesDialog(frame.getCurrentBasePanel());
propertiesDialog.updateEnableStatus();
propertiesDialog.setVisible(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public FindUnlinkedFilesAction(JabRefFrame jabRefFrame) {

@Override
public void execute() {
FindUnlinkedFilesDialog dlg = new FindUnlinkedFilesDialog(null, jabRefFrame);
FindUnlinkedFilesDialog dlg = new FindUnlinkedFilesDialog(jabRefFrame);
dlg.setVisible(true);
}

Expand Down
8 changes: 3 additions & 5 deletions src/main/java/org/jabref/gui/actions/WriteXMPAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import javax.swing.InputMap;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
Expand Down Expand Up @@ -95,7 +94,7 @@ public void init() {
errors = entriesChanged = skipped = 0;

if (optionsDialog == null) {
optionsDialog = new OptionsDialog(null);
optionsDialog = new OptionsDialog();
}
optionsDialog.open();

Expand Down Expand Up @@ -182,9 +181,8 @@ class OptionsDialog extends JabRefDialog {

private final JTextArea progressArea;


public OptionsDialog(JFrame parent) {
super(parent, Localization.lang("Writing XMP-metadata for selected entries..."), false, WriteXMPAction.OptionsDialog.class);
public OptionsDialog() {
super(Localization.lang("Writing XMP-metadata for selected entries..."), false, WriteXMPAction.OptionsDialog.class);
okButton.setEnabled(false);

okButton.addActionListener(e -> dispose());
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/auximport/FromAuxDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
Expand Down Expand Up @@ -69,7 +68,7 @@ public class FromAuxDialog extends JabRefDialog {
private final JabRefFrame parentFrame;

public FromAuxDialog(JabRefFrame frame, String title, boolean modal, TabPane viewedDBs) {
super((JFrame) null, title, modal, FromAuxDialog.class);
super(title, modal, FromAuxDialog.class);

parentTabbedPane = viewedDBs;
parentFrame = frame;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.WindowConstants;

Expand All @@ -31,7 +30,7 @@ public class BibtexKeyPatternDialog extends JabRefDialog {
private final BibtexKeyPatternPanel bibtexKeyPatternPanel;

public BibtexKeyPatternDialog(BasePanel panel) {
super((JFrame) null, Localization.lang("BibTeX key patterns"), true, BibtexKeyPatternDialog.class);
super(Localization.lang("BibTeX key patterns"), true, BibtexKeyPatternDialog.class);
this.bibtexKeyPatternPanel = new BibtexKeyPatternPanel(panel);
this.panel = panel;
this.metaData = panel.getBibDatabaseContext().getMetaData();
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/org/jabref/gui/collab/ChangeDisplayDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
Expand All @@ -35,10 +34,9 @@ class ChangeDisplayDialog extends JabRefDialog implements TreeSelectionListener
private JComponent infoShown;
private boolean okPressed;


public ChangeDisplayDialog(JFrame owner, final BasePanel panel,
BibDatabase secondary, final DefaultMutableTreeNode root) {
super(owner, Localization.lang("External changes"), true, ChangeDisplayDialog.class);
public ChangeDisplayDialog(final BasePanel panel,
BibDatabase secondary, final DefaultMutableTreeNode root) {
super(Localization.lang("External changes"), true, ChangeDisplayDialog.class);
BibDatabase localSecondary;

// Just to be sure, put in an empty secondary base if none is given:
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/collab/ChangeScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private static BibEntry bestFit(BibEntry targetEntry, List<BibEntry> entries) {
public void displayResult(final DisplayResultCallback fup) {
if (changes.getChildCount() > 0) {
SwingUtilities.invokeLater(() -> {
ChangeDisplayDialog changeDialog = new ChangeDisplayDialog(null, panel, databaseInTemp.getDatabase(), changes);
ChangeDisplayDialog changeDialog = new ChangeDisplayDialog(panel, databaseInTemp.getDatabase(), changes);
changeDialog.setVisible(true);
fup.scanResultsResolved(changeDialog.isOkPressed());
if (changeDialog.isOkPressed()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
Expand Down Expand Up @@ -82,14 +81,13 @@ public class ContentSelectorDialog extends JabRefDialog {

/**
*
* @param owner the parent Window (Dialog or Frame)
* @param frame the JabRef Frame
* @param panel the currently selected BasePanel
* @param modal should this dialog be modal?
* @param fieldName the field this selector is initialized for. May be null.
*/
public ContentSelectorDialog(Window owner, JabRefFrame frame, BasePanel panel, boolean modal, String fieldName) {
super(owner, Localization.lang("Manage content selectors"), ContentSelectorDialog.class);
public ContentSelectorDialog(JabRefFrame frame, BasePanel panel, boolean modal, String fieldName) {
super(Localization.lang("Manage content selectors"), ContentSelectorDialog.class);
this.setModal(modal);
this.metaData = panel.getBibDatabaseContext().getMetaData();
this.frame = frame;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import javax.swing.InputMap;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListSelectionModel;
Expand Down Expand Up @@ -75,7 +74,7 @@ public class EntryTypeCustomizationDialog extends JabRefDialog implements ListSe
* Creates a new instance of EntryTypeCustomizationDialog
*/
public EntryTypeCustomizationDialog(JabRefFrame frame) {
super((JFrame) null, Localization.lang("Customize entry types"), false, EntryTypeCustomizationDialog.class);
super(Localization.lang("Customize entry types"), false, EntryTypeCustomizationDialog.class);

this.frame = frame;
initGui();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JRadioButton;
import javax.swing.JTextField;

Expand Down Expand Up @@ -69,8 +68,8 @@ public class DatabasePropertiesDialog extends JabRefDialog {

private FieldFormatterCleanupsPanel fieldFormatterCleanupsPanel;

public DatabasePropertiesDialog(JFrame parent, BasePanel panel) {
super(parent, Localization.lang("Library properties"), true, DatabasePropertiesDialog.class);
public DatabasePropertiesDialog(BasePanel panel) {
super(Localization.lang("Library properties"), true, DatabasePropertiesDialog.class);
encoding = new JComboBox<>();
encoding.setModel(new DefaultComboBoxModel<>(Encodings.ENCODINGS));
ok = new JButton(Localization.lang("OK"));
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/org/jabref/gui/entryeditor/FieldsEditorTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ private Region setupPanel(BibEntry entry, boolean compressed, SuggestionProvider
boolean isFirstField = true;
for (String fieldName : fields) {
FieldEditorFX fieldEditor = FieldEditors.getForField(fieldName, Globals.TASK_EXECUTOR, dialogService,
Globals.journalAbbreviationLoader, Globals.prefs.getJournalAbbreviationPreferences(), Globals.prefs,
databaseContext, entry.getType(),
suggestionProviders, undoManager);
Globals.journalAbbreviationLoader.getRepository(Globals.prefs.getJournalAbbreviationPreferences()),
Globals.prefs, databaseContext, entry.getType(), suggestionProviders, undoManager);
fieldEditor.bindToEntry(entry);

editors.put(fieldName, fieldEditor);
Expand Down
Loading

0 comments on commit e01e445

Please sign in to comment.