Changeset 1847 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2009-07-25T23:44:19+02:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
r1820 r1847 13 13 import org.openstreetmap.josm.Main; 14 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; 15 import org.openstreetmap.josm.gui.OptionPaneUtil; 15 16 import org.openstreetmap.josm.tools.OpenBrowser; 16 17 import org.openstreetmap.josm.tools.Shortcut; … … 58 59 59 60 if (primitivesToShow.isEmpty()) { 60 JOptionPane.showMessageDialog(61 OptionPaneUtil.showMessageDialog( 61 62 Main.parent, 62 63 tr("Please select at least one already uploaded node, way, or relation."), -
trunk/src/org/openstreetmap/josm/actions/AlignInCircleAction.java
r1846 r1847 22 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 23 import org.openstreetmap.josm.data.osm.Way; 24 import org.openstreetmap.josm.gui.OptionPaneUtil; 24 25 import org.openstreetmap.josm.tools.Shortcut; 25 26 … … 132 133 133 134 if (nodes.size() < 4) { 134 JOptionPane.showMessageDialog(Main.parent, tr("Please select at least four nodes.")); 135 OptionPaneUtil.showMessageDialog( 136 Main.parent, 137 tr("Please select at least four nodes."), 138 tr("Information"), 139 JOptionPane.INFORMATION_MESSAGE 140 ); 135 141 return; 136 142 } -
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r1820 r1847 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 19 import org.openstreetmap.josm.data.osm.Way; 20 import org.openstreetmap.josm.gui.OptionPaneUtil; 20 21 import org.openstreetmap.josm.tools.Shortcut; 21 22 … … 60 61 } 61 62 if (nodes.size() < 3) { 62 JOptionPane.showMessageDialog(Main.parent, tr("Please select at least three nodes.")); 63 OptionPaneUtil.showMessageDialog( 64 Main.parent, 65 tr("Please select at least three nodes."), 66 tr("Information"), 67 JOptionPane.INFORMATION_MESSAGE 68 ); 63 69 return; 64 70 } -
trunk/src/org/openstreetmap/josm/actions/ApiPreconditionChecker.java
r1843 r1847 15 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 16 import org.openstreetmap.josm.data.osm.Way; 17 import org.openstreetmap.josm.gui.OptionPaneUtil; 17 18 import org.openstreetmap.josm.io.OsmApi; 18 19 import org.openstreetmap.josm.io.OsmApiInitializationException; … … 47 48 total = add.size() + update.size() + delete.size(); 48 49 if(total > maxElements) { 49 JOptionPane.showMessageDialog(50 OptionPaneUtil.showMessageDialog( 50 51 Main.parent, 51 52 tr("Current number of changes exceeds the max. number of changes, current is {0}, max is {1}", … … 61 62 } catch (OsmApiInitializationException e) { 62 63 e.printStackTrace(); 63 JOptionPane.showMessageDialog(64 OptionPaneUtil.showMessageDialog( 64 65 Main.parent, 65 66 tr("Failed to initialize API. Please try again later."), … … 88 89 continue; 89 90 } 90 JOptionPane.showMessageDialog(Main.parent,91 OptionPaneUtil.showMessageDialog(Main.parent, 91 92 tr("Length of value for tag ''{0}'' on primitive {1} exceeds the max. allowed length {2}. Values length is {3}.", 92 93 e.getKey(), Long.toString(osmPrimitive.id), 255, e.getValue().length() … … 104 105 if (osmPrimitive instanceof Way && 105 106 ((Way)osmPrimitive).nodes.size() > maxNodes) { 106 JOptionPane.showMessageDialog(107 OptionPaneUtil.showMessageDialog( 107 108 Main.parent, 108 109 tr("{0} nodes in way {1} exceed the max. allowed number of nodes {2}", -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r1820 r1847 16 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 17 17 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 18 import org.openstreetmap.josm.gui.OptionPaneUtil; 18 19 import org.openstreetmap.josm.gui.layer.Layer; 19 20 import org.openstreetmap.josm.tools.Shortcut; … … 86 87 } 87 88 if (sel.isEmpty()) { 88 JOptionPane.showMessageDialog(Main.parent, 89 mode.equals("selection") ? tr("Nothing selected to zoom to.") : tr("No conflicts to zoom to")); 89 OptionPaneUtil.showMessageDialog( 90 Main.parent, 91 (mode.equals("selection") ? tr("Nothing selected to zoom to.") : tr("No conflicts to zoom to")), 92 tr("Information"), 93 JOptionPane.INFORMATION_MESSAGE 94 ); 90 95 return null; 91 96 } -
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r1820 r1847 37 37 import org.openstreetmap.josm.data.osm.Way; 38 38 import org.openstreetmap.josm.gui.ExtendedDialog; 39 import org.openstreetmap.josm.gui.OptionPaneUtil; 39 40 import org.openstreetmap.josm.tools.GBC; 40 41 import org.openstreetmap.josm.tools.Pair; … … 65 66 66 67 if (selectedWays.size() < 2) { 67 JOptionPane.showMessageDialog(Main.parent, tr("Please select at least two ways to combine.")); 68 OptionPaneUtil.showMessageDialog( 69 Main.parent, 70 tr("Please select at least two ways to combine."), 71 tr("Information"), 72 JOptionPane.INFORMATION_MESSAGE 73 ); 68 74 return; 69 75 } … … 152 158 nodeList = (List<Node>) secondTry; 153 159 } else { 154 JOptionPane.showMessageDialog(Main.parent, secondTry); 160 OptionPaneUtil.showMessageDialog( 161 Main.parent, 162 secondTry, // FIXME: not sure whether this fits in a dialog 163 tr("Information"), 164 JOptionPane.INFORMATION_MESSAGE 165 ); 155 166 return; 156 167 } -
trunk/src/org/openstreetmap/josm/actions/CopyAction.java
r1820 r1847 24 24 import org.openstreetmap.josm.data.osm.Way; 25 25 import org.openstreetmap.josm.data.osm.visitor.AbstractVisitor; 26 import org.openstreetmap.josm.gui.OptionPaneUtil; 26 27 import org.openstreetmap.josm.tools.Shortcut; 27 28 … … 136 137 Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected(); 137 138 if (sel.isEmpty()) { 138 JOptionPane.showMessageDialog(139 OptionPaneUtil.showMessageDialog( 139 140 Main.parent, 140 tr("Please select something to copy.") 141 tr("Please select something to copy."), 142 tr("Information"), 143 JOptionPane.INFORMATION_MESSAGE 141 144 ); 142 145 return true; -
trunk/src/org/openstreetmap/josm/actions/CreateCircleAction.java
r1846 r1847 23 23 import org.openstreetmap.josm.data.osm.Way; 24 24 import org.openstreetmap.josm.data.osm.visitor.CollectBackReferencesVisitor; 25 import org.openstreetmap.josm.gui.OptionPaneUtil; 25 26 import org.openstreetmap.josm.tools.Shortcut; 26 27 … … 202 203 203 204 if (sUnder == 0) { 204 JOptionPane.showMessageDialog(Main.parent, tr("Those nodes are not in a circle.")); 205 OptionPaneUtil.showMessageDialog( 206 Main.parent, 207 tr("Those nodes are not in a circle. Aborting."), 208 tr("Warning"), 209 JOptionPane.WARNING_MESSAGE 210 ); 205 211 return; 206 212 } … … 261 267 262 268 } else { 263 JOptionPane.showMessageDialog(Main.parent, tr("Please select exactly two or three nodes or one way with exactly two or three nodes.")); 269 OptionPaneUtil.showMessageDialog( 270 Main.parent, 271 tr("Please select exactly two or three nodes or one way with exactly two or three nodes."), 272 tr("Information"), 273 JOptionPane.INFORMATION_MESSAGE 274 ); 264 275 return; 265 276 } -
trunk/src/org/openstreetmap/josm/actions/DistributeAction.java
r1820 r1847 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 19 import org.openstreetmap.josm.data.osm.Way; 20 import org.openstreetmap.josm.gui.OptionPaneUtil; 20 21 import org.openstreetmap.josm.tools.Shortcut; 21 22 … … 59 60 60 61 if (nodes.size() < 3) { 61 JOptionPane.showMessageDialog(Main.parent, tr("Please select at least three nodes.")); 62 OptionPaneUtil.showMessageDialog( 63 Main.parent, 64 tr("Please select at least three nodes."), 65 tr("Information"), 66 JOptionPane.INFORMATION_MESSAGE 67 ); 62 68 return; 63 69 } -
trunk/src/org/openstreetmap/josm/actions/DownloadAction.java
r1811 r1847 13 13 14 14 import org.openstreetmap.josm.Main; 15 import org.openstreetmap.josm.gui.OptionPaneUtil; 15 16 import org.openstreetmap.josm.gui.download.DownloadDialog; 16 17 import org.openstreetmap.josm.gui.download.DownloadDialog.DownloadTask; … … 32 33 public DownloadAction() { 33 34 super(tr("Download from OSM..."), "download", tr("Download map data from the OSM server."), 34 Shortcut.registerShortcut("file:download", tr("File: {0}", tr("Download from OSM...")), KeyEvent.VK_D, Shortcut.GROUPS_ALT1+Shortcut.GROUP_HOTKEY), true);35 Shortcut.registerShortcut("file:download", tr("File: {0}", tr("Download from OSM...")), KeyEvent.VK_D, Shortcut.GROUPS_ALT1+Shortcut.GROUP_HOTKEY), true); 35 36 } 36 37 … … 46 47 dialog.setOptionPane(pane); 47 48 48 if (dlg.getWidth() > 1000) 49 if (dlg.getWidth() > 1000) { 49 50 dlg.setSize(1000, dlg.getHeight()); 50 if (dlg.getHeight() > 600) 51 } 52 if (dlg.getHeight() > 600) { 51 53 dlg.setSize(dlg.getWidth(),600); 54 } 52 55 53 56 boolean finish = false; … … 64 67 } 65 68 } 66 } else 69 } else { 67 70 finish = true; 68 if (!finish) 69 JOptionPane.showMessageDialog(Main.parent, tr("Please select at least one task to download")); 71 } 72 if (!finish) { 73 OptionPaneUtil.showMessageDialog( 74 Main.parent, 75 tr("Please select at least one task to download"), 76 tr("Error"), 77 JOptionPane.ERROR_MESSAGE 78 ); 79 } 70 80 } 71 81 72 82 dialog = null; 73 83 dlg.dispose(); 74 84 } -
trunk/src/org/openstreetmap/josm/actions/DownloadReferrersAction.java
r1820 r1847 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 19 import org.openstreetmap.josm.data.osm.visitor.MergeVisitor; 20 import org.openstreetmap.josm.gui.OptionPaneUtil; 20 21 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 21 22 import org.openstreetmap.josm.gui.layer.Layer; … … 85 86 msg = lastException.toString(); 86 87 } 87 JOptionPane.showMessageDialog(88 OptionPaneUtil.showMessageDialog( 88 89 Main.map, 89 90 msg, … … 121 122 return; 122 123 Main.map.mapView.getEditLayer().getConflicts().add(visitor.getConflicts()); 123 JOptionPane op = new JOptionPane( 124 OptionPaneUtil.showMessageDialog( 125 Main.parent, 124 126 tr("There were {0} conflicts during import.", 125 visitor.getConflicts().size()), 126 JOptionPane.WARNING_MESSAGE 127 visitor.getConflicts().size() 128 ), 129 tr("Conflicts during download"), 130 JOptionPane.WARNING_MESSAGE 127 131 ); 128 JDialog dialog = op.createDialog(null, tr("Conflicts in data"));129 dialog.setAlwaysOnTop(true);130 dialog.setModal(true);131 dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);132 dialog.setVisible(true);133 132 } 134 133 -
trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java
r1820 r1847 29 29 import org.openstreetmap.josm.data.gpx.GpxData; 30 30 import org.openstreetmap.josm.gui.ExtendedDialog; 31 import org.openstreetmap.josm.gui.OptionPaneUtil; 31 32 import org.openstreetmap.josm.gui.layer.GpxLayer; 32 33 import org.openstreetmap.josm.gui.layer.Layer; … … 62 63 GpxLayer layer = getLayer(); 63 64 if (layer == null) { 64 JOptionPane.showMessageDialog(Main.parent, tr("Nothing to export. Get some data first.")); 65 OptionPaneUtil.showMessageDialog( 66 Main.parent, 67 tr("Nothing to export. Get some data first."), 68 tr("Information"), 69 JOptionPane.INFORMATION_MESSAGE 70 ); 65 71 return; 66 72 } -
trunk/src/org/openstreetmap/josm/actions/HelpAction.java
r1820 r1847 30 30 31 31 import org.openstreetmap.josm.Main; 32 import org.openstreetmap.josm.gui.OptionPaneUtil; 32 33 import org.openstreetmap.josm.tools.ImageProvider; 33 34 import org.openstreetmap.josm.tools.LanguageInfo; … … 110 111 } else if (tr("Edit").equals(e.getActionCommand())) { 111 112 if (!url.startsWith(baseurl)) { 112 JOptionPane.showMessageDialog(Main.parent, tr("Can only edit help pages from JOSM Online Help")); 113 OptionPaneUtil.showMessageDialog( 114 Main.parent, 115 tr("Can only edit help pages from JOSM Online Help"), 116 tr("Warning"), 117 JOptionPane.WARNING_MESSAGE 118 ); 113 119 return; 114 120 } -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r1820 r1847 72 72 73 73 if (selectedNodes.size() < 2) { 74 JOptionPane.showMessageDialog(Main.parent, tr("Please select at least two nodes to merge.")); 74 JOptionPane.showMessageDialog( 75 Main.parent, 76 tr("Please select at least two nodes to merge."), 77 tr("Warning"), 78 JOptionPane.WARNING_MESSAGE 79 ); 75 80 return; 76 81 } -
trunk/src/org/openstreetmap/josm/actions/MirrorAction.java
r1820 r1847 49 49 50 50 if (nodes.size() == 0) { 51 JOptionPane.showMessageDialog(Main.parent, tr("Please select at least one node or way.")); 51 JOptionPane.showMessageDialog( 52 Main.parent, 53 tr("Please select at least one node or way."), 54 tr("Information"), 55 JOptionPane.INFORMATION_MESSAGE 56 ); 52 57 return; 53 58 } -
trunk/src/org/openstreetmap/josm/actions/MoveAction.java
r1820 r1847 17 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 18 import org.openstreetmap.josm.data.osm.visitor.AllNodesVisitor; 19 import org.openstreetmap.josm.gui.OptionPaneUtil; 19 20 import org.openstreetmap.josm.tools.Shortcut; 20 21 … … 102 103 // Revert move 103 104 ((MoveCommand) c).moveAgain(-distx, -disty); 104 JOptionPane.showMessageDialog(Main.parent, 105 tr("Cannot move objects outside of the world.")); 105 OptionPaneUtil.showMessageDialog( 106 Main.parent, 107 tr("Cannot move objects outside of the world."), 108 tr("Warning"), 109 JOptionPane.WARNING_MESSAGE 110 ); 106 111 return; 107 112 } -
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r1637 r1847 13 13 14 14 import org.openstreetmap.josm.Main; 15 import org.openstreetmap.josm.gui.OptionPaneUtil; 15 16 import org.openstreetmap.josm.io.FileImporter; 16 17 import org.openstreetmap.josm.tools.Shortcut; … … 29 30 public OpenFileAction() { 30 31 super(tr("Open..."), "open", tr("Open a file."), 31 Shortcut.registerShortcut("system:open", tr("File: {0}", tr("Open...")), KeyEvent.VK_O, Shortcut.GROUP_MENU));32 Shortcut.registerShortcut("system:open", tr("File: {0}", tr("Open...")), KeyEvent.VK_O, Shortcut.GROUP_MENU)); 32 33 } 33 34 … … 37 38 return; 38 39 File[] files = fc.getSelectedFiles(); 39 for (int i = files.length; i > 0; --i) 40 for (int i = files.length; i > 0; --i) { 40 41 openFile(files[i-1]); 42 } 41 43 } 42 44 … … 48 50 System.out.println("Open file: " + file.getAbsolutePath() + " (" + file.length() + " bytes)"); 49 51 for (FileImporter importer : ExtensionFileFilter.importers) 50 if (importer.acceptFile(file)) 52 if (importer.acceptFile(file)) { 51 53 importer.importData(file); 54 } 52 55 } catch (IOException x) { 53 56 x.printStackTrace(); 54 JOptionPane.showMessageDialog(Main.parent, tr("Could not read \"{0}\"", file.getName()) + "\n" 55 + x.getMessage()); 57 OptionPaneUtil.showMessageDialog( 58 Main.parent, 59 tr("<html>Could not read file ''{0}\''. Error is: <br>{1}</html>", file.getName(), x.getMessage()), 60 tr("Error"), 61 JOptionPane.ERROR_MESSAGE 62 ); 63 56 64 } 57 65 } -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r1838 r1847 12 12 13 13 import javax.swing.JOptionPane; 14 import javax.swing.text.html.Option; 14 15 15 16 import org.openstreetmap.josm.Main; … … 23 24 import org.openstreetmap.josm.data.osm.Way; 24 25 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 26 import org.openstreetmap.josm.gui.OptionPaneUtil; 25 27 import org.openstreetmap.josm.tools.Shortcut; 26 28 … … 57 59 if(osm instanceof Node) { 58 60 if(dirnodes.size() == 2) { 59 JOptionPane.showMessageDialog(Main.parent, tr("Only two nodes allowed")); 61 OptionPaneUtil.showMessageDialog( 62 Main.parent, 63 tr("Only two nodes allowed"), 64 tr("Information"), 65 JOptionPane.INFORMATION_MESSAGE 66 ); 60 67 return; 61 68 } … … 65 72 // Check if selection consists now only of ways 66 73 if (!(osm instanceof Way)) { 67 JOptionPane.showMessageDialog(Main.parent, tr("Selection must consist only of ways.")); 74 OptionPaneUtil.showMessageDialog( 75 Main.parent, 76 tr("Selection must consist only of ways."), 77 tr("Information"), 78 JOptionPane.INFORMATION_MESSAGE 79 ); 68 80 return; 69 81 } … … 72 84 Way way = (Way)osm; 73 85 if ((way.nodes.size() < 5) || (!way.nodes.get(0).equals(way.nodes.get(way.nodes.size() - 1)))) { 74 JOptionPane.showMessageDialog(Main.parent, tr("Please select one or more closed ways of at least four nodes.")); 86 OptionPaneUtil.showMessageDialog( 87 Main.parent, 88 tr("Please select one or more closed ways of at least four nodes."), 89 tr("Information"), 90 JOptionPane.INFORMATION_MESSAGE 91 ); 75 92 return; 76 93 } … … 112 129 // Check, if selection held neither none nor two nodes 113 130 if(dirnodes.size() == 1) { 114 JOptionPane.showMessageDialog(Main.parent, tr("Only one node selected")); 131 OptionPaneUtil.showMessageDialog( 132 Main.parent, 133 tr("Only one node selected"), 134 tr("Warning"), 135 JOptionPane.WARNING_MESSAGE 136 ); 115 137 return; 116 138 } -
trunk/src/org/openstreetmap/josm/actions/PasteTagsAction.java
r1843 r1847 103 103 /* only enable if there is something selected to paste into and 104 104 if we don't have conflicting keys in the pastebuffer */ 105 setEnabled(selection != null && 106 ! selection.isEmpty() && 107 ! pasteBuffer.allPrimitives().isEmpty() && 108 (getCurrentDataSet().getSelectedNodes().isEmpty() || 109 ! containsSameKeysWithDifferentValues(pasteBuffer.nodes)) && 110 (getCurrentDataSet().getSelectedWays().isEmpty() || 111 ! containsSameKeysWithDifferentValues(pasteBuffer.ways)) && 112 (getCurrentDataSet().getSelectedRelations().isEmpty() || 113 ! containsSameKeysWithDifferentValues(pasteBuffer.relations))); 105 DataSet ds = getCurrentDataSet(); 106 if (ds == null || ds.getSelected().isEmpty() || pasteBuffer == null || pasteBuffer.allPrimitives().isEmpty()) { 107 setEnabled(false); 108 return; 109 } 110 setEnabled((!ds.getSelectedNodes().isEmpty() && ! containsSameKeysWithDifferentValues(pasteBuffer.nodes)) || 111 (!ds.getSelectedWays().isEmpty() && ! containsSameKeysWithDifferentValues(pasteBuffer.ways)) || 112 (! ds.getSelectedRelations().isEmpty() && ! containsSameKeysWithDifferentValues(pasteBuffer.relations))); 114 113 } 115 114 116 115 @Override public void pasteBufferChanged(DataSet newPasteBuffer) { 117 possiblyEnable(getCurrentDataSet().getSelected(), newPasteBuffer);116 updateEnabledState(); 118 117 } 119 118 -
trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java
r1646 r1847 15 15 16 16 import org.openstreetmap.josm.Main; 17 import org.openstreetmap.josm.gui.OptionPaneUtil; 17 18 import org.openstreetmap.josm.gui.layer.Layer; 18 19 import org.openstreetmap.josm.tools.ImageProvider; … … 52 53 filerename.setEnabled(file != null); 53 54 } 54 if (filerename.isEnabled()) 55 if (filerename.isEnabled()) { 55 56 filerename.setSelected(Main.pref.getBoolean("layer.rename-file", true)); 57 } 56 58 57 59 final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION){ … … 62 64 }; 63 65 final JDialog dlg = optionPane.createDialog(Main.parent, tr("Rename layer")); 66 dlg.setModal(true); 67 dlg.setAlwaysOnTop(true); 68 dlg.toFront(); 64 69 dlg.setVisible(true); 65 70 66 71 Object answer = optionPane.getValue(); 67 72 if (answer == null || answer == JOptionPane.UNINITIALIZED_VALUE || 68 (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION)) {73 (answer instanceof Integer && (Integer)answer != JOptionPane.OK_OPTION)) 69 74 return; 70 }71 75 72 76 String nameText = name.getText(); … … 75 79 if (filerename.isSelected()) { 76 80 String newname = nameText; 77 if (newname.indexOf("/") == -1 && newname.indexOf("\\") == -1) 81 if (newname.indexOf("/") == -1 && newname.indexOf("\\") == -1) { 78 82 newname = file.getParent() + File.separator + newname; 83 } 79 84 String oldname = file.getName(); 80 if (name.getText().indexOf('.') == -1 && oldname.indexOf('.') >= 0) 85 if (name.getText().indexOf('.') == -1 && oldname.indexOf('.') >= 0) { 81 86 newname += oldname.substring(oldname.lastIndexOf('.')); 87 } 82 88 File newFile = new File(newname); 83 89 if (file.renameTo(newFile)) { … … 85 91 nameText = newFile.getName(); 86 92 } else { 87 JOptionPane.showMessageDialog(Main.parent, tr("Could not rename the file \"{0}\".", file.getPath())); 93 OptionPaneUtil.showMessageDialog( 94 Main.parent, 95 tr("Could not rename file ''{0}''", file.getPath()), 96 tr("Error"), 97 JOptionPane.ERROR_MESSAGE 98 ); 88 99 return; 89 100 } -
trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java
r1844 r1847 21 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 22 import org.openstreetmap.josm.data.osm.Way; 23 import org.openstreetmap.josm.gui.OptionPaneUtil; 23 24 import org.openstreetmap.josm.tools.Shortcut; 24 25 … … 43 44 } 44 45 if (sel.isEmpty()) { 45 JOptionPane.showMessageDialog(Main.parent, 46 tr("Please select at least one way.")); 46 OptionPaneUtil.showMessageDialog( 47 Main.parent, 48 tr("Please select at least one way."), 49 tr("Information"), 50 JOptionPane.INFORMATION_MESSAGE 51 ); 47 52 return; 48 53 } -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r1820 r1847 23 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 24 24 import org.openstreetmap.josm.gui.ExtendedDialog; 25 import org.openstreetmap.josm.gui.OptionPaneUtil; 25 26 import org.openstreetmap.josm.gui.layer.GpxLayer; 26 27 import org.openstreetmap.josm.gui.layer.Layer; … … 90 91 } 91 92 if (Main.map == null) { 92 JOptionPane.showMessageDialog(Main.parent, tr("No document open so nothing to save.")); 93 JOptionPane.showMessageDialog( 94 Main.parent, 95 tr("No document open so nothing to save."), 96 tr("Warning"), 97 JOptionPane.WARNING_MESSAGE 98 ); 93 99 return false; 94 100 } … … 128 134 dstStream = new FileOutputStream(dst); 129 135 } catch (FileNotFoundException e) { 130 JOptionPane.showMessageDialog(Main.parent, tr("Could not back up file.")+"\n"+e.getMessage()); 136 OptionPaneUtil.showMessageDialog( 137 Main.parent, 138 tr("Could not back up file. Exception is: {0}", e.getMessage()), 139 tr("Error"), 140 JOptionPane.ERROR_MESSAGE 141 ); 131 142 return; 132 143 } … … 192 203 } 193 204 } else { 194 JOptionPane.showMessageDialog(Main.parent, tr("Unknown file extension.")); 205 OptionPaneUtil.showMessageDialog( 206 Main.parent, 207 tr("Unknown file extension for file ''{0}''", file.toString()), 208 tr("Error"), 209 JOptionPane.ERROR_MESSAGE 210 ); 195 211 return; 196 212 } … … 198 214 } catch (IOException e) { 199 215 e.printStackTrace(); 200 JOptionPane.showMessageDialog(Main.parent, tr("An error occurred while saving.")+"\n"+e.getMessage()); 216 OptionPaneUtil.showMessageDialog( 217 Main.parent, 218 tr("<html>An error occurred while saving. <br>Error is: <br>{0}</html>", e.getMessage()), 219 tr("Error"), 220 JOptionPane.ERROR_MESSAGE 221 ); 201 222 202 223 try { … … 208 229 } catch (IOException e2) { 209 230 e2.printStackTrace(); 210 JOptionPane.showMessageDialog(Main.parent, tr("An error occurred while restoring backup file.")+"\n"+e2.getMessage()); 231 OptionPaneUtil.showMessageDialog( 232 Main.parent, 233 tr("<html>An error occurred while restoring backup file.<br> Error is: <br>{0}</html>", e2.getMessage()), 234 tr("Error"), 235 JOptionPane.ERROR_MESSAGE 236 ); 211 237 } 212 238 } … … 235 261 } 236 262 } else { 237 JOptionPane.showMessageDialog(Main.parent, tr("Unknown file extension.")); 263 OptionPaneUtil.showMessageDialog( 264 Main.parent, 265 tr("Unknown file extension."), 266 tr("Error"), 267 JOptionPane.ERROR_MESSAGE 268 ); 238 269 return; 239 270 } … … 250 281 } catch (IOException e) { 251 282 e.printStackTrace(); 252 JOptionPane.showMessageDialog(Main.parent, tr("An error occurred while restoring backup file.")+"\n"+e.getMessage()); 283 OptionPaneUtil.showMessageDialog( 284 Main.parent, 285 tr("<html>An error occurred while restoring backup file.<br>Error is:<br>{0}</html>", e.getMessage()), 286 tr("Error"), 287 JOptionPane.ERROR_MESSAGE 288 );; 253 289 } 254 290 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTaskList.java
r1811 r1847 20 20 import org.openstreetmap.josm.data.osm.DataSet; 21 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 22 import org.openstreetmap.josm.gui.OptionPaneUtil; 22 23 import org.openstreetmap.josm.gui.download.DownloadDialog.DownloadTask; 23 24 import org.openstreetmap.josm.gui.layer.Layer; … … 100 101 101 102 if(! errors.equals("")) { 102 JOptionPane.showMessageDialog(Main.parent, 103 tr("The following errors occurred during mass download:") + "\r\n" + errors, 103 OptionPaneUtil.showMessageDialog( 104 Main.parent, 105 tr("<html>The following errors occurred during mass download: {0}</html>", errors), 104 106 tr("Errors during Download"), 105 107 JOptionPane.ERROR_MESSAGE); … … 167 169 ); 168 170 169 int ret = JOptionPane.showOptionDialog(171 int ret =OptionPaneUtil.showOptionDialog( 170 172 Main.parent, 171 173 message, … … 173 175 JOptionPane.YES_NO_OPTION, 174 176 JOptionPane.WARNING_MESSAGE, 175 null,176 177 options, 177 178 options[0] -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r1844 r1847 41 41 import org.openstreetmap.josm.gui.MapFrame; 42 42 import org.openstreetmap.josm.gui.MapView; 43 import org.openstreetmap.josm.gui.OptionPaneUtil; 43 44 import org.openstreetmap.josm.gui.SelectionManager; 44 45 import org.openstreetmap.josm.gui.SelectionManager.SelectionEnded; … … 246 247 ((MoveCommand) c).moveAgain(-dx, -dy); 247 248 248 JOptionPane.showMessageDialog(Main.parent, 249 tr("Cannot move objects outside of the world.")); 249 OptionPaneUtil.showMessageDialog( 250 Main.parent, 251 tr("Cannot move objects outside of the world."), 252 tr("Warning"), 253 JOptionPane.WARNING_MESSAGE 254 255 ); 250 256 restoreCursor(); 251 257 return; -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r1820 r1847 23 23 import org.openstreetmap.josm.data.osm.OsmPrimitive; 24 24 import org.openstreetmap.josm.gui.ExtendedDialog; 25 import org.openstreetmap.josm.gui.OptionPaneUtil; 25 26 import org.openstreetmap.josm.tools.GBC; 26 27 import org.openstreetmap.josm.tools.Shortcut; … … 47 48 return; 48 49 if (Main.map == null) { 49 JOptionPane.showMessageDialog(Main.parent, tr("No data loaded.")); 50 OptionPaneUtil.showMessageDialog( 51 Main.parent, 52 tr("Can't search because there is no loaded data."), 53 tr("Warning"), 54 JOptionPane.WARNING_MESSAGE 55 ); 50 56 return; 51 57 } … … 190 196 } 191 197 Main.map.statusLine.setHelpText(msg); 192 JOptionPane.showMessageDialog(Main.parent, msg); 198 OptionPaneUtil.showMessageDialog( 199 Main.parent, 200 msg, 201 tr("Warning"), 202 JOptionPane.WARNING_MESSAGE 203 ); 193 204 } else { 194 205 Main.map.statusLine.setHelpText(tr("Found {0} matches", foundMatches)); 195 206 } 196 207 } catch (SearchCompiler.ParseError e) { 197 JOptionPane.showMessageDialog(Main.parent, e.getMessage()); 208 OptionPaneUtil.showMessageDialog( 209 Main.parent, 210 e.getMessage(), 211 tr("Error"), 212 JOptionPane.ERROR_MESSAGE 213 214 ); 198 215 } 199 216 }
Note:
See TracChangeset
for help on using the changeset viewer.