### Eclipse Workspace Patch 1.0
#P josm
diff --git src/org/openstreetmap/josm/actions/AboutAction.java src/org/openstreetmap/josm/actions/AboutAction.java
index e0d3aef..fafb322 100644
|
|
|
|
| 19 | 19 | import java.io.InputStream; |
| 20 | 20 | import java.io.InputStreamReader; |
| 21 | 21 | import java.nio.charset.StandardCharsets; |
| | 22 | import java.nio.file.Files; |
| | 23 | import java.nio.file.InvalidPathException; |
| | 24 | import java.nio.file.Path; |
| 22 | 25 | import java.util.Map.Entry; |
| 23 | 26 | |
| 24 | 27 | import javax.swing.AbstractAction; |
| … |
… |
|
| 179 | 182 | } |
| 180 | 183 | |
| 181 | 184 | private static class OpenDirAction extends AbstractAction { |
| 182 | | final String dir; |
| | 185 | private final Path dirPath; |
| 183 | 186 | |
| 184 | 187 | OpenDirAction(String dir) { |
| 185 | | putValue(Action.NAME, "..."); |
| 186 | | this.dir = dir; |
| 187 | | try { |
| 188 | | setEnabled(dir != null && new File(dir).isDirectory()); |
| 189 | | } catch (SecurityException e) { |
| 190 | | setEnabled(false); |
| 191 | | Logging.warn(e); |
| | 188 | super("..."); |
| | 189 | |
| | 190 | Path path = null; |
| | 191 | boolean isValidDir = false; |
| | 192 | |
| | 193 | if (dir != null) { |
| | 194 | try { |
| | 195 | path = Path.of(dir); |
| | 196 | isValidDir = Files.isDirectory(path); |
| | 197 | } catch (InvalidPathException | SecurityException e) { |
| | 198 | Logging.warn(e); |
| | 199 | } |
| 192 | 200 | } |
| | 201 | |
| | 202 | this.dirPath = isValidDir ? path : null; |
| | 203 | setEnabled(isValidDir); |
| 193 | 204 | } |
| 194 | 205 | |
| 195 | 206 | @Override |
| 196 | 207 | public void actionPerformed(ActionEvent e) { |
| 197 | | OpenBrowser.displayUrl(new File(dir).toURI()); |
| | 208 | if (dirPath != null) { |
| | 209 | OpenBrowser.displayUrl(dirPath.toUri()); |
| | 210 | } |
| 198 | 211 | } |
| 199 | 212 | } |
| 200 | 213 | |