Skip to content

Commit 50cacc1

Browse files
author
Federico Fissore
committed
Got rid of Java 8 warnings about _ as a method name
1 parent 5dd73a1 commit 50cacc1

File tree

60 files changed

+704
-725
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+704
-725
lines changed

app/src/cc/arduino/contributions/BuiltInCoreIsNewerCheck.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
import java.util.List;
4949
import java.util.stream.Collectors;
5050

51-
import static processing.app.I18n._;
51+
import static processing.app.I18n.tr;
5252

5353
public class BuiltInCoreIsNewerCheck implements Runnable {
5454

@@ -93,7 +93,7 @@ private void builtInPackageIsNewerCheck() throws InterruptedException {
9393
SwingUtilities.invokeLater(() -> {
9494
PreferencesData.setInteger("builtin_platform_is_newer", BaseNoGui.REVISION);
9595
assert base.hasActiveEditor();
96-
int chosenOption = JOptionPane.showConfirmDialog(base.getActiveEditor(), I18n.format(_("The IDE includes an updated {0} package, but you're using an older one.\nDo you want to upgrade {0}?"), installedBuiltIn.getName()), I18n.format(_("A newer {0} package is available"), installedBuiltIn.getName()), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
96+
int chosenOption = JOptionPane.showConfirmDialog(base.getActiveEditor(), I18n.format(tr("The IDE includes an updated {0} package, but you're using an older one.\nDo you want to upgrade {0}?"), installedBuiltIn.getName()), I18n.format(tr("A newer {0} package is available"), installedBuiltIn.getName()), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
9797
if (chosenOption == JOptionPane.YES_OPTION) {
9898
Action openBoardsManager = base.getOpenBoardsManager();
9999
Event event = new Event(base.getActiveEditor(), ActionEvent.ACTION_PERFORMED, installedBuiltIn.getName());

app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCell.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
import java.util.List;
5555
import java.util.stream.Collectors;
5656

57-
import static processing.app.I18n._;
57+
import static processing.app.I18n.tr;
5858
import static processing.app.I18n.format;
5959

6060
@SuppressWarnings("serial")
@@ -72,13 +72,13 @@ public class ContributedLibraryTableCell extends InstallerTableCell {
7272

7373
public ContributedLibraryTableCell() {
7474
{
75-
installButton = new JButton(_("Install"));
75+
installButton = new JButton(tr("Install"));
7676
installButton.addActionListener(e -> onInstall(editorValue.getSelected(), editorValue.getInstalled()));
7777
int width = installButton.getPreferredSize().width;
7878
installButtonPlaceholder = Box.createRigidArea(new Dimension(width, 1));
7979
}
8080

81-
downgradeButton = new JButton(_("Install"));
81+
downgradeButton = new JButton(tr("Install"));
8282
downgradeButton.addActionListener(e -> {
8383
ContributedLibrary selected = (ContributedLibrary) downgradeChooser.getSelectedItem();
8484
onInstall(selected, editorValue.getInstalled());
@@ -234,7 +234,7 @@ public Component getTableCellEditorComponent(JTable table, Object value,
234234
Collections.sort(uninstalledReleases, new ReverseComparator<>(new DownloadableContributionVersionComparator()));
235235

236236
downgradeChooser.removeAllItems();
237-
downgradeChooser.addItem(_("Select version"));
237+
downgradeChooser.addItem(tr("Select version"));
238238

239239
final List<ContributedLibrary> uninstalledPreviousReleases = Lists.newLinkedList();
240240
final List<ContributedLibrary> uninstalledNewerReleases = Lists.newLinkedList();
@@ -286,10 +286,10 @@ private Component getUpdatedCellComponent(Object value, boolean isSelected, int
286286
upgradable = new DownloadableContributionVersionComparator().compare(selected, installed) > 0;
287287
}
288288
if (installable) {
289-
installButton.setText(_("Install"));
289+
installButton.setText(tr("Install"));
290290
}
291291
if (upgradable) {
292-
installButton.setText(_("Update"));
292+
installButton.setText(tr("Update"));
293293
}
294294
installButton.setVisible(installable || upgradable);
295295
installButtonPlaceholder.setVisible(!(installable || upgradable));
@@ -323,9 +323,9 @@ private Component getUpdatedCellComponent(Object value, boolean isSelected, int
323323
if (installed != null) {
324324
String installedVer = installed.getParsedVersion();
325325
if (installedVer == null) {
326-
desc += " " + _("Version unknown");
326+
desc += " " + tr("Version unknown");
327327
} else {
328-
desc += " " + format(_("Version <b>{0}</b>"), installedVer);
328+
desc += " " + format(tr("Version <b>{0}</b>"), installedVer);
329329
}
330330
}
331331
desc += "</font>";

app/src/cc/arduino/contributions/libraries/ui/DropdownInstalledLibraryItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
import java.util.function.Predicate;
3838

39-
import static processing.app.I18n._;
39+
import static processing.app.I18n.tr;
4040

4141
public class DropdownInstalledLibraryItem implements DropdownItem<ContributedLibrary> {
4242

@@ -47,7 +47,7 @@ public DropdownInstalledLibraryItem(LibrariesIndex index) {
4747
}
4848

4949
public String toString() {
50-
return _("Installed");
50+
return tr("Installed");
5151
}
5252

5353
@Override

app/src/cc/arduino/contributions/libraries/ui/DropdownUpdatableLibrariesItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import java.util.function.Predicate;
99

10-
import static processing.app.I18n._;
10+
import static processing.app.I18n.tr;
1111

1212
public class DropdownUpdatableLibrariesItem implements DropdownItem<ContributedLibrary> {
1313

@@ -24,7 +24,7 @@ public Predicate<ContributedLibrary> getFilterPredicate() {
2424

2525
@Override
2626
public String toString() {
27-
return _("Updatable");
27+
return tr("Updatable");
2828
}
2929

3030
@Override

app/src/cc/arduino/contributions/libraries/ui/LibraryManagerUI.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import java.util.LinkedList;
4848
import java.util.function.Predicate;
4949

50-
import static processing.app.I18n._;
50+
import static processing.app.I18n.tr;
5151

5252
@SuppressWarnings("serial")
5353
public class LibraryManagerUI extends InstallerJDialog<ContributedLibrary> {
@@ -91,18 +91,18 @@ protected void onRemove(ContributedLibrary library) {
9191
}
9292

9393
public LibraryManagerUI(Frame parent, Platform platform) {
94-
super(parent, "Library Manager", Dialog.ModalityType.APPLICATION_MODAL, _("Unable to reach Arduino.cc due to possible network issues."));
94+
super(parent, "Library Manager", Dialog.ModalityType.APPLICATION_MODAL, tr("Unable to reach Arduino.cc due to possible network issues."));
9595
this.platform = platform;
9696

97-
filtersContainer.add(new JLabel(_("Topic")), 1);
97+
filtersContainer.add(new JLabel(tr("Topic")), 1);
9898
filtersContainer.remove(2);
9999

100100
typeChooser = new JComboBox();
101101
typeChooser.setMaximumRowCount(20);
102102
typeChooser.setEnabled(false);
103103

104104
filtersContainer.add(Box.createHorizontalStrut(5), 0);
105-
filtersContainer.add(new JLabel(_("Type")), 1);
105+
filtersContainer.add(new JLabel(tr("Type")), 1);
106106
filtersContainer.add(Box.createHorizontalStrut(5), 2);
107107
filtersContainer.add(typeChooser, 3);
108108
}
@@ -236,7 +236,7 @@ public void onInstallPressed(final ContributedLibrary lib, final ContributedLibr
236236
clearErrorMessage();
237237
installerThread = new Thread(() -> {
238238
try {
239-
setProgressVisible(true, _("Installing..."));
239+
setProgressVisible(true, tr("Installing..."));
240240
installer.install(lib, replaced);
241241
onIndexesUpdated(); // TODO: Do a better job in refreshing only the needed element
242242
//getContribModel().updateLibrary(lib);
@@ -254,7 +254,7 @@ public void onRemovePressed(final ContributedLibrary lib) {
254254
boolean managedByIndex = indexer.getIndex().getLibraries().contains(lib);
255255

256256
if (!managedByIndex) {
257-
int chosenOption = JOptionPane.showConfirmDialog(this, _("This library is not listed on Library Manager. You won't be able to reinstall it from here.\nAre you sure you want to delete it?"), _("Please confirm library deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
257+
int chosenOption = JOptionPane.showConfirmDialog(this, tr("This library is not listed on Library Manager. You won't be able to reinstall it from here.\nAre you sure you want to delete it?"), tr("Please confirm library deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
258258
if (chosenOption != JOptionPane.YES_OPTION) {
259259
return;
260260
}
@@ -263,7 +263,7 @@ public void onRemovePressed(final ContributedLibrary lib) {
263263
clearErrorMessage();
264264
installerThread = new Thread(() -> {
265265
try {
266-
setProgressVisible(true, _("Removing..."));
266+
setProgressVisible(true, tr("Removing..."));
267267
installer.remove(lib);
268268
onIndexesUpdated(); // TODO: Do a better job in refreshing only the needed element
269269
//getContribModel().updateLibrary(lib);

app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCell.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
import java.util.LinkedList;
5656
import java.util.stream.Collectors;
5757

58-
import static processing.app.I18n._;
58+
import static processing.app.I18n.tr;
5959
import static processing.app.I18n.format;
6060

6161
@SuppressWarnings("serial")
@@ -75,20 +75,20 @@ public class ContributedPlatformTableCell extends InstallerTableCell {
7575

7676
public ContributedPlatformTableCell() {
7777
{
78-
installButton = new JButton(_("Install"));
78+
installButton = new JButton(tr("Install"));
7979
installButton.addActionListener(e -> onInstall(editorValue.getSelected(), editorValue.getInstalled()));
8080
int width = installButton.getPreferredSize().width;
8181
installButtonPlaceholder = Box.createRigidArea(new Dimension(width, 1));
8282
}
8383

8484
{
85-
removeButton = new JButton(_("Remove"));
85+
removeButton = new JButton(tr("Remove"));
8686
removeButton.addActionListener(e -> onRemove(editorValue.getInstalled()));
8787
int width = removeButton.getPreferredSize().width;
8888
removeButtonPlaceholder = Box.createRigidArea(new Dimension(width, 1));
8989
}
9090

91-
downgradeButton = new JButton(_("Install"));
91+
downgradeButton = new JButton(tr("Install"));
9292
downgradeButton.addActionListener(e -> {
9393
ContributedPlatform selected = (ContributedPlatform) downgradeChooser.getSelectedItem();
9494
onInstall(selected, editorValue.getInstalled());
@@ -246,7 +246,7 @@ public Component getTableCellEditorComponent(JTable table, Object value,
246246
Collections.sort(uninstalledReleases, new ReverseComparator<>(new DownloadableContributionVersionComparator()));
247247

248248
downgradeChooser.removeAllItems();
249-
downgradeChooser.addItem(_("Select version"));
249+
downgradeChooser.addItem(tr("Select version"));
250250

251251
final java.util.List<ContributedPlatform> uninstalledPreviousReleases = Lists.newLinkedList();
252252
final java.util.List<ContributedPlatform> uninstalledNewerReleases = Lists.newLinkedList();
@@ -300,10 +300,10 @@ private Component getUpdatedCellComponent(Object value, boolean isSelected, int
300300
upgradable = new DownloadableContributionVersionComparator().compare(selected, installed) > 0;
301301
}
302302
if (installable) {
303-
installButton.setText(_("Install"));
303+
installButton.setText(tr("Install"));
304304
}
305305
if (upgradable) {
306-
installButton.setText(_("Update"));
306+
installButton.setText(tr("Update"));
307307
}
308308
installButton.setVisible(installable || upgradable);
309309
installButtonPlaceholder.setVisible(!(installable || upgradable));
@@ -321,11 +321,11 @@ private Component getUpdatedCellComponent(Object value, boolean isSelected, int
321321
desc += " " + format("by <b>{0}</b>", author);
322322
}
323323
if (installed != null) {
324-
desc += " " + format(_("version <b>{0}</b>"), installed.getParsedVersion()) + " <strong><font color=\"#00979D\">INSTALLED</font></strong>";
324+
desc += " " + format(tr("version <b>{0}</b>"), installed.getParsedVersion()) + " <strong><font color=\"#00979D\">INSTALLED</font></strong>";
325325
}
326326
desc += "<br />";
327327

328-
desc += _("Boards included in this package:") + "<br />";
328+
desc += tr("Boards included in this package:") + "<br />";
329329
for (ContributedBoard board : selected.getBoards()) {
330330
desc += board.getName() + ", ";
331331
}

app/src/cc/arduino/contributions/packages/ui/ContributionManagerUI.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import java.util.LinkedList;
4646
import java.util.List;
4747

48-
import static processing.app.I18n._;
48+
import static processing.app.I18n.tr;
4949

5050
@SuppressWarnings("serial")
5151
public class ContributionManagerUI extends InstallerJDialog {
@@ -86,7 +86,7 @@ protected void onRemove(ContributedPlatform installedPlatform) {
8686
}
8787

8888
public ContributionManagerUI(Frame parent, Platform platform) {
89-
super(parent, _("Boards Manager"), Dialog.ModalityType.APPLICATION_MODAL, _("Unable to reach Arduino.cc due to possible network issues."));
89+
super(parent, tr("Boards Manager"), Dialog.ModalityType.APPLICATION_MODAL, tr("Unable to reach Arduino.cc due to possible network issues."));
9090
this.platform = platform;
9191
}
9292

@@ -169,7 +169,7 @@ public void onInstallPressed(final ContributedPlatform platformToInstall, final
169169
installerThread = new Thread(() -> {
170170
List<String> errors = new LinkedList<>();
171171
try {
172-
setProgressVisible(true, _("Installing..."));
172+
setProgressVisible(true, tr("Installing..."));
173173
errors.addAll(installer.install(platformToInstall));
174174
if (platformToRemove != null && !platformToRemove.isReadOnly()) {
175175
errors.addAll(installer.remove(platformToRemove));
@@ -192,15 +192,15 @@ public void onRemovePressed(final ContributedPlatform platform, boolean showWarn
192192
clearErrorMessage();
193193

194194
if (showWarning) {
195-
int chosenOption = JOptionPane.showConfirmDialog(this, I18n.format(_("Do you want to remove {0}?\nIf you do so you won't be able to use {0} any more."), platform.getName()), _("Please confirm boards deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
195+
int chosenOption = JOptionPane.showConfirmDialog(this, I18n.format(tr("Do you want to remove {0}?\nIf you do so you won't be able to use {0} any more."), platform.getName()), tr("Please confirm boards deletion"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
196196
if (chosenOption != JOptionPane.YES_OPTION) {
197197
return;
198198
}
199199
}
200200

201201
installerThread = new Thread(() -> {
202202
try {
203-
setProgressVisible(true, _("Removing..."));
203+
setProgressVisible(true, tr("Removing..."));
204204
installer.remove(platform);
205205
onIndexesUpdated();
206206
} catch (Exception e) {

app/src/cc/arduino/contributions/packages/ui/DropdownAllCoresItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535

3636
import java.util.function.Predicate;
3737

38-
import static processing.app.I18n._;
38+
import static processing.app.I18n.tr;
3939

4040
public class DropdownAllCoresItem implements DropdownItem<ContributedPlatform> {
4141

4242
public String toString() {
43-
return _("All");
43+
return tr("All");
4444
}
4545

4646
@Override

app/src/cc/arduino/contributions/packages/ui/DropdownUpdatableCoresItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import java.util.function.Predicate;
99

10-
import static processing.app.I18n._;
10+
import static processing.app.I18n.tr;
1111

1212
public class DropdownUpdatableCoresItem implements DropdownItem<ContributedPlatform> {
1313

@@ -24,7 +24,7 @@ public Predicate<ContributedPlatform> getFilterPredicate() {
2424

2525
@Override
2626
public String toString() {
27-
return _("Updatable");
27+
return tr("Updatable");
2828
}
2929

3030
@Override

app/src/cc/arduino/contributions/ui/DropdownAllItem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@
3434

3535
import java.util.function.Predicate;
3636

37-
import static processing.app.I18n._;
37+
import static processing.app.I18n.tr;
3838

3939
public class DropdownAllItem implements DropdownItem<DownloadableContribution> {
4040

4141
public String toString() {
42-
return _("All");
42+
return tr("All");
4343
}
4444

4545
@Override

app/src/cc/arduino/contributions/ui/InstallerJDialog.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import java.util.stream.Stream;
4444

4545
import static cc.arduino.contributions.packages.ui.ContributionIndexTableModel.DESCRIPTION_COL;
46-
import static processing.app.I18n._;
46+
import static processing.app.I18n.tr;
4747

4848
public abstract class InstallerJDialog<T> extends JDialog {
4949

@@ -92,7 +92,7 @@ public InstallerJDialog(Frame parent, String title, ModalityType applicationModa
9292
categoryChooser.setMaximumRowCount(20);
9393
categoryChooser.setEnabled(false);
9494

95-
filterField = new FilterJTextField(_("Filter your search...")) {
95+
filterField = new FilterJTextField(tr("Filter your search...")) {
9696
@Override
9797
protected void onFilter(String[] _filters) {
9898
filters = _filters;
@@ -106,7 +106,7 @@ protected void onFilter(String[] _filters) {
106106
filtersContainer = new JPanel();
107107
filtersContainer.setLayout(new BoxLayout(filtersContainer, BoxLayout.X_AXIS));
108108
filtersContainer.add(Box.createHorizontalStrut(5));
109-
filtersContainer.add(new JLabel(_("Type")));
109+
filtersContainer.add(new JLabel(tr("Type")));
110110
filtersContainer.add(Box.createHorizontalStrut(5));
111111
filtersContainer.add(categoryChooser);
112112
filtersContainer.add(Box.createHorizontalStrut(5));
@@ -169,21 +169,21 @@ public void keyReleased(KeyEvent keyEvent) {
169169
errorMessage.setForeground(Color.RED);
170170

171171
{
172-
JButton cancelButton = new JButton(_("Cancel"));
172+
JButton cancelButton = new JButton(tr("Cancel"));
173173
cancelButton.addActionListener(arg0 -> onCancelPressed());
174174

175175
progressBox = Box.createHorizontalBox();
176176
progressBox.add(progressBar);
177177
progressBox.add(Box.createHorizontalStrut(5));
178178
progressBox.add(cancelButton);
179179

180-
dismissErrorMessageButton = new JButton(_("OK"));
180+
dismissErrorMessageButton = new JButton(tr("OK"));
181181
dismissErrorMessageButton.addActionListener(arg0 -> {
182182
clearErrorMessage();
183183
setErrorMessageVisible(false);
184184
});
185185

186-
closeButton = new JButton(_("Close"));
186+
closeButton = new JButton(tr("Close"));
187187
closeButton.addActionListener(arg0 -> InstallerJDialog.this.dispatchEvent(new WindowEvent(InstallerJDialog.this, WindowEvent.WINDOW_CLOSING)));
188188

189189
errorMessageBox = Box.createHorizontalBox();

0 commit comments

Comments
 (0)