- Timestamp:
- 2006-11-28T19:58:41+01:00 (18 years ago)
- Location:
- src/org/openstreetmap/josm
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/Main.java
r159 r169 168 168 toolBar.add(menu.upload); 169 169 toolBar.addSeparator(); 170 toolBar.add(menu.newAction); 170 171 toolBar.add(menu.open); 171 172 toolBar.add(menu.save); … … 323 324 } 324 325 326 public static boolean breakBecauseUnsavedChanges() { 327 if (map != null) { 328 boolean modified = false; 329 boolean uploadedModified = false; 330 for (final Layer l : map.mapView.getAllLayers()) { 331 if (l instanceof OsmDataLayer && ((OsmDataLayer)l).isModified()) { 332 modified = true; 333 uploadedModified = ((OsmDataLayer)l).uploadedModified; 334 break; 335 } 336 } 337 if (modified) { 338 final String msg = uploadedModified ? "\n"+tr("Hint: Some changes came from uploading new data to the server.") : ""; 339 final int answer = JOptionPane.showConfirmDialog( 340 parent, tr("There are unsaved changes. Discard the changes and continue?")+msg, 341 tr("Unsaved Changes"), JOptionPane.YES_NO_OPTION); 342 if (answer != JOptionPane.YES_OPTION) 343 return true; 344 } 345 } 346 return false; 347 } 348 325 349 private static void downloadFromParamString(final boolean rawGps, String s) { 326 350 if (s.startsWith("http:")) { -
src/org/openstreetmap/josm/actions/PreferencesAction.java
r168 r169 36 36 JPanel prefPanel = new JPanel(new GridBagLayout()); 37 37 prefPanel.add(prefDlg, GBC.eol().fill(GBC.BOTH)); 38 38 39 39 JOptionPane pane = new JOptionPane(prefPanel, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION); 40 40 JDialog dlg = pane.createDialog(Main.parent, tr("Preferences")); 41 42 if (dlg.getWidth() > 600) 43 dlg.setSize(600, dlg.getHeight()); 44 if (dlg.getHeight() > 450) 45 dlg.setSize(dlg.getWidth(), 450); 46 41 47 dlg.setVisible(true); 42 48 if (pane.getValue() instanceof Integer && (Integer)pane.getValue() == JOptionPane.OK_OPTION) -
src/org/openstreetmap/josm/gui/MainApplication.java
r159 r169 20 20 21 21 import org.openstreetmap.josm.Main; 22 import org.openstreetmap.josm.gui.layer.Layer;23 import org.openstreetmap.josm.gui.layer.OsmDataLayer;24 22 import org.openstreetmap.josm.plugins.PluginException; 25 23 import org.openstreetmap.josm.plugins.PluginInformation; … … 42 40 mainFrame.addWindowListener(new WindowAdapter(){ 43 41 @Override public void windowClosing(final WindowEvent arg0) { 44 if (Main.map != null) { 45 boolean modified = false; 46 boolean uploadedModified = false; 47 for (final Layer l : Main.map.mapView.getAllLayers()) { 48 if (l instanceof OsmDataLayer && ((OsmDataLayer)l).isModified()) { 49 modified = true; 50 uploadedModified = ((OsmDataLayer)l).uploadedModified; 51 break; 52 } 53 } 54 if (modified) { 55 final String msg = uploadedModified ? "\n"+tr("Hint: Some changes came from uploading new data to the server.") : ""; 56 final int answer = JOptionPane.showConfirmDialog( 57 Main.parent, tr("There are unsaved changes. Really quit?")+msg, 58 tr("Unsaved Changes"), JOptionPane.YES_NO_OPTION); 59 if (answer != JOptionPane.YES_OPTION) 60 return; 61 } 62 } 42 if (Main.breakBecauseUnsavedChanges()) 43 return; 63 44 System.exit(0); 64 45 } -
src/org/openstreetmap/josm/gui/MainMenu.java
r167 r169 16 16 import org.openstreetmap.josm.actions.GpxExportAction; 17 17 import org.openstreetmap.josm.actions.HelpAction; 18 import org.openstreetmap.josm.actions.NewAction; 18 19 import org.openstreetmap.josm.actions.OpenAction; 19 20 import org.openstreetmap.josm.actions.PreferencesAction; … … 37 38 public final UndoAction undo = new UndoAction(); 38 39 public final RedoAction redo = new RedoAction(); 40 public final NewAction newAction = new NewAction(); 39 41 public final OpenAction open = new OpenAction(); 40 42 public final DownloadAction download = new DownloadAction(); … … 62 64 public MainMenu() { 63 65 fileMenu.setMnemonic('F'); 66 fileMenu.add(newAction); 64 67 fileMenu.add(open); 65 68 fileMenu.add(save); -
src/org/openstreetmap/josm/gui/MapView.java
r153 r169 113 113 if (editLayer != null) { 114 114 editLayer.mergeFrom(layer); 115 if (autoScale) 116 recalculateCenterScale(); 115 117 repaint(); 116 118 return; -
src/org/openstreetmap/josm/io/OsmReader.java
r160 r169 14 14 15 15 16 import org.openstreetmap.josm.Main; 16 17 import org.openstreetmap.josm.data.coor.LatLon; 17 18 import org.openstreetmap.josm.data.osm.DataSet; … … 100 101 if (atts == null) 101 102 throw new SAXException(tr("Unknown version")); 102 if (! "0.3".equals(atts.getValue("version")))103 if (!Main.pref.get("osm-server.version", "0.3").equals(atts.getValue("version"))) 103 104 throw new SAXException(tr("Unknown version")+": "+atts.getValue("version")); 104 105 } else if (qName.equals("node")) { -
src/org/openstreetmap/josm/io/OsmServerWriter.java
r153 r169 153 153 OsmPrimitive osm, boolean addBody) { 154 154 try { 155 URL url = new URL(Main.pref.get("osm-server.url") + "/0.3/" + urlSuffix + "/" + osm.id); 155 String version = Main.pref.get("osm-server.version", "0.3"); 156 URL url = new URL( 157 Main.pref.get("osm-server.url") + 158 "/" + version + 159 "/" + urlSuffix + 160 "/" + ((version.equals("0.4") && osm.id==0) ? "create":osm.id)); 156 161 System.out.println("upload to: "+url); 157 activeConnection = (HttpURLConnection) 162 activeConnection = (HttpURLConnection)url.openConnection(); 158 163 activeConnection.setConnectTimeout(15000); 159 164 activeConnection.setRequestMethod(requestMethod); -
src/org/openstreetmap/josm/io/OsmWriter.java
r167 r169 5 5 import java.util.Map.Entry; 6 6 7 import org.openstreetmap.josm.Main; 7 8 import org.openstreetmap.josm.data.osm.DataSet; 8 9 import org.openstreetmap.josm.data.osm.Node; … … 33 34 public abstract static class Osm implements OsmWriterInterface { 34 35 public void header(PrintWriter out) { 35 out.println("<osm version='0.3' generator='JOSM'>"); 36 out.print("<osm version='"); 37 out.print(Main.pref.get("osm-server.version", "0.3")); 38 out.println("' generator='JOSM'>"); 36 39 } 37 40 public void footer(PrintWriter out) { -
src/org/openstreetmap/josm/plugins/PluginInformation.java
r167 r169 48 48 String classPath = attr.getValue("Class-Path"); 49 49 if (classPath != null) { 50 for (String s : classPath.split(classPath.contains(";") ? ";" : ":")) { 51 if (!s.startsWith("/") && !s.startsWith("\\") && !s.matches("^.:")) 50 String[] cp = classPath.split(" "); 51 StringBuilder entry = new StringBuilder(); 52 for (String s : cp) { 53 entry.append(s); 54 if (s.endsWith("\\")) { 55 entry.setLength(entry.length()-1); 56 entry.append("%20"); // append the split character " " as html-encode 57 continue; 58 } 59 s = entry.toString(); 60 entry = new StringBuilder(); 61 if (!s.startsWith("/") && !s.startsWith("\\") && !s.matches("^.\\:")) 52 62 s = file.getParent() + File.separator + s; 53 63 libraries.add(new URL(getURLString(s)));
Note:
See TracChangeset
for help on using the changeset viewer.