Ticket #17192: 17192-v2.patch
| File 17192-v2.patch, 5.5 KB (added by , 7 years 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; … … 16 18 import java.io.InputStream; 17 19 import java.io.InputStreamReader; 18 20 21 import javax.swing.AbstractAction; 19 22 import javax.swing.BorderFactory; 23 import javax.swing.JButton; 24 import javax.swing.JFileChooser; 20 25 import javax.swing.JLabel; 21 26 import javax.swing.JPanel; 22 27 import javax.swing.JScrollPane; … … 37 42 import org.openstreetmap.josm.tools.ImageProvider.ImageSizes; 38 43 import org.openstreetmap.josm.tools.Logging; 39 44 import org.openstreetmap.josm.tools.OpenBrowser; 45 import org.openstreetmap.josm.tools.PlatformManager; 40 46 import org.openstreetmap.josm.tools.Shortcut; 41 47 import org.openstreetmap.josm.tools.Utils; 42 48 … … 112 118 info.add(logos, GBC.eol().insets(0, 10, 0, 0)); 113 119 info.add(GBC.glue(0, 5), GBC.eol()); 114 120 121 final String envJavaHome = getSystemEnv("JAVA_HOME"); 122 final String envJavaHomeAlt = PlatformManager.isPlatformWindows() ? "%JAVA_HOME%" : "${JAVA_HOME}"; 123 final String propJavaHome = getSystemProperty("java.home"); 124 final String propJavaHomeAlt = "<java.home>"; 125 final String prefDir = Config.getDirs().getPreferencesDirectory(false).toString(); 126 final String prefDirAlt = "<josm.pref>"; 127 final String userDataDir = Config.getDirs().getUserDataDirectory(false).toString(); 128 final String userDataDirAlt = "<josm.userdata>"; 129 final String userCacheDir = Config.getDirs().getCacheDirectory(false).toString(); 130 final String userCacheDirAlt = "<josm.cache>"; 131 132 JPanel inst = new JPanel(new GridBagLayout()); 133 addInstLine(inst, envJavaHomeAlt, envJavaHome); 134 addInstLine(inst, propJavaHomeAlt, propJavaHome); 135 addInstLine(inst, prefDirAlt, prefDir); 136 addInstLine(inst, userDataDirAlt, userDataDir); 137 addInstLine(inst, userCacheDirAlt, userCacheDir); 138 115 139 about.addTab(tr("Info"), info); 116 140 about.addTab(tr("Readme"), createScrollPane(readme)); 117 141 about.addTab(tr("Revision"), createScrollPane(revision)); … … 118 142 about.addTab(tr("Contribution"), createScrollPane(contribution)); 119 143 about.addTab(tr("License"), createScrollPane(license)); 120 144 about.addTab(tr("Plugins"), new JScrollPane(PluginHandler.getInfoPanel())); 145 about.addTab(tr("Installation Details"), inst); 121 146 122 147 // Get the list of Launchpad contributors using customary msgid “translator-credits” 123 148 String translators = tr("translator-credits"); … … 133 158 panel.add(about, GBC.std().fill()); 134 159 135 160 GuiHelper.prepareResizeableOptionPane(panel, panel.getPreferredSize()); 136 int ret = new ExtendedDialog(MainApplication.getMainFrame(), tr("About JOSM..."), tr("OK"), tr("Report bug"))137 .setButtonIcons("ok", "bug")138 .setContent(panel, false)139 .showDialog().getValue();161 ExtendedDialog dlg = new ExtendedDialog(MainApplication.getMainFrame(), tr("About JOSM..."), tr("OK"), tr("Report bug")); 162 int ret = dlg.setButtonIcons("ok", "bug") 163 .setContent(panel, false) 164 .showDialog().getValue(); 140 165 if (2 == ret) { 141 166 MainApplication.getMenu().reportbug.actionPerformed(null); 142 167 } 168 GuiHelper.destroyComponents(panel, false); 169 dlg.dispose(); 143 170 } 144 171 172 private static class OpenDirAction extends AbstractAction { 173 final String dir; 174 175 OpenDirAction(String dir) { 176 super(); 177 178 this.dir = dir; 179 } 180 181 @Override 182 public void actionPerformed(ActionEvent e) { 183 new JFileChooser(dir).showOpenDialog(null); 184 } 185 } 186 187 private void addInstLine(JPanel inst, String symbol, String dir) { 188 inst.add(new JLabel(symbol), GBC.std()); 189 inst.add(GBC.glue(5, 0), GBC.std()); 190 inst.add(new JLabel(dir), GBC.std().fill(GBC.HORIZONTAL)); 191 JButton btn = new JButton(tr("open")); 192 btn.setAction(new OpenDirAction(dir)); 193 btn.setToolTipText(tr("Open directory")); 194 btn.setIcon(ImageProvider.get("open", ImageProvider.ImageSizes.SMALLICON)); 195 inst.add(btn, GBC.eol()); 196 } 197 145 198 private static JLabel createImageLink(String tooltip, String icon, final String link) { 146 199 JLabel label = new JLabel(ImageProvider.get("dialogs/about", icon, ImageSizes.LARGEICON)); 147 200 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);
