- Timestamp:
- 2009-02-14T12:25:54+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r1169 r1397 38 38 import org.openstreetmap.josm.data.osm.TigerUtils; 39 39 import org.openstreetmap.josm.data.osm.Way; 40 import org.openstreetmap.josm.gui.ExtendedDialog; 40 41 import org.openstreetmap.josm.tools.GBC; 41 42 import org.openstreetmap.josm.tools.Pair; … … 108 109 for (HashSet<Way> waylinks : backlinks.values()) { 109 110 if (!waylinks.containsAll(selectedWays)) { 110 int option = JOptionPane.showConfirmDialog(Main.parent, 111 tr("The selected ways have differing relation memberships. " 112 + "Do you still want to combine them?"), 113 tr("Combine ways with different memberships?"), 114 JOptionPane.YES_NO_OPTION); 115 if (option == JOptionPane.YES_OPTION) 116 break; 111 int option = new ExtendedDialog(Main.parent, 112 tr("Combine ways with different memberships?"), 113 tr("The selected ways have differing relation memberships. " 114 + "Do you still want to combine them?"), 115 new String[] {tr("Combine Anyway"), tr("Cancel")}, 116 new String[] {"combineway.png", "cancel.png"}).getValue(); 117 if (option == 1) break; 118 117 119 return; 118 120 } … … 136 138 Object secondTry = actuallyCombineWays(selectedWays, true); 137 139 if (secondTry instanceof List) { 138 int option = JOptionPane.showConfirmDialog(Main.parent, 140 int option = new ExtendedDialog(Main.parent, 141 tr("Change directions?"), 139 142 tr("The ways can not be combined in their current directions. " 140 + "Do you want to reverse some of them?"), tr("Change directions?"), 141 JOptionPane.YES_NO_OPTION); 142 if (option != JOptionPane.YES_OPTION) { 143 return; 144 } 143 + "Do you want to reverse some of them?"), 144 new String[] {tr("Reverse and Combine"), tr("Cancel")}, 145 new String[] {"wayflip.png", "cancel.png"}).getValue(); 146 if (option != 1) return; 145 147 nodeList = (List<Node>) secondTry; 146 148 } else { … … 191 193 192 194 if (!components.isEmpty()) { 193 int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Enter values for all conflicts."), JOptionPane.OK_CANCEL_OPTION); 194 if (answer != JOptionPane.OK_OPTION) 195 return; 195 int answer = new ExtendedDialog(Main.parent, 196 tr("Enter values for all conflicts."), 197 p, 198 new String[] {tr("Solve Conflicts"), tr("Cancel")}, 199 new String[] {"dialogs/conflict.png", "cancel.png"}).getValue(); 200 if (answer != 1) return; 201 196 202 for (Entry<String, JComboBox> e : components.entrySet()) 197 203 newWay.put(e.getKey(), e.getValue().getEditor().getItem().toString()); -
trunk/src/org/openstreetmap/josm/actions/DiskAccessAction.java
r1180 r1397 10 10 11 11 import org.openstreetmap.josm.Main; 12 import org.openstreetmap.josm.gui.ExtendedDialog; 12 13 import org.openstreetmap.josm.tools.Shortcut; 13 14 … … 43 44 if (!open) { 44 45 File file = fc.getSelectedFile(); 45 if (file == null || (file.exists() && JOptionPane.YES_OPTION != 46 JOptionPane.showConfirmDialog(Main.parent, tr("File exists. Overwrite?"), tr("Overwrite"), JOptionPane.YES_NO_OPTION))) 46 if (file == null || (file.exists() && 1 != 47 new ExtendedDialog(Main.parent, 48 tr("Overwrite"), 49 tr("File exists. Overwrite?"), 50 new String[] {tr("Overwrite"), tr("Cancel")}, 51 new String[] {"save_as.png", "cancel.png"}).getValue())) 47 52 return null; 48 53 } -
trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java
r1212 r1397 32 32 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 33 33 import org.openstreetmap.josm.io.GpxWriter; 34 import org.openstreetmap.josm.gui.ExtendedDialog; 34 35 import org.openstreetmap.josm.tools.GBC; 35 36 import org.openstreetmap.josm.tools.Shortcut; … … 111 112 p.add(keywords, GBC.eop().fill(GBC.HORIZONTAL)); 112 113 113 int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Export options"), JOptionPane.OK_CANCEL_OPTION); 114 if (answer != JOptionPane.OK_OPTION) 114 int answer = new ExtendedDialog(Main.parent, 115 tr("Export options"), 116 p, 117 new String[] {tr("Export and Save"), tr("Cancel")}, 118 new String[] {"exportgpx.png", "cancel.png"}).getValue(); 119 if (answer != 1) 115 120 return; 116 121 -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r1169 r1397 38 38 import org.openstreetmap.josm.data.osm.Way; 39 39 import org.openstreetmap.josm.data.osm.visitor.CollectBackReferencesVisitor; 40 import org.openstreetmap.josm.gui.ExtendedDialog; 40 41 import org.openstreetmap.josm.tools.GBC; 41 42 import org.openstreetmap.josm.tools.Pair; … … 144 145 for (HashSet<Node> nodelinks : backlinks.values()) { 145 146 if (!nodelinks.containsAll(allNodes)) { 146 int option = JOptionPane.showConfirmDialog(Main.parent,147 tr("The selected nodes have differing relation memberships. "148 + "Do you still want to merge them?"),149 tr("Merge nodes with different memberships?"),150 JOptionPane.YES_NO_OPTION);151 if (option == JOptionPane.YES_OPTION)152 147 int option = new ExtendedDialog(Main.parent, 148 tr("Merge nodes with different memberships?"), 149 tr("The selected nodes have differing relation memberships. " 150 + "Do you still want to merge them?"), 151 new String[] {tr("Merge Anyway"), tr("Cancel")}, 152 new String[] {"mergenodes.png", "cancel.png"}).getValue(); 153 if (option == 1) break; 153 154 return null; 154 155 } … … 191 192 192 193 if (!components.isEmpty()) { 193 int answer = JOptionPane.showConfirmDialog(Main.parent, p, tr("Enter values for all conflicts."), JOptionPane.OK_CANCEL_OPTION); 194 if (answer != JOptionPane.OK_OPTION) 194 int answer = new ExtendedDialog(Main.parent, 195 tr("Enter values for all conflicts."), 196 p, 197 new String[] {tr("Solve Conflicts"), tr("Cancel")}, 198 new String[] {"dialogs/conflict.png", "cancel.png"}).getValue(); 199 if (answer != 1) 195 200 return null; 196 201 for (Entry<String, JComboBox> e : components.entrySet()) -
trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
r1195 r1397 24 24 import org.openstreetmap.josm.actions.downloadtasks.DownloadOsmTask; 25 25 import org.openstreetmap.josm.data.osm.DataSet; 26 import org.openstreetmap.josm.gui.ExtendedDialog; 26 27 import org.openstreetmap.josm.gui.layer.GpxLayer; 27 28 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 55 56 layer.setSelected(Main.pref.getBoolean("download.newlayer")); 56 57 JPanel all = new JPanel(new GridBagLayout()); 57 all.add(new JLabel( "Enter URL to download:"), GBC.eol());58 all.add(new JLabel(tr("Enter URL to download:")), GBC.eol()); 58 59 JTextField urltext = new JTextField(40); 59 60 all.add(urltext, GBC.eol()); 60 61 all.add(layer, GBC.eol()); 61 int answer = JOptionPane.showConfirmDialog(Main.parent, all, tr("Download Location"), JOptionPane.OK_CANCEL_OPTION); 62 if (answer != JOptionPane.OK_OPTION) 63 return; 62 int answer = new ExtendedDialog(Main.parent, 63 tr("Download Location"), 64 all, 65 new String[] {tr("Download URL"), tr("Cancel")}, 66 new String[] {"download.png", "cancel.png"}).getValue(); 67 if (answer != 1) return; 64 68 openUrl(layer.isSelected(), urltext.getText()); 65 69 } -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r1373 r1397 17 17 import org.openstreetmap.josm.Main; 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 import org.openstreetmap.josm.gui.ExtendedDialog; 19 20 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 20 21 import org.openstreetmap.josm.gui.layer.Layer; … … 78 79 } 79 80 80 if (layer instanceof OsmDataLayer && isDataSetEmpty((OsmDataLayer)layer) && JOptionPane.NO_OPTION == JOptionPane.showConfirmDialog(Main.parent,tr("The document contains no data. Save anyway?"), tr("Empty document"), JOptionPane.YES_NO_OPTION)) {81 if (layer instanceof OsmDataLayer && isDataSetEmpty((OsmDataLayer)layer) && 1 != new ExtendedDialog(Main.parent, tr("Empty document"), tr("The document contains no data."), new String[] {tr("Save anyway"), tr("Cancel")}, new String[] {"save.png", "cancel.png"}).getValue()) { 81 82 return false; 82 83 } … … 85 86 } 86 87 if (!Main.map.conflictDialog.conflicts.isEmpty()) { 87 int answer = JOptionPane.showConfirmDialog(Main.parent, 88 tr("There are unresolved conflicts. Conflicts will not be saved and handled as if you rejected all. Continue?"),tr("Conflicts"), JOptionPane.YES_NO_OPTION); 89 if (answer != JOptionPane.YES_OPTION) 90 return false; 88 int answer = new ExtendedDialog(Main.parent, 89 tr("Conflicts"), 90 tr("There are unresolved conflicts. Conflicts will not be saved and handled as if you rejected all. Continue?"), 91 new String[] {tr("Reject Conflicts and Save"), tr("Cancel")}, 92 new String[] {"save.png", "cancel.png"}).getValue(); 93 94 if (answer != 1) return false; 91 95 } 92 96 return true; -
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r1212 r1397 18 18 import org.openstreetmap.josm.Main; 19 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; 20 import org.openstreetmap.josm.gui.ExtendedDialog; 20 21 import org.openstreetmap.josm.gui.OsmPrimitivRenderer; 21 22 import org.openstreetmap.josm.gui.PleaseWaitRunnable; … … 98 99 } 99 100 100 return JOptionPane.showConfirmDialog(Main.parent, p, tr("Upload these changes?"), 101 JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION; 101 return new ExtendedDialog(Main.parent, 102 tr("Upload these changes?"), 103 p, 104 new String[] {tr("Upload Changes"), tr("Cancel")}, 105 new String[] {"upload.png", "cancel.png"}).getValue() == 1; 102 106 } 103 107 }); -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r1375 r1397 21 21 import org.openstreetmap.josm.actions.JosmAction; 22 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 import org.openstreetmap.josm.gui.ExtendedDialog; 23 24 import org.openstreetmap.josm.tools.GBC; 24 25 import org.openstreetmap.josm.tools.Shortcut; … … 55 56 JLabel label = new JLabel(tr("Please enter a search string.")); 56 57 final JTextField input = new JTextField(initialValues.text); 58 input.selectAll(); 59 input.requestFocusInWindow(); 57 60 JRadioButton replace = new JRadioButton(tr("replace selection"), initialValues.mode == SearchMode.replace); 58 61 JRadioButton add = new JRadioButton(tr("add to selection"), initialValues.mode == SearchMode.add); … … 99 102 p.add(left); 100 103 p.add(right); 101 102 JOptionPane pane = new JOptionPane(p, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null) { 103 @Override 104 public void selectInitialValue() { 105 input.requestFocusInWindow(); 106 input.selectAll(); 107 } 108 }; 109 pane.createDialog(Main.parent, tr("Search")).setVisible(true); 110 if (!Integer.valueOf(JOptionPane.OK_OPTION).equals(pane.getValue())) 111 return; 104 105 int result = new ExtendedDialog(Main.parent, 106 tr("Search"), 107 p, 108 new String[] {tr("Start Search"), tr("Cancel")}, 109 new String[] {"dialogs/search.png", "cancel.png"}).getValue(); 110 if(result != 1) return; 111 112 112 // User pressed OK - let's perform the search 113 113 SearchMode mode = replace.isSelected() ? SearchAction.SearchMode.replace -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r1169 r1397 31 31 import org.openstreetmap.josm.data.osm.visitor.CollectBackReferencesVisitor; 32 32 import org.openstreetmap.josm.data.osm.visitor.NameVisitor; 33 import org.openstreetmap.josm.gui.ExtendedDialog; 33 34 import org.openstreetmap.josm.tools.DontShowAgainInfo; 34 35 import org.openstreetmap.josm.tools.ImageProvider; … … 154 155 } 155 156 if (role.length() > 0) { 156 return JOptionPane.showConfirmDialog(Main.parent, tr( 157 "Selection \"{0}\" is used by relation \"{1}\" with role {2}.\nDelete from relation?", s.name, 158 n.name, role), tr("Conflicting relation"), JOptionPane.YES_NO_OPTION); 157 return new ExtendedDialog(Main.parent, 158 tr("Conflicting relation"), 159 tr("Selection \"{0}\" is used by relation \"{1}\" with role {2}.\nDelete from relation?", 160 s.name, n.name, role), 161 new String[] {tr("Delete from relation"), tr("Cancel")}, 162 new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 159 163 } else { 160 return JOptionPane.showConfirmDialog(Main.parent, tr( 161 "Selection \"{0}\" is used by relation \"{1}\".\nDelete from relation?", s.name, n.name), 162 tr("Conflicting relation"), JOptionPane.YES_NO_OPTION); 164 return new ExtendedDialog(Main.parent, 165 tr("Conflicting relation"), 166 tr("Selection \"{0}\" is used by relation \"{1}\".\nDelete from relation?", 167 s.name, n.name), 168 new String[] {tr("Delete from relation"), tr("Cancel")}, 169 new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 163 170 } 164 171 } … … 208 215 waysToBeChanged.add((Way) ref); 209 216 } else if (ref instanceof Relation) { 210 if (testRelation((Relation) ref, osm) == JOptionPane.YES_OPTION) {217 if (testRelation((Relation) ref, osm) == 1) { 211 218 Collection<OsmPrimitive> relset = relationsToBeChanged.get(ref); 212 219 if (relset == null) … … 248 255 } 249 256 if (!found) { 250 if (testRelation((Relation) ref, w) == JOptionPane.YES_OPTION) {257 if (testRelation((Relation) ref, w) == 1) { 251 258 relset.add(w); 252 259 relationsToBeChanged.put(ref, relset); -
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r1373 r1397 7 7 import java.awt.event.ComponentListener; 8 8 import java.awt.GridBagLayout; 9 import java.awt.Toolkit; 9 10 10 11 import javax.swing.AbstractAction; … … 19 20 import javax.swing.JPanel; 20 21 import javax.swing.JRootPane; 22 import javax.swing.JScrollBar; 21 23 import javax.swing.JScrollPane; 22 24 import javax.swing.KeyStroke; 23 25 24 26 import org.openstreetmap.josm.Main; 27 import org.openstreetmap.josm.gui.JMultilineLabel; 25 28 import org.openstreetmap.josm.tools.GBC; 26 29 import org.openstreetmap.josm.tools.I18n; … … 47 50 48 51 public ExtendedDialog(Component parent, String title, Component content, String[] buttonTexts) { 52 this(parent, title, content, buttonTexts, null); 53 } 54 55 // just display a breakable message 56 public ExtendedDialog(Component parent, String title, String message, String[] buttonTexts, String[] buttonIcons) { 49 57 super(JOptionPane.getFrameForComponent(parent), title, true); 50 bTexts = buttonTexts; 51 setupDialog(parent, title, content, buttonTexts, null); 58 59 JMultilineLabel lbl = new JMultilineLabel(message); 60 // Make it not wider than 2/3 of the screen 61 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 62 lbl.setMaxWidth(Math.round(screenSize.width*2/3)); 63 64 bTexts = buttonTexts; 65 setupDialog(parent, title, lbl, buttonTexts, buttonIcons); 66 } 67 68 public ExtendedDialog(Component parent, String title, String message, String[] buttonTexts) { 69 this(parent, title, message, buttonTexts, null); 52 70 } 53 71 54 72 private void setupDialog(Component parent, String title, Component content, String[] buttonTexts, String[] buttonIcons) { 73 setupEscListener(); 74 55 75 JButton button; 56 76 JPanel buttonsPanel = new JPanel(new GridBagLayout()); … … 79 99 80 100 JPanel cp = new JPanel(new GridBagLayout()); 81 cp.add(content, GBC.eol().anchor(GBC.CENTER).insets( 0,10,0,0)); //fill(GBC.HORIZONTAL).101 cp.add(content, GBC.eol().anchor(GBC.CENTER).insets(5,10,5,0)); 82 102 cp.add(buttonsPanel, GBC.eol().anchor(GBC.CENTER).insets(5,5,5,5)); 83 103 84 JScrollPane pane = new JScrollPane(cp); 104 JScrollPane pane = new JScrollPane(cp); 85 105 pane.setBorder(null); 86 106 setContentPane(pane); … … 88 108 pack(); 89 109 90 // Try to make it not larger than the parent window or at least not larger than a reasonable value110 // Try to make it not larger than the parent window or at least not larger than 2/3 of the screen 91 111 Dimension d = getSize(); 92 Dimension x = new Dimension(700, 500); 112 Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 113 Dimension x = new Dimension(Math.round(screenSize.width*2/3), Math.round(screenSize.height*2/3)); 114 93 115 try { 94 95 116 if(parent != null) 96 117 x = JOptionPane.getFrameForComponent(parent).getSize(); 97 118 } catch(NullPointerException e) { } 119 120 boolean limitedInWidth = d.width > x.width; 121 boolean limitedInHeight = d.height > x.height; 98 122 99 123 if(x.width > 0 && d.width > x.width) d.width = x.width; 100 124 if(x.height > 0 && d.height > x.height) d.height = x.height; 125 126 // We have a vertical scrollbar and enough space to prevent a horizontal one 127 if(!limitedInWidth && limitedInHeight) 128 d.width += new JScrollBar().getPreferredSize().width; 129 101 130 setSize(d); 102 103 setLocationRelativeTo(parent); 104 105 setupEscListener(); 131 setLocationRelativeTo(parent); 106 132 setVisible(true); 107 133 } -
trunk/src/org/openstreetmap/josm/gui/JMultilineLabel.java
r1169 r1397 93 93 float w = insets.left + insets.right; 94 94 float x = insets.left, y=insets.top; 95 96 95 97 if (width > 0 && text != null && text.length() > 0) { 96 AttributedString as = new AttributedString(getText()); 97 as.addAttribute(TextAttribute.FONT, getFont()); 98 AttributedCharacterIterator aci = as.getIterator(); 99 LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc); 100 float max = 0; 101 while (lbm.getPosition() < aci.getEndIndex()) { 102 TextLayout textLayout = lbm.nextLayout(width); 103 if (g != null && isJustified() && textLayout.getVisibleAdvance() > 0.80 * width) 104 textLayout = textLayout.getJustifiedLayout(width); 105 if (g != null) 106 textLayout.draw(g, x, y + textLayout.getAscent()); 107 y += textLayout.getDescent() + textLayout.getLeading() + textLayout.getAscent(); 108 max = Math.max(max, textLayout.getVisibleAdvance()); 98 String[] lines = getText().split("\n"); 99 for(String line : lines) { 100 // Insert a space so new lines get rendered 101 if(line.length() == 0) line = " "; 102 AttributedString as = new AttributedString(line); 103 as.addAttribute(TextAttribute.FONT, getFont()); 104 AttributedCharacterIterator aci = as.getIterator(); 105 LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc); 106 float max = 0; 107 while (lbm.getPosition() < aci.getEndIndex()) { 108 TextLayout textLayout = lbm.nextLayout(width); 109 if (g != null && isJustified() && textLayout.getVisibleAdvance() > 0.80 * width) 110 textLayout = textLayout.getJustifiedLayout(width); 111 if (g != null) 112 textLayout.draw(g, x, y + textLayout.getAscent()); 113 y += textLayout.getDescent() + textLayout.getLeading() + textLayout.getAscent(); 114 max = Math.max(max, textLayout.getVisibleAdvance()); 115 } 116 w += max; 109 117 } 110 w += max;111 118 } 112 119 return new Dimension((int)Math.ceil(w), (int)Math.ceil(y) + insets.bottom); -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r1265 r1397 22 22 import javax.swing.JLabel; 23 23 import javax.swing.JList; 24 import javax.swing.JOptionPane;25 24 import javax.swing.JPanel; 26 25 import javax.swing.JScrollPane; … … 31 30 32 31 import org.openstreetmap.josm.Main; 32 import org.openstreetmap.josm.gui.ExtendedDialog; 33 33 import org.openstreetmap.josm.gui.MapFrame; 34 34 import org.openstreetmap.josm.gui.MapView; … … 77 77 if (((OsmDataLayer)l).isModified()) 78 78 { 79 if(JOptionPane.showConfirmDialog(instance, tr("There are unsaved changes. Delete the layer anwyay?"), 80 tr("Unsaved Changes"), JOptionPane.YES_NO_OPTION) != JOptionPane.YES_OPTION) 81 return; 79 int result = new ExtendedDialog(Main.parent, tr("Unsaved Changes"), 80 tr("There are unsaved changes. Delete the layer anwyay?"), 81 new String[] {tr("Delete Layer"), tr("Cancel")}, 82 new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 83 84 if(result != 1) return; 82 85 } 83 86 else if(!DontShowAgainInfo.show("delete_layer", tr("Do you really want to delete the whole layer?"), false)) -
trunk/src/org/openstreetmap/josm/gui/dialogs/PropertiesDialog.java
r1354 r1397 57 57 import org.openstreetmap.josm.data.osm.RelationMember; 58 58 import org.openstreetmap.josm.data.osm.visitor.NameVisitor; 59 import org.openstreetmap.josm.gui.ExtendedDialog; 59 60 import org.openstreetmap.josm.gui.MapFrame; 60 61 import org.openstreetmap.josm.gui.SideButton; … … 548 549 NameVisitor n = new NameVisitor(); 549 550 cur.visit(n); 550 if(JOptionPane.showConfirmDialog(Main.parent, tr("Really delete selection from relation {0}?", n.name), 551 tr("Change relation"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION) 551 552 int result = new ExtendedDialog(Main.parent, 553 tr("Change relation"), 554 tr("Really delete selection from relation {0}?", n.name), 555 new String[] {tr("Delete from relation"), tr("Cancel")}, 556 new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 557 558 if(result == 1) 552 559 { 553 560 Relation rel = new Relation(cur); -
trunk/src/org/openstreetmap/josm/io/OsmConnection.java
r1169 r1397 17 17 import javax.swing.JCheckBox; 18 18 import javax.swing.JLabel; 19 import javax.swing.JOptionPane;20 19 import javax.swing.JPanel; 21 20 import javax.swing.JPasswordField; … … 23 22 24 23 import org.openstreetmap.josm.Main; 24 import org.openstreetmap.josm.gui.ExtendedDialog; 25 25 import org.openstreetmap.josm.tools.Base64; 26 26 import org.openstreetmap.josm.tools.GBC; … … 90 90 p.add(savePassword, GBC.eop()); 91 91 92 int choice = JOptionPane.showConfirmDialog(Main.parent, p, tr("Enter Password"), JOptionPane.OK_CANCEL_OPTION); 93 if (choice == JOptionPane.CANCEL_OPTION) { 92 int choice = new ExtendedDialog(Main.parent, 93 tr("Enter Password"), 94 p, 95 new String[] {tr("Login"), tr("Cancel")}, 96 new String[] {"ok.png", "cancel.png"}).getValue(); 97 98 if (choice != 1) { 94 99 authCancelled = true; 95 100 return null; -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r1390 r1397 34 34 import org.openstreetmap.josm.gui.MapFrame; 35 35 import org.openstreetmap.josm.gui.download.DownloadSelection; 36 import org.openstreetmap.josm.gui.ExtendedDialog; 36 37 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 37 38 import org.openstreetmap.josm.tools.GBC; … … 150 151 } catch (Throwable e) { 151 152 e.printStackTrace(); 152 if(JOptionPane.showConfirmDialog(Main.parent, 153 tr("Could not load plugin {0}. Delete from preferences?", 154 info.name), tr("Disable plugin"), 155 JOptionPane.YES_NO_OPTION) == JOptionPane.OK_OPTION) 153 154 int result = new ExtendedDialog(Main.parent, 155 tr("Disable plugin"), 156 tr("Could not load plugin {0}. Delete from preferences?", info.name), 157 new String[] {tr("Disable plugin"), tr("Cancel")}, 158 new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 159 160 if(result == 1) 156 161 { 157 162 plugins.remove(info.name); … … 247 252 248 253 if (plugin != null) { 249 int answer = JOptionPane.showConfirmDialog( 250 Main.parent, tr("An unexpected exception occurred that may have come from the ''{0}'' plugin.", 251 plugin.info.name) + "\n"+ (plugin.info.author != null ? 252 tr("According to the information within the plugin, the author is {0}.", 253 plugin.info.author) : "") + "\n" + 254 tr("Try updating to the newest version of this plugin before reporting a bug.") + "\n" + 255 tr("Should the plugin be disabled?"), 256 tr("Disable plugin"), 257 JOptionPane.YES_NO_OPTION); 258 if (answer == JOptionPane.OK_OPTION) { 254 int answer = new ExtendedDialog(Main.parent, 255 tr("Disable plugin"), 256 tr("An unexpected exception occurred that may have come from the ''{0}'' plugin.", plugin.info.name) 257 + "\n" 258 + (plugin.info.author != null 259 ? tr("According to the information within the plugin, the author is {0}.", plugin.info.author) 260 : "") 261 + "\n" 262 + tr("Try updating to the newest version of this plugin before reporting a bug.") 263 + "\n" 264 + tr("Should the plugin be disabled?"), 265 new String[] {tr("Disable plugin"), tr("Cancel")}, 266 new String[] {"dialogs/delete.png", "cancel.png"}).getValue(); 267 if (answer == 1) { 259 268 LinkedList<String> plugins = new LinkedList<String>(Arrays.asList(Main.pref.get("plugins").split(","))); 260 269 if (plugins.contains(plugin.info.name)) { -
trunk/src/org/openstreetmap/josm/plugins/PluginSelection.java
r1326 r1397 39 39 40 40 import org.openstreetmap.josm.Main; 41 import org.openstreetmap.josm.gui.ExtendedDialog; 41 42 import org.openstreetmap.josm.tools.OpenBrowser; 42 43 import org.openstreetmap.josm.tools.XmlObjectParser.Uniform; … … 78 79 done = true; 79 80 } else { 80 int answer = JOptionPane.showConfirmDialog(Main.parent, tr("Update the following plugins:\n\n{0}", 81 toUpdateStr.toString()), tr("Update"), JOptionPane.OK_CANCEL_OPTION); 82 if (answer == JOptionPane.OK_OPTION) { 81 int answer = new ExtendedDialog(Main.parent, 82 tr("Update"), 83 tr("Update the following plugins:\n\n{0}", toUpdateStr.toString()), 84 new String[] {tr("Update Plugins"), tr("Cancel")}, 85 new String[] {"dialogs/refresh.png", "cancel.png"}).getValue(); 86 if (answer == 1) { 83 87 PluginDownloader.update(toUpdate); 84 88 done = true; … … 100 104 } 101 105 if (!toDownload.isEmpty()) { 102 int answer = JOptionPane.showConfirmDialog(Main.parent, 103 tr("Download the following plugins?\n\n{0}", msg), 104 tr("Download missing plugins"), 105 JOptionPane.YES_NO_OPTION); 106 if (answer != JOptionPane.OK_OPTION) 106 int answer = new ExtendedDialog(Main.parent, 107 tr("Download missing plugins"), 108 tr("Download the following plugins?\n\n{0}", msg), 109 new String[] {tr("Download Plugins"), tr("Cancel")}, 110 new String[] {"download.png", "cancel.png"}).getValue(); 111 if (answer != 1) 107 112 for (PluginDescription pd : toDownload) 108 113 pluginMap.put(pd.name, false); … … 202 207 if ((getLoaded(plugin.name) == null) && (plinfo != null)) { 203 208 try { 204 int answer = JOptionPane.showConfirmDialog(Main.parent, 205 tr("Plugin archive already available. Do you want to download the current version by deleting existing archive?\n\n{0}", 206 plinfo.file.getCanonicalPath()), tr("Plugin already exists"), JOptionPane.OK_CANCEL_OPTION); 207 if (answer == JOptionPane.OK_OPTION) { 209 int answer = new ExtendedDialog(Main.parent, 210 tr("Plugin already exists"), 211 tr("Plugin archive already available. Do you want to download" 212 + " the current version by deleting existing archive?\n\n{0}", 213 plinfo.file.getCanonicalPath()), 214 new String[] {tr("Delete and Download"), tr("Cancel")}, 215 new String[] {"download.png", "cancel.png"}).getValue(); 216 217 if (answer == 1) { 208 218 if (!plinfo.file.delete()) { 209 219 JOptionPane.showMessageDialog(Main.parent, tr("Error deleting plugin file: {0}", plinfo.file.getCanonicalPath()));
Note:
See TracChangeset
for help on using the changeset viewer.