Changeset 9918 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-03-04T00:25:08+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r9134 r9918 6 6 7 7 import java.awt.Dimension; 8 import java.awt.GraphicsEnvironment; 8 9 import java.awt.GridBagLayout; 9 10 import java.awt.event.ActionEvent; … … 108 109 formats.setToolTipText(tr("Select image format for WMS layer")); 109 110 110 if (1 != new ExtendedDialog(Main.parent, tr("Select WMS layers"), new String[]{tr("Add layers"), tr("Cancel")}) { { 111 final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree()); 112 scrollPane.setPreferredSize(new Dimension(400, 400)); 113 final JPanel panel = new JPanel(new GridBagLayout()); 114 panel.add(scrollPane, GBC.eol().fill()); 115 panel.add(formats, GBC.eol().fill(GBC.HORIZONTAL)); 116 setContent(panel); 117 } }.showDialog().getValue()) { 118 return null; 111 if (!GraphicsEnvironment.isHeadless()) { 112 if (1 != new ExtendedDialog(Main.parent, tr("Select WMS layers"), new String[]{tr("Add layers"), tr("Cancel")}) { { 113 final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree()); 114 scrollPane.setPreferredSize(new Dimension(400, 400)); 115 final JPanel panel = new JPanel(new GridBagLayout()); 116 panel.add(scrollPane, GBC.eol().fill()); 117 panel.add(formats, GBC.eol().fill(GBC.HORIZONTAL)); 118 setContent(panel); 119 } }.showDialog().getValue()) { 120 return null; 121 } 119 122 } 120 123 … … 141 144 return ret; 142 145 } catch (MalformedURLException ex) { 143 JOptionPane.showMessageDialog(Main.parent, tr("Invalid service URL."), 144 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 146 if (!GraphicsEnvironment.isHeadless()) { 147 JOptionPane.showMessageDialog(Main.parent, tr("Invalid service URL."), 148 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 149 } 150 Main.error(ex, false); 145 151 } catch (IOException ex) { 146 JOptionPane.showMessageDialog(Main.parent, tr("Could not retrieve WMS layer list."), 147 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 152 if (!GraphicsEnvironment.isHeadless()) { 153 JOptionPane.showMessageDialog(Main.parent, tr("Could not retrieve WMS layer list."), 154 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 155 } 156 Main.error(ex, false); 148 157 } catch (WMSImagery.WMSGetCapabilitiesException ex) { 149 JOptionPane.showMessageDialog(Main.parent, tr("Could not parse WMS layer list."), 150 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 158 if (!GraphicsEnvironment.isHeadless()) { 159 JOptionPane.showMessageDialog(Main.parent, tr("Could not parse WMS layer list."), 160 tr("WMS Error"), JOptionPane.ERROR_MESSAGE); 161 } 151 162 Main.error("Could not parse WMS layer list. Incoming data:\n"+ex.getIncomingData()); 152 163 } -
trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java
r9917 r9918 245 245 doShowOptionDialog(parentComponent, title, options, defaultOption, helpTopic, buttons, pane); 246 246 } 247 return (Integer) pane.getValue();247 return pane.getValue() instanceof Integer ? (Integer) pane.getValue() : JOptionPane.OK_OPTION; 248 248 } 249 249
Note:
See TracChangeset
for help on using the changeset viewer.