Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused swing code #4787

Merged
merged 2 commits into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 4 additions & 19 deletions src/main/java/org/jabref/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,7 @@ public JabRefGUI(Stage mainStage, List<ParserResult> argsDatabases, boolean isBl
}

private void openWindow(Stage mainStage) {
// Set antialiasing on everywhere. This only works in JRE >= 1.5.
// Or... it doesn't work, period.
// TODO test and maybe remove this! I found this commented out with no additional info ( payload@lavabit.com )
// Enabled since JabRef 2.11 beta 4
System.setProperty("swing.aatext", "true");
// Default is "on".
// "lcd" instead of "on" because of http://wiki.netbeans.org/FaqFontRendering and http://docs.oracle.com/javase/6/docs/technotes/guides/2d/flags.html#aaFonts
System.setProperty("awt.useSystemAAFontSettings", "lcd");

// look and feel. This MUST be the first thing to do before loading any Swing-specific code!
setLookAndFeel();
applyFontRenderingTweak();

// If the option is enabled, open the last edited libraries, if any.
if (!isBlank && Globals.prefs.getBoolean(JabRefPreferences.OPEN_LAST_EDITED)) {
Expand Down Expand Up @@ -242,9 +232,9 @@ private boolean isLoaded(File fileToOpen) {
return false;
}

private void setLookAndFeel() {
// On Linux, Java FX fonts look blurry per default. This can be improved by using a non-default rendering
// setting. See https://github.com/woky/javafx-hates-linux
private void applyFontRenderingTweak() {
// On Linux, Java FX fonts look blurry per default. This can be improved by using a non-default rendering setting.
// See https://github.com/woky/javafx-hates-linux
if (Globals.prefs.getBoolean(JabRefPreferences.FX_FONT_RENDERING_TWEAK)) {
System.setProperty("prism.text", "t2k");
System.setProperty("prism.lcdtext", "true");
Expand All @@ -254,9 +244,4 @@ private void setLookAndFeel() {
public static JabRefFrame getMainFrame() {
return mainFrame;
}

// Only used for testing, other than that do NOT set the mainFrame...
public static void setMainFrame(JabRefFrame mainFrame) {
JabRefGUI.mainFrame = mainFrame;
}
}
34 changes: 0 additions & 34 deletions src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@
import org.jabref.gui.specialfields.SpecialFieldViewModel;
import org.jabref.gui.undo.CountingUndoManager;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.UndoableChangeType;
import org.jabref.gui.undo.UndoableFieldChange;
import org.jabref.gui.undo.UndoableInsertEntry;
import org.jabref.gui.undo.UndoableRemoveEntry;
Expand Down Expand Up @@ -1021,39 +1020,6 @@ public BibDatabase getDatabase() {
return bibDatabaseContext.getDatabase();
}

public void changeTypeOfSelectedEntries(String newType) {
List<BibEntry> bes = mainTable.getSelectedEntries();
changeType(bes, newType);
}

private void changeType(List<BibEntry> entries, String newType) {
if ((entries == null) || (entries.isEmpty())) {
LOGGER.error("At least one entry must be selected to be able to change the type.");
return;
}

if (entries.size() > 1) {
boolean proceed = dialogService.showConfirmationDialogAndWait(Localization.lang("Change entry type"), Localization.lang("Multiple entries selected. Do you want to change the type of all these to '%0'?"));
if (!proceed) {
return;
}
}

NamedCompound compound = new NamedCompound(Localization.lang("Change entry type"));
for (BibEntry entry : entries) {
compound.addEdit(new UndoableChangeType(entry, entry.getType(), newType));
DefaultTaskExecutor.runInJavaFXThread(() -> {
entry.setType(newType);
});
}

output(formatOutputMessage(Localization.lang("Changed type to '%0' for", newType), entries.size()));
compound.end();
getUndoManager().addEdit(compound);
markBaseChanged();
updateEntryEditorIfShowing();
}

public boolean showDeleteConfirmationDialog(int numberOfEntries) {
if (Globals.prefs.getBoolean(JabRefPreferences.CONFIRM_DELETE)) {
String title = Localization.lang("Delete entry");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/DuplicateResolverDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private void init(BibEntry one, BibEntry two, DuplicateResolverType type) {

getDialogPane().setContent(borderPane);
Button helpButton = (Button) this.getDialogPane().lookupButton(help);
helpButton.setOnAction(evt -> helpCommand.getCommand().execute());
helpButton.setOnAction(evt -> helpCommand.execute());
}

public BibEntry getMergedEntry() {
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/org/jabref/gui/GUIGlobals.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
import org.jabref.logic.l10n.Localization;
import org.jabref.preferences.JabRefPreferences;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Static variables for graphics files and keyboard shortcuts.
*/
Expand All @@ -32,11 +29,6 @@ public class GUIGlobals {

public static final String UNTITLED_TITLE = Localization.lang("untitled");

// Colors.
public static final Color ENTRY_EDITOR_LABEL_COLOR = new Color(100, 100, 150); // Empty field, blue.

private static final Logger LOGGER = LoggerFactory.getLogger(GUIGlobals.class);

private GUIGlobals() {
}

Expand Down
57 changes: 0 additions & 57 deletions src/main/java/org/jabref/gui/JEditorPaneWithHighlighting.java

This file was deleted.

26 changes: 0 additions & 26 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -550,32 +550,6 @@ public void changed(ObservableValue<? extends Boolean> observable, Boolean oldVa
});

setCenter(splitPane);

/*
GridBagLayout gbl = new GridBagLayout();
GridBagConstraints con = new GridBagConstraints();
con.fill = GridBagConstraints.BOTH;
con.anchor = GridBagConstraints.WEST;
JPanel status = new JPanel();
status.setLayout(gbl);
con.weighty = 0;
con.weightx = 0;
con.gridwidth = 1;
con.insets = new Insets(0, 2, 0, 0);
gbl.setConstraints(statusLabel, con);
status.add(statusLabel);
con.weightx = 1;
con.insets = new Insets(0, 4, 0, 0);
con.gridwidth = 1;
gbl.setConstraints(statusLine, con);
status.add(statusLine);
con.weightx = 0;
con.gridwidth = GridBagConstraints.REMAINDER;
con.insets = new Insets(2, 4, 2, 2);
gbl.setConstraints(progressBar, con);
status.add(progressBar);
statusLabel.setForeground(GUIGlobals.ENTRY_EDITOR_LABEL_COLOR.darker());
*/
}

private void setDividerPosition() {
Expand Down
52 changes: 0 additions & 52 deletions src/main/java/org/jabref/gui/actions/ChangeTypeAction.java

This file was deleted.

18 changes: 4 additions & 14 deletions src/main/java/org/jabref/gui/actions/CopyDoiUrlAction.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package org.jabref.gui.actions;

import java.awt.event.ActionEvent;
import java.util.Optional;

import javax.swing.AbstractAction;

import javafx.scene.control.TextArea;

import org.jabref.Globals;
Expand All @@ -15,24 +12,17 @@
/**
* Copies the doi url to the clipboard
*/
public class CopyDoiUrlAction extends AbstractAction {

private TextArea component = null;
private String identifier;
public class CopyDoiUrlAction extends SimpleCommand {

public CopyDoiUrlAction(String identifier) {
super(Localization.lang("Copy DOI url"));
this.identifier = identifier;
}
private TextArea component;

public CopyDoiUrlAction(TextArea component) {
this(component.getText());
this.component = component;
}

@Override
public void actionPerformed(ActionEvent e) {
identifier = component == null ? identifier : component.getText();
public void execute() {
String identifier = component.getText();

Optional<String> urlOptional = DOI.parse(identifier).map(DOI::getURIAsASCIIString);
if (urlOptional.isPresent()) {
Expand Down
44 changes: 0 additions & 44 deletions src/main/java/org/jabref/gui/actions/MnemonicAwareAction.java

This file was deleted.

5 changes: 5 additions & 0 deletions src/main/java/org/jabref/gui/actions/StandardActions.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public enum StandardActions implements Action {
OPEN_FILE(Localization.lang("Open file"), Localization.lang("Open file"), IconTheme.JabRefIcons.FILE, KeyBinding.OPEN_FILE),
OPEN_CONSOLE(Localization.lang("Open terminal here"), Localization.lang("Open terminal here"), IconTheme.JabRefIcons.CONSOLE, KeyBinding.OPEN_CONSOLE),
COPY_LINKED_FILES(Localization.lang("Copy linked files to folder...")),
COPY_DOI(Localization.lang("Copy DOI url")),
ABBREVIATE(Localization.lang("Abbreviate journal names")),
ABBREVIATE_ISO("ISO", Localization.lang("Abbreviate journal names of the selected entries (ISO abbreviation)"), KeyBinding.ABBREVIATE),
ABBREVIATE_MEDLINE("MEDLINE", Localization.lang("Abbreviate journal names of the selected entries (MEDLINE abbreviation)")),
Expand Down Expand Up @@ -138,6 +139,10 @@ public enum StandardActions implements Action {
SET_FILE_LINKS(Localization.lang("Automatically set file links"), KeyBinding.AUTOMATICALLY_LINK_FILES),

HELP(Localization.lang("Online help"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
HELP_KEY_PATTERNS(Localization.lang("Help on key patterns"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
HELP_REGEX_SEARCH(Localization.lang("Help on regular expression search"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
HELP_NAME_FORMATTER(Localization.lang("Help on Name Formatting"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
HELP_SPECIAL_FIELDS(Localization.lang("Help on special fields"), IconTheme.JabRefIcons.HELP, KeyBinding.HELP),
WEB_MENU(Localization.lang("JabRef resources")),
OPEN_WEBPAGE(Localization.lang("Website"), Localization.lang("Opens JabRef's website")),
OPEN_FACEBOOK("Facebook", Localization.lang("Opens JabRef's Facebook page"), IconTheme.JabRefIcons.FACEBOOK),
Expand Down
Loading