Ticket #4782: patch_josm_ticket_4782_directupload.diff

File patch_josm_ticket_4782_directupload.diff, 2.2 KB (added by leoss, 15 years ago)
Line 
1diff -rc DirectUpload/README DirectUpload_patched/README
2*** DirectUpload/README Wed Mar 31 13:03:44 2010
3--- DirectUpload_patched/README Wed Mar 31 12:57:53 2010
4***************
5*** 1,4 ****
6 Directly uploads GPX from active layer in JOSM to OpenStreetMap Server.
7- This currently uses OSM Api 0.5.
8
9 More Details and FAQ's at : http://wiki.openstreetmap.org/index.php/User:Subhodip/GSoC_Doc#DirectUpload_Plugin_in_JOSM_:
10--- 1,3 ----
11diff -rc DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java DirectUpload_patched/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java
12*** DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java Wed Mar 31 13:03:44 2010
13--- DirectUpload_patched/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGuiPlugin.java Wed Mar 31 12:56:55 2010
14***************
15*** 10,15 ****
16--- 10,16 ----
17
18 import java.awt.event.ActionEvent;
19 import java.awt.event.KeyEvent;
20+ import java.util.List;
21
22 import org.openstreetmap.josm.Main;
23 import org.openstreetmap.josm.actions.JosmAction;
24***************
25*** 43,49 ****
26
27 @Override
28 protected void updateEnabledState() {
29! if(Main.map == null
30 || Main.map.mapView == null
31 || Main.map.mapView.getActiveLayer() == null
32 || !(Main.map.mapView.getActiveLayer() instanceof GpxLayer)) {
33--- 44,51 ----
34
35 @Override
36 protected void updateEnabledState() {
37! // enable button if there is "one active GpxLayer" or "exactly one GpxLayer in the list of all layers available"
38! if(Main.map == null
39 || Main.map.mapView == null
40 || Main.map.mapView.getActiveLayer() == null
41 || !(Main.map.mapView.getActiveLayer() instanceof GpxLayer)) {
42***************
43*** 52,57 ****
44--- 54,65 ----
45 setEnabled(true);
46 }
47
48+ if(Main.map != null && Main.map.mapView.getNumLayers() > 1) {
49+ List<GpxLayer> list = Main.map.mapView.getLayersOfType(GpxLayer.class);
50+ if (list.size() == 1)
51+ setEnabled(true);
52+ }
53+
54 }
55 }
56 }
57\ No newline at end of file