Changeset 10035 in josm
- Timestamp:
- 2016-03-23T22:36:15+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r10001 r10035 146 146 147 147 public ExtendedDialog(Component parent, String title, String[] buttonTexts, boolean modal, boolean disposeOnClose) { 148 super( JOptionPane.getFrameForComponent(parent), title, modal ? ModalityType.DOCUMENT_MODAL : ModalityType.MODELESS);148 super(GuiHelper.getFrameForComponent(parent), title, modal ? ModalityType.DOCUMENT_MODAL : ModalityType.MODELESS); 149 149 this.parent = parent; 150 150 this.modal = modal; … … 441 441 Dimension x = new Dimension(screenSize.width*2/3, screenSize.height*2/3); 442 442 if (parent != null && parent.isVisible()) { 443 x = JOptionPane.getFrameForComponent(parent).getSize();443 x = GuiHelper.getFrameForComponent(parent).getSize(); 444 444 } 445 445 return x; -
trunk/src/org/openstreetmap/josm/gui/HelpAwareOptionPane.java
r9970 r10035 252 252 final JOptionPane pane) { 253 253 final JDialog dialog = new JDialog( 254 JOptionPane.getFrameForComponent(parentComponent),254 GuiHelper.getFrameForComponent(parentComponent), 255 255 title, 256 256 ModalityType.DOCUMENT_MODAL -
trunk/src/org/openstreetmap/josm/gui/PleaseWaitDialog.java
r9543 r10035 16 16 import javax.swing.JDialog; 17 17 import javax.swing.JLabel; 18 import javax.swing.JOptionPane;19 18 import javax.swing.JPanel; 20 19 import javax.swing.JProgressBar; … … 24 23 import org.openstreetmap.josm.Main; 25 24 import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor.ProgressMonitorDialog; 25 import org.openstreetmap.josm.gui.util.GuiHelper; 26 26 import org.openstreetmap.josm.gui.widgets.JosmTextArea; 27 27 import org.openstreetmap.josm.tools.GBC; … … 90 90 */ 91 91 public PleaseWaitDialog(Component parent) { 92 super( JOptionPane.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL);92 super(GuiHelper.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL); 93 93 initDialog(); 94 94 } -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java
r9473 r10035 218 218 */ 219 219 public CombinePrimitiveResolverDialog(Component parent) { 220 super( JOptionPane.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL);220 super(GuiHelper.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL); 221 221 build(); 222 222 } -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialog.java
r9849 r10035 28 28 import javax.swing.JDialog; 29 29 import javax.swing.JLabel; 30 import javax.swing.JOptionPane;31 30 import javax.swing.JPanel; 32 31 import javax.swing.JTabbedPane; … … 40 39 import org.openstreetmap.josm.gui.SideButton; 41 40 import org.openstreetmap.josm.gui.tagging.TagTableColumnModelBuilder; 41 import org.openstreetmap.josm.gui.util.GuiHelper; 42 42 import org.openstreetmap.josm.tools.ImageProvider; 43 43 import org.openstreetmap.josm.tools.WindowGeometry; … … 73 73 */ 74 74 public PasteTagsConflictResolverDialog(Component owner) { 75 super( JOptionPane.getFrameForComponent(owner), ModalityType.DOCUMENT_MODAL);75 super(GuiHelper.getFrameForComponent(owner), ModalityType.DOCUMENT_MODAL); 76 76 build(); 77 77 iconResolved = ImageProvider.get("dialogs/conflict", "tagconflictresolved"); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java
r9543 r10035 30 30 import org.openstreetmap.josm.gui.help.HelpBrowser; 31 31 import org.openstreetmap.josm.gui.help.HelpUtil; 32 import org.openstreetmap.josm.gui.util.GuiHelper; 32 33 import org.openstreetmap.josm.tools.ImageProvider; 33 34 import org.openstreetmap.josm.tools.WindowGeometry; … … 134 135 */ 135 136 public ConflictResolutionDialog(Component parent) { 136 super( JOptionPane.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL);137 super(GuiHelper.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL); 137 138 build(); 138 139 pack(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/DeleteFromRelationConfirmationDialog.java
r9543 r10035 22 22 import javax.swing.AbstractAction; 23 23 import javax.swing.JDialog; 24 import javax.swing.JOptionPane;25 24 import javax.swing.JPanel; 26 25 import javax.swing.JScrollPane; … … 41 40 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 42 41 import org.openstreetmap.josm.gui.help.HelpUtil; 42 import org.openstreetmap.josm.gui.util.GuiHelper; 43 43 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 44 44 import org.openstreetmap.josm.tools.I18n; … … 132 132 */ 133 133 public DeleteFromRelationConfirmationDialog() { 134 super( JOptionPane.getFrameForComponent(Main.parent), "", ModalityType.DOCUMENT_MODAL);134 super(GuiHelper.getFrameForComponent(Main.parent), "", ModalityType.DOCUMENT_MODAL); 135 135 build(); 136 136 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r9833 r10035 40 40 import javax.swing.JLabel; 41 41 import javax.swing.JMenu; 42 import javax.swing.JOptionPane;43 42 import javax.swing.JPanel; 44 43 import javax.swing.JPopupMenu; … … 665 664 private class DetachedDialog extends JDialog { 666 665 DetachedDialog() { 667 super( JOptionPane.getFrameForComponent(Main.parent));666 super(GuiHelper.getFrameForComponent(Main.parent)); 668 667 getContentPane().add(ToggleDialog.this); 669 668 addWindowListener(new WindowAdapter() { -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r9543 r10035 41 41 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 42 42 import org.openstreetmap.josm.gui.help.HelpUtil; 43 import org.openstreetmap.josm.gui.util.GuiHelper; 43 44 import org.openstreetmap.josm.io.OnlineResource; 44 45 import org.openstreetmap.josm.plugins.PluginHandler; … … 229 230 */ 230 231 public DownloadDialog(Component parent, String helpTopic) { 231 super( JOptionPane.getFrameForComponent(parent), tr("Download"), ModalityType.DOCUMENT_MODAL);232 super(GuiHelper.getFrameForComponent(parent), tr("Download"), ModalityType.DOCUMENT_MODAL); 232 233 HelpUtil.setHelpContext(getRootPane(), helpTopic); 233 234 getContentPane().setLayout(new BorderLayout()); -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java
r9602 r10035 17 17 import javax.swing.JDialog; 18 18 import javax.swing.JLabel; 19 import javax.swing.JOptionPane;20 19 import javax.swing.JPanel; 21 20 import javax.swing.KeyStroke; … … 29 28 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 30 29 import org.openstreetmap.josm.gui.help.HelpUtil; 30 import org.openstreetmap.josm.gui.util.GuiHelper; 31 31 import org.openstreetmap.josm.tools.ImageProvider; 32 32 … … 49 49 */ 50 50 public HistoryBrowserDialog(History history) { 51 super( JOptionPane.getFrameForComponent(Main.parent), false);51 super(GuiHelper.getFrameForComponent(Main.parent), false); 52 52 build(); 53 53 setHistory(history); -
trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java
r9543 r10035 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; … … 32 31 import org.openstreetmap.josm.data.osm.Changeset; 33 32 import org.openstreetmap.josm.gui.SideButton; 33 import org.openstreetmap.josm.gui.util.GuiHelper; 34 34 import org.openstreetmap.josm.tools.ImageProvider; 35 35 import org.openstreetmap.josm.tools.InputMapUtils; … … 111 111 */ 112 112 public CloseChangesetDialog() { 113 super( JOptionPane.getFrameForComponent(Main.parent), ModalityType.DOCUMENT_MODAL);113 super(GuiHelper.getFrameForComponent(Main.parent), ModalityType.DOCUMENT_MODAL); 114 114 build(); 115 115 } -
trunk/src/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTask.java
r9078 r10035 18 18 import org.openstreetmap.josm.gui.JosmUserIdentityManager; 19 19 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 20 import org.openstreetmap.josm.gui.util.GuiHelper; 20 21 import org.openstreetmap.josm.io.ChangesetQuery; 21 22 import org.openstreetmap.josm.io.OsmServerChangesetReader; … … 59 60 if (JosmUserIdentityManager.getInstance().isAnonymous()) { 60 61 JOptionPane.showMessageDialog( 61 JOptionPane.getFrameForComponent(parent),62 GuiHelper.getFrameForComponent(parent), 62 63 "<html>" + tr("Could not retrieve the list of your open changesets because<br>" 63 64 + "JOSM does not know your identity.<br>" -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
r9556 r10035 140 140 141 141 public SaveLayersDialog(Component parent) { 142 super( JOptionPane.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL);142 super(GuiHelper.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL); 143 143 build(); 144 144 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r9759 r10035 51 51 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 52 52 import org.openstreetmap.josm.gui.help.HelpUtil; 53 import org.openstreetmap.josm.gui.util.GuiHelper; 53 54 import org.openstreetmap.josm.io.OsmApi; 54 55 import org.openstreetmap.josm.tools.GBC; … … 101 102 */ 102 103 public UploadDialog() { 103 super( JOptionPane.getFrameForComponent(Main.parent), ModalityType.DOCUMENT_MODAL);104 super(GuiHelper.getFrameForComponent(Main.parent), ModalityType.DOCUMENT_MODAL); 104 105 build(); 105 106 } -
trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java
r9543 r10035 24 24 import javax.swing.JLabel; 25 25 import javax.swing.JList; 26 import javax.swing.JOptionPane;27 26 import javax.swing.JPanel; 28 27 import javax.swing.JScrollPane; … … 41 40 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 42 41 import org.openstreetmap.josm.gui.help.HelpUtil; 42 import org.openstreetmap.josm.gui.util.GuiHelper; 43 43 import org.openstreetmap.josm.tools.ImageProvider; 44 44 import org.openstreetmap.josm.tools.WindowGeometry; … … 61 61 */ 62 62 public UploadSelectionDialog() { 63 super( JOptionPane.getFrameForComponent(Main.parent), ModalityType.DOCUMENT_MODAL);63 super(GuiHelper.getFrameForComponent(Main.parent), ModalityType.DOCUMENT_MODAL); 64 64 build(); 65 65 } -
trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java
r9960 r10035 29 29 import javax.swing.JDialog; 30 30 import javax.swing.JLabel; 31 import javax.swing.JOptionPane;32 31 import javax.swing.JPanel; 33 32 import javax.swing.JScrollPane; … … 256 255 */ 257 256 public OAuthAuthorizationWizard(Component parent, String apiUrl, Executor executor) { 258 super( JOptionPane.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL);257 super(GuiHelper.getFrameForComponent(parent), ModalityType.DOCUMENT_MODAL); 259 258 CheckParameterUtil.ensureParameterNotNull(apiUrl, "apiUrl"); 260 259 this.apiUrl = apiUrl; -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r9576 r10035 22 22 import javax.swing.JComponent; 23 23 import javax.swing.JDialog; 24 import javax.swing.JOptionPane;25 24 import javax.swing.JPanel; 26 25 import javax.swing.KeyStroke; … … 79 78 80 79 public PreferenceDialog(Component parent) { 81 super( JOptionPane.getFrameForComponent(parent), tr("Preferences"), ModalityType.DOCUMENT_MODAL);80 super(GuiHelper.getFrameForComponent(parent), tr("Preferences"), ModalityType.DOCUMENT_MODAL); 82 81 build(); 83 82 this.setMinimumSize(new Dimension(600, 350)); -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r10024 r10035 904 904 .createFileChooser(true, null, Arrays.asList(ff, FileFilterAllFiles.getInstance()), ff, JFileChooser.FILES_ONLY); 905 905 prepareFileChooser(tfURL.getText(), fcm.getFileChooser()); 906 AbstractFileChooser fc = fcm.openFileChooser( JOptionPane.getFrameForComponent(SourceEditor.this));906 AbstractFileChooser fc = fcm.openFileChooser(GuiHelper.getFrameForComponent(SourceEditor.this)); 907 907 if (fc != null) { 908 908 tfURL.setText(fc.getSelectedFile().toString()); … … 1634 1634 } 1635 1635 prepareFileChooser(tfFileName.getText(), fcm.getFileChooser()); 1636 AbstractFileChooser fc = fcm.openFileChooser( JOptionPane.getFrameForComponent(SourceEditor.this));1636 AbstractFileChooser fc = fcm.openFileChooser(GuiHelper.getFrameForComponent(SourceEditor.this)); 1637 1637 if (fc != null) { 1638 1638 tfFileName.setText(fc.getSelectedFile().toString()); -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java
r9759 r10035 105 105 final PrefEntry e = (PrefEntry) model.getValueAt(getSelectedRow(), 1); 106 106 Setting<?> stg = e.getValue(); 107 boolean ok = false; 107 108 if (stg instanceof StringSetting) { 108 109 editCellAt(getSelectedRow(), 1); … … 112 113 } 113 114 } else if (stg instanceof ListSetting) { 114 ListSetting lSetting = (ListSetting) stg; 115 ListEditor lEditor = new ListEditor(gui, e, lSetting); 116 lEditor.showDialog(); 117 if (lEditor.getValue() == 1) { 118 List<String> data = lEditor.getData(); 119 if (!lSetting.equalVal(data)) { 120 e.setValue(new ListSetting(data)); 121 return true; 122 } 123 } 115 ok = doEditList(gui, e, (ListSetting) stg); 124 116 } else if (stg instanceof ListListSetting) { 125 ListListSetting llSetting = (ListListSetting) stg; 126 ListListEditor llEditor = new ListListEditor(gui, e, llSetting); 127 llEditor.showDialog(); 128 if (llEditor.getValue() == 1) { 129 List<List<String>> data = llEditor.getData(); 130 if (!llSetting.equalVal(data)) { 131 e.setValue(new ListListSetting(data)); 132 return true; 133 } 134 } 117 ok = doEditListList(gui, e, (ListListSetting) stg); 135 118 } else if (stg instanceof MapListSetting) { 136 MapListSetting mlSetting = (MapListSetting) stg; 137 MapListEditor mlEditor = new MapListEditor(gui, e, mlSetting); 138 mlEditor.showDialog(); 139 if (mlEditor.getValue() == 1) { 140 List<Map<String, String>> data = mlEditor.getData(); 141 if (!mlSetting.equalVal(data)) { 142 e.setValue(new MapListSetting(data)); 143 return true; 144 } 119 ok = doEditMapList(gui, e, (MapListSetting) stg); 120 } 121 return ok; 122 } 123 124 static boolean doEditList(final JComponent gui, final PrefEntry e, ListSetting lSetting) { 125 ListEditor lEditor = new ListEditor(gui, e, lSetting); 126 lEditor.showDialog(); 127 if (lEditor.getValue() == 1) { 128 List<String> data = lEditor.getData(); 129 if (!lSetting.equalVal(data)) { 130 e.setValue(new ListSetting(data)); 131 return true; 132 } 133 } 134 return false; 135 } 136 137 static boolean doEditListList(final JComponent gui, final PrefEntry e, ListListSetting llSetting) { 138 ListListEditor llEditor = new ListListEditor(gui, e, llSetting); 139 llEditor.showDialog(); 140 if (llEditor.getValue() == 1) { 141 List<List<String>> data = llEditor.getData(); 142 if (!llSetting.equalVal(data)) { 143 e.setValue(new ListListSetting(data)); 144 return true; 145 } 146 } 147 return false; 148 } 149 150 static boolean doEditMapList(final JComponent gui, final PrefEntry e, MapListSetting mlSetting) { 151 MapListEditor mlEditor = new MapListEditor(gui, e, mlSetting); 152 mlEditor.showDialog(); 153 if (mlEditor.getValue() == 1) { 154 List<Map<String, String>> data = mlEditor.getData(); 155 if (!mlSetting.equalVal(data)) { 156 e.setValue(new MapListSetting(data)); 157 return true; 145 158 } 146 159 } … … 190 203 StringSetting sSetting = new StringSetting(null); 191 204 pe = new PrefEntry(tkey.getText(), sSetting, sSetting, false); 192 StringEditor sEditor = new StringEditor(gui, pe, sSetting); 193 sEditor.showDialog(); 194 if (sEditor.getValue() == 1) { 195 String data = sEditor.getData(); 196 if (!Objects.equals(sSetting.getValue(), data)) { 197 pe.setValue(new StringSetting(data)); 198 ok = true; 199 } 200 } 205 ok = doAddSimple(gui, pe, sSetting); 201 206 } else if (rbList.isSelected()) { 202 207 ListSetting lSetting = new ListSetting(null); 203 208 pe = new PrefEntry(tkey.getText(), lSetting, lSetting, false); 204 ListEditor lEditor = new ListEditor(gui, pe, lSetting); 205 lEditor.showDialog(); 206 if (lEditor.getValue() == 1) { 207 List<String> data = lEditor.getData(); 208 if (!lSetting.equalVal(data)) { 209 pe.setValue(new ListSetting(data)); 210 ok = true; 211 } 212 } 209 ok = doAddList(gui, pe, lSetting); 213 210 } else if (rbListList.isSelected()) { 214 211 ListListSetting llSetting = new ListListSetting(null); 215 212 pe = new PrefEntry(tkey.getText(), llSetting, llSetting, false); 216 ListListEditor llEditor = new ListListEditor(gui, pe, llSetting); 217 llEditor.showDialog(); 218 if (llEditor.getValue() == 1) { 219 List<List<String>> data = llEditor.getData(); 220 if (!llSetting.equalVal(data)) { 221 pe.setValue(new ListListSetting(data)); 222 ok = true; 223 } 224 } 213 ok = doAddListList(gui, pe, llSetting); 225 214 } else if (rbMapList.isSelected()) { 226 215 MapListSetting mlSetting = new MapListSetting(null); 227 216 pe = new PrefEntry(tkey.getText(), mlSetting, mlSetting, false); 228 MapListEditor mlEditor = new MapListEditor(gui, pe, mlSetting); 229 mlEditor.showDialog(); 230 if (mlEditor.getValue() == 1) { 231 List<Map<String, String>> data = mlEditor.getData(); 232 if (!mlSetting.equalVal(data)) { 233 pe.setValue(new MapListSetting(data)); 234 ok = true; 235 } 236 } 237 } 238 } 239 if (ok) 240 return pe; 241 else 242 return null; 217 ok = doAddMapList(gui, pe, mlSetting); 218 } 219 } 220 return ok ? pe : null; 221 } 222 223 static boolean doAddSimple(final JComponent gui, PrefEntry pe, StringSetting sSetting) { 224 StringEditor sEditor = new StringEditor(gui, pe, sSetting); 225 sEditor.showDialog(); 226 if (sEditor.getValue() == 1) { 227 String data = sEditor.getData(); 228 if (!Objects.equals(sSetting.getValue(), data)) { 229 pe.setValue(new StringSetting(data)); 230 return true; 231 } 232 } 233 return false; 234 } 235 236 static boolean doAddList(final JComponent gui, PrefEntry pe, ListSetting lSetting) { 237 ListEditor lEditor = new ListEditor(gui, pe, lSetting); 238 lEditor.showDialog(); 239 if (lEditor.getValue() == 1) { 240 List<String> data = lEditor.getData(); 241 if (!lSetting.equalVal(data)) { 242 pe.setValue(new ListSetting(data)); 243 return true; 244 } 245 } 246 return false; 247 } 248 249 static boolean doAddListList(final JComponent gui, PrefEntry pe, ListListSetting llSetting) { 250 ListListEditor llEditor = new ListListEditor(gui, pe, llSetting); 251 llEditor.showDialog(); 252 if (llEditor.getValue() == 1) { 253 List<List<String>> data = llEditor.getData(); 254 if (!llSetting.equalVal(data)) { 255 pe.setValue(new ListListSetting(data)); 256 return true; 257 } 258 } 259 return false; 260 } 261 262 static boolean doAddMapList(final JComponent gui, PrefEntry pe, MapListSetting mlSetting) { 263 MapListEditor mlEditor = new MapListEditor(gui, pe, mlSetting); 264 mlEditor.showDialog(); 265 if (mlEditor.getValue() == 1) { 266 List<Map<String, String>> data = mlEditor.getData(); 267 if (!mlSetting.equalVal(data)) { 268 pe.setValue(new MapListSetting(data)); 269 return true; 270 } 271 } 272 return false; 243 273 } 244 274 -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r9621 r10035 543 543 public void actionPerformed(ActionEvent e) { 544 544 String s = JOptionPane.showInputDialog( 545 JOptionPane.getFrameForComponent(PluginConfigurationSitesPanel.this),545 GuiHelper.getFrameForComponent(PluginConfigurationSitesPanel.this), 546 546 tr("Add JOSM Plugin description URL."), 547 547 tr("Enter URL"), … … 558 558 if (list.getSelectedValue() == null) { 559 559 JOptionPane.showMessageDialog( 560 JOptionPane.getFrameForComponent(PluginConfigurationSitesPanel.this),560 GuiHelper.getFrameForComponent(PluginConfigurationSitesPanel.this), 561 561 tr("Please select an entry."), 562 562 tr("Warning"), … … 584 584 if (list.getSelectedValue() == null) { 585 585 JOptionPane.showMessageDialog( 586 JOptionPane.getFrameForComponent(PluginConfigurationSitesPanel.this),586 GuiHelper.getFrameForComponent(PluginConfigurationSitesPanel.this), 587 587 tr("Please select an entry."), 588 588 tr("Warning"), -
trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java
r9231 r10035 10 10 import java.awt.event.WindowListener; 11 11 12 import javax.swing.JOptionPane;13 12 import javax.swing.SwingUtilities; 14 13 … … 17 16 import org.openstreetmap.josm.gui.MapStatus.BackgroundProgressMonitor; 18 17 import org.openstreetmap.josm.gui.PleaseWaitDialog; 18 import org.openstreetmap.josm.gui.util.GuiHelper; 19 19 20 20 public class PleaseWaitProgressMonitor extends AbstractProgressMonitor { … … 124 124 this.dialogParent = dialogParent; 125 125 } else { 126 this.dialogParent = JOptionPane.getFrameForComponent(dialogParent);126 this.dialogParent = GuiHelper.getFrameForComponent(dialogParent); 127 127 } 128 128 this.cancelable = true; … … 135 135 */ 136 136 public PleaseWaitProgressMonitor(Component dialogParent, String windowTitle) { 137 this( JOptionPane.getFrameForComponent(dialogParent));137 this(GuiHelper.getFrameForComponent(dialogParent)); 138 138 this.windowTitle = windowTitle; 139 139 } -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r10024 r10035 12 12 import java.awt.DisplayMode; 13 13 import java.awt.Font; 14 import java.awt.Frame; 14 15 import java.awt.GraphicsDevice; 15 16 import java.awt.GraphicsEnvironment; … … 509 510 }); 510 511 } 512 513 /** 514 * Returns the specified component's <code>Frame</code> without throwing exception in headless mode. 515 * 516 * @param parentComponent the <code>Component</code> to check for a <code>Frame</code> 517 * @return the <code>Frame</code> that contains the component, or <code>getRootFrame</code> 518 * if the component is <code>null</code>, or does not have a valid <code>Frame</code> parent 519 * @see JOptionPane#getFrameForComponent 520 * @see GraphicsEnvironment#isHeadless 521 * @since 10035 522 */ 523 public static Frame getFrameForComponent(Component parentComponent) { 524 if (parentComponent == null && GraphicsEnvironment.isHeadless()) { 525 return null; 526 } 527 return JOptionPane.getFrameForComponent(parentComponent); 528 } 511 529 }
Note:
See TracChangeset
for help on using the changeset viewer.