Ticket #17192: 17192-v4.patch
File 17192-v4.patch, 6.1 KB (added by , 5 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; 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; 24 import javax.swing.Action; 19 25 import javax.swing.BorderFactory; 26 import javax.swing.JButton; 20 27 import javax.swing.JLabel; 21 28 import javax.swing.JPanel; 22 29 import javax.swing.JScrollPane; … … 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 JPanel inst = new JPanel(new GridBagLayout()); 123 addInstLine(inst, getSystemEnv("JAVA_HOME")); 124 addInstLine(inst, getSystemProperty("java.home")); 125 addInstLine(inst, Config.getDirs().getPreferencesDirectory(false).toString()); 126 addInstLine(inst, Config.getDirs().getUserDataDirectory(false).toString()); 127 addInstLine(inst, Config.getDirs().getCacheDirectory(false).toString()); 128 115 129 about.addTab(tr("Info"), info); 116 130 about.addTab(tr("Readme"), createScrollPane(readme)); 117 131 about.addTab(tr("Revision"), createScrollPane(revision)); … … 118 132 about.addTab(tr("Contribution"), createScrollPane(contribution)); 119 133 about.addTab(tr("License"), createScrollPane(license)); 120 134 about.addTab(tr("Plugins"), new JScrollPane(PluginHandler.getInfoPanel())); 135 about.addTab(tr("Installation Details"), inst); 121 136 122 137 // Get the list of Launchpad contributors using customary msgid “translator-credits” 123 138 String translators = tr("translator-credits"); … … 133 148 panel.add(about, GBC.std().fill()); 134 149 135 150 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();151 ExtendedDialog dlg = new ExtendedDialog(MainApplication.getMainFrame(), tr("About JOSM..."), tr("OK"), tr("Report bug")); 152 int ret = dlg.setButtonIcons("ok", "bug") 153 .setContent(panel, false) 154 .showDialog().getValue(); 140 155 if (2 == ret) { 141 156 MainApplication.getMenu().reportbug.actionPerformed(null); 142 157 } 158 GuiHelper.destroyComponents(panel, false); 159 dlg.dispose(); 143 160 } 144 161 162 private static class OpenDirAction extends AbstractAction { 163 final String dir; 164 165 OpenDirAction(String dir) { 166 super(); 167 putValue(Action.NAME, "..."); 168 this.dir = dir; 169 setEnabled(dir != null && new File(dir).isDirectory()); 170 } 171 172 @Override 173 public void actionPerformed(ActionEvent e) { 174 OpenBrowser.displayUrl(new File(dir).toURI()); 175 } 176 } 177 178 /** 179 * Add line to installation details showing symbolic name used in status report and actual directory. 180 * @param inst the panel 181 * @param dir the actual path represented by a symbol 182 */ 183 private void addInstLine(JPanel inst, String dir) { 184 JLabel symbol = new JLabel(ShowStatusReportAction.paramCleanup(dir)); 185 symbol.setFont(GuiHelper.getMonospacedFont(symbol)); 186 inst.add(symbol, GBC.std().insets(5, 0, 0, 0)); 187 inst.add(GBC.glue(10, 0), GBC.std()); 188 JosmTextArea dirLabel = new JosmTextArea(); 189 if (dir != null && !dir.isEmpty()) { 190 dirLabel.setText(dir); 191 dirLabel.setEditable(false); 192 } else { 193 dirLabel.setText("(unset)"); 194 dirLabel.setFont(dirLabel.getFont().deriveFont(Font.ITALIC)); 195 } 196 dirLabel.setFont(GuiHelper.getMonospacedFont(dirLabel)); 197 dirLabel.setOpaque(false); 198 inst.add(dirLabel, GBC.std().fill(GBC.HORIZONTAL)); 199 JButton btn = new JButton(new OpenDirAction(dir)); 200 btn.setToolTipText(tr("Open directory")); 201 inst.add(btn, GBC.eol().insets(0, 0, 5, 0)); 202 } 203 145 204 private static JLabel createImageLink(String tooltip, String icon, final String link) { 146 205 JLabel label = new JLabel(ImageProvider.get("dialogs/about", icon, ImageSizes.LARGEICON)); 147 206 label.setToolTipText(tooltip); -
src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
223 223 * @param param parameter to cleanup 224 224 * @return shortened/anonymized parameter 225 225 */ 226 p rivatestatic String paramCleanup(String param) {226 public static String paramCleanup(String param) { 227 227 final String envJavaHome = getSystemEnv("JAVA_HOME"); 228 228 final String envJavaHomeAlt = PlatformManager.isPlatformWindows() ? "%JAVA_HOME%" : "${JAVA_HOME}"; 229 229 final String propJavaHome = getSystemProperty("java.home"); … … 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);