Changeset 14693 in josm
- Timestamp:
- 2019-01-13T14:49:19+01:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r14623 r14693 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; … … 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; … … 38 45 import org.openstreetmap.josm.tools.Logging; 39 46 import org.openstreetmap.josm.tools.OpenBrowser; 47 import org.openstreetmap.josm.tools.PlatformManager; 40 48 import org.openstreetmap.josm.tools.Shortcut; 41 49 import org.openstreetmap.josm.tools.Utils; … … 113 121 info.add(GBC.glue(0, 5), GBC.eol()); 114 122 123 JPanel inst = new JPanel(new GridBagLayout()); 124 addInstallationLine(inst, getSystemEnv("JAVA_HOME"), PlatformManager.isPlatformWindows() ? "%JAVA_HOME%" : "${JAVA_HOME}"); 125 addInstallationLine(inst, getSystemProperty("java.home"), "java.home"); 126 addInstallationLine(inst, Config.getDirs().getPreferencesDirectory(false).toString(), null); 127 addInstallationLine(inst, Config.getDirs().getUserDataDirectory(false).toString(), null); 128 addInstallationLine(inst, Config.getDirs().getCacheDirectory(false).toString(), null); 129 115 130 about.addTab(tr("Info"), info); 116 131 about.addTab(tr("Readme"), createScrollPane(readme)); … … 119 134 about.addTab(tr("License"), createScrollPane(license)); 120 135 about.addTab(tr("Plugins"), new JScrollPane(PluginHandler.getInfoPanel())); 136 about.addTab(tr("Installation Details"), inst); 121 137 122 138 // Get the list of Launchpad contributors using customary msgid “translator-credits” … … 134 150 135 151 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(); 152 ExtendedDialog dlg = new ExtendedDialog(MainApplication.getMainFrame(), tr("About JOSM..."), tr("OK"), tr("Report bug")); 153 int ret = dlg.setButtonIcons("ok", "bug") 154 .setContent(panel, false) 155 .showDialog().getValue(); 140 156 if (2 == ret) { 141 157 MainApplication.getMenu().reportbug.actionPerformed(null); 142 158 } 159 GuiHelper.destroyComponents(panel, false); 160 dlg.dispose(); 161 } 162 163 private static class OpenDirAction extends AbstractAction { 164 final String dir; 165 166 OpenDirAction(String dir) { 167 super(); 168 putValue(Action.NAME, "..."); 169 this.dir = dir; 170 setEnabled(dir != null && new File(dir).isDirectory()); 171 } 172 173 @Override 174 public void actionPerformed(ActionEvent e) { 175 OpenBrowser.displayUrl(new File(dir).toURI()); 176 } 177 } 178 179 /** 180 * Add line to installation details showing symbolic name used in status report and actual directory. 181 * @param inst the panel 182 * @param dir the actual path represented by a symbol 183 * @param source source for symbol 184 */ 185 private void addInstallationLine(JPanel inst, String dir, String source) { 186 if (dir == null && source == null) 187 return; 188 JLabel symbol = new JLabel(); 189 JosmTextArea dirLabel = new JosmTextArea(); 190 if (dir != null && !dir.isEmpty()) { 191 symbol.setText(ShowStatusReportAction.paramCleanup(dir)); 192 dirLabel.setText(dir); 193 dirLabel.setEditable(false); 194 } else { 195 symbol.setText(source); 196 dirLabel.setText(tr("(unset)")); 197 dirLabel.setFont(dirLabel.getFont().deriveFont(Font.ITALIC)); 198 } 199 symbol.setFont(GuiHelper.getMonospacedFont(symbol)); 200 inst.add(symbol, GBC.std().insets(5, 0, 0, 0)); 201 inst.add(GBC.glue(10, 0), GBC.std()); 202 dirLabel.setFont(GuiHelper.getMonospacedFont(dirLabel)); 203 dirLabel.setOpaque(false); 204 inst.add(dirLabel, GBC.std().fill(GBC.HORIZONTAL)); 205 JButton btn = new JButton(new OpenDirAction(dir)); 206 btn.setToolTipText(tr("Open directory")); 207 inst.add(btn, GBC.eol().insets(0, 0, 5, 0)); 143 208 } 144 209 -
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r14671 r14693 224 224 * @return shortened/anonymized parameter 225 225 */ 226 privatestatic String paramCleanup(String param) {226 static String paramCleanup(String param) { 227 227 final String envJavaHome = getSystemEnv("JAVA_HOME"); 228 228 final String envJavaHomeAlt = PlatformManager.isPlatformWindows() ? "%JAVA_HOME%" : "${JAVA_HOME}"; … … 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);
Note:
See TracChangeset
for help on using the changeset viewer.