- Timestamp:
- 2016-07-23T21:38:02+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r10611 r10616 576 576 private void requestFocusToDefaultButton() { 577 577 if (defaultButton != null) { 578 GuiHelper.runInEDT( () -> defaultButton.requestFocusInWindow());578 GuiHelper.runInEDT(defaultButton::requestFocusInWindow); 579 579 } 580 580 } -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r10611 r10616 500 500 final Popup staticPopup = popup; 501 501 popup = null; 502 EventQueue.invokeLater( () -> staticPopup.hide());502 EventQueue.invokeLater(staticPopup::hide); 503 503 } 504 504 … … 520 520 } else { 521 521 // There is no old popup 522 EventQueue.invokeLater( () -> staticPopup.show());522 EventQueue.invokeLater(staticPopup::show); 523 523 } 524 524 this.popupLabels = lbls; -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java
r10611 r10616 420 420 refreshView(r); 421 421 } 422 SwingUtilities.invokeLater( () -> Main.map.repaint());422 SwingUtilities.invokeLater(Main.map::repaint); 423 423 } catch (OsmTransferException e) { 424 424 if (canceled) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r10611 r10616 122 122 // just trigger a repaint - the display name of the relation members may have changed 123 123 Collection<RelationMember> sel = getSelectedMembers(); 124 GuiHelper.runInEDT( () -> fireTableDataChanged());124 GuiHelper.runInEDT(this::fireTableDataChanged); 125 125 setSelectedMembers(sel); 126 126 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ParentRelationLoadingTask.java
r10611 r10616 167 167 // FIXME: this is necessary because there are dialogs listening 168 168 // for DataChangeEvents which manipulate Swing components on this thread. 169 SwingUtilities.invokeLater( () -> getLayer().onPostDownloadFromServer());169 SwingUtilities.invokeLater(getLayer()::onPostDownloadFromServer); 170 170 171 171 if (visitor.getConflicts().isEmpty()) -
trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesWithReferrersTask.java
r10611 r10616 138 138 final Set<PrimitiveId> errs = mainTask.getMissingPrimitives(); 139 139 if (errs != null && !errs.isEmpty()) 140 GuiHelper.runInEDTAndWait( () ->reportProblemDialog(errs,140 GuiHelper.runInEDTAndWait(reportProblemDialog(errs, 141 141 trn("Object could not be downloaded", "Some objects could not be downloaded", errs.size()), 142 142 trn("One object could not be downloaded.<br>", … … 148 148 tr("missing objects:"), 149 149 JOptionPane.ERROR_MESSAGE 150 ) .showDialog());150 )::showDialog); 151 151 152 152 // Warm about deleted primitives … … 160 160 } 161 161 if (!del.isEmpty()) 162 GuiHelper.runInEDTAndWait( () ->reportProblemDialog(del,162 GuiHelper.runInEDTAndWait(reportProblemDialog(del, 163 163 trn("Object deleted", "Objects deleted", del.size()), 164 164 trn( … … 169 169 null, 170 170 JOptionPane.WARNING_MESSAGE 171 ) .showDialog());171 )::showDialog); 172 172 } 173 173 -
trunk/src/org/openstreetmap/josm/io/NMEAImporter.java
r10615 r10616 75 75 .append("</html>"); 76 76 if (success) { 77 SwingUtilities.invokeLater( () ->new Notification(77 SwingUtilities.invokeLater(new Notification( 78 78 "<h3>" + tr("NMEA import success:") + "</h3>" + msg.toString()) 79 79 .setIcon(JOptionPane.INFORMATION_MESSAGE) 80 .show());80 ::show); 81 81 } else { 82 82 HelpAwareOptionPane.showMessageDialogInEDT( -
trunk/src/org/openstreetmap/josm/plugins/Plugin.java
r9645 r10616 146 146 File pluginJar = new File(pluginDir, info.name + ".jar"); 147 147 final URL pluginJarUrl = Utils.fileToURL(pluginJar); 148 return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { 149 @Override 150 public ClassLoader run() { 151 return new URLClassLoader(new URL[] {pluginJarUrl}, Main.class.getClassLoader()); 152 } 153 }); 148 return AccessController.doPrivileged((PrivilegedAction<ClassLoader>) 149 () -> new URLClassLoader(new URL[] {pluginJarUrl}, Main.class.getClassLoader())); 154 150 } 155 151 } -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r10493 r10616 24 24 import java.util.Collection; 25 25 import java.util.Collections; 26 import java.util.Comparator;27 26 import java.util.HashMap; 28 27 import java.util.HashSet; … … 35 34 import java.util.Set; 36 35 import java.util.TreeSet; 37 import java.util.concurrent.Callable;38 36 import java.util.concurrent.ExecutionException; 39 37 import java.util.concurrent.FutureTask; … … 534 532 535 533 // Continuation 536 Main.worker.submit(new Runnable() { 537 @Override 538 public void run() { 539 // Build list of plugins to download 540 Set<PluginInformation> toDownload = new HashSet<>(pluginInfoDownloadTask.getAvailablePlugins()); 541 for (Iterator<PluginInformation> it = toDownload.iterator(); it.hasNext();) { 542 PluginInformation info = it.next(); 543 if (!missingRequiredPlugin.contains(info.getName())) { 544 it.remove(); 534 Main.worker.submit(() -> { 535 // Build list of plugins to download 536 Set<PluginInformation> toDownload = new HashSet<>(pluginInfoDownloadTask.getAvailablePlugins()); 537 for (Iterator<PluginInformation> it = toDownload.iterator(); it.hasNext();) { 538 PluginInformation info = it.next(); 539 if (!missingRequiredPlugin.contains(info.getName())) { 540 it.remove(); 541 } 542 } 543 // Check if something has still to be downloaded 544 if (!toDownload.isEmpty()) { 545 // download plugins 546 final PluginDownloadTask task = new PluginDownloadTask(parent, toDownload, tr("Download plugins")); 547 Main.worker.submit(task); 548 Main.worker.submit(() -> { 549 // restart if some plugins have been downloaded 550 if (!task.getDownloadedPlugins().isEmpty()) { 551 // update plugin list in preferences 552 Set<String> plugins = new HashSet<>(Main.pref.getCollection("plugins")); 553 for (PluginInformation plugin : task.getDownloadedPlugins()) { 554 plugins.add(plugin.name); 555 } 556 Main.pref.putCollection("plugins", plugins); 557 // restart 558 new RestartAction().actionPerformed(null); 559 } else { 560 Main.warn("No plugin downloaded, restart canceled"); 545 561 } 546 } 547 // Check if something has still to be downloaded 548 if (!toDownload.isEmpty()) { 549 // download plugins 550 final PluginDownloadTask task = new PluginDownloadTask(parent, toDownload, tr("Download plugins")); 551 Main.worker.submit(task); 552 Main.worker.submit(new Runnable() { 553 @Override 554 public void run() { 555 // restart if some plugins have been downloaded 556 if (!task.getDownloadedPlugins().isEmpty()) { 557 // update plugin list in preferences 558 Set<String> plugins = new HashSet<>(Main.pref.getCollection("plugins")); 559 for (PluginInformation plugin : task.getDownloadedPlugins()) { 560 plugins.add(plugin.name); 561 } 562 Main.pref.putCollection("plugins", plugins); 563 // restart 564 new RestartAction().actionPerformed(null); 565 } else { 566 Main.warn("No plugin downloaded, restart canceled"); 567 } 568 } 569 }); 570 } else { 571 Main.warn("No plugin to download, operation canceled"); 572 } 562 }); 563 } else { 564 Main.warn("No plugin to download, operation canceled"); 573 565 } 574 566 }); … … 665 657 public static synchronized DynamicURLClassLoader getPluginClassLoader() { 666 658 if (pluginClassLoader == null) { 667 pluginClassLoader = AccessController.doPrivileged(new PrivilegedAction<DynamicURLClassLoader>() { 668 @Override 669 public DynamicURLClassLoader run() { 670 return new DynamicURLClassLoader(new URL[0], Main.class.getClassLoader()); 671 } 672 }); 659 pluginClassLoader = AccessController.doPrivileged((PrivilegedAction<DynamicURLClassLoader>) 660 () -> new DynamicURLClassLoader(new URL[0], Main.class.getClassLoader())); 673 661 sources.add(0, pluginClassLoader); 674 662 } … … 760 748 Collections.sort( 761 749 toLoad, 762 new Comparator<PluginInformation>() { 763 @Override 764 public int compare(PluginInformation o1, PluginInformation o2) { 765 if (o1.stage < o2.stage) return -1; 766 if (o1.stage == o2.stage) return 0; 767 return 1; 768 } 750 (o1, o2) -> { 751 if (o1.stage < o2.stage) return -1; 752 if (o1.stage == o2.stage) return 0; 753 return 1; 769 754 } 770 755 ); … … 1173 1158 return; 1174 1159 1175 final File[] files = pluginDir.listFiles(new FilenameFilter() { 1176 @Override 1177 public boolean accept(File dir, String name) { 1178 return name.endsWith(".jar.new"); 1179 } 1180 }); 1160 final File[] files = pluginDir.listFiles((FilenameFilter) (dir, name) -> name.endsWith(".jar.new")); 1181 1161 if (files == null) 1182 1162 return; … … 1198 1178 } catch (IOException e) { 1199 1179 if (dowarn) { 1200 Main.warn( tr("Failed to install plugin ''{0}'' from temporary download file ''{1}''. {2}",1180 Main.warn(e, tr("Failed to install plugin ''{0}'' from temporary download file ''{1}''. {2}", 1201 1181 plugin.toString(), updatedPlugin.toString(), e.getLocalizedMessage())); 1202 1182 } … … 1309 1289 1310 1290 try { 1311 FutureTask<Integer> task = new FutureTask<>(new Callable<Integer>() { 1312 @Override 1313 public Integer call() { 1314 return HelpAwareOptionPane.showOptionDialog( 1315 Main.parent, 1316 msg.toString(), 1317 tr("Update plugins"), 1318 JOptionPane.QUESTION_MESSAGE, 1319 null, 1320 options, 1321 options[0], 1322 ht("/ErrorMessages#ErrorInPlugin") 1323 ); 1324 } 1325 }); 1291 FutureTask<Integer> task = new FutureTask<>(() -> HelpAwareOptionPane.showOptionDialog( 1292 Main.parent, 1293 msg.toString(), 1294 tr("Update plugins"), 1295 JOptionPane.QUESTION_MESSAGE, 1296 null, 1297 options, 1298 options[0], 1299 ht("/ErrorMessages#ErrorInPlugin") 1300 )); 1326 1301 GuiHelper.runInEDT(task); 1327 1302 return task.get(); … … 1394 1369 plugins.remove(plugin.getPluginInformation().name); 1395 1370 Main.pref.putCollection("plugins", plugins); 1396 GuiHelper.runInEDTAndWait(new Runnable() { 1397 @Override 1398 public void run() { 1399 JOptionPane.showMessageDialog( 1400 Main.parent, 1401 tr("The plugin has been removed from the configuration. Please restart JOSM to unload the plugin."), 1402 tr("Information"), 1403 JOptionPane.INFORMATION_MESSAGE 1404 ); 1405 } 1406 }); 1371 GuiHelper.runInEDTAndWait(() -> JOptionPane.showMessageDialog( 1372 Main.parent, 1373 tr("The plugin has been removed from the configuration. Please restart JOSM to unload the plugin."), 1374 tr("Information"), 1375 JOptionPane.INFORMATION_MESSAGE 1376 )); 1407 1377 return null; 1408 1378 default: -
trunk/src/org/openstreetmap/josm/plugins/ReadLocalPluginInformationTask.java
r10173 r10616 47 47 } 48 48 49 /** 50 * Constructs a new {@code ReadLocalPluginInformationTask}. 51 * @param monitor progress monitor 52 */ 49 53 public ReadLocalPluginInformationTask(ProgressMonitor monitor) { 50 54 super(tr("Reading local plugin information.."), monitor, false); … … 77 81 78 82 private static File[] listFiles(File pluginsDirectory, final String regex) { 79 return pluginsDirectory.listFiles( 80 new FilenameFilter() { 81 @Override 82 public boolean accept(File dir, String name) { 83 return name.matches(regex); 84 } 85 } 86 ); 83 return pluginsDirectory.listFiles((FilenameFilter) (dir, name) -> name.matches(regex)); 87 84 } 88 85 … … 108 105 protected void scanPluginFiles(ProgressMonitor monitor, File pluginsDirectory) { 109 106 File[] pluginFiles = pluginsDirectory.listFiles( 110 new FilenameFilter() { 111 @Override 112 public boolean accept(File dir, String name) { 113 return name.endsWith(".jar") || name.endsWith(".jar.new"); 114 } 115 } 107 (FilenameFilter) (dir, name) -> name.endsWith(".jar") || name.endsWith(".jar.new") 116 108 ); 117 109 if (pluginFiles == null || pluginFiles.length == 0) … … 131 123 } 132 124 } catch (PluginException e) { 133 Main.warn( "PluginException: "+e.getMessage());125 Main.warn(e, "PluginException: "); 134 126 Main.warn(tr("Failed to scan file ''{0}'' for plugin information. Skipping.", fname)); 135 127 } -
trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java
r10173 r10616 200 200 private static void displayErrorMessage(final ProgressMonitor monitor, final String msg, final String details, final String title, 201 201 final String firstMessage) { 202 GuiHelper.runInEDTAndWait(new Runnable() { 203 @Override public void run() { 204 JPanel panel = new JPanel(new GridBagLayout()); 205 panel.add(new JLabel(firstMessage), GBC.eol().insets(0, 0, 0, 10)); 206 StringBuilder b = new StringBuilder(); 207 for (String part : msg.split("(?<=\\G.{200})")) { 208 b.append(part).append('\n'); 209 } 210 panel.add(new JLabel("<html><body width=\"500\"><b>"+b.toString().trim()+"</b></body></html>"), GBC.eol().insets(0, 0, 0, 10)); 211 if (details != null && !details.isEmpty()) { 212 panel.add(new JLabel(tr("Details:")), GBC.eol().insets(0, 0, 0, 10)); 213 JosmTextArea area = new JosmTextArea(details); 214 area.setEditable(false); 215 area.setLineWrap(true); 216 area.setWrapStyleWord(true); 217 JScrollPane scrollPane = new JScrollPane(area); 218 scrollPane.setPreferredSize(new Dimension(500, 300)); 219 panel.add(scrollPane, GBC.eol().fill()); 220 } 221 JOptionPane.showMessageDialog(monitor.getWindowParent(), panel, title, JOptionPane.ERROR_MESSAGE); 222 } 202 GuiHelper.runInEDTAndWait(() -> { 203 JPanel panel = new JPanel(new GridBagLayout()); 204 panel.add(new JLabel(firstMessage), GBC.eol().insets(0, 0, 0, 10)); 205 StringBuilder b = new StringBuilder(); 206 for (String part : msg.split("(?<=\\G.{200})")) { 207 b.append(part).append('\n'); 208 } 209 panel.add(new JLabel("<html><body width=\"500\"><b>"+b.toString().trim()+"</b></body></html>"), GBC.eol().insets(0, 0, 0, 10)); 210 if (details != null && !details.isEmpty()) { 211 panel.add(new JLabel(tr("Details:")), GBC.eol().insets(0, 0, 0, 10)); 212 JosmTextArea area = new JosmTextArea(details); 213 area.setEditable(false); 214 area.setLineWrap(true); 215 area.setWrapStyleWord(true); 216 JScrollPane scrollPane = new JScrollPane(area); 217 scrollPane.setPreferredSize(new Dimension(500, 300)); 218 panel.add(scrollPane, GBC.eol().fill()); 219 } 220 JOptionPane.showMessageDialog(monitor.getWindowParent(), panel, title, JOptionPane.ERROR_MESSAGE); 223 221 }); 224 222 } … … 296 294 for (String location : PluginInformation.getPluginLocations()) { 297 295 File[] f = new File(location).listFiles( 298 new FilenameFilter() { 299 @Override 300 public boolean accept(File dir, String name) { 301 return name.matches("^([0-9]+-)?site.*\\.txt$") || 302 name.matches("^([0-9]+-)?site.*-icons\\.zip$"); 303 } 304 } 296 (FilenameFilter) (dir, name) -> name.matches("^([0-9]+-)?site.*\\.txt$") || 297 name.matches("^([0-9]+-)?site.*-icons\\.zip$") 305 298 ); 306 299 if (f != null && f.length > 0) { -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r9876 r10616 34 34 import org.openstreetmap.josm.io.OsmTransferException; 35 35 import org.openstreetmap.josm.io.auth.CredentialsManager; 36 import org.openstreetmap.josm.tools.Utils.Function; 36 37 import org.openstreetmap.josm.tools.date.DateUtils; 37 38 … … 141 142 OsmPrimitive firstRefs = conflict.b.iterator().next(); 142 143 String objId = Long.toString(conflict.a.getId()); 143 Collection<Long> refIds = Utils.transform(conflict.b, new Utils.Function<OsmPrimitive, Long>() { 144 145 @Override 146 public Long apply(OsmPrimitive x) { 147 return x.getId(); 148 } 149 }); 144 Collection<Long> refIds = Utils.transform(conflict.b, (Function<OsmPrimitive, Long>) x -> x.getId()); 150 145 String refIdsString = refIds.size() == 1 ? refIds.iterator().next().toString() : refIds.toString(); 151 146 if (conflict.a instanceof Node) { -
trunk/src/org/openstreetmap/josm/tools/I18n.java
r9983 r10616 16 16 import java.util.Arrays; 17 17 import java.util.Collection; 18 import java.util.Comparator;19 18 import java.util.HashMap; 20 19 import java.util.Locale; … … 382 381 Locale[] l = new Locale[v.size()]; 383 382 l = v.toArray(l); 384 Arrays.sort(l, new Comparator<Locale>() { 385 @Override 386 public int compare(Locale o1, Locale o2) { 387 return o1.toString().compareTo(o2.toString()); 388 } 389 }); 383 Arrays.sort(l, (o1, o2) -> o1.toString().compareTo(o2.toString())); 390 384 return l; 391 385 } … … 743 737 744 738 public static TranslationAdapter getTranslationAdapter() { 745 return new TranslationAdapter() { 746 @Override 747 public String tr(String text, Object... objects) { 748 return I18n.tr(text, objects); 749 } 750 }; 739 return (text, objects) -> I18n.tr(text, objects); 751 740 } 752 741 -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r10600 r10616 33 33 import java.util.Arrays; 34 34 import java.util.Collection; 35 import java.util.Comparator;36 35 import java.util.HashMap; 37 36 import java.util.Hashtable; … … 76 75 import org.w3c.dom.NodeList; 77 76 import org.xml.sax.Attributes; 78 import org.xml.sax.EntityResolver;79 77 import org.xml.sax.InputSource; 80 78 import org.xml.sax.SAXException; … … 687 685 * Load the image in a background thread. 688 686 * 689 * This method returns immediately and runs the image request 690 * asynchronously. 687 * This method returns immediately and runs the image request asynchronously. 691 688 * 692 689 * @param callback a callback. It is called, when the image is ready. … … 697 694 public void getInBackground(final ImageCallback callback) { 698 695 if (name.startsWith(HTTP_PROTOCOL) || name.startsWith(WIKI_PROTOCOL)) { 699 Runnable fetch = new Runnable() { 700 @Override 701 public void run() { 702 ImageIcon result = get(); 703 callback.finished(result); 704 } 705 }; 706 IMAGE_FETCHER.submit(fetch); 696 IMAGE_FETCHER.submit(() -> callback.finished(get())); 707 697 } else { 708 ImageIcon result = get(); 709 callback.finished(result); 698 callback.finished(get()); 710 699 } 711 700 } … … 714 703 * Load the image in a background thread. 715 704 * 716 * This method returns immediately and runs the image request 717 * asynchronously. 705 * This method returns immediately and runs the image request asynchronously. 718 706 * 719 707 * @param callback a callback. It is called, when the image is ready. … … 725 713 public void getInBackground(final ImageResourceCallback callback) { 726 714 if (name.startsWith(HTTP_PROTOCOL) || name.startsWith(WIKI_PROTOCOL)) { 727 Runnable fetch = new Runnable() { 728 @Override 729 public void run() { 730 callback.finished(getResource()); 731 } 732 }; 733 IMAGE_FETCHER.submit(fetch); 715 IMAGE_FETCHER.submit(() -> callback.finished(getResource())); 734 716 } else { 735 717 callback.finished(getResource()); … … 1280 1262 }); 1281 1263 1282 parser.setEntityResolver(new EntityResolver() { 1283 @Override 1284 public InputSource resolveEntity(String publicId, String systemId) { 1285 return new InputSource(new ByteArrayInputStream(new byte[0])); 1286 } 1287 }); 1264 parser.setEntityResolver((publicId, systemId) -> new InputSource(new ByteArrayInputStream(new byte[0]))); 1288 1265 1289 1266 CachedFile cf = new CachedFile(base + fn).setDestDir( … … 1508 1485 // Check if the presets have icons for nodes/relations. 1509 1486 if (!OsmPrimitiveType.WAY.equals(primitive.getType())) { 1510 final Collection<TaggingPreset> presets = new TreeSet<>(new Comparator<TaggingPreset>() { 1511 @Override 1512 public int compare(TaggingPreset o1, TaggingPreset o2) { 1513 final int o1TypesSize = o1.types == null || o1.types.isEmpty() ? Integer.MAX_VALUE : o1.types.size(); 1514 final int o2TypesSize = o2.types == null || o2.types.isEmpty() ? Integer.MAX_VALUE : o2.types.size(); 1515 return Integer.compare(o1TypesSize, o2TypesSize); 1516 } 1487 final Collection<TaggingPreset> presets = new TreeSet<>((o1, o2) -> { 1488 final int o1TypesSize = o1.types == null || o1.types.isEmpty() ? Integer.MAX_VALUE : o1.types.size(); 1489 final int o2TypesSize = o2.types == null || o2.types.isEmpty() ? Integer.MAX_VALUE : o2.types.size(); 1490 return Integer.compare(o1TypesSize, o2TypesSize); 1517 1491 }); 1518 1492 presets.addAll(TaggingPresets.getMatchingPresets(primitive)); -
trunk/src/org/openstreetmap/josm/tools/MultikeyActionsHandler.java
r9634 r10616 7 7 import java.awt.KeyboardFocusManager; 8 8 import java.awt.event.ActionEvent; 9 import java.awt.event.ActionListener;10 9 import java.awt.event.KeyEvent; 11 10 import java.util.HashMap; … … 63 62 String.valueOf(info.getShortcut()), info.getDescription())); 64 63 item.setMnemonic(info.getShortcut()); 65 item.addActionListener(new ActionListener() { 66 @Override 67 public void actionPerformed(ActionEvent e) { 68 action.action.executeMultikeyAction(info.getIndex(), false); 69 } 70 }); 64 item.addActionListener(e -> action.action.executeMultikeyAction(info.getIndex(), false)); 71 65 layers.add(item); 72 66 } … … 79 73 "Repeat " + lastLayer.getDescription())); 80 74 repeateItem.setMnemonic(action.shortcut.getKeyStroke().getKeyCode()); 81 repeateItem.addActionListener(new ActionListener() { 82 @Override 83 public void actionPerformed(ActionEvent e) { 84 action.action.executeMultikeyAction(-1, true); 85 } 86 }); 75 repeateItem.addActionListener(e -> action.action.executeMultikeyAction(-1, true)); 87 76 layers.add(repeateItem); 88 77 } -
trunk/src/org/openstreetmap/josm/tools/PlatformHookUnixoid.java
r10580 r10616 421 421 // Method unused, but kept for translation already done. To reuse during Java 9 migration 422 422 protected void askUpdateJava(final String version, final String url) { 423 GuiHelper.runInEDTAndWait(new Runnable() { 424 @Override 425 public void run() { 426 ExtendedDialog ed = new ExtendedDialog( 427 Main.parent, 428 tr("Outdated Java version"), 429 new String[]{tr("OK"), tr("Update Java"), tr("Cancel")}); 430 // Check if the dialog has not already been permanently hidden by user 431 if (!ed.toggleEnable("askUpdateJava9").toggleCheckState()) { 432 ed.setButtonIcons(new String[]{"ok", "java", "cancel"}).setCancelButton(3); 433 ed.setMinimumSize(new Dimension(480, 300)); 434 ed.setIcon(JOptionPane.WARNING_MESSAGE); 435 StringBuilder content = new StringBuilder(tr("You are running version {0} of Java.", "<b>"+version+"</b>")) 436 .append("<br><br>"); 437 if ("Sun Microsystems Inc.".equals(System.getProperty("java.vendor")) && !isOpenJDK()) { 438 content.append("<b>").append(tr("This version is no longer supported by {0} since {1} and is not recommended for use.", 439 "Oracle", tr("April 2015"))).append("</b><br><br>"); // TODO: change date once Java 8 EOL is announced 440 } 441 content.append("<b>") 442 .append(tr("JOSM will soon stop working with this version; we highly recommend you to update to Java {0}.", "8")) 443 .append("</b><br><br>") 444 .append(tr("Would you like to update now ?")); 445 ed.setContent(content.toString()); 446 447 if (ed.showDialog().getValue() == 2) { 448 try { 449 openUrl(url); 450 } catch (IOException e) { 451 Main.warn(e); 452 } 423 GuiHelper.runInEDTAndWait(() -> { 424 ExtendedDialog ed = new ExtendedDialog( 425 Main.parent, 426 tr("Outdated Java version"), 427 new String[]{tr("OK"), tr("Update Java"), tr("Cancel")}); 428 // Check if the dialog has not already been permanently hidden by user 429 if (!ed.toggleEnable("askUpdateJava9").toggleCheckState()) { 430 ed.setButtonIcons(new String[]{"ok", "java", "cancel"}).setCancelButton(3); 431 ed.setMinimumSize(new Dimension(480, 300)); 432 ed.setIcon(JOptionPane.WARNING_MESSAGE); 433 StringBuilder content = new StringBuilder(tr("You are running version {0} of Java.", "<b>"+version+"</b>")) 434 .append("<br><br>"); 435 if ("Sun Microsystems Inc.".equals(System.getProperty("java.vendor")) && !isOpenJDK()) { 436 content.append("<b>").append(tr("This version is no longer supported by {0} since {1} and is not recommended for use.", 437 "Oracle", tr("April 2015"))).append("</b><br><br>"); // TODO: change date once Java 8 EOL is announced 438 } 439 content.append("<b>") 440 .append(tr("JOSM will soon stop working with this version; we highly recommend you to update to Java {0}.", "8")) 441 .append("</b><br><br>") 442 .append(tr("Would you like to update now ?")); 443 ed.setContent(content.toString()); 444 445 if (ed.showDialog().getValue() == 2) { 446 try { 447 openUrl(url); 448 } catch (IOException e) { 449 Main.warn(e); 453 450 } 454 451 } -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r10604 r10616 1374 1374 */ 1375 1375 public static Executor newDirectExecutor() { 1376 return new Executor() { 1377 @Override 1378 public void execute(Runnable command) { 1379 command.run(); 1380 } 1381 }; 1376 return command -> command.run(); 1382 1377 } 1383 1378 … … 1620 1615 public static void setObjectsAccessible(final AccessibleObject ... objects) { 1621 1616 if (objects != null && objects.length > 0) { 1622 AccessController.doPrivileged(new PrivilegedAction<Object>() { 1623 @Override 1624 public Object run() { 1625 for (AccessibleObject o : objects) { 1626 o.setAccessible(true); 1627 } 1628 return null; 1617 AccessController.doPrivileged((PrivilegedAction<Object>) () -> { 1618 for (AccessibleObject o : objects) { 1619 o.setAccessible(true); 1629 1620 } 1621 return null; 1630 1622 }); 1631 1623 } -
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReportSender.java
r10404 r10616 132 132 private void failed(String string) { 133 133 errorMessage = string; 134 SwingUtilities.invokeLater(new Runnable() { 135 @Override 136 public void run() { 137 JPanel errorPanel = new JPanel(new GridBagLayout()); 138 errorPanel.add(new JMultilineLabel( 139 tr("Opening the bug report failed. Please report manually using this website:")), 140 GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 141 errorPanel.add(new UrlLabel(Main.getJOSMWebsite() + "/newticket", 2), GBC.eop().insets(8, 0, 0, 0)); 142 errorPanel.add(new DebugTextDisplay(statusText)); 134 SwingUtilities.invokeLater(() -> { 135 JPanel errorPanel = new JPanel(new GridBagLayout()); 136 errorPanel.add(new JMultilineLabel( 137 tr("Opening the bug report failed. Please report manually using this website:")), 138 GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 139 errorPanel.add(new UrlLabel(Main.getJOSMWebsite() + "/newticket", 2), GBC.eop().insets(8, 0, 0, 0)); 140 errorPanel.add(new DebugTextDisplay(statusText)); 143 141 144 JOptionPane.showMessageDialog(Main.parent, errorPanel, tr("You have encountered a bug in JOSM"), 145 JOptionPane.ERROR_MESSAGE); 146 } 142 JOptionPane.showMessageDialog(Main.parent, errorPanel, tr("You have encountered a bug in JOSM"), 143 JOptionPane.ERROR_MESSAGE); 147 144 }); 148 145 }
Note:
See TracChangeset
for help on using the changeset viewer.