- Timestamp:
- 2007-02-15T17:32:41+01:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/gui/annotation/AnnotationPreset.java
r193 r202 95 95 public String text; 96 96 public String values; 97 public String display_values = "";97 public String display_values; 98 98 public String default_; 99 99 public boolean delete_if_empty = false; … … 103 103 104 104 public void addToPanel(JPanel p) { 105 combo = new JComboBox( display_values.split(","));105 combo = new JComboBox((display_values != null ? display_values : values).split(",")); 106 106 combo.setEditable(editable); 107 107 combo.setSelectedItem(default_); -
src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r201 r202 181 181 instance.addMouseListener(new MouseAdapter(){ 182 182 private void openPopup(MouseEvent e) { 183 Point p = listScrollPane.getMousePosition(); 184 if (p == null) 185 return; // user is faster than swing with mouse movement 183 186 int index = instance.locationToIndex(e.getPoint()); 184 187 Layer layer = (Layer)instance.getModel().getElementAt(index); 185 188 LayerListPopup menu = new LayerListPopup(instance, layer); 186 Point p = listScrollPane.getMousePosition();187 189 menu.show(listScrollPane, p.x, p.y-3); 188 190 } -
src/org/openstreetmap/josm/tools/BugReportExceptionHandler.java
r172 r202 12 12 import java.text.DateFormat; 13 13 import java.text.SimpleDateFormat; 14 import java.util.Arrays; 14 15 import java.util.Date; 16 import java.util.LinkedList; 15 17 16 18 import javax.swing.JLabel; … … 39 41 } 40 42 43 // Check for an explicit problem when calling a plugin function 41 44 if (e instanceof PluginException) { 42 45 PluginProxy plugin = ((PluginException)e).getPlugin(); … … 48 51 } 49 52 53 // Try a heuristic to guess whether the problem may be within a plugin 54 String pluginName = guessPlugin(e); 55 if (pluginName != null) { 56 LinkedList<String> plugins = new LinkedList<String>(Arrays.asList(Main.pref.get("plugins").split(","))); 57 if (plugins.contains(pluginName)) { 58 String author = findPluginAuthor(pluginName); 59 int answer = JOptionPane.showConfirmDialog( 60 Main.parent, 61 tr("An unexpected exception occoured, that may come from in the ''{0}'' plugin.", pluginName)+"\n"+ 62 (author != null ? tr("According to the information within the plugin, the author is {0}.", author) : "")+"\n"+ 63 tr("Should the plugin be disabled?"), 64 tr("Disable plugin"), 65 JOptionPane.YES_NO_OPTION); 66 if (answer == JOptionPane.OK_OPTION) { 67 plugins.remove(pluginName); 68 String p = ""; 69 for (String s : plugins) 70 p += ","+s; 71 if (p.length() > 0) 72 p = p.substring(1); 73 Main.pref.put("plugins", p); 74 JOptionPane.showMessageDialog(Main.parent, tr("The plugin has been removed from the configuration. Please restart JOSM to unload the plugin.")); 75 return; 76 } 77 } 78 } 79 50 80 Object[] options = new String[]{tr("Do nothing"), tr("Report Bug")}; 51 81 int answer = JOptionPane.showOptionDialog(Main.parent, tr("An unexpected exception occoured.\n\n" + 52 82 "This is always a coding error. If you are running the latest\n" + 53 54 55 83 "version of JOSM, please consider be kind and file a bug report."), 84 tr("Unexpected Exception"), JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE, 85 null, options, options[0]); 56 86 if (answer == 1) { 57 87 try { … … 97 127 } 98 128 } 129 130 /** 131 * Try to find the author of the given plugin. Return <code>null</code> 132 * if no author specified or the plugin is not found. 133 */ 134 private String findPluginAuthor(String pluginName) { 135 for (PluginProxy proxy : Main.plugins) 136 if (pluginName.equals(proxy.info.name)) 137 return proxy.info.author; 138 return null; 139 } 140 141 /** 142 * Analyze the stack of the argument and return a name of a plugin, if 143 * some known problem pattern has been found or <code>null</code>, if 144 * the stack does not contain plugin-code. 145 * 146 * Note: This heuristic is not meant as discrimination against specific 147 * plugins, but only to stop the flood of similar bug reports about plugins. 148 * Of course, plugin writers are free to install their own version of 149 * an exception handler with their email address listed to receive 150 * bug reports ;-). 151 */ 152 private String guessPlugin(Throwable e) { 153 for (StackTraceElement element : e.getStackTrace()) { 154 String c = element.getClassName(); 155 if (c.contains("wmsplugin.") || c.contains(".WMSLayer")) 156 return "wmsplugin"; 157 if (c.contains("landsat.") || c.contains(".LandsatLayer")) 158 return "landsat"; 159 if (c.contains("mappaint.")) 160 return "mappaint"; 161 if (c.contains("annotationtester.")) 162 return "annotation-tester"; 163 } 164 return null; 165 } 99 166 }
Note:
See TracChangeset
for help on using the changeset viewer.