Changeset 3733 in josm for trunk/src/org/openstreetmap/josm/actions/Map_Rectifier_WMSmenuAction.java
- Timestamp:
- 2010-12-20T18:00:55+01:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/Map_Rectifier_WMSmenuAction.java
r3720 r3733 112 112 @Override 113 113 public void actionPerformed(ActionEvent e) { 114 if (!isEnabled()) return; 114 115 JPanel panel = new JPanel(new GridBagLayout()); 115 116 panel.add(new JLabel(tr("Supported Rectifier Services:")), GBC.eol()); … … 123 124 for(RectifierService s : services) { 124 125 JRadioButton serviceBtn = new JRadioButton(s.name); 125 if(firstBtn == null) 126 if(firstBtn == null) { 126 127 firstBtn = serviceBtn; 128 } 127 129 // Checks clipboard contents against current service if no match has been found yet. 128 130 // If the contents match, they will be inserted into the text field and the corresponding … … 138 140 panel.add(serviceBtn, GBC.std()); 139 141 panel.add(new UrlLabel(s.url, tr("Visit Homepage")), GBC.eol().anchor(GridBagConstraints.EAST)); 140 } else 142 } else { 141 143 panel.add(serviceBtn, GBC.eol().anchor(GridBagConstraints.WEST)); 144 } 142 145 } 143 146 144 147 // Fallback in case no match was found 145 if(tfWmsUrl.getText().equals("") && firstBtn != null) 148 if(tfWmsUrl.getText().equals("") && firstBtn != null) { 146 149 firstBtn.setSelected(true); 150 } 147 151 148 152 panel.add(new JLabel(tr("WMS URL or Image ID:")), GBC.eol()); … … 162 166 int answer = diag.getValue(); 163 167 // Break loop when the user cancels 164 if(answer != 1) 168 if(answer != 1) { 165 169 break; 170 } 166 171 167 172 String text = tfWmsUrl.getText().trim(); 168 173 // Loop all services until we find the selected one 169 174 for(RectifierService s : services) { 170 if(!s.isSelected()) 175 if(!s.isSelected()) { 171 176 continue; 177 } 172 178 173 179 // We've reached the custom WMS URL service … … 237 243 return result.trim(); 238 244 } 245 246 @Override 247 protected void updateEnabledState() { 248 setEnabled(Main.map != null && Main.map.mapView != null && !Main.map.mapView.getAllLayers().isEmpty()); 249 } 239 250 }
Note:
See TracChangeset
for help on using the changeset viewer.
