Ticket #17192: 17192-v3.patch
File 17192-v3.patch, 6.1 KB (added by , 5 weeks ago) |
---|
-
src/org/openstreetmap/josm/actions/AboutAction.java
2 2 package org.openstreetmap.josm.actions; 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.Utils.getSystemEnv; 6 import static org.openstreetmap.josm.tools.Utils.getSystemProperty; 5 7 6 8 import java.awt.Color; 7 9 import java.awt.Dimension; 8 10 import java.awt.FlowLayout; 11 import java.awt.Font; 9 12 import java.awt.GridBagLayout; 10 13 import java.awt.event.ActionEvent; 11 14 import java.awt.event.KeyEvent; … … 12 15 import java.awt.event.MouseAdapter; 13 16 import java.awt.event.MouseEvent; 14 17 import java.io.BufferedReader; 18 import java.io.File; 15 19 import java.io.IOException; 16 20 import java.io.InputStream; 17 21 import java.io.InputStreamReader; 18 22 23 import javax.swing.AbstractAction; 19 24 import javax.swing.BorderFactory; 25 import javax.swing.JButton; 20 26 import javax.swing.JLabel; 21 27 import javax.swing.JPanel; 22 28 import javax.swing.JScrollPane; … … 37 43 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; 38 44 import org.openstreetmap.josm.tools.Logging; 39 45 import org.openstreetmap.josm.tools.OpenBrowser; 46 import org.openstreetmap.josm.tools.PlatformManager; 40 47 import org.openstreetmap.josm.tools.Shortcut; 41 48 import org.openstreetmap.josm.tools.Utils; 42 49 … … 112 119 info.add(logos, GBC.eol().insets(0, 10, 0, 0)); 113 120 info.add(GBC.glue(0, 5), GBC.eol()); 114 121 122 final String envJavaHome = getSystemEnv("JAVA_HOME"); 123 final String envJavaHomeAlt = PlatformManager.isPlatformWindows() ? "%JAVA_HOME%" : "${JAVA_HOME}"; 124 final String propJavaHome = getSystemProperty("java.home"); 125 final String propJavaHomeAlt = "<java.home>"; 126 final String prefDir = Config.getDirs().getPreferencesDirectory(false).toString(); 127 final String prefDirAlt = "<josm.pref>"; 128 final String userDataDir = Config.getDirs().getUserDataDirectory(false).toString(); 129 final String userDataDirAlt = "<josm.userdata>"; 130 final String userCacheDir = Config.getDirs().getCacheDirectory(false).toString(); 131 final String userCacheDirAlt = "<josm.cache>"; 132 133 JPanel inst = new JPanel(new GridBagLayout()); 134 addInstLine(inst, envJavaHomeAlt, envJavaHome); 135 addInstLine(inst, propJavaHomeAlt, propJavaHome); 136 addInstLine(inst, prefDirAlt, prefDir); 137 addInstLine(inst, userDataDirAlt, userDataDir); 138 addInstLine(inst, userCacheDirAlt, userCacheDir); 139 115 140 about.addTab(tr("Info"), info); 116 141 about.addTab(tr("Readme"), createScrollPane(readme)); 117 142 about.addTab(tr("Revision"), createScrollPane(revision)); … … 118 143 about.addTab(tr("Contribution"), createScrollPane(contribution)); 119 144 about.addTab(tr("License"), createScrollPane(license)); 120 145 about.addTab(tr("Plugins"), new JScrollPane(PluginHandler.getInfoPanel())); 146 about.addTab(tr("Installation Details"), inst); 121 147 122 148 // Get the list of Launchpad contributors using customary msgid “translator-credits” 123 149 String translators = tr("translator-credits"); … … 133 159 panel.add(about, GBC.std().fill()); 134 160 135 161 GuiHelper.prepareResizeableOptionPane(panel, panel.getPreferredSize()); 136 int ret = new ExtendedDialog(MainApplication.getMainFrame(), tr("About JOSM..."), tr("OK"), tr("Report bug"))137 138 .setContent(panel, false)139 .showDialog().getValue();162 ExtendedDialog dlg = new ExtendedDialog(MainApplication.getMainFrame(), tr("About JOSM..."), tr("OK"), tr("Report bug")); 163 int ret = dlg.setButtonIcons("ok", "bug") 164 .setContent(panel, false) 165 .showDialog().getValue(); 140 166 if (2 == ret) { 141 167 MainApplication.getMenu().reportbug.actionPerformed(null); 142 168 } 169 GuiHelper.destroyComponents(panel, false); 170 dlg.dispose(); 143 171 } 144 172 173 private static class OpenDirAction extends AbstractAction { 174 final String dir; 175 176 OpenDirAction(String dir) { 177 super(); 178 this.dir = dir; 179 setEnabled(dir != null && new File(dir).isDirectory()); 180 } 181 182 @Override 183 public void actionPerformed(ActionEvent e) { 184 OpenBrowser.displayUrl(new File(dir).toURI()); 185 } 186 } 187 188 private void addInstLine(JPanel inst, String symbol, String dir) { 189 inst.add(new JLabel(symbol), GBC.std()); 190 inst.add(GBC.glue(5, 0), GBC.std()); 191 JLabel dirLabel; 192 if (dir != null && !dir.isEmpty()) { 193 dirLabel = new JLabel(dir); 194 } else { 195 dirLabel = new JLabel("(unset)"); 196 dirLabel.setFont(dirLabel.getFont().deriveFont(Font.ITALIC)); 197 } 198 inst.add(dirLabel, GBC.std().fill(GBC.HORIZONTAL)); 199 JButton btn = new JButton(tr("open")); 200 btn.setAction(new OpenDirAction(dir)); 201 btn.setToolTipText(tr("Open directory")); 202 btn.setIcon(ImageProvider.get("open", ImageProvider.ImageSizes.SMALLICON)); 203 inst.add(btn, GBC.eol()); 204 } 205 145 206 private static JLabel createImageLink(String tooltip, String icon, final String link) { 146 207 JLabel label = new JLabel(ImageProvider.get("dialogs/about", icon, ImageSizes.LARGEICON)); 147 208 label.setToolTipText(tooltip); -
src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
241 241 242 242 String val = param; 243 243 val = paramReplace(val, envJavaHome, envJavaHomeAlt); 244 val = paramReplace(val, envJavaHome, envJavaHomeAlt);245 244 val = paramReplace(val, propJavaHome, propJavaHomeAlt); 246 245 val = paramReplace(val, prefDir, prefDirAlt); 247 246 val = paramReplace(val, userDataDir, userDataDirAlt);