Changeset 14153 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2018-08-13T02:18:54+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 188 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r14150 r14153 13 13 import org.openstreetmap.josm.data.projection.ProjectionChangeListener; 14 14 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 15 import org.openstreetmap.josm.gui.MainApplication; 15 16 import org.openstreetmap.josm.io.FileWatcher; 16 17 import org.openstreetmap.josm.io.NetworkManager; … … 25 26 * Abstract class holding various static global variables and methods used in large parts of JOSM application. 26 27 * @since 98 28 * @deprecated Not needed anymore 27 29 */ 30 @Deprecated 28 31 public abstract class Main implements IOsmDataManager { 29 32 30 33 /** 31 34 * Global parent component for all dialogs and message boxes 32 */ 35 * @deprecated Use {@link MainApplication#getMainFrame} 36 */ 37 @Deprecated 33 38 public static Component parent; 34 39 -
trunk/src/org/openstreetmap/josm/actions/AboutAction.java
r14119 r14153 24 24 import javax.swing.JTextArea; 25 25 26 import org.openstreetmap.josm.Main;27 26 import org.openstreetmap.josm.data.Version; 28 27 import org.openstreetmap.josm.gui.ExtendedDialog; … … 136 135 137 136 GuiHelper.prepareResizeableOptionPane(panel, panel.getPreferredSize()); 138 int ret = new ExtendedDialog(Main .parent, tr("About JOSM..."), tr("OK"), tr("Report bug"))137 int ret = new ExtendedDialog(MainApplication.getMainFrame(), tr("About JOSM..."), tr("OK"), tr("Report bug")) 139 138 .setButtonIcons("ok", "bug") 140 139 .setContent(panel, false) -
trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
r13954 r14153 12 12 import javax.swing.JOptionPane; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.data.notes.Note; 16 15 import org.openstreetmap.josm.data.osm.IPrimitive; … … 88 87 }; 89 88 return 0 == HelpAwareOptionPane.showOptionDialog( 90 Main .parent,89 MainApplication.getMainFrame(), 91 90 new StringBuilder(msg).insert(0, "<html>").append("</html>").toString(), 92 91 tr("Warning"), … … 114 113 if (primitivesToShow.isEmpty() && noteToShow == null) { 115 114 JOptionPane.showMessageDialog( 116 Main .parent,115 MainApplication.getMainFrame(), 117 116 tr("Please select at least one already uploaded node, way, or relation."), 118 117 tr("Warning"), -
trunk/src/org/openstreetmap/josm/actions/AbstractMergeAction.java
r13206 r14153 15 15 import javax.swing.JPanel; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.gui.ExtendedDialog; 18 import org.openstreetmap.josm.gui.MainApplication; 19 19 import org.openstreetmap.josm.gui.layer.Layer; 20 20 import org.openstreetmap.josm.gui.widgets.JosmComboBox; … … 114 114 return targetLayers[0]; 115 115 } 116 ExtendedDialog ed = new ExtendedDialog(Main .parent, title, buttonText, tr("Cancel"));116 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), title, buttonText, tr("Cancel")); 117 117 ed.setButtonIcons(buttonIcon, "cancel"); 118 118 ed.setContent(pnl); … … 132 132 Utils.escapeReservedCharactersHTML(sourceLayer.getName())); 133 133 if (!GraphicsEnvironment.isHeadless()) { 134 JOptionPane.showMessageDialog(Main .parent, message, tr("No target layers"), JOptionPane.WARNING_MESSAGE);134 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), message, tr("No target layers"), JOptionPane.WARNING_MESSAGE); 135 135 } 136 136 } -
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r13897 r14153 21 21 import javax.swing.JScrollPane; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.data.imagery.DefaultLayer; 25 24 import org.openstreetmap.josm.data.imagery.ImageryInfo; … … 30 29 import org.openstreetmap.josm.data.imagery.WMTSTileSource.WMTSGetCapabilitiesException; 31 30 import org.openstreetmap.josm.gui.ExtendedDialog; 31 import org.openstreetmap.josm.gui.MainApplication; 32 32 import org.openstreetmap.josm.gui.layer.AlignImageryPanel; 33 33 import org.openstreetmap.josm.gui.layer.ImageryLayer; … … 52 52 static class SelectWmsLayersDialog extends ExtendedDialog { 53 53 SelectWmsLayersDialog(WMSLayerTree tree, JComboBox<String> formats) { 54 super(Main .parent, tr("Select WMS layers"), tr("Add layers"), tr("Cancel"));54 super(MainApplication.getMainFrame(), tr("Select WMS layers"), tr("Add layers"), tr("Cancel")); 55 55 final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree()); 56 56 scrollPane.setPreferredSize(new Dimension(400, 400)); … … 155 155 } else { 156 156 Logging.error(ex); 157 JOptionPane.showMessageDialog(Main .parent, ex.getMessage(), tr("Error"), JOptionPane.ERROR_MESSAGE);157 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), ex.getMessage(), tr("Error"), JOptionPane.ERROR_MESSAGE); 158 158 if (layer != null) { 159 159 getLayerManager().removeLayer(layer); … … 184 184 185 185 if (!GraphicsEnvironment.isHeadless()) { 186 ExtendedDialog dialog = new ExtendedDialog(Main.parent, tr("Select WMS layers"), tr("Add layers"), tr("Cancel")); 186 ExtendedDialog dialog = new ExtendedDialog(MainApplication.getMainFrame(), 187 tr("Select WMS layers"), tr("Add layers"), tr("Cancel")); 187 188 final JScrollPane scrollPane = new JScrollPane(tree.getLayerTree()); 188 189 scrollPane.setPreferredSize(new Dimension(400, 400)); … … 227 228 private static void handleException(Exception ex, String uiMessage, String uiTitle, String logMessage) { 228 229 if (!GraphicsEnvironment.isHeadless()) { 229 JOptionPane.showMessageDialog(Main .parent, uiMessage, uiTitle, JOptionPane.ERROR_MESSAGE);230 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), uiMessage, uiTitle, JOptionPane.ERROR_MESSAGE); 230 231 } 231 232 Logging.log(Logging.LEVEL_ERROR, logMessage, ex); -
trunk/src/org/openstreetmap/josm/actions/AddNodeAction.java
r14134 r14153 9 9 import java.util.Collections; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.command.AddCommand; 13 12 import org.openstreetmap.josm.data.UndoRedoHandler; … … 44 43 return; 45 44 46 LatLonDialog dialog = new LatLonDialog(Main .parent, tr("Add Node..."), ht("/Action/AddNode"));45 LatLonDialog dialog = new LatLonDialog(MainApplication.getMainFrame(), tr("Add Node..."), ht("/Action/AddNode")); 47 46 48 47 if (textLatLon != null) { -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r13955 r14153 21 21 import javax.swing.event.TreeSelectionListener; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.data.Bounds; 25 24 import org.openstreetmap.josm.data.DataSource; … … 85 84 if (sel.isEmpty()) { 86 85 JOptionPane.showMessageDialog( 87 Main .parent,86 MainApplication.getMainFrame(), 88 87 tr("Nothing selected to zoom to."), 89 88 tr("Information"), … … 303 302 if (sel.isEmpty()) { 304 303 JOptionPane.showMessageDialog( 305 Main .parent,304 MainApplication.getMainFrame(), 306 305 "selection".equals(mode) ? tr("Nothing selected to zoom to.") : tr("No conflicts to zoom to"), 307 306 tr("Information"), -
trunk/src/org/openstreetmap/josm/actions/CloseChangesetAction.java
r14121 r14153 14 14 import javax.swing.SwingUtilities; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.osm.Changeset; 18 17 import org.openstreetmap.josm.data.osm.ChangesetCache; … … 66 65 if (openChangesets.isEmpty()) { 67 66 JOptionPane.showMessageDialog( 68 Main .parent,67 MainApplication.getMainFrame(), 69 68 tr("There are no open changesets"), 70 69 tr("No open changesets"), -
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r14134 r14153 19 19 import javax.swing.JOptionPane; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.command.ChangeCommand; 23 22 import org.openstreetmap.josm.command.Command; … … 35 34 import org.openstreetmap.josm.data.preferences.BooleanProperty; 36 35 import org.openstreetmap.josm.gui.ExtendedDialog; 36 import org.openstreetmap.josm.gui.MainApplication; 37 37 import org.openstreetmap.josm.gui.Notification; 38 38 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog; … … 61 61 62 62 protected static boolean confirmChangeDirectionOfWays() { 63 return new ExtendedDialog(Main .parent,63 return new ExtendedDialog(MainApplication.getMainFrame(), 64 64 tr("Change directions?"), 65 65 tr("Reverse and Combine"), tr("Cancel")) -
trunk/src/org/openstreetmap/josm/actions/CopyAction.java
r13434 r14153 13 13 import javax.swing.JOptionPane; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.osm.DataSet; 17 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 76 75 protected void showEmptySelectionWarning() { 77 76 JOptionPane.showMessageDialog( 78 Main .parent,77 MainApplication.getMainFrame(), 79 78 tr("Please select something to copy."), 80 79 tr("Information"), -
trunk/src/org/openstreetmap/josm/actions/DeleteAction.java
r13434 r14153 14 14 import javax.swing.JPanel; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.command.DeleteCommand.DeletionCallback; 18 17 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; … … 132 131 return ConditionalOptionPaneUtil.showConfirmationDialog( 133 132 "delete_relations", 134 Main .parent,133 MainApplication.getMainFrame(), 135 134 msg, 136 135 tr("Delete relation?"), -
trunk/src/org/openstreetmap/josm/actions/DownloadAlongAction.java
r12675 r14153 17 17 import javax.swing.JPanel; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.actions.downloadtasks.DownloadTaskList; 20 import org.openstreetmap.josm.gui.MainApplication; 21 21 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 22 22 import org.openstreetmap.josm.gui.progress.swing.PleaseWaitProgressMonitor; … … 112 112 toDownload.size())), GBC.eol()); 113 113 if (!GraphicsEnvironment.isHeadless() && JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog( 114 Main .parent, msg, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE)) {114 MainApplication.getMainFrame(), msg, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE)) { 115 115 return; 116 116 } -
trunk/src/org/openstreetmap/josm/actions/FullscreenToggleAction.java
r14138 r14153 19 19 import javax.swing.KeyStroke; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.gui.MainApplication; 23 22 import org.openstreetmap.josm.gui.util.GuiHelper; … … 70 69 71 70 protected void setMode() { 72 JFrame frame = (JFrame) Main.parent;71 JFrame frame = MainApplication.getMainFrame(); 73 72 74 73 List<Window> visibleWindows = new ArrayList<>(); -
trunk/src/org/openstreetmap/josm/actions/GpxExportAction.java
r13210 r14153 14 14 import javax.swing.JOptionPane; 15 15 16 import org.openstreetmap.josm. Main;16 import org.openstreetmap.josm.gui.MainApplication; 17 17 import org.openstreetmap.josm.gui.io.importexport.FileExporter; 18 18 import org.openstreetmap.josm.gui.io.importexport.GpxImporter; … … 73 73 if (layer == null) { 74 74 JOptionPane.showMessageDialog( 75 Main .parent,75 MainApplication.getMainFrame(), 76 76 tr("Nothing to export. Get some data first."), 77 77 tr("Information"), -
trunk/src/org/openstreetmap/josm/actions/HelpAction.java
r14121 r14153 12 12 import javax.swing.SwingUtilities; 13 13 14 import org.openstreetmap.josm. Main;14 import org.openstreetmap.josm.gui.MainApplication; 15 15 import org.openstreetmap.josm.gui.help.HelpBrowser; 16 16 import org.openstreetmap.josm.gui.help.HelpUtil; … … 61 61 } 62 62 } else { 63 Point mouse = Main.parent.getMousePosition(); 64 topic = HelpUtil.getContextSpecificHelpTopic(SwingUtilities.getDeepestComponentAt(Main.parent, mouse.x, mouse.y)); 63 Point mouse = MainApplication.getMainFrame().getMousePosition(); 64 topic = HelpUtil.getContextSpecificHelpTopic( 65 SwingUtilities.getDeepestComponentAt(MainApplication.getMainFrame(), mouse.x, mouse.y)); 65 66 } 66 67 HelpBrowser.setUrlForHelpTopic(Optional.ofNullable(topic).orElse("/")); -
trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java
r14121 r14153 8 8 import java.awt.event.KeyEvent; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.data.osm.OsmData; 12 11 import org.openstreetmap.josm.gui.MainApplication; … … 60 59 */ 61 60 public HistoryObjectIDDialog() { 62 super(Main .parent, tr("Show history"), tr("Show history"), tr("Cancel"));61 super(MainApplication.getMainFrame(), tr("Show history"), tr("Show history"), tr("Cancel")); 63 62 setButtonIcons("dialogs/history", "cancel"); 64 63 init(); -
trunk/src/org/openstreetmap/josm/actions/ImageryAdjustAction.java
r14120 r14153 21 21 import javax.swing.JPanel; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.actions.mapmode.MapMode; 25 24 import org.openstreetmap.josm.data.coor.EastNorth; … … 249 248 */ 250 249 ImageryOffsetDialog() { 251 super(Main .parent,250 super(MainApplication.getMainFrame(), 252 251 tr("Adjust imagery offset"), 253 252 new String[] {tr("OK"), tr("Cancel")}, … … 269 268 setContent(pnl); 270 269 setupDialog(); 271 setRememberWindowGeometry(getClass().getName() + ".geometry", WindowGeometry.centerInWindow(Main.parent, getSize())); 270 setRememberWindowGeometry(getClass().getName() + ".geometry", 271 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), getSize())); 272 272 } 273 273 … … 327 327 private boolean confirmOverwriteBookmark() { 328 328 ExtendedDialog dialog = new ExtendedDialog( 329 Main .parent,329 MainApplication.getMainFrame(), 330 330 tr("Overwrite"), 331 331 tr("Overwrite"), tr("Cancel") -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r14138 r14153 16 16 import javax.swing.JPanel; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.command.Command; 20 19 import org.openstreetmap.josm.data.osm.DataSelectionListener; … … 471 470 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 472 471 operation + "_outside_nodes", 473 Main .parent,472 MainApplication.getMainFrame(), 474 473 msg, 475 474 dialogTitle, … … 485 484 boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 486 485 operation + "_incomplete", 487 Main .parent,486 MainApplication.getMainFrame(), 488 487 msg, 489 488 dialogTitle, -
trunk/src/org/openstreetmap/josm/actions/JumpToAction.java
r13761 r14153 17 17 import javax.swing.event.DocumentListener; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.Bounds; 21 20 import org.openstreetmap.josm.data.coor.LatLon; … … 57 56 static class JumpToPositionDialog extends ExtendedDialog { 58 57 JumpToPositionDialog(String[] buttons, JPanel panel) { 59 super(Main .parent, tr("Jump to Position"), buttons);58 super(MainApplication.getMainFrame(), tr("Jump to Position"), buttons); 60 59 setContent(panel); 61 60 setCancelButton(2); … … 165 164 ll = LatLonParser.parse(lat.getText() + "; " + lon.getText()); 166 165 } catch (IllegalArgumentException ex2) { 167 JOptionPane.showMessageDialog(Main .parent,166 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 168 167 tr("Could not parse Latitude, Longitude or Zoom. Please check."), 169 168 tr("Unable to parse Lon/Lat"), JOptionPane.ERROR_MESSAGE); -
trunk/src/org/openstreetmap/josm/actions/MapRectifierWMSmenuAction.java
r13123 r14153 21 21 import javax.swing.JRadioButton; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.data.imagery.ImageryInfo; 25 24 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; … … 166 165 panel.add(tfWmsUrl, GBC.eol().fill(GridBagConstraints.HORIZONTAL)); 167 166 168 ExtendedDialog diag = new ExtendedDialog(Main .parent,167 ExtendedDialog diag = new ExtendedDialog(MainApplication.getMainFrame(), 169 168 tr("Add Rectified Image"), 170 169 tr("Add Rectified Image"), tr("Cancel")) … … 223 222 224 223 // and display an error message. The while loop ensures that the dialog pops up again 225 JOptionPane.showMessageDialog(Main .parent,224 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 226 225 tr("Couldn''t match the entered link or id to the selected service. Please try again."), 227 226 tr("No valid WMS URL or id"), … … 244 243 } catch (IOException | WMSGetCapabilitiesException e) { 245 244 Logging.error(e); 246 JOptionPane.showMessageDialog(Main.parent, e.getMessage(), tr("No valid WMS URL or id"), JOptionPane.ERROR_MESSAGE); 245 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 246 e.getMessage(), tr("No valid WMS URL or id"), JOptionPane.ERROR_MESSAGE); 247 247 return; 248 248 } -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r14134 r14153 20 20 import javax.swing.JOptionPane; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.command.ChangeCommand; 24 23 import org.openstreetmap.josm.command.ChangeNodesCommand; … … 229 228 }; 230 229 HelpAwareOptionPane.showOptionDialog( 231 Main .parent,230 MainApplication.getMainFrame(), 232 231 tr("Cannot merge nodes: Would have to delete way {0} which is still used by {1}", 233 232 DefaultNameFormatter.getInstance().formatAsHtmlUnorderedList(w), -
trunk/src/org/openstreetmap/josm/actions/MoveAction.java
r14134 r14153 11 11 import javax.swing.JOptionPane; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.command.Command; 15 14 import org.openstreetmap.josm.command.MoveCommand; … … 157 156 ((MoveCommand) c).moveAgain(-distx, -disty); 158 157 JOptionPane.showMessageDialog( 159 Main .parent,158 MainApplication.getMainFrame(), 160 159 tr("Cannot move objects outside of the world."), 161 160 tr("Warning"), -
trunk/src/org/openstreetmap/josm/actions/MoveNodeAction.java
r14134 r14153 8 8 import java.util.Collection; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.command.MoveCommand; 12 11 import org.openstreetmap.josm.data.UndoRedoHandler; … … 40 39 return; 41 40 42 LatLonDialog dialog = new LatLonDialog(Main .parent, tr("Move Node..."), ht("/Action/MoveNode"));41 LatLonDialog dialog = new LatLonDialog(MainApplication.getMainFrame(), tr("Move Node..."), ht("/Action/MoveNode")); 43 42 Node n = (Node) selNodes.toArray()[0]; 44 43 dialog.setCoordinates(n.getCoor()); -
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r14138 r14153 31 31 import javax.swing.filechooser.FileFilter; 32 32 33 import org.openstreetmap.josm.Main;34 33 import org.openstreetmap.josm.data.PreferencesUtils; 35 34 import org.openstreetmap.josm.gui.HelpAwareOptionPane; … … 209 208 210 209 HelpAwareOptionPane.showMessageDialogInEDT( 211 Main .parent,210 MainApplication.getMainFrame(), 212 211 msg.toString(), 213 212 tr("Warning"), … … 233 232 234 233 HelpAwareOptionPane.showMessageDialogInEDT( 235 Main .parent,234 MainApplication.getMainFrame(), 236 235 msg.toString(), 237 236 tr("Warning"), … … 272 271 if (!chosenImporter.acceptFile(f)) { 273 272 if (f.isDirectory()) { 274 SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(Main .parent, tr(273 SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr( 275 274 "<html>Cannot open directory ''{0}''.<br>Please select a file.</html>", 276 275 f.getAbsolutePath()), tr("Open file"), JOptionPane.ERROR_MESSAGE)); -
trunk/src/org/openstreetmap/josm/actions/OpenLocationAction.java
r14134 r14153 24 24 import javax.swing.JPanel; 25 25 26 import org.openstreetmap.josm.Main;27 26 import org.openstreetmap.josm.actions.downloadtasks.DownloadGpsTask; 28 27 import org.openstreetmap.josm.actions.downloadtasks.DownloadNotesTask; … … 73 72 static class WhichTasksToPerformDialog extends ExtendedDialog { 74 73 WhichTasksToPerformDialog(JList<DownloadTask> list) { 75 super(Main .parent, tr("Which tasks to perform?"), new String[]{tr("Ok"), tr("Cancel")}, true);74 super(MainApplication.getMainFrame(), tr("Which tasks to perform?"), new String[]{tr("Ok"), tr("Cancel")}, true); 76 75 setButtonIcons("ok", "cancel"); 77 76 final JPanel pane = new JPanel(new GridLayout(2, 1)); … … 153 152 ExpertToggleAction.addVisibilitySwitcher(zoom); 154 153 155 ExtendedDialog dialog = new ExtendedDialog(Main .parent,154 ExtendedDialog dialog = new ExtendedDialog(MainApplication.getMainFrame(), 156 155 tr("Download Location"), 157 156 tr("Download URL"), tr("Cancel")) … … 165 164 dialog.pack(); 166 165 dialog.setRememberWindowGeometry(getClass().getName() + ".geometry", 167 WindowGeometry.centerInWindow(Main .parent, dialog.getPreferredSize()));166 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), dialog.getPreferredSize())); 168 167 if (dialog.showDialog().getValue() == 1) { 169 168 USE_NEW_LAYER.put(layer.isSelected()); … … 313 312 protected void warnNoSuitableTasks(final String url) { 314 313 final String details = findSummaryDocumentation(); // Explain what patterns are supported 315 HelpAwareOptionPane.showMessageDialogInEDT(Main .parent, "<html><p>" + tr(314 HelpAwareOptionPane.showMessageDialogInEDT(MainApplication.getMainFrame(), "<html><p>" + tr( 316 315 "Cannot open URL ''{0}''<br>The following download tasks accept the URL patterns shown:<br>{1}", 317 316 url, details) + "</p></html>", tr("Download Location"), JOptionPane.ERROR_MESSAGE, ht("/Action/OpenLocation")); -
trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java
r14134 r14153 21 21 import javax.swing.JOptionPane; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.command.Command; 25 24 import org.openstreetmap.josm.command.MoveCommand; … … 33 32 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 34 33 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 34 import org.openstreetmap.josm.gui.MainApplication; 35 35 import org.openstreetmap.josm.gui.Notification; 36 36 import org.openstreetmap.josm.tools.Geometry; … … 156 156 if (!ConditionalOptionPaneUtil.showConfirmationDialog( 157 157 "align_rectangular_4326", 158 Main .parent,158 MainApplication.getMainFrame(), 159 159 msg, 160 160 tr("Warning"), -
trunk/src/org/openstreetmap/josm/actions/PreferencesAction.java
r8443 r14153 8 8 import java.awt.event.KeyEvent; 9 9 10 import org.openstreetmap.josm. Main;10 import org.openstreetmap.josm.gui.MainApplication; 11 11 import org.openstreetmap.josm.gui.preferences.PreferenceDialog; 12 12 import org.openstreetmap.josm.gui.preferences.SubPreferenceSetting; … … 104 104 @Override 105 105 public void run() { 106 final PreferenceDialog p = new PreferenceDialog(Main .parent);106 final PreferenceDialog p = new PreferenceDialog(MainApplication.getMainFrame()); 107 107 if (tab != null) { 108 108 p.selectPreferencesTabByClass(tab); -
trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
r14134 r14153 27 27 import javax.swing.JSeparator; 28 28 29 import org.openstreetmap.josm.Main;30 29 import org.openstreetmap.josm.command.PurgeCommand; 31 30 import org.openstreetmap.josm.data.UndoRedoHandler; … … 34 33 import org.openstreetmap.josm.data.osm.OsmPrimitive; 35 34 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 35 import org.openstreetmap.josm.gui.MainApplication; 36 36 import org.openstreetmap.josm.gui.PrimitiveRenderer; 37 37 import org.openstreetmap.josm.gui.help.HelpUtil; … … 95 95 if (!GraphicsEnvironment.isHeadless()) { 96 96 final boolean answer = ConditionalOptionPaneUtil.showConfirmationDialog( 97 "purge", Main .parent, buildPanel(modified), tr("Confirm Purging"),97 "purge", MainApplication.getMainFrame(), buildPanel(modified), tr("Confirm Purging"), 98 98 JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_OPTION); 99 99 if (!answer) -
trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java
r14138 r14153 15 15 import javax.swing.JOptionPane; 16 16 17 import org.openstreetmap.josm. Main;17 import org.openstreetmap.josm.gui.MainApplication; 18 18 import org.openstreetmap.josm.gui.layer.Layer; 19 19 import org.openstreetmap.josm.gui.widgets.JosmTextField; … … 73 73 74 74 final JOptionPane optionPane = new InitialValueOptionPane(panel, name); 75 final JDialog dlg = optionPane.createDialog(Main .parent, tr("Rename layer"));75 final JDialog dlg = optionPane.createDialog(MainApplication.getMainFrame(), tr("Rename layer")); 76 76 dlg.setModalityType(ModalityType.DOCUMENT_MODAL); 77 77 dlg.setVisible(true); … … 104 104 } else { 105 105 JOptionPane.showMessageDialog( 106 Main .parent,106 MainApplication.getMainFrame(), 107 107 tr("Could not rename file ''{0}''", file.getPath()), 108 108 tr("Error"), … … 114 114 } 115 115 layer.rename(nameText); 116 Main .parent.repaint();116 MainApplication.getMainFrame().repaint(); 117 117 } 118 118 } -
trunk/src/org/openstreetmap/josm/actions/SaveAction.java
r13329 r14153 8 8 import java.io.File; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.gui.ExtendedDialog; 11 import org.openstreetmap.josm.gui.MainApplication; 12 12 import org.openstreetmap.josm.gui.layer.GpxLayer; 13 13 import org.openstreetmap.josm.gui.layer.Layer; … … 49 49 if (f != null && layer instanceof GpxLayer) { 50 50 ExtendedDialog dialog = new ExtendedDialog( 51 Main .parent,51 MainApplication.getMainFrame(), 52 52 tr("Overwrite"), 53 53 tr("Overwrite"), tr("Cancel")) -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r13570 r14153 15 15 import javax.swing.filechooser.FileFilter; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.data.PreferencesUtils; 19 18 import org.openstreetmap.josm.gui.ExtendedDialog; 19 import org.openstreetmap.josm.gui.MainApplication; 20 20 import org.openstreetmap.josm.gui.io.importexport.FileExporter; 21 21 import org.openstreetmap.josm.gui.layer.Layer; … … 107 107 if (!exported) { 108 108 GuiHelper.runInEDT(() -> 109 JOptionPane.showMessageDialog(Main .parent, tr("No Exporter found! Nothing saved."), tr("Warning"),109 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("No Exporter found! Nothing saved."), tr("Warning"), 110 110 JOptionPane.WARNING_MESSAGE)); 111 111 return false; … … 120 120 ((OsmDataLayer) layer).onPostSaveToFile(); 121 121 } 122 Main .parent.repaint();122 MainApplication.getMainFrame().repaint(); 123 123 } catch (IOException e) { 124 124 Logging.error(e); … … 213 213 if (file == null || file.exists()) { 214 214 return new ExtendedDialog( 215 Main .parent,215 MainApplication.getMainFrame(), 216 216 tr("Overwrite"), 217 217 tr("Overwrite"), tr("Cancel")) -
trunk/src/org/openstreetmap/josm/actions/SearchNotesDownloadAction.java
r13927 r14153 16 16 import javax.swing.JPanel; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.actions.downloadtasks.DownloadNotesTask; 20 19 import org.openstreetmap.josm.actions.downloadtasks.DownloadParams; 21 20 import org.openstreetmap.josm.gui.ExtendedDialog; 21 import org.openstreetmap.josm.gui.MainApplication; 22 22 import org.openstreetmap.josm.gui.Notification; 23 23 import org.openstreetmap.josm.gui.widgets.HistoryComboBox; … … 56 56 contentPanel.add(searchTermBox, gc); 57 57 58 ExtendedDialog ed = new ExtendedDialog(Main .parent, tr("Search for notes"), tr("Search for notes"), tr("Cancel"))58 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), tr("Search for notes"), tr("Search for notes"), tr("Cancel")) 59 59 .setContent(contentPanel) 60 60 .setButtonIcons("note_search", "cancel"); -
trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java
r14120 r14153 19 19 import javax.swing.SwingUtilities; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 23 22 import org.openstreetmap.josm.gui.HelpAwareOptionPane; … … 204 203 Logging.error(e); 205 204 HelpAwareOptionPane.showMessageDialogInEDT( 206 Main .parent,205 MainApplication.getMainFrame(), 207 206 tr("<html>Could not load session file ''{0}''.<br>Error is:<br>{1}</html>", 208 207 uri != null ? uri : file.getName(), Utils.escapeReservedCharactersHTML(e.getMessage())), -
trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java
r13761 r14153 32 32 import javax.swing.filechooser.FileFilter; 33 33 34 import org.openstreetmap.josm.Main;35 34 import org.openstreetmap.josm.gui.ExtendedDialog; 36 35 import org.openstreetmap.josm.gui.HelpAwareOptionPane; … … 171 170 Logging.error(ex); 172 171 HelpAwareOptionPane.showMessageDialogInEDT( 173 Main .parent,172 MainApplication.getMainFrame(), 174 173 tr("<html>Could not save session file ''{0}''.<br>Error is:<br>{1}</html>", 175 174 file.getName(), Utils.escapeReservedCharactersHTML(ex.getMessage())), … … 190 189 */ 191 190 public SessionSaveAsDialog() { 192 super(Main .parent, tr("Save Session"), tr("Save As"), tr("Cancel"));191 super(MainApplication.getMainFrame(), tr("Save Session"), tr("Save As"), tr("Cancel")); 193 192 initialize(); 194 193 setButtonIcons("save_as", "cancel"); 195 194 setDefaultButton(1); 196 195 setRememberWindowGeometry(getClass().getName() + ".geometry", 197 WindowGeometry.centerInWindow(Main .parent, new Dimension(350, 450)));196 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(350, 450))); 198 197 setContent(build(), false); 199 198 } -
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r14149 r14153 25 25 import java.util.stream.Collectors; 26 26 27 import org.openstreetmap.josm.Main;28 27 import org.openstreetmap.josm.data.Preferences; 29 28 import org.openstreetmap.josm.data.Version; … … 294 293 DebugTextDisplay ta = new DebugTextDisplay(text.toString()); 295 294 296 ExtendedDialog ed = new ExtendedDialog(Main .parent,295 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), 297 296 tr("Status Report"), 298 297 tr("Copy to clipboard and close"), tr("Report bug"), tr("Close")); … … 300 299 ed.setContent(ta, false); 301 300 ed.setMinimumSize(new Dimension(380, 200)); 302 ed.setPreferredSize(new Dimension(700, Main .parent.getHeight()-50));301 ed.setPreferredSize(new Dimension(700, MainApplication.getMainFrame().getHeight()-50)); 303 302 304 303 switch (ed.showDialog().getValue()) { -
trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java
r14134 r14153 20 20 import javax.swing.SwingUtilities; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.command.ChangeCommand; 24 23 import org.openstreetmap.josm.command.Command; … … 33 32 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 34 33 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 34 import org.openstreetmap.josm.gui.MainApplication; 35 35 import org.openstreetmap.josm.gui.Notification; 36 36 import org.openstreetmap.josm.spi.preferences.Config; … … 82 82 }; 83 83 return 0 == HelpAwareOptionPane.showOptionDialog( 84 Main .parent,84 MainApplication.getMainFrame(), 85 85 tr("The selection contains {0} ways. Are you sure you want to simplify them all?", numWays), 86 86 tr("Simplify ways?"), -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r14134 r14153 24 24 import javax.swing.ListSelectionModel; 25 25 26 import org.openstreetmap.josm.Main;27 26 import org.openstreetmap.josm.command.SplitWayCommand; 28 27 import org.openstreetmap.josm.data.UndoRedoHandler; … … 165 164 166 165 SegmentToKeepSelectionDialog(Way selectedWay, List<Way> newWays, Way wayToKeep, List<OsmPrimitive> selection) { 167 super(Main .parent, tr("Which way segment should reuse the history of {0}?", selectedWay.getId()),166 super(MainApplication.getMainFrame(), tr("Which way segment should reuse the history of {0}?", selectedWay.getId()), 168 167 new String[]{tr("Ok"), tr("Cancel")}, true); 169 168 -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r14134 r14153 26 26 import javax.swing.JToggleButton; 27 27 28 import org.openstreetmap.josm.Main;29 28 import org.openstreetmap.josm.command.AddCommand; 30 29 import org.openstreetmap.josm.command.ChangeCommand; … … 209 208 210 209 private PropertiesMembershipDialog(boolean preselectNew, boolean queryTags, boolean queryMemberships) { 211 super(Main .parent, tr("Tags/Memberships"), tr("Unglue"), tr("Cancel"));210 super(MainApplication.getMainFrame(), tr("Tags/Memberships"), tr("Unglue"), tr("Cancel")); 212 211 setButtonIcons("unglueways", "cancel"); 213 212 -
trunk/src/org/openstreetmap/josm/actions/UpdateSelectionAction.java
r14121 r14153 14 14 import javax.swing.JOptionPane; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.osm.DataSet; 18 17 import org.openstreetmap.josm.data.osm.DownloadPolicy; … … 137 136 if (toUpdate.isEmpty()) { 138 137 JOptionPane.showMessageDialog( 139 Main .parent,138 MainApplication.getMainFrame(), 140 139 tr("There are no selected objects to update."), 141 140 tr("Selection empty"), -
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r13568 r14153 14 14 import javax.swing.JOptionPane; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.actions.upload.ApiPreconditionCheckerHook; 18 17 import org.openstreetmap.josm.actions.upload.DiscardTagsHook; … … 163 162 protected static void alertUnresolvedConflicts(OsmDataLayer layer) { 164 163 HelpAwareOptionPane.showOptionDialog( 165 Main .parent,164 MainApplication.getMainFrame(), 166 165 tr("<html>The data to be uploaded participates in unresolved conflicts of layer ''{0}''.<br>" 167 166 + "You have to resolve them first.</html>", Utils.escapeReservedCharactersHTML(layer.getName()) … … 232 231 if (apiData.isEmpty()) { 233 232 JOptionPane.showMessageDialog( 234 Main .parent,233 MainApplication.getMainFrame(), 235 234 tr("No changes to upload."), 236 235 tr("Warning"), … … 291 290 if (MainApplication.getMap() == null) { 292 291 JOptionPane.showMessageDialog( 293 Main .parent,292 MainApplication.getMainFrame(), 294 293 tr("Nothing to upload. Get some data first."), 295 294 tr("Warning"), -
trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
r13568 r14153 16 16 import javax.swing.SwingUtilities; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.APIDataSet; 20 19 import org.openstreetmap.josm.data.osm.DataSet; … … 102 101 if (modifiedCandidates.isEmpty() && deletedCandidates.isEmpty()) { 103 102 JOptionPane.showMessageDialog( 104 Main .parent,103 MainApplication.getMainFrame(), 105 104 tr("No changes to upload."), 106 105 tr("Warning"), … … 120 119 if (toUpload.isEmpty()) { 121 120 JOptionPane.showMessageDialog( 122 Main .parent,121 MainApplication.getMainFrame(), 123 122 tr("No changes to upload."), 124 123 tr("Warning"), -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTask.java
r13849 r14153 12 12 import java.util.List; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.data.osm.Changeset; 16 15 import org.openstreetmap.josm.data.osm.ChangesetCache; 17 16 import org.openstreetmap.josm.data.osm.ChangesetDataSet; 18 17 import org.openstreetmap.josm.gui.ExceptionDialogUtil; 18 import org.openstreetmap.josm.gui.MainApplication; 19 19 import org.openstreetmap.josm.io.OsmTransferCanceledException; 20 20 import org.openstreetmap.josm.io.OsmTransferException; … … 103 103 */ 104 104 public ChangesetContentDownloadTask(int changesetId) { 105 this(Main .parent, changesetId);105 this(MainApplication.getMainFrame(), changesetId); 106 106 } 107 107 … … 113 113 */ 114 114 public ChangesetContentDownloadTask(Collection<Integer> changesetIds) { 115 this(Main .parent, changesetIds);115 this(MainApplication.getMainFrame(), changesetIds); 116 116 } 117 117 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTask.java
r10250 r14153 11 11 import java.util.Set; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.osm.Changeset; 15 14 import org.openstreetmap.josm.data.osm.ChangesetCache; 16 15 import org.openstreetmap.josm.gui.ExceptionDialogUtil; 16 import org.openstreetmap.josm.gui.MainApplication; 17 17 import org.openstreetmap.josm.io.OsmTransferException; 18 18 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 80 80 */ 81 81 public ChangesetHeaderDownloadTask(Collection<Integer> ids) { 82 this(Main .parent, ids, false);82 this(MainApplication.getMainFrame(), ids, false); 83 83 } 84 84 … … 122 122 */ 123 123 public static ChangesetHeaderDownloadTask buildTaskForChangesets(Collection<Changeset> changesets) { 124 return buildTaskForChangesets(Main .parent, changesets);124 return buildTaskForChangesets(MainApplication.getMainFrame(), changesets); 125 125 } 126 126 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTask.java
r12743 r14153 9 9 import javax.swing.JOptionPane; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.UserIdentityManager; 13 12 import org.openstreetmap.josm.data.osm.UserInfo; 13 import org.openstreetmap.josm.gui.MainApplication; 14 14 import org.openstreetmap.josm.gui.util.GuiHelper; 15 15 import org.openstreetmap.josm.io.ChangesetQuery; … … 91 91 public void run() { 92 92 JOptionPane.showMessageDialog( 93 parent != null ? parent : Main .parent,93 parent != null ? parent : MainApplication.getMainFrame(), 94 94 ExceptionUtil.explainException(lastException), 95 95 tr("Errors during download"), … … 120 120 */ 121 121 public ChangesetQueryTask(ChangesetQuery query) { 122 this(Main .parent, query);122 this(MainApplication.getMainFrame(), query); 123 123 } 124 124 -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java
r13927 r14153 13 13 import javax.swing.JOptionPane; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.Bounds; 17 16 import org.openstreetmap.josm.data.ProjectionBounds; … … 175 174 Logging.debug(e); 176 175 notesData = e.notes; 177 JOptionPane.showMessageDialog(Main .parent, "<html>"176 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), "<html>" 178 177 + trn("{0} note has been downloaded.", "{0} notes have been downloaded.", e.limit, e.limit) 179 178 + "<br>" -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java
r13612 r14153 17 17 import javax.swing.SwingUtilities; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.osm.DataSet; 21 20 import org.openstreetmap.josm.data.osm.DataSetMerger; … … 127 126 targetLayer.getConflicts().add(visitor.getConflicts()); 128 127 JOptionPane.showMessageDialog( 129 Main .parent,128 MainApplication.getMainFrame(), 130 129 trn("There was {0} conflict during import.", 131 130 "There were {0} conflicts during import.", -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r13927 r14153 22 22 import javax.swing.JOptionPane; 23 23 24 import org.openstreetmap.josm.Main;25 24 import org.openstreetmap.josm.actions.UpdateSelectionAction; 26 25 import org.openstreetmap.josm.data.Bounds; … … 190 189 191 190 int ret = HelpAwareOptionPane.showOptionDialog( 192 Main .parent,191 MainApplication.getMainFrame(), 193 192 message, 194 193 tr("Deleted or moved objects"), … … 266 265 new Notification(items.iterator().next()).setIcon(JOptionPane.WARNING_MESSAGE).show(); 267 266 } else { 268 JOptionPane.showMessageDialog(Main .parent, "<html>"267 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), "<html>" 269 268 + tr("The following errors occurred during mass download: {0}", 270 269 Utils.joinAsHtmlUnorderedList(items)) + "</html>", -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandler.java
r13849 r14153 17 17 import javax.swing.SwingUtilities; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.gui.ExceptionDialogUtil; 20 import org.openstreetmap.josm.gui.MainApplication; 21 21 import org.openstreetmap.josm.gui.Notification; 22 22 import org.openstreetmap.josm.gui.util.GuiHelper; … … 91 91 } else { 92 92 JOptionPane.showMessageDialog( 93 Main .parent,93 MainApplication.getMainFrame(), 94 94 error.toString(), 95 95 tr("Error during download"), … … 115 115 if (!GraphicsEnvironment.isHeadless()) { 116 116 SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog( 117 Main .parent,117 MainApplication.getMainFrame(), 118 118 "<html>"+Utils.joinAsHtmlUnorderedList(items)+"</html>", 119 119 tr("Errors during download"), -
trunk/src/org/openstreetmap/josm/actions/mapmode/AddNoteAction.java
r13761 r14153 10 10 import javax.swing.SwingUtilities; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.coor.LatLon; 14 13 import org.openstreetmap.josm.data.osm.NoteData; … … 72 71 map.selectMapMode(map.mapModeSelect); 73 72 74 NoteInputDialog dialog = new NoteInputDialog(Main .parent, tr("Create a new note"), tr("Create note"));73 NoteInputDialog dialog = new NoteInputDialog(MainApplication.getMainFrame(), tr("Create a new note"), tr("Create note")); 75 74 dialog.showNoteDialog(tr("Enter a detailed comment to create a note"), ImageProvider.get("dialogs/notes", "note_new")); 76 75 -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r14134 r14153 32 32 import javax.swing.SwingUtilities; 33 33 34 import org.openstreetmap.josm.Main;35 34 import org.openstreetmap.josm.actions.JosmAction; 36 35 import org.openstreetmap.josm.command.AddCommand; … … 531 530 if (n.getCoor().isOutSideWorld()) { 532 531 JOptionPane.showMessageDialog( 533 Main .parent,532 MainApplication.getMainFrame(), 534 533 tr("Cannot add a node outside of the world."), 535 534 tr("Warning"), -
trunk/src/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyAction.java
r14137 r14153 21 21 import javax.swing.JOptionPane; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.command.AddCommand; 25 24 import org.openstreetmap.josm.command.ChangeCommand; … … 416 415 // Checking if the new coordinate is outside of the world 417 416 if (mv.getLatLon(mousePos.x, mousePos.y).isOutSideWorld()) { 418 JOptionPane.showMessageDialog(Main .parent,417 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 419 418 tr("Cannot add a node outside of the world."), 420 419 tr("Warning"), JOptionPane.WARNING_MESSAGE); … … 502 501 } 503 502 } else if (candidateNode.isTagged()) { 504 JOptionPane.showMessageDialog(Main .parent,503 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 505 504 tr("Cannot delete node that has tags"), 506 505 tr("Error"), JOptionPane.ERROR_MESSAGE); -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r14138 r14153 22 22 import javax.swing.JOptionPane; 23 23 24 import org.openstreetmap.josm.Main;25 24 import org.openstreetmap.josm.actions.MergeNodesAction; 26 25 import org.openstreetmap.josm.command.AddCommand; … … 731 730 // TODO: We might use a simple notification in the lower left corner. 732 731 JOptionPane.showMessageDialog( 733 Main .parent,732 MainApplication.getMainFrame(), 734 733 tr("Cannot move objects outside of the world."), 735 734 tr("Warning"), … … 873 872 static class ConfirmMoveDialog extends ExtendedDialog { 874 873 ConfirmMoveDialog() { 875 super(Main .parent,874 super(MainApplication.getMainFrame(), 876 875 tr("Move elements"), 877 876 tr("Move them"), tr("Undo move")); -
trunk/src/org/openstreetmap/josm/actions/relation/EditRelationAction.java
r13957 r14153 12 12 import javax.swing.JOptionPane; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.data.osm.IRelation; 16 15 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 78 77 if (filteredRelations.size() > Config.getPref().getInt("warn.open.maxrelations", 5) && 79 78 /* I18N english text for value 1 makes no real sense, never called for values <= maxrel (usually 5) */ 80 JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(Main .parent,79 JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(MainApplication.getMainFrame(), 81 80 "<html>"+trn("You are about to open <b>{0}</b> different relation editor simultaneously.<br/>Do you want to continue?", 82 81 "You are about to open <b>{0}</b> different relation editors simultaneously.<br/>Do you want to continue?", -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r13950 r14153 40 40 import javax.swing.text.JTextComponent; 41 41 42 import org.openstreetmap.josm.Main;43 42 import org.openstreetmap.josm.actions.ActionParameter; 44 43 import org.openstreetmap.josm.actions.ExpertToggleAction; … … 400 399 401 400 ExtendedDialog dialog = new ExtendedDialog( 402 Main .parent,401 MainApplication.getMainFrame(), 403 402 initialValues instanceof Filter ? tr("Filter") : tr("Search"), 404 403 initialValues instanceof Filter ? tr("Submit filter") : tr("Start Search"), … … 419 418 Logging.debug(e); 420 419 JOptionPane.showMessageDialog( 421 Main .parent,420 MainApplication.getMainFrame(), 422 421 "<html>" + tr("Search expression is not valid: \n\n {0}", 423 422 e.getMessage().replace("<html>", "").replace("</html>", "")).replace("\n", "<br>") + … … 835 834 Logging.debug(e); 836 835 JOptionPane.showMessageDialog( 837 Main .parent,836 MainApplication.getMainFrame(), 838 837 e.getMessage(), 839 838 tr("Error"), -
trunk/src/org/openstreetmap/josm/actions/upload/ApiPreconditionCheckerHook.java
r14121 r14153 9 9 import javax.swing.JOptionPane; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.APIDataSet; 13 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 75 74 continue; 76 75 } 77 JOptionPane.showMessageDialog(Main .parent,76 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 78 77 tr("Length of value for tag ''{0}'' on object {1} exceeds the max. allowed length {2}. Values length is {3}.", 79 78 key, Long.toString(osmPrimitive.getId()), Tagged.MAX_TAG_LENGTH, value.length() … … 90 89 ((Way) osmPrimitive).getNodesCount() > maxNodes) { 91 90 JOptionPane.showMessageDialog( 92 Main .parent,91 MainApplication.getMainFrame(), 93 92 tr("{0} nodes in way {1} exceed the max. allowed number of nodes {2}", 94 93 ((Way) osmPrimitive).getNodesCount(), -
trunk/src/org/openstreetmap/josm/actions/upload/RelationUploadOrderHook.java
r13564 r14153 16 16 import javax.swing.table.DefaultTableModel; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.APIDataSet; 20 19 import org.openstreetmap.josm.data.osm.CyclicUploadDependencyException; 21 20 import org.openstreetmap.josm.data.osm.Relation; 22 21 import org.openstreetmap.josm.gui.ExtendedDialog; 22 import org.openstreetmap.josm.gui.MainApplication; 23 23 import org.openstreetmap.josm.gui.PrimitiveRenderer; 24 24 import org.openstreetmap.josm.gui.util.WindowGeometry; … … 80 80 JPanel pnl = buildWarningPanel(dep); 81 81 ExtendedDialog dialog = new ExtendedDialog( 82 Main .parent,82 MainApplication.getMainFrame(), 83 83 tr("Cycling dependencies"), 84 84 tr("OK") … … 88 88 dialog.setRememberWindowGeometry( 89 89 getClass().getName() + ".geometry", 90 WindowGeometry.centerInWindow(Main .parent, new Dimension(300, 300))90 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(300, 300)) 91 91 ); 92 92 dialog.showDialog(); -
trunk/src/org/openstreetmap/josm/actions/upload/ValidateUploadHook.java
r13893 r14153 13 13 import javax.swing.JScrollPane; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.APIDataSet; 17 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 144 143 p.add(new JScrollPane(errorPanel), GBC.eol().fill(GBC.BOTH)); 145 144 146 ExtendedDialog ed = new ExtendedDialog(Main .parent,145 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), 147 146 tr("Suspicious data found. Upload anyway?"), 148 147 tr("Continue upload"), tr("Cancel")) -
trunk/src/org/openstreetmap/josm/command/conflict/ConflictAddCommand.java
r14143 r14153 10 10 import javax.swing.JOptionPane; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.command.Command; 14 13 import org.openstreetmap.josm.data.conflict.Conflict; … … 17 16 import org.openstreetmap.josm.data.osm.OsmDataManager; 18 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 import org.openstreetmap.josm.gui.MainApplication; 19 19 import org.openstreetmap.josm.tools.ImageProvider; 20 20 import org.openstreetmap.josm.tools.Logging; … … 41 41 protected void warnBecauseOfDoubleConflict() { 42 42 JOptionPane.showMessageDialog( 43 Main .parent,43 MainApplication.getMainFrame(), 44 44 tr("<html>Layer ''{0}'' already has a conflict for object<br>" 45 45 + "''{1}''.<br>" -
trunk/src/org/openstreetmap/josm/corrector/ReverseWayNoTagCorrector.java
r12663 r14153 10 10 import javax.swing.JOptionPane; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 14 13 import org.openstreetmap.josm.data.osm.Tag; … … 17 16 import org.openstreetmap.josm.data.osm.Way; 18 17 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 18 import org.openstreetmap.josm.gui.MainApplication; 19 19 import org.openstreetmap.josm.tools.UserCancelException; 20 20 import org.openstreetmap.josm.tools.Utils; … … 91 91 int ret = ConditionalOptionPaneUtil.showOptionDialog( 92 92 "reverse_directional_way", 93 Main .parent,93 MainApplication.getMainFrame(), 94 94 msg, 95 95 tr("Reverse directional way."), -
trunk/src/org/openstreetmap/josm/corrector/TagCorrector.java
r13158 r14153 20 20 import javax.swing.JScrollPane; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.command.ChangeCommand; 24 23 import org.openstreetmap.josm.command.ChangeRelationMemberRoleCommand; … … 32 31 import org.openstreetmap.josm.data.osm.Relation; 33 32 import org.openstreetmap.josm.data.osm.Way; 33 import org.openstreetmap.josm.gui.MainApplication; 34 34 import org.openstreetmap.josm.gui.correction.RoleCorrectionTable; 35 35 import org.openstreetmap.josm.gui.correction.TagCorrectionTable; … … 150 150 151 151 int answer = JOptionPane.showOptionDialog( 152 Main .parent,152 MainApplication.getMainFrame(), 153 153 p, 154 154 tr("Automatic tag correction"), -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r14149 r14153 34 34 import javax.xml.stream.XMLStreamException; 35 35 36 import org.openstreetmap.josm.Main;37 36 import org.openstreetmap.josm.data.preferences.ColorInfo; 38 37 import org.openstreetmap.josm.data.preferences.JosmBaseDirectories; … … 40 39 import org.openstreetmap.josm.data.preferences.PreferencesReader; 41 40 import org.openstreetmap.josm.data.preferences.PreferencesWriter; 41 import org.openstreetmap.josm.gui.MainApplication; 42 42 import org.openstreetmap.josm.io.OfflineAccessException; 43 43 import org.openstreetmap.josm.io.OnlineResource; … … 454 454 if (!GraphicsEnvironment.isHeadless()) { 455 455 JOptionPane.showMessageDialog( 456 Main .parent,456 MainApplication.getMainFrame(), 457 457 tr("<html>Failed to initialize preferences.<br>Preference directory ''{0}'' is not a directory.</html>", 458 458 prefDir.getAbsoluteFile()), … … 469 469 if (!GraphicsEnvironment.isHeadless()) { 470 470 JOptionPane.showMessageDialog( 471 Main .parent,471 MainApplication.getMainFrame(), 472 472 tr("<html>Failed to initialize preferences.<br>Failed to create missing preference directory: {0}</html>", 473 473 prefDir.getAbsoluteFile()), … … 497 497 if (!GraphicsEnvironment.isHeadless()) { 498 498 JOptionPane.showMessageDialog( 499 Main .parent,499 MainApplication.getMainFrame(), 500 500 tr("<html>Failed to initialize preferences.<br>Failed to reset preference file to default: {0}</html>", 501 501 getPreferenceFile().getAbsoluteFile()), … … 514 514 if (!GraphicsEnvironment.isHeadless()) { 515 515 JOptionPane.showMessageDialog( 516 Main .parent,516 MainApplication.getMainFrame(), 517 517 tr("<html>Preferences file had errors.<br> Making backup of old one to <br>{0}<br> " + 518 518 "and creating a new default preference file.</html>", -
trunk/src/org/openstreetmap/josm/data/PreferencesUtils.java
r12894 r14153 18 18 import javax.swing.JOptionPane; 19 19 20 import org.openstreetmap.josm. Main;20 import org.openstreetmap.josm.gui.MainApplication; 21 21 import org.openstreetmap.josm.spi.preferences.IPreferences; 22 22 import org.openstreetmap.josm.spi.preferences.ListListSetting; … … 270 270 log("Warning: Unknown default value of %s , skipped\n", key); 271 271 JOptionPane.showMessageDialog( 272 Main .parent,272 MainApplication.getMainFrame(), 273 273 tr("<html>Settings file asks to append preferences to <b>{0}</b>,<br/> "+ 274 274 "but its default value is unknown at this moment.<br/> " + -
trunk/src/org/openstreetmap/josm/data/imagery/WMTSTileSource.java
r14120 r14153 43 43 import org.openstreetmap.gui.jmapviewer.interfaces.TemplatedTileSource; 44 44 import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource; 45 import org.openstreetmap.josm.Main;46 45 import org.openstreetmap.josm.data.ProjectionBounds; 47 46 import org.openstreetmap.josm.data.coor.EastNorth; … … 53 52 import org.openstreetmap.josm.data.projection.Projections; 54 53 import org.openstreetmap.josm.gui.ExtendedDialog; 54 import org.openstreetmap.josm.gui.MainApplication; 55 55 import org.openstreetmap.josm.gui.layer.NativeScaleLayer.ScaleList; 56 56 import org.openstreetmap.josm.gui.layer.imagery.WMTSLayerSelection; … … 281 281 282 282 SelectLayerDialog(Collection<Layer> layers) { 283 super(Main .parent, tr("Select WMTS layer"), tr("Add layers"), tr("Cancel"));283 super(MainApplication.getMainFrame(), tr("Select WMTS layer"), tr("Add layers"), tr("Cancel")); 284 284 this.list = new WMTSLayerSelection(groupLayersByNameAndTileMatrixSet(layers)); 285 285 setContent(list); -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java
r12881 r14153 12 12 import java.util.stream.Collectors; 13 13 14 import org.openstreetmap.josm.data.UserIdentityManager; 15 import org.openstreetmap.josm.spi.preferences.Config; 14 16 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent; 15 17 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener; 16 import org.openstreetmap.josm.data.UserIdentityManager;17 import org.openstreetmap.josm.spi.preferences.Config;18 18 import org.openstreetmap.josm.tools.SubclassFilteredCollection; 19 19 -
trunk/src/org/openstreetmap/josm/data/osm/FilterModel.java
r14143 r14153 16 16 import javax.swing.JOptionPane; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.data.StructUtils; 20 19 import org.openstreetmap.josm.data.osm.Filter.FilterPreferenceEntry; … … 56 55 Logging.error(e); 57 56 JOptionPane.showMessageDialog( 58 Main .parent,57 MainApplication.getMainFrame(), 59 58 tr("<html>Error in filter <code>{0}</code>:<br>{1}", 60 59 Utils.escapeReservedCharactersHTML(Utils.shortenString(filter.text, 80)), -
trunk/src/org/openstreetmap/josm/data/preferences/CachedProperty.java
r12881 r14153 2 2 package org.openstreetmap.josm.data.preferences; 3 3 4 import org.openstreetmap.josm.spi.preferences.Config; 4 5 import org.openstreetmap.josm.spi.preferences.PreferenceChangeEvent; 5 6 import org.openstreetmap.josm.spi.preferences.PreferenceChangedListener; 6 import org.openstreetmap.josm.spi.preferences.Config;7 7 8 8 /** -
trunk/src/org/openstreetmap/josm/data/preferences/JosmBaseDirectories.java
r14138 r14153 10 10 import javax.swing.JOptionPane; 11 11 12 import org.openstreetmap.josm. Main;12 import org.openstreetmap.josm.gui.MainApplication; 13 13 import org.openstreetmap.josm.spi.preferences.Config; 14 14 import org.openstreetmap.josm.spi.preferences.IBaseDirectories; … … 73 73 if (!GraphicsEnvironment.isHeadless()) { 74 74 JOptionPane.showMessageDialog( 75 Main .parent,75 MainApplication.getMainFrame(), 76 76 tr("<html>Failed to create missing preferences directory: {0}</html>", preferencesDir.getAbsoluteFile()), 77 77 tr("Error"), … … 106 106 if (!GraphicsEnvironment.isHeadless()) { 107 107 JOptionPane.showMessageDialog( 108 Main .parent,108 MainApplication.getMainFrame(), 109 109 tr("<html>Failed to create missing user data directory: {0}</html>", userdataDir.getAbsoluteFile()), 110 110 tr("Error"), … … 144 144 if (!GraphicsEnvironment.isHeadless()) { 145 145 JOptionPane.showMessageDialog( 146 Main .parent,146 MainApplication.getMainFrame(), 147 147 tr("<html>Failed to create missing cache directory: {0}</html>", cacheDir.getAbsoluteFile()), 148 148 tr("Error"), -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r14120 r14153 29 29 import javax.swing.JOptionPane; 30 30 31 import org.openstreetmap.josm.Main;32 31 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper; 33 32 import org.openstreetmap.josm.data.projection.ProjectionRegistry; … … 407 406 if (!GraphicsEnvironment.isHeadless()) { 408 407 GuiHelper.runInEDT(() -> 409 JOptionPane.showMessageDialog(Main .parent, message, tr("Error"), JOptionPane.ERROR_MESSAGE)408 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), message, tr("Error"), JOptionPane.ERROR_MESSAGE) 410 409 ); 411 410 } -
trunk/src/org/openstreetmap/josm/gui/DownloadParamType.java
r13050 r14153 16 16 import javax.swing.JOptionPane; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.actions.OpenLocationAction; 20 19 import org.openstreetmap.josm.data.Bounds; … … 40 39 if (b == null) { 41 40 JOptionPane.showMessageDialog( 42 Main .parent,41 MainApplication.getMainFrame(), 43 42 tr("Ignoring malformed URL: \"{0}\"", s), 44 43 tr("Warning"), … … 60 59 Logging.warn(e); 61 60 JOptionPane.showMessageDialog( 62 Main .parent,61 MainApplication.getMainFrame(), 63 62 tr("Ignoring malformed file URL: \"{0}\"", s), 64 63 tr("Warning"), … … 127 126 if (!GraphicsEnvironment.isHeadless()) { 128 127 JOptionPane.showMessageDialog( 129 Main .parent,128 MainApplication.getMainFrame(), 130 129 tr("Parameter \"downloadgps\" does not accept file names or file URLs"), 131 130 tr("Warning"), -
trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
r13849 r14153 15 15 import javax.swing.JOptionPane; 16 16 17 import org.openstreetmap.josm.Main;18 17 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 18 import org.openstreetmap.josm.gui.widgets.HtmlPanel; … … 50 49 public static void explainOsmApiInitializationException(OsmApiInitializationException e) { 51 50 HelpAwareOptionPane.showOptionDialog( 52 Main .parent,51 MainApplication.getMainFrame(), 53 52 ExceptionUtil.explainOsmApiInitializationException(e), 54 53 tr("Error"), … … 65 64 public static void explainChangesetClosedException(ChangesetClosedException e) { 66 65 HelpAwareOptionPane.showOptionDialog( 67 Main .parent,66 MainApplication.getMainFrame(), 68 67 ExceptionUtil.explainChangesetClosedException(e), 69 68 tr("Error"), … … 80 79 public static void explainPreconditionFailed(OsmApiException e) { 81 80 HelpAwareOptionPane.showOptionDialog( 82 Main .parent,81 MainApplication.getMainFrame(), 83 82 ExceptionUtil.explainPreconditionFailed(e), 84 83 tr("Precondition violation"), … … 108 107 public static void explainSecurityException(OsmTransferException e) { 109 108 HelpAwareOptionPane.showOptionDialog( 110 Main .parent,109 MainApplication.getMainFrame(), 111 110 ExceptionUtil.explainSecurityException(e), 112 111 tr("Security exception"), … … 126 125 public static void explainNestedSocketException(OsmTransferException e) { 127 126 HelpAwareOptionPane.showOptionDialog( 128 Main .parent,127 MainApplication.getMainFrame(), 129 128 ExceptionUtil.explainNestedSocketException(e), 130 129 tr("Network exception"), … … 144 143 public static void explainNestedIOException(OsmTransferException e) { 145 144 HelpAwareOptionPane.showOptionDialog( 146 Main .parent,145 MainApplication.getMainFrame(), 147 146 ExceptionUtil.explainNestedIOException(e), 148 147 tr("IO Exception"), … … 160 159 public static void explainNestedIllegalDataException(OsmTransferException e) { 161 160 HelpAwareOptionPane.showOptionDialog( 162 Main .parent,161 MainApplication.getMainFrame(), 163 162 ExceptionUtil.explainNestedIllegalDataException(e), 164 163 tr("Illegal Data"), … … 177 176 public static void explainNestedOfflineAccessException(OsmTransferException e) { 178 177 HelpAwareOptionPane.showOptionDialog( 179 Main .parent,178 MainApplication.getMainFrame(), 180 179 ExceptionUtil.explainOfflineAccessException(e), 181 180 tr("Offline mode"), … … 207 206 public static void explainInternalServerError(OsmTransferException e) { 208 207 HelpAwareOptionPane.showOptionDialog( 209 Main .parent,208 MainApplication.getMainFrame(), 210 209 ExceptionUtil.explainInternalServerError(e), 211 210 tr("Internal Server Error"), … … 223 222 public static void explainBadRequest(OsmApiException e) { 224 223 HelpAwareOptionPane.showOptionDialog( 225 Main .parent,224 MainApplication.getMainFrame(), 226 225 ExceptionUtil.explainBadRequest(e), 227 226 tr("Bad Request"), … … 239 238 public static void explainNotFound(OsmApiException e) { 240 239 HelpAwareOptionPane.showOptionDialog( 241 Main .parent,240 MainApplication.getMainFrame(), 242 241 ExceptionUtil.explainNotFound(e), 243 242 tr("Not Found"), … … 254 253 public static void explainConflict(OsmApiException e) { 255 254 HelpAwareOptionPane.showOptionDialog( 256 Main .parent,255 MainApplication.getMainFrame(), 257 256 ExceptionUtil.explainConflict(e), 258 257 tr("Conflict"), … … 277 276 278 277 HelpAwareOptionPane.showOptionDialog( 279 Main .parent,278 MainApplication.getMainFrame(), 280 279 msg, 281 280 tr("Authentication failed"), … … 314 313 315 314 HelpAwareOptionPane.showOptionDialog( 316 Main .parent,315 MainApplication.getMainFrame(), 317 316 msg, 318 317 tr("Authorisation Failed"), … … 330 329 public static void explainClientTimeout(OsmApiException e) { 331 330 HelpAwareOptionPane.showOptionDialog( 332 Main .parent,331 MainApplication.getMainFrame(), 333 332 ExceptionUtil.explainClientTimeout(e), 334 333 tr("Client Time Out"), … … 346 345 public static void explainBandwidthLimitExceeded(OsmApiException e) { 347 346 HelpAwareOptionPane.showOptionDialog( 348 Main .parent,347 MainApplication.getMainFrame(), 349 348 ExceptionUtil.explainBandwidthLimitExceeded(e), 350 349 tr("Bandwidth Limit Exceeded"), … … 368 367 } 369 368 HelpAwareOptionPane.showOptionDialog( 370 Main .parent,369 MainApplication.getMainFrame(), 371 370 msg, 372 371 tr("Communication with OSM server failed"), … … 384 383 public static void explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e) { 385 384 HelpAwareOptionPane.showOptionDialog( 386 Main .parent,385 MainApplication.getMainFrame(), 387 386 ExceptionUtil.explainMissingOAuthAccessTokenException(e), 388 387 tr("Authentication failed"), … … 401 400 public static void explainNestedUnkonwnHostException(OsmTransferException e) { 402 401 HelpAwareOptionPane.showOptionDialog( 403 Main .parent,402 MainApplication.getMainFrame(), 404 403 ExceptionUtil.explainNestedUnknownHostException(e), 405 404 tr("Unknown host"), … … 504 503 public static void explainGoneForUnknownPrimitive(OsmApiException e) { 505 504 HelpAwareOptionPane.showOptionDialog( 506 Main .parent,505 MainApplication.getMainFrame(), 507 506 ExceptionUtil.explainGoneForUnknownPrimitive(e), 508 507 tr("Object deleted"), -
trunk/src/org/openstreetmap/josm/gui/ExtendedDialog.java
r14121 r14153 64 64 * <pre> 65 65 * ExtendedDialog ed = new ExtendedDialog( 66 * Main .parent, tr("Dialog Title"),66 * MainApplication.getMainFrame(), tr("Dialog Title"), 67 67 * new String[] {tr("Ok"), tr("Cancel")}); 68 68 * ed.setButtonIcons(new String[] {"ok", "cancel"}); // optional -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r14149 r14153 174 174 * @author imi 175 175 */ 176 @SuppressWarnings("deprecation") 176 177 public class MainApplication extends Main { 177 178 … … 206 207 static volatile ToolbarPreferences toolbar; 207 208 208 private finalMainFrame mainFrame;209 private static MainFrame mainFrame; 209 210 210 211 /** … … 343 344 */ 344 345 public MainApplication(MainFrame mainFrame) { 345 this.mainFrame = mainFrame;346 MainApplication.mainFrame = mainFrame; 346 347 getLayerManager().addLayerChangeListener(undoRedoCleaner); 347 348 ProjectionRegistry.setboundsProvider(mainBoundsProvider); 348 Lifecycle.setShutdownSequence(new MainTermination( this));349 Lifecycle.setShutdownSequence(new MainTermination()); 349 350 } 350 351 … … 359 360 public static void askUpdateJava(String updVersion, String url, String eolDate, boolean major) { 360 361 ExtendedDialog ed = new ExtendedDialog( 361 Main.parent,362 mainFrame, 362 363 tr("Outdated Java version"), 363 364 tr("OK"), tr("Update Java"), tr("Cancel")); … … 414 415 * @since 14140 415 416 */ 416 public finalMainFrame getMainFrame() {417 public static MainFrame getMainFrame() { 417 418 return mainFrame; 418 419 } … … 1350 1351 if (!unsavedLayerFiles.isEmpty()) { 1351 1352 ExtendedDialog dialog = new ExtendedDialog( 1352 Main.parent,1353 mainFrame, 1353 1354 tr("Unsaved osm data"), 1354 1355 tr("Restore"), tr("Cancel"), tr("Discard") … … 1377 1378 if (hasErrors) { 1378 1379 ExtendedDialog ed = new ExtendedDialog( 1379 Main.parent, title,1380 mainFrame, title, 1380 1381 tr("Change proxy settings"), tr("Cancel")); 1381 1382 ed.setButtonIcons("dialogs/settings", "cancel").setCancelButton(2); … … 1435 1436 protected void realRun() throws SAXException, IOException, OsmTransferException { 1436 1437 // Wait for JOSM startup is advanced enough to load a file 1437 while ( Main.parent == null || !Main.parent.isVisible()) {1438 while (mainFrame == null || !mainFrame.isVisible()) { 1438 1439 try { 1439 1440 Thread.sleep(25); -
trunk/src/org/openstreetmap/josm/gui/MainTermination.java
r14149 r14153 6 6 import java.io.IOException; 7 7 import java.nio.file.InvalidPathException; 8 import java.util.Objects;9 8 10 9 import org.openstreetmap.josm.data.Preferences; … … 19 18 public class MainTermination implements Runnable { 20 19 21 private final MainApplication application;22 23 /**24 * Constructs a new {@code MainTermination}25 * @param application Main application. Must not be null26 */27 public MainTermination(MainApplication application) {28 this.application = Objects.requireNonNull(application);29 }30 31 20 @Override 32 21 public void run() { … … 38 27 JCSCacheManager.shutdown(); 39 28 40 if ( application.getMainFrame() != null) {41 application.getMainFrame().storeState();29 if (MainApplication.getMainFrame() != null) { 30 MainApplication.getMainFrame().storeState(); 42 31 } 43 32 if (MainApplication.getMap() != null) { -
trunk/src/org/openstreetmap/josm/gui/MapStatus.java
r13926 r14153 59 59 import javax.swing.event.PopupMenuListener; 60 60 61 import org.openstreetmap.josm.Main;62 61 import org.openstreetmap.josm.data.SystemOfMeasurement; 63 62 import org.openstreetmap.josm.data.SystemOfMeasurement.SoMChangeListener; … … 252 251 tr("The length of the new way segment being drawn."), 10, PROP_BACKGROUND_COLOR.get()); 253 252 private final ImageLabel nameText = new ImageLabel("name", 254 tr("The name of the object at the mouse pointer."), getNameLabelCharacterCount(Main.parent), PROP_BACKGROUND_COLOR.get()); 253 tr("The name of the object at the mouse pointer."), 254 getNameLabelCharacterCount(MainApplication.getMainFrame()), PROP_BACKGROUND_COLOR.get()); 255 255 private final JosmTextField helpText = new JosmTextField(); 256 256 private final JProgressBar progressBar = new JProgressBar(); … … 957 957 @Override 958 958 public void componentResized(ComponentEvent e) { 959 nameText.setCharCount(getNameLabelCharacterCount(Main .parent));959 nameText.setCharCount(getNameLabelCharacterCount(MainApplication.getMainFrame())); 960 960 revalidate(); 961 961 } -
trunk/src/org/openstreetmap/josm/gui/MenuScroller.java
r12678 r14153 28 28 import javax.swing.event.PopupMenuListener; 29 29 30 import org.openstreetmap.josm.Main;31 30 import org.openstreetmap.josm.gui.util.WindowGeometry; 32 31 import org.openstreetmap.josm.tools.Logging; … … 58 57 if (menu != null) { 59 58 // Compute max height of current screen 60 int maxHeight = WindowGeometry.getMaxDimensionOnScreen(menu).height - ((JFrame) Main .parent).getInsets().top;59 int maxHeight = WindowGeometry.getMaxDimensionOnScreen(menu).height - ((JFrame) MainApplication.getMainFrame()).getInsets().top; 61 60 62 61 // Remove top fixed part height … … 313 312 } 314 313 315 int allowedHeight = WindowGeometry.getMaxDimensionOnScreen(menu).height - ((JFrame) Main .parent).getInsets().top;314 int allowedHeight = WindowGeometry.getMaxDimensionOnScreen(menu).height - ((JFrame) MainApplication.getMainFrame()).getInsets().top; 316 315 317 316 boolean mustSCroll = allItemsHeight > allowedHeight; -
trunk/src/org/openstreetmap/josm/gui/NoteSortDialog.java
r12620 r14153 28 28 /** 29 29 * Construct a new dialog. The constructor automatically adds a "Cancel" button. 30 * @param parent - Parent component. Usually Main .parent30 * @param parent - Parent component. Usually MainApplication.getMainFrame() 31 31 * @param title - Translated text to display in the title bar of the dialog 32 32 * @param buttonText - Translated text to be shown on the action button -
trunk/src/org/openstreetmap/josm/gui/NotificationManager.java
r12637 r14153 36 36 import javax.swing.Timer; 37 37 38 import org.openstreetmap.josm.Main;39 38 import org.openstreetmap.josm.data.preferences.IntegerProperty; 40 39 import org.openstreetmap.josm.gui.help.HelpBrowser; … … 109 108 110 109 int margin = 5; 111 JFrame parentWindow = (JFrame) Main.parent;110 JFrame parentWindow = MainApplication.getMainFrame(); 112 111 Dimension size = currentNotificationPanel.getPreferredSize(); 113 112 if (parentWindow != null) { … … 117 116 if (MainApplication.isDisplayingMapView() && map.mapView.getHeight() > 0) { 118 117 MapView mv = map.mapView; 119 Point mapViewPos = SwingUtilities.convertPoint(mv.getParent(), mv.getX(), mv.getY(), Main .parent);118 Point mapViewPos = SwingUtilities.convertPoint(mv.getParent(), mv.getX(), mv.getY(), MainApplication.getMainFrame()); 120 119 x = mapViewPos.x + margin; 121 120 y = mapViewPos.y + mv.getHeight() - map.statusLine.getHeight() - size.height - margin; … … 152 151 if (currentNotificationPanel != null) { 153 152 currentNotificationPanel.setVisible(false); 154 JFrame parent = (JFrame) Main.parent;153 JFrame parent = MainApplication.getMainFrame(); 155 154 if (parent != null) { 156 155 parent.getLayeredPane().remove(currentNotificationPanel); -
trunk/src/org/openstreetmap/josm/gui/SplashScreen.java
r12678 r14153 32 32 import javax.swing.event.ChangeListener; 33 33 34 import org.openstreetmap.josm.Main;35 34 import org.openstreetmap.josm.data.Version; 36 35 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 370 369 @Override 371 370 public Component getWindowParent() { 372 return Main .parent;371 return MainApplication.getMainFrame(); 373 372 } 374 373 } -
trunk/src/org/openstreetmap/josm/gui/bbox/SlippyMapBBoxChooser.java
r13733 r14153 40 40 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 41 41 import org.openstreetmap.gui.jmapviewer.tilesources.OsmTileSource; 42 import org.openstreetmap.josm.Main;43 42 import org.openstreetmap.josm.data.Bounds; 44 43 import org.openstreetmap.josm.data.Version; … … 102 101 Logging.warn(ex); 103 102 if (ex.getMessage() != null && !ex.getMessage().isEmpty()) { 104 JOptionPane.showMessageDialog(Main .parent,103 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 105 104 ex.getMessage(), tr("Warning"), 106 105 JOptionPane.WARNING_MESSAGE); -
trunk/src/org/openstreetmap/josm/gui/bugreport/BugReportDialog.java
r14119 r14153 5 5 6 6 import java.awt.Component; 7 import java.awt.Frame;8 7 import java.awt.GridBagConstraints; 9 8 import java.awt.GridBagLayout; … … 22 21 import javax.swing.UIManager; 23 22 24 import org.openstreetmap.josm.Main;25 23 import org.openstreetmap.josm.actions.ExpertToggleAction; 24 import org.openstreetmap.josm.gui.MainApplication; 26 25 import org.openstreetmap.josm.gui.preferences.plugin.PluginPreference; 27 26 import org.openstreetmap.josm.gui.util.GuiHelper; … … 78 77 errorPanel.add(new DebugTextDisplay(statusText)); 79 78 80 JOptionPane.showMessageDialog(Main .parent, errorPanel, tr("You have encountered a bug in JOSM"),79 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), errorPanel, tr("You have encountered a bug in JOSM"), 81 80 JOptionPane.ERROR_MESSAGE); 82 81 }); … … 89 88 */ 90 89 public BugReportDialog(BugReport report) { 91 super( findParent(), tr("You have encountered a bug in JOSM"));90 super(MainApplication.getMainFrame(), tr("You have encountered a bug in JOSM")); 92 91 this.report = report; 93 92 textPanel = new DebugTextDisplay(report); … … 243 242 244 243 /** 245 * A safe way to find a matching parent frame.246 * @return The parent frame.247 */248 private static Frame findParent() {249 return (Frame) (Main.parent instanceof Frame ? Main.parent : SwingUtilities.getAncestorOfClass(Frame.class, Main.parent));250 }251 252 /**253 244 * Show the bug report for a given exception 254 245 * @param e The exception to display … … 260 251 if (e.isOutOfMemory()) { 261 252 // do not translate the string, as translation may raise an exception 262 JOptionPane.showMessageDialog(Main .parent, "JOSM is out of memory. " +253 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), "JOSM is out of memory. " + 263 254 "Strange things may happen.\nPlease restart JOSM with the -Xmx###M option,\n" + 264 255 "where ### is the number of MB assigned to JOSM (e.g. 256).\n" + … … 274 265 // Ask for restart to install new plugin 275 266 PluginPreference.notifyDownloadResults( 276 Main .parent, downloadTask, !downloadTask.getDownloadedPlugins().isEmpty());267 MainApplication.getMainFrame(), downloadTask, !downloadTask.getDownloadedPlugins().isEmpty()); 277 268 return SuppressionMode.NONE; 278 269 } -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMergeModel.java
r12661 r14153 28 28 import javax.swing.table.TableModel; 29 29 30 import org.openstreetmap.josm.Main;31 30 import org.openstreetmap.josm.command.conflict.ConflictResolveCommand; 32 31 import org.openstreetmap.josm.data.conflict.Conflict; … … 36 35 import org.openstreetmap.josm.data.osm.RelationMember; 37 36 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 37 import org.openstreetmap.josm.gui.MainApplication; 38 38 import org.openstreetmap.josm.gui.help.HelpUtil; 39 39 import org.openstreetmap.josm.gui.util.ChangeNotifier; … … 382 382 .append("</html>"); 383 383 HelpAwareOptionPane.showOptionDialog( 384 Main .parent,384 MainApplication.getMainFrame(), 385 385 sb.toString(), 386 386 tr("Merging deleted objects failed"), -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java
r12940 r14153 31 31 import javax.swing.JSplitPane; 32 32 33 import org.openstreetmap.josm.Main;34 33 import org.openstreetmap.josm.actions.ExpertToggleAction; 35 34 import org.openstreetmap.josm.command.Command; … … 41 40 import org.openstreetmap.josm.data.osm.Way; 42 41 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 42 import org.openstreetmap.josm.gui.MainApplication; 43 43 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 44 44 import org.openstreetmap.josm.gui.help.HelpUtil; … … 66 66 * Models have to be <strong>populated</strong> before the dialog is launched. Example: 67 67 * <pre> 68 * CombinePrimitiveResolverDialog dialog = new CombinePrimitiveResolverDialog(Main .parent);68 * CombinePrimitiveResolverDialog dialog = new CombinePrimitiveResolverDialog(MainApplication.getMainFrame()); 69 69 * dialog.getTagConflictResolverModel().populate(aTagCollection); 70 70 * dialog.getRelationMemberConflictResolverModel().populate(aRelationLinkCollection); … … 370 370 prepareGUIBeforeConflictResolutionStarts(); 371 371 setMinimumSize(new Dimension(400, 400)); 372 new WindowGeometry(getClass().getName() + ".geometry", WindowGeometry.centerInWindow(Main .parent,372 new WindowGeometry(getClass().getName() + ".geometry", WindowGeometry.centerInWindow(MainApplication.getMainFrame(), 373 373 new Dimension(800, 600))).applySafe(this); 374 374 setApplied(false); … … 521 521 UserCancelException canceled = GuiHelper.runInEDTAndWaitAndReturn(() -> { 522 522 // Build conflict resolution dialog 523 final CombinePrimitiveResolverDialog dialog = new CombinePrimitiveResolverDialog(Main.parent, tagModel, relModel); 523 final CombinePrimitiveResolverDialog dialog = new CombinePrimitiveResolverDialog( 524 MainApplication.getMainFrame(), tagModel, relModel); 524 525 525 526 // Ensure a proper title is displayed instead of a previous target (fix #7925) … … 580 581 if (!ConditionalOptionPaneUtil.showConfirmationDialog( 581 582 "combine_tags", 582 Main .parent,583 MainApplication.getMainFrame(), 583 584 "<html>" + msg + "</html>", 584 585 tr("Combine confirmation"), … … 614 615 if (!ConditionalOptionPaneUtil.showConfirmationDialog( 615 616 "combine_tags", 616 Main .parent,617 MainApplication.getMainFrame(), 617 618 "<html>" + msg + "</html>", 618 619 tr("Combine confirmation"), -
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java
r14134 r14153 14 14 import javax.swing.TransferHandler.TransferSupport; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.command.AddPrimitivesCommand; 18 17 import org.openstreetmap.josm.data.UndoRedoHandler; … … 26 25 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 27 26 import org.openstreetmap.josm.gui.ExtendedDialog; 27 import org.openstreetmap.josm.gui.MainApplication; 28 28 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTransferData; 29 29 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 137 137 138 138 private static boolean confirmDeleteIncomplete() { 139 ExtendedDialog ed = new ExtendedDialog(Main .parent, tr("Delete incomplete members?"),139 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), tr("Delete incomplete members?"), 140 140 tr("Paste without incomplete members"), tr("Cancel")); 141 141 ed.setButtonIcons("dialogs/relation/deletemembers", "cancel"); -
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveTagTransferPaster.java
r14143 r14153 14 14 import javax.swing.TransferHandler.TransferSupport; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.command.ChangePropertyCommand; 18 17 import org.openstreetmap.josm.command.Command; … … 25 24 import org.openstreetmap.josm.data.osm.TagCollection; 26 25 import org.openstreetmap.josm.data.osm.TagMap; 26 import org.openstreetmap.josm.gui.MainApplication; 27 27 import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog; 28 28 import org.openstreetmap.josm.gui.datatransfer.data.PrimitiveTagTransferData; … … 107 107 108 108 if (!tc.isApplicableToPrimitive()) { 109 PasteTagsConflictResolverDialog dialog = new PasteTagsConflictResolverDialog(Main .parent);109 PasteTagsConflictResolverDialog dialog = new PasteTagsConflictResolverDialog(MainApplication.getMainFrame()); 110 110 dialog.populate(tc, data.getStatistics(), getTargetStatistics()); 111 111 dialog.setVisible(true); … … 146 146 } 147 147 } else { 148 PasteTagsConflictResolverDialog dialog = new PasteTagsConflictResolverDialog(Main .parent);148 PasteTagsConflictResolverDialog dialog = new PasteTagsConflictResolverDialog(MainApplication.getMainFrame()); 149 149 dialog.populate( 150 150 data.getForPrimitives(OsmPrimitiveType.NODE), -
trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/TextTagPaster.java
r12683 r14153 16 16 import javax.swing.TransferHandler.TransferSupport; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.gui.ExtendedDialog; 19 import org.openstreetmap.josm.gui.MainApplication; 20 20 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 21 21 import org.openstreetmap.josm.gui.help.HelpUtil; … … 85 85 public static int warning(String text, String data, String code) { 86 86 ExtendedDialog ed = new ExtendedDialog( 87 Main .parent,87 MainApplication.getMainFrame(), 88 88 tr("Do you want to paste these tags?"), 89 89 tr("Ok"), tr("Cancel"), tr("Clear buffer"), tr("Ignore warnings")); … … 118 118 119 119 ExtendedDialog ed = new ExtendedDialog( 120 Main .parent,120 MainApplication.getMainFrame(), 121 121 tr("Warning"), 122 122 tr("Ok"), tr("Clear buffer")) -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictDialog.java
r14134 r14153 36 36 import javax.swing.event.PopupMenuListener; 37 37 38 import org.openstreetmap.josm.Main;39 38 import org.openstreetmap.josm.actions.AbstractSelectAction; 40 39 import org.openstreetmap.josm.actions.ExpertToggleAction; … … 205 204 206 205 Conflict<? extends OsmPrimitive> c = conflicts.get(index); 207 ConflictResolutionDialog dialog = new ConflictResolutionDialog(Main .parent);206 ConflictResolutionDialog dialog = new ConflictResolutionDialog(MainApplication.getMainFrame()); 208 207 dialog.getConflictResolver().populate(c); 209 208 dialog.showDialog(); … … 627 626 GuiHelper.runInEDT(() -> { 628 627 HelpAwareOptionPane.showOptionDialog( 629 Main .parent,628 MainApplication.getMainFrame(), 630 629 sb.toString(), 631 630 tr("Conflicts detected"), -
trunk/src/org/openstreetmap/josm/gui/dialogs/ConflictResolutionDialog.java
r14134 r14153 17 17 import javax.swing.JPanel; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.UndoRedoHandler; 21 20 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 22 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 23 22 import org.openstreetmap.josm.gui.ExtendedDialog; 23 import org.openstreetmap.josm.gui.MainApplication; 24 24 import org.openstreetmap.josm.gui.conflict.pair.ConflictResolver; 25 25 import org.openstreetmap.josm.gui.help.HelpBrowser; … … 180 180 tr("Close anyway"), 181 181 tr("Continue resolving")}; 182 int ret = JOptionPane.showOptionDialog(Main .parent,182 int ret = JOptionPane.showOptionDialog(MainApplication.getMainFrame(), 183 183 tr("<html>You did not finish to merge the differences in this conflict.<br>" 184 184 + "Conflict resolutions will not be applied unless all differences<br>" -
trunk/src/org/openstreetmap/josm/gui/dialogs/DeleteFromRelationConfirmationDialog.java
r13564 r14153 32 32 import javax.swing.table.TableColumn; 33 33 34 import org.openstreetmap.josm.Main;35 34 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 36 35 import org.openstreetmap.josm.data.osm.NameFormatter; 37 36 import org.openstreetmap.josm.data.osm.OsmPrimitive; 38 37 import org.openstreetmap.josm.data.osm.RelationToChildReference; 38 import org.openstreetmap.josm.gui.MainApplication; 39 39 import org.openstreetmap.josm.gui.PrimitiveRenderer; 40 40 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; … … 132 132 */ 133 133 public DeleteFromRelationConfirmationDialog() { 134 super(GuiHelper.getFrameForComponent(Main .parent), "", ModalityType.DOCUMENT_MODAL);134 super(GuiHelper.getFrameForComponent(MainApplication.getMainFrame()), "", ModalityType.DOCUMENT_MODAL); 135 135 build(); 136 136 } … … 164 164 getClass().getName() + ".geometry", 165 165 WindowGeometry.centerInWindow( 166 Main .parent,166 MainApplication.getMainFrame(), 167 167 new Dimension(400, 200) 168 168 ) -
trunk/src/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialog.java
r13949 r14153 21 21 import javax.swing.SingleSelectionModel; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 25 24 import org.openstreetmap.josm.data.osm.IPrimitive; … … 63 62 */ 64 63 public InspectPrimitiveDialog(final Collection<? extends IPrimitive> primitives, OsmData<?, ?, ?, ?> data) { 65 super(Main .parent, tr("Advanced object info"), tr("Close"));64 super(MainApplication.getMainFrame(), tr("Advanced object info"), tr("Close")); 66 65 this.primitives = new ArrayList<>(primitives); 67 66 setRememberWindowGeometry(getClass().getName() + ".geometry", 68 WindowGeometry.centerInWindow(Main .parent, new Dimension(750, 550)));67 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(750, 550))); 69 68 70 69 setButtonIcons("ok"); -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListPopup.java
r13130 r14153 19 19 import javax.swing.JPopupMenu; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.gui.ExtendedDialog; 22 import org.openstreetmap.josm.gui.MainApplication; 23 23 import org.openstreetmap.josm.gui.layer.Layer; 24 24 import org.openstreetmap.josm.gui.layer.Layer.LayerAction; … … 55 55 if (object instanceof Component) { 56 56 ExtendedDialog ed = new ExtendedDialog( 57 Main .parent, tr("Information about layer"),57 MainApplication.getMainFrame(), tr("Information about layer"), 58 58 tr("OK")); 59 59 ed.setButtonIcons("ok"); … … 65 65 } else { 66 66 JOptionPane.showMessageDialog( 67 Main .parent, object,67 MainApplication.getMainFrame(), object, 68 68 tr("Information about layer"), 69 69 JOptionPane.INFORMATION_MESSAGE -
trunk/src/org/openstreetmap/josm/gui/dialogs/LogShowDialog.java
r12279 r14153 11 11 import javax.swing.JScrollPane; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.gui.ExtendedDialog; 14 import org.openstreetmap.josm.gui.MainApplication; 15 15 import org.openstreetmap.josm.gui.widgets.JosmEditorPane; 16 16 import org.openstreetmap.josm.tools.GBC; … … 30 30 */ 31 31 public LogShowDialog(String title, String msg, String log) { 32 super(Main .parent, title, tr("OK"));32 super(MainApplication.getMainFrame(), title, tr("OK")); 33 33 setButtonIcons("ok"); 34 34 setContent(build(msg, log)); -
trunk/src/org/openstreetmap/josm/gui/dialogs/MapPaintDialog.java
r13647 r14153 52 52 import javax.swing.table.TableCellRenderer; 53 53 54 import org.openstreetmap.josm.Main;55 54 import org.openstreetmap.josm.actions.ExtensionFileFilter; 56 55 import org.openstreetmap.josm.actions.JosmAction; … … 539 538 return; 540 539 final StyleSource s = model.getRow(sel); 541 ExtendedDialog info = new ExtendedDialog(Main .parent, tr("Map Style info"), tr("Close"));540 ExtendedDialog info = new ExtendedDialog(MainApplication.getMainFrame(), tr("Map Style info"), tr("Close")); 542 541 info.setPreferredSize(new Dimension(600, 400)); 543 542 info.setButtonIcons("ok"); -
trunk/src/org/openstreetmap/josm/gui/dialogs/MenuItemSearchDialog.java
r13134 r14153 14 14 import javax.swing.ListCellRenderer; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.actions.JosmAction; 18 17 import org.openstreetmap.josm.gui.ExtendedDialog; … … 31 30 32 31 private MenuItemSearchDialog(MainMenu menu) { 33 super(Main .parent, tr("Search menu items"), tr("Select"), tr("Cancel"));32 super(MainApplication.getMainFrame(), tr("Search menu items"), tr("Select"), tr("Cancel")); 34 33 this.selector = new MenuItemSelector(menu); 35 34 this.selector.setDblClickListener(e -> buttonAction(0, null)); -
trunk/src/org/openstreetmap/josm/gui/dialogs/NotesDialog.java
r14119 r14153 28 28 import javax.swing.SwingUtilities; 29 29 30 import org.openstreetmap.josm.Main;31 30 import org.openstreetmap.josm.actions.DownloadNotesInViewAction; 32 31 import org.openstreetmap.josm.actions.UploadNotesAction; … … 320 319 return; 321 320 } 322 NoteInputDialog dialog = new NoteInputDialog(Main .parent, tr("Comment on note"), tr("Add comment"));321 NoteInputDialog dialog = new NoteInputDialog(MainApplication.getMainFrame(), tr("Comment on note"), tr("Add comment")); 323 322 dialog.showNoteDialog(tr("Add comment to note:"), ImageProvider.get("dialogs/notes", "note_comment")); 324 323 if (dialog.getValue() != 1) { … … 344 343 @Override 345 344 public void actionPerformed(ActionEvent e) { 346 NoteInputDialog dialog = new NoteInputDialog(Main .parent, tr("Close note"), tr("Close note"));345 NoteInputDialog dialog = new NoteInputDialog(MainApplication.getMainFrame(), tr("Close note"), tr("Close note")); 347 346 dialog.showNoteDialog(tr("Close note with message:"), ImageProvider.get("dialogs/notes", "note_closed")); 348 347 if (dialog.getValue() != 1) { … … 389 388 @Override 390 389 public void actionPerformed(ActionEvent e) { 391 NoteInputDialog dialog = new NoteInputDialog(Main .parent, tr("Reopen note"), tr("Reopen note"));390 NoteInputDialog dialog = new NoteInputDialog(MainApplication.getMainFrame(), tr("Reopen note"), tr("Reopen note")); 392 391 dialog.showNoteDialog(tr("Reopen note with message:"), ImageProvider.get("dialogs/notes", "note_open")); 393 392 if (dialog.getValue() != 1) { … … 415 414 @Override 416 415 public void actionPerformed(ActionEvent e) { 417 NoteSortDialog sortDialog = new NoteSortDialog(Main .parent, tr("Sort notes"), tr("Apply"));416 NoteSortDialog sortDialog = new NoteSortDialog(MainApplication.getMainFrame(), tr("Sort notes"), tr("Apply")); 418 417 sortDialog.showSortDialog(noteData.getCurrentSortMethod()); 419 418 if (sortDialog.getValue() == 1) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/ToggleDialog.java
r14143 r14153 48 48 import javax.swing.SwingUtilities; 49 49 50 import org.openstreetmap.josm.Main;51 50 import org.openstreetmap.josm.actions.JosmAction; 52 51 import org.openstreetmap.josm.data.preferences.BooleanProperty; … … 569 568 pref.setBorder(BorderFactory.createEmptyBorder()); 570 569 pref.addActionListener(e -> { 571 final PreferenceDialog p = new PreferenceDialog(Main .parent);570 final PreferenceDialog p = new PreferenceDialog(MainApplication.getMainFrame()); 572 571 if (TabPreferenceSetting.class.isAssignableFrom(preferenceClass)) { 573 572 p.selectPreferencesTabByClass((Class<? extends TabPreferenceSetting>) preferenceClass); … … 677 676 private class DetachedDialog extends JDialog { 678 677 DetachedDialog() { 679 super(GuiHelper.getFrameForComponent(Main .parent));678 super(GuiHelper.getFrameForComponent(MainApplication.getMainFrame())); 680 679 getContentPane().add(ToggleDialog.this); 681 680 addWindowListener(new WindowAdapter() { … … 714 713 ToggleDialog.this.setPreferredSize(ToggleDialog.this.getDefaultDetachedSize()); 715 714 pack(); 716 setLocationRelativeTo(Main .parent);715 setLocationRelativeTo(MainApplication.getMainFrame()); 717 716 } 718 717 super.setTitle(titleBar.getTitle()); -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r14134 r14153 29 29 import javax.swing.tree.TreePath; 30 30 31 import org.openstreetmap.josm.Main;32 31 import org.openstreetmap.josm.actions.AbstractSelectAction; 33 32 import org.openstreetmap.josm.actions.AutoScaleAction; … … 251 250 if (asked == JOptionPane.DEFAULT_OPTION) { 252 251 String[] a = new String[] {tr("Whole group"), tr("Single elements"), tr("Nothing")}; 253 asked = JOptionPane.showOptionDialog(Main .parent, tr("Ignore whole group or individual elements?"),252 asked = JOptionPane.showOptionDialog(MainApplication.getMainFrame(), tr("Ignore whole group or individual elements?"), 254 253 tr("Ignoring elements"), JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, null, 255 254 a, a[1]); -
trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityAction.java
r13849 r14153 34 34 import javax.swing.border.Border; 35 35 36 import org.openstreetmap.josm. Main;36 import org.openstreetmap.josm.gui.MainApplication; 37 37 import org.openstreetmap.josm.gui.SideButton; 38 38 import org.openstreetmap.josm.gui.dialogs.IEnabledStateUpdating; … … 117 117 // Action can be trigger either by opacity button or by popup menu (in case toggle buttons are hidden). 118 118 // In that case, show it in the middle of screen (because opacityButton is not visible) 119 popup.show(Main.parent, Main.parent.getWidth() / 2, (Main.parent.getHeight() - popup.getHeight()) / 2); 119 popup.show(MainApplication.getMainFrame(), 120 MainApplication.getMainFrame().getWidth() / 2, 121 (MainApplication.getMainFrame().getHeight() - popup.getHeight()) / 2); 120 122 } 121 123 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r14143 r14153 48 48 import javax.swing.table.TableRowSorter; 49 49 50 import org.openstreetmap.josm.Main;51 50 import org.openstreetmap.josm.actions.JosmAction; 52 51 import org.openstreetmap.josm.actions.relation.DownloadMembersAction; … … 1029 1028 } 1030 1029 1031 ExtendedDialog ed = new ExtendedDialog(Main .parent,1030 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), 1032 1031 tr("Change relation"), 1033 1032 tr("Delete from relation"), tr("Cancel")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/SearchBasedRowFilter.java
r12656 r14153 27 27 28 28 @Override 29 public boolean include(Entry entry) {29 public boolean include(Entry<? extends TableModel, ? extends Integer> entry) { 30 30 final String key = entry.getStringValue(0); 31 31 final String value = entry.getStringValue(1); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelper.java
r14143 r14153 62 62 import javax.swing.text.JTextComponent; 63 63 64 import org.openstreetmap.josm.Main;65 64 import org.openstreetmap.josm.actions.JosmAction; 66 65 import org.openstreetmap.josm.actions.search.SearchAction; … … 83 82 import org.openstreetmap.josm.gui.ExtendedDialog; 84 83 import org.openstreetmap.josm.gui.IExtendedDialog; 84 import org.openstreetmap.josm.gui.MainApplication; 85 85 import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils; 86 86 import org.openstreetmap.josm.gui.mappaint.MapPaintStyles; … … 351 351 Logging.warn(parseError); 352 352 JOptionPane.showMessageDialog( 353 Main .parent,353 MainApplication.getMainFrame(), 354 354 parseError.getMessage(), 355 355 tr("Error"), … … 383 383 private static boolean warnOverwriteKey(String action, String togglePref) { 384 384 return new ExtendedDialog( 385 Main .parent,385 MainApplication.getMainFrame(), 386 386 tr("Overwrite key"), 387 387 tr("Replace"), tr("Cancel")) … … 420 420 421 421 protected EditTagDialog(String key, Map<String, Integer> map, final boolean initialFocusOnKey) { 422 super(Main .parent, trn("Change value?", "Change values?", map.size()), tr("OK"), tr("Cancel"));422 super(MainApplication.getMainFrame(), trn("Change value?", "Change values?", map.size()), tr("OK"), tr("Cancel")); 423 423 setButtonIcons("ok", "cancel"); 424 424 setCancelButton(2); … … 576 576 577 577 setRememberWindowGeometry(getClass().getName() + ".geometry", 578 WindowGeometry.centerInWindow(Main .parent, size));578 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), size)); 579 579 } 580 580 … … 688 688 689 689 protected AddTagsDialog() { 690 super(Main .parent, tr("Add value?"), tr("OK"), tr("Cancel"));690 super(MainApplication.getMainFrame(), tr("Add value?"), tr("OK"), tr("Cancel")); 691 691 setButtonIcons("ok", "cancel"); 692 692 setCancelButton(2); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowser.java
r13761 r14153 30 30 import javax.swing.tree.TreePath; 31 31 32 import org.openstreetmap.josm.Main;33 32 import org.openstreetmap.josm.data.osm.DataSet; 34 33 import org.openstreetmap.josm.data.osm.DataSetMerger; … … 335 334 if (conflictsCount > 0) { 336 335 JOptionPane.showMessageDialog( 337 Main .parent,336 MainApplication.getMainFrame(), 338 337 trn("There was {0} conflict during import.", 339 338 "There were {0} conflicts during import.", … … 374 373 375 374 JOptionPane.showMessageDialog( 376 Main .parent,375 MainApplication.getMainFrame(), 377 376 message, 378 377 tr("Relation is deleted"), -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r14056 r14153 49 49 import javax.swing.KeyStroke; 50 50 51 import org.openstreetmap.josm.Main;52 51 import org.openstreetmap.josm.actions.JosmAction; 53 52 import org.openstreetmap.josm.command.ChangeCommand; … … 182 181 183 182 setRememberWindowGeometry(getClass().getName() + ".geometry", 184 WindowGeometry.centerInWindow(Main .parent, new Dimension(700, 650)));183 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(700, 650))); 185 184 186 185 final TaggingPresetHandler presetHandler = new TaggingPresetHandler() { … … 780 779 int ret = ConditionalOptionPaneUtil.showOptionDialog( 781 780 "clean_relation_self_references", 782 Main .parent,781 MainApplication.getMainFrame(), 783 782 tr("<html>There is at least one member in this relation referring<br>" 784 783 + "to the relation itself.<br>" … … 853 852 int ret = ConditionalOptionPaneUtil.showOptionDialog( 854 853 "add_primitive_to_relation", 855 Main .parent,854 MainApplication.getMainFrame(), 856 855 msg, 857 856 tr("Multiple members referring to same object."), … … 885 884 Utils.escapeReservedCharactersHTML(primitive.getDisplayName(DefaultNameFormatter.getInstance()))); 886 885 JOptionPane.showMessageDialog( 887 Main .parent,886 MainApplication.getMainFrame(), 888 887 msg, 889 888 tr("Warning"), -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/ParentRelationLoadingTask.java
r13654 r14153 12 12 import javax.swing.SwingUtilities; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.data.osm.DataSet; 16 15 import org.openstreetmap.josm.data.osm.DataSetMerger; 17 16 import org.openstreetmap.josm.data.osm.Relation; 17 import org.openstreetmap.josm.gui.MainApplication; 18 18 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 19 19 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 131 131 protected void showLastException() { 132 132 JOptionPane.showMessageDialog( 133 Main .parent,133 MainApplication.getMainFrame(), 134 134 Optional.ofNullable(lastException.getMessage()).orElseGet(lastException::toString), 135 135 tr("Error"), … … 174 174 getLayer().getConflicts().add(visitor.getConflicts()); 175 175 JOptionPane.showMessageDialog( 176 Main .parent,176 MainApplication.getMainFrame(), 177 177 tr("There were {0} conflicts during import.", 178 178 visitor.getConflicts().size()), -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/RelationEditor.java
r14029 r14153 8 8 import java.util.Collection; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.data.osm.Relation; 12 11 import org.openstreetmap.josm.data.osm.RelationMember; 13 12 import org.openstreetmap.josm.gui.ExtendedDialog; 13 import org.openstreetmap.josm.gui.MainApplication; 14 14 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 15 15 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 52 52 */ 53 53 protected RelationEditor(OsmDataLayer layer, Relation relation) { 54 super(Main .parent,54 super(MainApplication.getMainFrame(), 55 55 "", 56 56 new String[] {tr("Apply Changes"), tr("Cancel")}, -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/CancelAction.java
r14030 r14153 9 9 import javax.swing.RootPaneContainer; 10 10 11 import org.openstreetmap.josm.Main;12 11 import org.openstreetmap.josm.data.osm.Relation; 13 12 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 14 13 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 14 import org.openstreetmap.josm.gui.MainApplication; 15 15 import org.openstreetmap.josm.spi.preferences.Config; 16 16 import org.openstreetmap.josm.tools.ImageProvider; … … 83 83 84 84 return HelpAwareOptionPane.showOptionDialog( 85 Main .parent,85 MainApplication.getMainFrame(), 86 86 tr("<html>The relation has been changed.<br><br>Do you want to save your changes?</html>"), 87 87 tr("Unsaved changes"), -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/RefreshAction.java
r14138 r14153 11 11 import javax.swing.JRootPane; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.UndoRedoHandler; 15 14 import org.openstreetmap.josm.data.UndoRedoHandler.CommandQueueListener; … … 17 16 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 18 17 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 18 import org.openstreetmap.josm.gui.MainApplication; 19 19 import org.openstreetmap.josm.gui.dialogs.relation.IRelationEditor; 20 20 import org.openstreetmap.josm.tools.ImageProvider; … … 94 94 95 95 return HelpAwareOptionPane.showOptionDialog( 96 Main .parent,96 MainApplication.getMainFrame(), 97 97 tr("<html>You have unsaved changes in this editor window.<br>"+ 98 98 "<br>Do you want to discard these changes and reload data from layer?</html>"), … … 123 123 124 124 return HelpAwareOptionPane.showOptionDialog( 125 Main .parent,125 MainApplication.getMainFrame(), 126 126 tr("<html>Relation has been deleted outside editor.<br><br>Do you want to close this window?</html>"), 127 127 tr("Deleted relation"), -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SavingAction.java
r14134 r14153 11 11 import javax.swing.SwingUtilities; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.command.AddCommand; 15 14 import org.openstreetmap.josm.command.ChangeCommand; … … 62 61 String msg = tr("One or more members of this new relation have been deleted while the relation editor\n" + 63 62 "was open. They have been removed from the relation members list."); 64 JOptionPane.showMessageDialog(Main .parent, msg, tr("Warning"), JOptionPane.WARNING_MESSAGE);63 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), msg, tr("Warning"), JOptionPane.WARNING_MESSAGE); 65 64 } 66 65 // If the user wanted to create a new relation, but hasn't added any members or … … 124 123 125 124 int ret = HelpAwareOptionPane.showOptionDialog( 126 Main .parent,125 MainApplication.getMainFrame(), 127 126 tr("<html>This relation has been changed outside of the editor.<br>" 128 127 + "You cannot apply your changes and continue editing.<br>" … … 144 143 protected void warnDoubleConflict() { 145 144 JOptionPane.showMessageDialog( 146 Main .parent,145 MainApplication.getMainFrame(), 147 146 tr("<html>Layer ''{0}'' already has a conflict for object<br>" 148 147 + "''{1}''.<br>" -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/SetRoleAction.java
r14030 r14153 11 11 import javax.swing.event.DocumentListener; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 14 import org.openstreetmap.josm.gui.MainApplication; 15 15 import org.openstreetmap.josm.gui.tagging.ac.AutoCompletingTextField; 16 16 import org.openstreetmap.josm.tools.ImageProvider; … … 61 61 int ret = ConditionalOptionPaneUtil.showOptionDialog( 62 62 "relation_editor.confirm_applying_empty_role", 63 Main .parent,63 MainApplication.getMainFrame(), 64 64 message, 65 65 tr("Confirm empty role"), -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
r13130 r14153 22 22 import javax.swing.event.ListSelectionListener; 23 23 24 import org.openstreetmap.josm.Main;25 24 import org.openstreetmap.josm.data.Bounds; 26 25 import org.openstreetmap.josm.data.UserIdentityManager; 26 import org.openstreetmap.josm.gui.MainApplication; 27 27 import org.openstreetmap.josm.gui.download.BookmarkList.Bookmark; 28 28 import org.openstreetmap.josm.gui.widgets.JMultilineLabel; … … 188 188 if (currentArea == null) { 189 189 JOptionPane.showMessageDialog( 190 Main .parent,190 MainApplication.getMainFrame(), 191 191 tr("Currently, there is no download area selected. Please select an area first."), 192 192 tr("Information"), … … 198 198 b.setName( 199 199 JOptionPane.showInputDialog( 200 Main .parent, tr("Please enter a name for the bookmarked download area."),200 MainApplication.getMainFrame(), tr("Please enter a name for the bookmarked download area."), 201 201 tr("Name of location"), 202 202 JOptionPane.QUESTION_MESSAGE) … … 259 259 Object value = 260 260 JOptionPane.showInputDialog( 261 Main .parent, tr("Please enter a name for the bookmarked download area."),261 MainApplication.getMainFrame(), tr("Please enter a name for the bookmarked download area."), 262 262 tr("Name of location"), 263 263 JOptionPane.QUESTION_MESSAGE, -
trunk/src/org/openstreetmap/josm/gui/download/DownloadDialog.java
r14121 r14153 35 35 import javax.swing.event.ChangeListener; 36 36 37 import org.openstreetmap.josm.Main;38 37 import org.openstreetmap.josm.actions.ExpertToggleAction; 39 38 import org.openstreetmap.josm.data.Bounds; … … 81 80 public static synchronized DownloadDialog getInstance() { 82 81 if (instance == null) { 83 instance = new DownloadDialog(Main .parent);82 instance = new DownloadDialog(MainApplication.getMainFrame()); 84 83 } 85 84 return instance; -
trunk/src/org/openstreetmap/josm/gui/download/DownloadObjectDialog.java
r14121 r14153 11 11 import javax.swing.JCheckBox; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 14 import org.openstreetmap.josm.gui.MainApplication; 15 15 import org.openstreetmap.josm.gui.dialogs.OsmIdSelectionDialog; 16 16 import org.openstreetmap.josm.io.NetworkManager; … … 31 31 32 32 /** 33 * Constructs a new DownloadObjectDialog with Main .parentas parent component.33 * Constructs a new DownloadObjectDialog with MainApplication.getMainFrame() as parent component. 34 34 */ 35 35 public DownloadObjectDialog() { 36 this(Main .parent);36 this(MainApplication.getMainFrame()); 37 37 } 38 38 -
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r13761 r14153 43 43 import javax.xml.parsers.ParserConfigurationException; 44 44 45 import org.openstreetmap.josm.Main;46 45 import org.openstreetmap.josm.data.Bounds; 47 46 import org.openstreetmap.josm.gui.ExceptionDialogUtil; … … 272 271 Logging.log(Logging.LEVEL_WARN, tr("Error occured with query ''{0}'': ''{1}''", urlString, e.getMessage()), e); 273 272 GuiHelper.runInEDTAndWait(() -> HelpAwareOptionPane.showOptionDialog( 274 Main .parent,273 MainApplication.getMainFrame(), 275 274 tr("Name server returned invalid data. Please try again."), 276 275 tr("Bad response"), -
trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java
r13844 r14153 44 44 import javax.swing.text.html.StyleSheet; 45 45 46 import org.openstreetmap.josm.Main;47 46 import org.openstreetmap.josm.actions.JosmAction; 48 47 import org.openstreetmap.josm.gui.HelpAwareOptionPane; … … 384 383 Logging.warn(e); 385 384 HelpAwareOptionPane.showOptionDialog( 386 Main .parent,385 MainApplication.getMainFrame(), 387 386 tr( 388 387 "<html>Failed to open help page for url {0}.<br>" … … 469 468 if (!GraphicsEnvironment.isHeadless()) { 470 469 JOptionPane.showMessageDialog( 471 Main .parent,470 MainApplication.getMainFrame(), 472 471 message, 473 472 tr("Warning"), -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialog.java
r12634 r14153 18 18 import javax.swing.JPanel; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.data.osm.PrimitiveId; 22 21 import org.openstreetmap.josm.data.osm.history.History; … … 48 47 */ 49 48 public HistoryBrowserDialog(History history) { 50 super(GuiHelper.getFrameForComponent(Main .parent), false);49 super(GuiHelper.getFrameForComponent(MainApplication.getMainFrame()), false); 51 50 build(); 52 51 setHistory(history); -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r13974 r14153 19 19 import javax.swing.SwingUtilities; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.data.osm.PrimitiveId; 23 22 import org.openstreetmap.josm.data.osm.history.History; … … 225 224 if (notNewPrimitives.isEmpty()) { 226 225 JOptionPane.showMessageDialog( 227 Main .parent,226 MainApplication.getMainFrame(), 228 227 tr("Please select at least one already uploaded node, way, or relation."), 229 228 tr("Warning"), -
trunk/src/org/openstreetmap/josm/gui/io/AbstractUploadTask.java
r13842 r14153 17 17 import javax.swing.JOptionPane; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.actions.DownloadReferrersAction; 21 20 import org.openstreetmap.josm.actions.UpdateDataAction; … … 155 154 ); 156 155 int ret = HelpAwareOptionPane.showOptionDialog( 157 Main .parent,156 MainApplication.getMainFrame(), 158 157 msg, 159 158 tr("Conflicts detected"), … … 195 194 ); 196 195 int ret = HelpAwareOptionPane.showOptionDialog( 197 Main .parent,196 MainApplication.getMainFrame(), 198 197 msg, 199 198 tr("Conflicts detected"), … … 222 221 ); 223 222 JOptionPane.showMessageDialog( 224 Main .parent,223 MainApplication.getMainFrame(), 225 224 msg, 226 225 tr("Changeset closed"), … … 255 254 options[0].text)) + "</html>"; 256 255 int ret = HelpAwareOptionPane.showOptionDialog( 257 Main .parent,256 MainApplication.getMainFrame(), 258 257 msg, 259 258 tr("Object still in use"), -
trunk/src/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTask.java
r14134 r14153 87 87 if (asynchronousUploadPrimitivesTask != null) { 88 88 GuiHelper.runInEDTAndWait(() -> 89 JOptionPane.showMessageDialog(MainApplication. parent,89 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 90 90 tr("A background upload is already in progress. " + 91 91 "Kindly wait for it to finish before uploading new changes"))); -
trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java
r13130 r14153 25 25 import javax.swing.event.ListSelectionListener; 26 26 27 import org.openstreetmap.josm.Main;28 27 import org.openstreetmap.josm.data.osm.Changeset; 28 import org.openstreetmap.josm.gui.MainApplication; 29 29 import org.openstreetmap.josm.gui.SideButton; 30 30 import org.openstreetmap.josm.gui.util.GuiHelper; … … 97 97 new WindowGeometry( 98 98 getClass().getName() + ".geometry", 99 WindowGeometry.centerInWindow(Main .parent, new Dimension(300, 300))99 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(300, 300)) 100 100 ).applySafe(this); 101 101 } else if (isShowing()) { // Avoid IllegalComponentStateException like in #8775 … … 109 109 */ 110 110 public CloseChangesetDialog() { 111 super(GuiHelper.getFrameForComponent(Main .parent), ModalityType.DOCUMENT_MODAL);111 super(GuiHelper.getFrameForComponent(MainApplication.getMainFrame()), ModalityType.DOCUMENT_MODAL); 112 112 build(); 113 113 } -
trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java
r13849 r14153 30 30 import javax.swing.JTextField; 31 31 32 import org.openstreetmap.josm. Main;32 import org.openstreetmap.josm.gui.MainApplication; 33 33 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 34 34 import org.openstreetmap.josm.gui.help.HelpUtil; … … 120 120 public void setVisible(boolean visible) { 121 121 if (visible) { 122 WindowGeometry.centerInWindow(Main .parent, new Dimension(350, 300)).applySafe(this);122 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(350, 300)).applySafe(this); 123 123 } 124 124 super.setVisible(visible); -
trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java
r14149 r14153 39 39 import javax.xml.transform.stream.StreamResult; 40 40 41 import org.openstreetmap.josm.Main;42 41 import org.openstreetmap.josm.data.Preferences; 43 42 import org.openstreetmap.josm.data.PreferencesUtils; 44 43 import org.openstreetmap.josm.data.Version; 45 44 import org.openstreetmap.josm.gui.MainApplication; 45 import org.openstreetmap.josm.gui.MainFrame; 46 46 import org.openstreetmap.josm.plugins.PluginDownloadTask; 47 47 import org.openstreetmap.josm.plugins.PluginInformation; … … 137 137 } 138 138 File fOut = new File(dir, path); 139 DownloadFileTask downloadFileTask = new DownloadFileTask(Main .parent, address, fOut, mkdir, unzip);139 DownloadFileTask downloadFileTask = new DownloadFileTask(MainApplication.getMainFrame(), address, fOut, mkdir, unzip); 140 140 141 141 MainApplication.worker.submit(downloadFileTask); 142 142 PreferencesUtils.log("Info: downloading file from %s to %s in background ", parentDir, fOut.getAbsolutePath()); 143 143 if (unzip) PreferencesUtils.log("and unpacking it"); else PreferencesUtils.log(""); 144 145 144 } 146 145 … … 152 151 public static void messageBox(String type, String text) { 153 152 char c = (type == null || type.isEmpty() ? "plain" : type).charAt(0); 153 MainFrame parent = MainApplication.getMainFrame(); 154 154 switch (c) { 155 case 'i': JOptionPane.showMessageDialog( Main.parent, text, tr("Information"), JOptionPane.INFORMATION_MESSAGE); break;156 case 'w': JOptionPane.showMessageDialog( Main.parent, text, tr("Warning"), JOptionPane.WARNING_MESSAGE); break;157 case 'e': JOptionPane.showMessageDialog( Main.parent, text, tr("Error"), JOptionPane.ERROR_MESSAGE); break;158 case 'q': JOptionPane.showMessageDialog( Main.parent, text, tr("Question"), JOptionPane.QUESTION_MESSAGE); break;159 case 'p': JOptionPane.showMessageDialog( Main.parent, text, tr("Message"), JOptionPane.PLAIN_MESSAGE); break;155 case 'i': JOptionPane.showMessageDialog(parent, text, tr("Information"), JOptionPane.INFORMATION_MESSAGE); break; 156 case 'w': JOptionPane.showMessageDialog(parent, text, tr("Warning"), JOptionPane.WARNING_MESSAGE); break; 157 case 'e': JOptionPane.showMessageDialog(parent, text, tr("Error"), JOptionPane.ERROR_MESSAGE); break; 158 case 'q': JOptionPane.showMessageDialog(parent, text, tr("Question"), JOptionPane.QUESTION_MESSAGE); break; 159 case 'p': JOptionPane.showMessageDialog(parent, text, tr("Message"), JOptionPane.PLAIN_MESSAGE); break; 160 160 default: Logging.warn("Unsupported messageBox type: " + c); 161 161 } … … 170 170 public static int askForOption(String text, String opts) { 171 171 if (!opts.isEmpty()) { 172 return JOptionPane.showOptionDialog(Main .parent, text, "Question",172 return JOptionPane.showOptionDialog(MainApplication.getMainFrame(), text, "Question", 173 173 JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, opts.split(";"), 0); 174 174 } else { 175 return JOptionPane.showOptionDialog(Main .parent, text, "Question",175 return JOptionPane.showOptionDialog(MainApplication.getMainFrame(), text, "Question", 176 176 JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, 2); 177 177 } … … 179 179 180 180 public static String askForText(String text) { 181 String s = JOptionPane.showInputDialog(Main .parent, text, tr("Enter text"), JOptionPane.QUESTION_MESSAGE);181 String s = JOptionPane.showInputDialog(MainApplication.getMainFrame(), text, tr("Enter text"), JOptionPane.QUESTION_MESSAGE); 182 182 return s != null ? s.trim() : null; 183 183 } … … 344 344 if (!installList.isEmpty()) { 345 345 PluginDownloadTask pluginDownloadTask = 346 new PluginDownloadTask(Main .parent, toInstallPlugins, tr("Installing plugins"));346 new PluginDownloadTask(MainApplication.getMainFrame(), toInstallPlugins, tr("Installing plugins")); 347 347 MainApplication.worker.submit(pluginDownloadTask); 348 348 } -
trunk/src/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTask.java
r12743 r14153 13 13 import javax.swing.SwingUtilities; 14 14 15 import org.openstreetmap.josm.Main;16 15 import org.openstreetmap.josm.data.UserIdentityManager; 17 16 import org.openstreetmap.josm.data.osm.Changeset; … … 19 18 import org.openstreetmap.josm.data.osm.UserInfo; 20 19 import org.openstreetmap.josm.gui.ExceptionDialogUtil; 20 import org.openstreetmap.josm.gui.MainApplication; 21 21 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 22 22 import org.openstreetmap.josm.gui.util.GuiHelper; … … 81 81 if (!GraphicsEnvironment.isHeadless()) { 82 82 JOptionPane.showMessageDialog( 83 Main .parent,83 MainApplication.getMainFrame(), 84 84 tr("There are no open changesets"), 85 85 tr("No open changesets"), -
trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesWithReferrersTask.java
r13534 r14153 19 19 import javax.swing.JScrollPane; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.actions.downloadtasks.DownloadReferrersTask; 23 22 import org.openstreetmap.josm.data.osm.DataSet; … … 225 224 226 225 return new ExtendedDialog( 227 Main .parent,226 MainApplication.getMainFrame(), 228 227 title, 229 228 tr("Ok")) -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java
r13647 r14153 42 42 import javax.swing.event.TableModelListener; 43 43 44 import org.openstreetmap.josm.Main;45 44 import org.openstreetmap.josm.actions.SessionSaveAsAction; 46 45 import org.openstreetmap.josm.actions.UploadAction; 47 46 import org.openstreetmap.josm.gui.ExceptionDialogUtil; 47 import org.openstreetmap.josm.gui.MainApplication; 48 48 import org.openstreetmap.josm.gui.io.SaveLayersModel.Mode; 49 49 import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer; … … 111 111 public static boolean saveUnsavedModifications(Iterable<? extends Layer> selectedLayers, Reason reason) { 112 112 if (!GraphicsEnvironment.isHeadless()) { 113 SaveLayersDialog dialog = new SaveLayersDialog(Main .parent);113 SaveLayersDialog dialog = new SaveLayersDialog(MainApplication.getMainFrame()); 114 114 List<AbstractModifiableLayer> layersWithUnmodifiedChanges = new ArrayList<>(); 115 115 for (Layer l: selectedLayers) { … … 278 278 // For unit test coverage in headless mode 279 279 if (!GraphicsEnvironment.isHeadless()) { 280 JOptionPane.showConfirmDialog(Main .parent, panel, title, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE);280 JOptionPane.showConfirmDialog(MainApplication.getMainFrame(), panel, title, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE); 281 281 } 282 282 } … … 665 665 ); 666 666 JOptionPane.showMessageDialog( 667 Main .parent,667 MainApplication.getMainFrame(), 668 668 msg, 669 669 tr("Incomplete upload and/or save"), -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r14106 r14153 36 36 import javax.swing.JTabbedPane; 37 37 38 import org.openstreetmap.josm.Main;39 38 import org.openstreetmap.josm.data.APIDataSet; 40 39 import org.openstreetmap.josm.data.Version; … … 44 43 import org.openstreetmap.josm.gui.ExtendedDialog; 45 44 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 45 import org.openstreetmap.josm.gui.MainApplication; 46 46 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 47 47 import org.openstreetmap.josm.gui.help.HelpUtil; … … 105 105 */ 106 106 public UploadDialog() { 107 super(GuiHelper.getFrameForComponent(Main .parent), ModalityType.DOCUMENT_MODAL);107 super(GuiHelper.getFrameForComponent(MainApplication.getMainFrame()), ModalityType.DOCUMENT_MODAL); 108 108 build(); 109 109 pack(); … … 384 384 getClass().getName() + ".geometry", 385 385 WindowGeometry.centerInWindow( 386 Main .parent,386 MainApplication.getMainFrame(), 387 387 new Dimension(400, 600) 388 388 ) … … 545 545 } 546 546 if (!emptyChangesetTags.isEmpty() && JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog( 547 Main .parent,547 MainApplication.getMainFrame(), 548 548 trn( 549 549 "<html>The following changeset tag contains an empty key/value:<br>{0}<br>Continue?</html>", -
trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java
r14119 r14153 14 14 import javax.swing.SwingUtilities; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.APIDataSet; 18 17 import org.openstreetmap.josm.data.osm.Changeset; … … 26 25 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 27 26 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 27 import org.openstreetmap.josm.gui.MainApplication; 28 28 import org.openstreetmap.josm.gui.Notification; 29 29 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 127 127 String msg = "<html>" + msg1 + "<br><br>" + msg2 +"<br><br>" + msg3 + "</html>"; 128 128 int ret = HelpAwareOptionPane.showOptionDialog( 129 Main .parent,129 MainApplication.getMainFrame(), 130 130 msg, 131 131 tr("Changeset is full"), -
trunk/src/org/openstreetmap/josm/gui/io/UploadSelectionDialog.java
r13564 r14153 32 32 import javax.swing.event.ListSelectionListener; 33 33 34 import org.openstreetmap.josm.Main;35 34 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; 36 35 import org.openstreetmap.josm.data.osm.OsmPrimitive; 37 36 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 37 import org.openstreetmap.josm.gui.MainApplication; 38 38 import org.openstreetmap.josm.gui.PrimitiveRenderer; 39 39 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; … … 61 61 */ 62 62 public UploadSelectionDialog() { 63 super(GuiHelper.getFrameForComponent(Main .parent), ModalityType.DOCUMENT_MODAL);63 super(GuiHelper.getFrameForComponent(MainApplication.getMainFrame()), ModalityType.DOCUMENT_MODAL); 64 64 build(); 65 65 } … … 174 174 getClass().getName() + ".geometry", 175 175 WindowGeometry.centerInWindow( 176 Main .parent,176 MainApplication.getMainFrame(), 177 177 new Dimension(200, 400) 178 178 ) -
trunk/src/org/openstreetmap/josm/gui/io/importexport/FileImporter.java
r12671 r14153 10 10 import javax.swing.JOptionPane; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.ExtensionFileFilter; 14 13 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 14 import org.openstreetmap.josm.gui.MainApplication; 15 15 import org.openstreetmap.josm.gui.Notification; 16 16 import org.openstreetmap.josm.gui.progress.ProgressMonitor; … … 115 115 Logging.error(e); 116 116 HelpAwareOptionPane.showMessageDialogInEDT( 117 Main .parent,117 MainApplication.getMainFrame(), 118 118 tr("<html>Could not read file ''{0}''.<br>Error is:<br>{1}</html>", 119 119 f.getName(), Utils.escapeReservedCharactersHTML(e.getMessage())), … … 146 146 Logging.error(e); 147 147 HelpAwareOptionPane.showMessageDialogInEDT( 148 Main .parent,148 MainApplication.getMainFrame(), 149 149 tr("<html>Could not read files.<br>Error is:<br>{0}</html>", Utils.escapeReservedCharactersHTML(e.getMessage())), 150 150 tr("Error"), -
trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java
r13838 r14153 25 25 import javax.swing.ListSelectionModel; 26 26 27 import org.openstreetmap.josm.Main;28 27 import org.openstreetmap.josm.data.gpx.GpxConstants; 29 28 import org.openstreetmap.josm.data.gpx.GpxData; … … 152 151 p.add(keywords, GBC.eop().fill(GBC.HORIZONTAL)); 153 152 154 ExtendedDialog ed = new ExtendedDialog(Main .parent,153 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), 155 154 tr("Export options"), 156 155 tr("Export and Save"), tr("Cancel")) … … 212 211 } catch (IOException | InvalidPathException ex) { 213 212 Logging.error(ex); 214 JOptionPane.showMessageDialog(Main .parent, tr("Error while exporting {0}:\n{1}", fn, ex.getMessage()),213 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Error while exporting {0}:\n{1}", fn, ex.getMessage()), 215 214 tr("Error"), JOptionPane.ERROR_MESSAGE); 216 215 } … … 309 308 l.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 310 309 int answer = JOptionPane.showConfirmDialog( 311 Main .parent,310 MainApplication.getMainFrame(), 312 311 new JScrollPane(l), 313 312 tr("Choose a predefined license"), -
trunk/src/org/openstreetmap/josm/gui/io/importexport/NMEAImporter.java
r14010 r14153 11 11 import javax.swing.SwingUtilities; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.ExtensionFileFilter; 15 14 import org.openstreetmap.josm.gui.HelpAwareOptionPane; … … 86 85 } else { 87 86 HelpAwareOptionPane.showMessageDialogInEDT( 88 Main .parent,87 MainApplication.getMainFrame(), 89 88 msg.toString(), 90 89 tr("NMEA import failure!"), -
trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmChangeImporter.java
r14108 r14153 11 11 import javax.swing.JOptionPane; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.actions.ExtensionFileFilter; 15 14 import org.openstreetmap.josm.data.osm.DataSet; … … 78 77 GuiHelper.runInEDT(() -> 79 78 JOptionPane.showMessageDialog( 80 Main .parent,79 MainApplication.getMainFrame(), 81 80 tr("No data found in file {0}.", associatedFile.getPath()), 82 81 tr("Open OsmChange file"), -
trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmExporter.java
r13838 r14153 16 16 import javax.swing.JOptionPane; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.actions.ExtensionFileFilter; 19 import org.openstreetmap.josm.gui.MainApplication; 20 20 import org.openstreetmap.josm.gui.layer.Layer; 21 21 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 99 99 Logging.error(e); 100 100 JOptionPane.showMessageDialog( 101 Main .parent,101 MainApplication.getMainFrame(), 102 102 tr("<html>An error occurred while saving.<br>Error is:<br>{0}</html>", 103 103 Utils.escapeReservedCharactersHTML(e.getMessage())), … … 114 114 Logging.error(e2); 115 115 JOptionPane.showMessageDialog( 116 Main .parent,116 MainApplication.getMainFrame(), 117 117 tr("<html>An error occurred while restoring backup file.<br>Error is:<br>{0}</html>", 118 118 Utils.escapeReservedCharactersHTML(e2.getMessage())), -
trunk/src/org/openstreetmap/josm/gui/io/importexport/OsmImporter.java
r13352 r14153 12 12 import javax.swing.JOptionPane; 13 13 14 import org.openstreetmap.josm.Main;15 14 import org.openstreetmap.josm.actions.ExtensionFileFilter; 16 15 import org.openstreetmap.josm.data.osm.DataSet; … … 146 145 } 147 146 JOptionPane.showMessageDialog( 148 Main .parent,147 MainApplication.getMainFrame(), 149 148 msg, 150 149 tr("Open OSM file"), -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r14120 r14153 74 74 import org.openstreetmap.gui.jmapviewer.interfaces.TileSource; 75 75 import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource; 76 import org.openstreetmap.josm.Main;77 76 import org.openstreetmap.josm.actions.ExpertToggleAction; 78 77 import org.openstreetmap.josm.actions.ImageryAdjustAction; … … 420 419 public void actionPerformed(ActionEvent ae) { 421 420 if (tile != null) { 422 ExtendedDialog ed = new ExtendedDialog(Main .parent, tr("Tile Info"), tr("OK"));421 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), tr("Tile Info"), tr("OK")); 423 422 JPanel panel = new JPanel(new GridBagLayout()); 424 423 Rectangle2D displaySize = layer.coordinateConverter.getRectangleForTile(tile); -
trunk/src/org/openstreetmap/josm/gui/layer/CustomizeColor.java
r13130 r14153 19 19 import javax.swing.JOptionPane; 20 20 21 import org.openstreetmap.josm.Main;22 21 import org.openstreetmap.josm.data.preferences.AbstractProperty; 22 import org.openstreetmap.josm.gui.MainApplication; 23 23 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; 24 24 import org.openstreetmap.josm.gui.layer.Layer.LayerAction; … … 77 77 Object[] options = new Object[]{tr("OK"), tr("Cancel"), tr("Default")}; 78 78 int answer = JOptionPane.showOptionDialog( 79 Main .parent,79 MainApplication.getMainFrame(), 80 80 c, 81 81 tr("Choose a color"), -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r13173 r14153 20 20 import javax.swing.SwingUtilities; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.actions.GpxExportAction; 24 23 import org.openstreetmap.josm.actions.SaveAction; … … 32 31 import org.openstreetmap.josm.data.projection.Projection; 33 32 import org.openstreetmap.josm.data.projection.ProjectionChangeListener; 33 import org.openstreetmap.josm.gui.MainApplication; 34 34 import org.openstreetmap.josm.tools.Destroyable; 35 35 import org.openstreetmap.josm.tools.ImageProcessor; … … 605 605 606 606 // run later to not block loading the UI. 607 SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(Main .parent,607 SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 608 608 message, 609 609 tr("Warning"), -
trunk/src/org/openstreetmap/josm/gui/layer/MainLayerManager.java
r14005 r14153 232 232 GuiHelper.runInEDT(() -> 233 233 JOptionPane.showMessageDialog( 234 MainApplication. parent,234 MainApplication.getMainFrame(), 235 235 tr("Trying to set a read only data layer as edit layer"), 236 236 tr("Warning"), … … 289 289 protected Collection<Layer> realRemoveSingleLayer(Layer layer) { 290 290 if ((layer instanceof OsmDataLayer) && (((OsmDataLayer) layer).isUploadInProgress())) { 291 GuiHelper.runInEDT(() -> JOptionPane.showMessageDialog(MainApplication. parent,291 GuiHelper.runInEDT(() -> JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 292 292 tr("Trying to delete the layer with background upload. Please wait until the upload is finished."))); 293 293 … … 495 495 Logging.warn(msg); 496 496 if (!GraphicsEnvironment.isHeadless()) { 497 GuiHelper.runInEDT(() -> JOptionPane.showMessageDialog(MainApplication. parent, msg));497 GuiHelper.runInEDT(() -> JOptionPane.showMessageDialog(MainApplication.getMainFrame(), msg)); 498 498 } 499 499 } -
trunk/src/org/openstreetmap/josm/gui/layer/NoteLayer.java
r14102 r14153 34 34 import javax.swing.text.View; 35 35 36 import org.openstreetmap.josm.Main;37 36 import org.openstreetmap.josm.actions.SaveActionBase; 38 37 import org.openstreetmap.josm.data.Bounds; … … 44 43 import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor; 45 44 import org.openstreetmap.josm.gui.MainApplication; 46 import org.openstreetmap.josm.gui.MainFrame;47 45 import org.openstreetmap.josm.gui.MapView; 48 46 import org.openstreetmap.josm.gui.dialogs.LayerListDialog; … … 236 234 displayedPanel.enableClickableHyperlinks(); 237 235 pTooltip = fixPanelSizeAndLocation(mv, text, xl, xr, yt, yb); 238 displayedWindow = new JWindow( (MainFrame) Main.parent);236 displayedWindow = new JWindow(MainApplication.getMainFrame()); 239 237 displayedWindow.setAutoRequestFocus(false); 240 238 displayedWindow.add(displayedPanel); -
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r14134 r14153 44 44 import javax.swing.JScrollPane; 45 45 46 import org.openstreetmap.josm.Main;47 46 import org.openstreetmap.josm.actions.ExpertToggleAction; 48 47 import org.openstreetmap.josm.actions.RenameLayerAction; … … 567 566 Logging.error(e); 568 567 JOptionPane.showMessageDialog( 569 Main .parent,568 MainApplication.getMainFrame(), 570 569 e.getHtmlMessage() != null ? e.getHtmlMessage() : e.getMessage(), 571 570 tr("Error"), … … 1027 1026 String result = DatasetConsistencyTest.runTests(data); 1028 1027 if (result.isEmpty()) { 1029 JOptionPane.showMessageDialog(Main .parent, tr("No problems found"));1028 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("No problems found")); 1030 1029 } else { 1031 1030 JPanel p = new JPanel(new GridBagLayout()); … … 1036 1035 p.add(new JScrollPane(info), GBC.eop()); 1037 1036 1038 JOptionPane.showMessageDialog(Main .parent, p, tr("Warning"), JOptionPane.WARNING_MESSAGE);1037 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), p, tr("Warning"), JOptionPane.WARNING_MESSAGE); 1039 1038 } 1040 1039 } … … 1103 1102 } 1104 1103 return new ExtendedDialog( 1105 Main .parent,1104 MainApplication.getMainFrame(), 1106 1105 tr("Empty document"), 1107 1106 tr("Save anyway"), tr("Cancel")) … … 1116 1115 return conflictsCol == null || conflictsCol.isEmpty() || 1 == GuiHelper.runInEDTAndWaitAndReturn(() -> 1117 1116 new ExtendedDialog( 1118 Main .parent,1117 MainApplication.getMainFrame(), 1119 1118 /* I18N: Display title of the window showing conflicts */ 1120 1119 tr("Conflicts"), -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r14010 r14153 60 60 import javax.swing.event.DocumentListener; 61 61 62 import org.openstreetmap.josm.Main;63 62 import org.openstreetmap.josm.actions.DiskAccessAction; 64 63 import org.openstreetmap.josm.actions.ExtensionFileFilter; … … 133 132 timezone = Timezone.parseTimezone(tfTimezone.getText().trim()); 134 133 } catch (ParseException e) { 135 JOptionPane.showMessageDialog(Main .parent, e.getMessage(),134 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), e.getMessage(), 136 135 tr("Invalid timezone"), JOptionPane.ERROR_MESSAGE); 137 136 return AGAIN; … … 141 140 delta = Offset.parseOffset(tfOffset.getText().trim()); 142 141 } catch (ParseException e) { 143 JOptionPane.showMessageDialog(Main .parent, e.getMessage(),142 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), e.getMessage(), 144 143 tr("Invalid offset"), JOptionPane.ERROR_MESSAGE); 145 144 return AGAIN; … … 147 146 148 147 if (lastNumMatched == 0 && new ExtendedDialog( 149 Main .parent,148 MainApplication.getMainFrame(), 150 149 tr("Correlate images with GPX track"), 151 150 tr("OK"), tr("Try Again")). … … 272 271 if (!sel.getName().equals(wrapper.name)) { 273 272 JOptionPane.showMessageDialog( 274 Main .parent,273 MainApplication.getMainFrame(), 275 274 tr("File {0} is loaded yet under the name \"{1}\"", sel.getName(), wrapper.name), 276 275 tr("Error"), … … 291 290 Logging.error(ex); 292 291 JOptionPane.showMessageDialog( 293 Main .parent,292 MainApplication.getMainFrame(), 294 293 tr("Error while parsing {0}", sel.getName())+": "+ex.getMessage(), 295 294 tr("Error"), … … 300 299 Logging.error(ex); 301 300 JOptionPane.showMessageDialog( 302 Main .parent,301 MainApplication.getMainFrame(), 303 302 tr("Could not read \"{0}\"", sel.getName())+'\n'+ex.getMessage(), 304 303 tr("Error"), … … 490 489 while (!isOk) { 491 490 int answer = JOptionPane.showConfirmDialog( 492 Main .parent, panel,491 MainApplication.getMainFrame(), panel, 493 492 tr("Synchronize time from a photo of the GPS receiver"), 494 493 JOptionPane.OK_CANCEL_OPTION, … … 504 503 - dateFormat.parse(tfGpsTime.getText()).getTime(); 505 504 } catch (ParseException e) { 506 JOptionPane.showMessageDialog(Main .parent, tr("Error while parsing the date.\n"505 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Error while parsing the date.\n" 507 506 + "Please use the requested format"), 508 507 tr("Invalid date"), JOptionPane.ERROR_MESSAGE); … … 723 722 if (!GraphicsEnvironment.isHeadless()) { 724 723 syncDialog = new ExtendedDialog( 725 Main .parent,724 MainApplication.getMainFrame(), 726 725 tr("Correlate images with GPX track"), 727 726 new String[] {tr("Correlate"), tr("Cancel")}, … … 932 931 } catch (JosmRuntimeException | IllegalArgumentException | IllegalStateException e) { 933 932 Logging.warn(e); 934 JOptionPane.showMessageDialog(Main .parent,933 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 935 934 tr("An error occurred while trying to match the photos to the GPX track." 936 935 +" You can adjust the sliders to manually match the photos."), … … 950 949 // immediately. Therefore "Close" is marked with an "OK" icon. 951 950 // Settings are only saved temporarily to the layer. 952 new ExtendedDialog(Main .parent,951 new ExtendedDialog(MainApplication.getMainFrame(), 953 952 tr("Adjust timezone and offset"), 954 953 tr("Close")). … … 1012 1011 } catch (IndexOutOfBoundsException ex) { 1013 1012 Logging.debug(ex); 1014 JOptionPane.showMessageDialog(Main .parent,1013 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 1015 1014 tr("The selected photos do not contain time information."), 1016 1015 tr("Photos do not contain time information"), JOptionPane.WARNING_MESSAGE); … … 1018 1017 } catch (NoGpxTimestamps ex) { 1019 1018 Logging.debug(ex); 1020 JOptionPane.showMessageDialog(Main .parent,1019 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 1021 1020 tr("The selected GPX track does not contain timestamps. Please select another one."), 1022 1021 tr("GPX Track has no time information"), JOptionPane.WARNING_MESSAGE); … … 1081 1080 if (item == null || ((GpxDataWrapper) item).file == null) { 1082 1081 if (complain) { 1083 JOptionPane.showMessageDialog(Main .parent, tr("You should select a GPX track"),1082 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("You should select a GPX track"), 1084 1083 tr("No selected GPX track"), JOptionPane.ERROR_MESSAGE); 1085 1084 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r13843 r14153 39 39 import javax.swing.SwingConstants; 40 40 41 import org.openstreetmap.josm.Main;42 41 import org.openstreetmap.josm.actions.LassoModeAction; 43 42 import org.openstreetmap.josm.actions.RenameLayerAction; … … 285 284 if (!errorMessages.isEmpty()) { 286 285 JOptionPane.showMessageDialog( 287 Main .parent,286 MainApplication.getMainFrame(), 288 287 formatErrorMessages(), 289 288 tr("Error"), … … 716 715 717 716 int result = new ExtendedDialog( 718 Main .parent,717 MainApplication.getMainFrame(), 719 718 tr("Delete image file from disk"), 720 719 tr("Cancel"), tr("Delete")) … … 738 737 } else { 739 738 JOptionPane.showMessageDialog( 740 Main .parent,739 MainApplication.getMainFrame(), 741 740 tr("Image file could not be deleted."), 742 741 tr("Error"), -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityAction.java
r13130 r14153 31 31 import javax.swing.table.TableRowSorter; 32 32 33 import org.openstreetmap.josm.Main;34 33 import org.openstreetmap.josm.data.SystemOfMeasurement; 35 34 import org.openstreetmap.josm.data.gpx.GpxConstants; … … 266 265 if (!GraphicsEnvironment.isHeadless()) { 267 266 // build dialog 268 ExtendedDialog ed = new ExtendedDialog(Main .parent, tr("Set track visibility for {0}", layer.getName()),267 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), tr("Set track visibility for {0}", layer.getName()), 269 268 tr("Show all"), tr("Show selected only"), tr("Cancel")); 270 269 ed.setButtonIcons("eye", "dialogs/filter", "cancel"); … … 274 273 ed.configureContextsensitiveHelp("/Action/ChooseTrackVisibility", true); 275 274 ed.setRememberWindowGeometry(getClass().getName() + ".geometry", 276 WindowGeometry.centerInWindow(Main .parent, new Dimension(1000, 500)));275 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(1000, 500))); 277 276 ed.showDialog(); 278 277 dateFilter.saveInPrefs(); -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertFromGpxLayerAction.java
r14129 r14153 21 21 import javax.swing.JRadioButton; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.data.gpx.GpxConstants; 25 24 import org.openstreetmap.josm.data.gpx.GpxTrack; … … 30 29 import org.openstreetmap.josm.data.osm.Way; 31 30 import org.openstreetmap.josm.gui.ExtendedDialog; 31 import org.openstreetmap.josm.gui.MainApplication; 32 32 import org.openstreetmap.josm.gui.layer.GpxLayer; 33 33 import org.openstreetmap.josm.gui.layer.OsmDataLayer; … … 209 209 rNone.addActionListener(disabler); 210 210 211 ExtendedDialog ed = new ExtendedDialog(Main .parent, tr("Options"),211 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), tr("Options"), 212 212 tr("Convert"), tr("Convert and remember selection"), tr("Cancel")) 213 213 .setButtonIcons("exportgpx", "exportgpx", "cancel").setContent(p); -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerAction.java
r14129 r14153 14 14 import javax.swing.JPanel; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.data.osm.DataSet; 18 17 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; … … 58 57 GBC.eol()); 59 58 msg.add(new UrlLabel(Config.getUrls().getOSMWebsite() + "/traces", 2), GBC.eop()); 60 if (!ConditionalOptionPaneUtil.showConfirmationDialog("convert_to_data", Main .parent, msg, tr("Warning"),59 if (!ConditionalOptionPaneUtil.showConfirmationDialog("convert_to_data", MainApplication.getMainFrame(), msg, tr("Warning"), 61 60 JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_OPTION)) { 62 61 return; -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/CustomizeDrawingAction.java
r13130 r14153 18 18 import javax.swing.JScrollPane; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.gui.MainApplication; 22 21 import org.openstreetmap.josm.gui.layer.GpxLayer; … … 100 99 scrollpane.setPreferredSize(new Dimension(panel.getPreferredSize().width, Math.min(panel.getPreferredSize().height, 450))); 101 100 } 102 int answer = JOptionPane.showConfirmDialog(Main .parent, scrollpane, tr("Customize track drawing"),101 int answer = JOptionPane.showConfirmDialog(MainApplication.getMainFrame(), scrollpane, tr("Customize track drawing"), 103 102 JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); 104 103 if (answer == JOptionPane.CANCEL_OPTION || answer == JOptionPane.CLOSED_OPTION) { -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongPanel.java
r13842 r14153 16 16 import javax.swing.event.ChangeListener; 17 17 18 import org.openstreetmap.josm.Main;19 18 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 20 19 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec; 20 import org.openstreetmap.josm.gui.MainApplication; 21 21 import org.openstreetmap.josm.spi.preferences.Config; 22 22 import org.openstreetmap.josm.tools.GBC; … … 181 181 addChangeListener(e -> options[0].setEnabled(isDownloadOsmData() || isDownloadGpxData())); 182 182 183 int ret = HelpAwareOptionPane.showOptionDialog(Main .parent, this, title,183 int ret = HelpAwareOptionPane.showOptionDialog(MainApplication.getMainFrame(), this, title, 184 184 JOptionPane.QUESTION_MESSAGE, null, options, options[0], helpTopic); 185 185 if (0 == ret) { -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackAction.java
r13206 r14153 14 14 15 15 import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTMSTileSource; 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.actions.AbstractMergeAction; 18 17 import org.openstreetmap.josm.data.coor.LatLon; … … 131 130 132 131 protected void warnNoImageryLayers() { 133 JOptionPane.showMessageDialog(Main.parent, tr("There are no imagery layers."), tr("No imagery layers"), JOptionPane.WARNING_MESSAGE); 132 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 133 tr("There are no imagery layers."), tr("No imagery layers"), JOptionPane.WARNING_MESSAGE); 134 134 } 135 135 } -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r14120 r14153 18 18 import javax.swing.filechooser.FileFilter; 19 19 20 import org.openstreetmap.josm.Main;21 20 import org.openstreetmap.josm.actions.DiskAccessAction; 22 21 import org.openstreetmap.josm.data.gpx.GpxConstants; … … 80 79 "Because its way points do not include a timestamp we cannot correlate them with audio data.</html>", 81 80 Utils.escapeReservedCharactersHTML(layer.getName())); 82 HelpAwareOptionPane.showOptionDialog(Main .parent, msg, tr("Import not possible"),81 HelpAwareOptionPane.showOptionDialog(MainApplication.getMainFrame(), msg, tr("Import not possible"), 83 82 JOptionPane.WARNING_MESSAGE, ht("/Action/ImportAudio#CantImportIntoGpxLayerFromServer")); 84 83 } … … 165 164 if (firstTime < 0.0) { 166 165 JOptionPane.showMessageDialog( 167 Main .parent,166 MainApplication.getMainFrame(), 168 167 tr("No GPX track available in layer to associate audio with."), 169 168 tr("Error"), … … 302 301 303 302 if (timedMarkersOmitted && !markers.timedMarkersOmitted) { 304 JOptionPane.showMessageDialog(Main .parent,303 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 305 304 tr("Some waypoints with timestamps from before the start of the track or after the end were omitted or moved to the start.")); 306 305 markers.timedMarkersOmitted = timedMarkersOmitted; 307 306 } 308 307 if (untimedMarkersOmitted && !markers.untimedMarkersOmitted) { 309 JOptionPane.showMessageDialog(Main .parent,308 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 310 309 tr("Some waypoints which were too far from the track to sensibly estimate their time were omitted.")); 311 310 markers.untimedMarkersOmitted = untimedMarkersOmitted; -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportImagesAction.java
r13130 r14153 14 14 import javax.swing.JOptionPane; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.gui.HelpAwareOptionPane; 17 import org.openstreetmap.josm.gui.MainApplication; 18 18 import org.openstreetmap.josm.gui.io.importexport.JpgImporter; 19 19 import org.openstreetmap.josm.gui.layer.GpxLayer; … … 46 46 "Because its way points do not include a timestamp we cannot correlate them with images.</html>", 47 47 Utils.escapeReservedCharactersHTML(layer.getName())); 48 HelpAwareOptionPane.showOptionDialog(Main .parent, msg, tr("Import not possible"),48 HelpAwareOptionPane.showOptionDialog(MainApplication.getMainFrame(), msg, tr("Import not possible"), 49 49 JOptionPane.WARNING_MESSAGE, ht("/Action/ImportImages#CantImportIntoGpxLayerFromServer")); 50 50 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarker.java
r13281 r14153 20 20 import javax.swing.JViewport; 21 21 22 import org.openstreetmap.josm.Main;23 22 import org.openstreetmap.josm.data.coor.LatLon; 24 23 import org.openstreetmap.josm.data.gpx.GpxConstants; 25 24 import org.openstreetmap.josm.data.gpx.GpxLink; 26 25 import org.openstreetmap.josm.data.gpx.WayPoint; 26 import org.openstreetmap.josm.gui.MainApplication; 27 27 import org.openstreetmap.josm.tools.ImageProvider; 28 28 … … 66 66 JOptionPane pane = new JOptionPane(p, JOptionPane.PLAIN_MESSAGE); 67 67 if (!GraphicsEnvironment.isHeadless()) { 68 JDialog dlg = pane.createDialog(Main .parent, imageUrl.toString());68 JDialog dlg = pane.createDialog(MainApplication.getMainFrame(), imageUrl.toString()); 69 69 dlg.setModal(false); 70 70 dlg.toFront(); -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayer.java
r14129 r14153 28 28 import javax.swing.JOptionPane; 29 29 30 import org.openstreetmap.josm.Main;31 30 import org.openstreetmap.josm.actions.RenameLayerAction; 32 31 import org.openstreetmap.josm.data.Bounds; … … 309 308 if (am == null) { 310 309 JOptionPane.showMessageDialog( 311 Main .parent,310 MainApplication.getMainFrame(), 312 311 tr("No existing audio markers in this layer to offset from."), 313 312 tr("Error"), … … 537 536 if (!AudioPlayer.paused()) { 538 537 JOptionPane.showMessageDialog( 539 Main .parent,538 MainApplication.getMainFrame(), 540 539 tr("You need to pause audio at the moment when you hear your synchronization cue."), 541 540 tr("Warning"), … … 547 546 if (synchronizeAudioMarkers(recent)) { 548 547 JOptionPane.showMessageDialog( 549 Main .parent,548 MainApplication.getMainFrame(), 550 549 tr("Audio synchronized at point {0}.", syncAudioMarker.getText()), 551 550 tr("Information"), … … 554 553 } else { 555 554 JOptionPane.showMessageDialog( 556 Main .parent,555 MainApplication.getMainFrame(), 557 556 tr("Unable to synchronize in layer being played."), 558 557 tr("Error"), … … 575 574 if (!AudioPlayer.paused()) { 576 575 JOptionPane.showMessageDialog( 577 Main .parent,576 MainApplication.getMainFrame(), 578 577 tr("You need to have paused audio at the point on the track where you want the marker."), 579 578 tr("Warning"), -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
r14120 r14153 14 14 import javax.swing.Timer; 15 15 16 import org.openstreetmap.josm.Main;17 16 import org.openstreetmap.josm.actions.mapmode.MapMode; 18 17 import org.openstreetmap.josm.actions.mapmode.PlayHeadDragMode; … … 179 178 /* Not close enough to track, or no audio marker found for some other reason */ 180 179 JOptionPane.showMessageDialog( 181 Main .parent,180 MainApplication.getMainFrame(), 182 181 tr("You need to drag the play head near to the GPX track " + 183 182 "whose associated sound track you were playing (after the first marker)."), … … 238 237 if (cw == null) { 239 238 JOptionPane.showMessageDialog( 240 Main .parent,239 MainApplication.getMainFrame(), 241 240 tr("You need to SHIFT-drag the play head onto an audio marker or onto the track point where you want to synchronize."), 242 241 tr("Warning"), … … 252 251 if (ca == null) { 253 252 JOptionPane.showMessageDialog( 254 Main .parent,253 MainApplication.getMainFrame(), 255 254 tr("Unable to create new audio marker."), 256 255 tr("Error"), … … 260 259 } else if (recent.parentLayer.synchronizeAudioMarkers(ca)) { 261 260 JOptionPane.showMessageDialog( 262 Main .parent,261 MainApplication.getMainFrame(), 263 262 tr("Audio synchronized at point {0}.", recent.parentLayer.syncAudioMarker.getText()), 264 263 tr("Information"), … … 269 268 } else { 270 269 JOptionPane.showMessageDialog( 271 Main .parent,270 MainApplication.getMainFrame(), 272 271 tr("Unable to synchronize in layer being played."), 273 272 tr("Error"), -
trunk/src/org/openstreetmap/josm/gui/mappaint/Cascade.java
r12620 r14153 201 201 return ((Number) o).floatValue() != 0; 202 202 if (o instanceof List) 203 return !((List ) o).isEmpty();203 return !((List<?>) o).isEmpty(); 204 204 if (o instanceof float[]) 205 205 return ((float[]) o).length != 0; -
trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java
r14119 r14153 37 37 import javax.swing.text.html.HTMLEditorKit; 38 38 39 import org.openstreetmap.josm.Main;40 39 import org.openstreetmap.josm.data.oauth.OAuthAccessTokenHolder; 41 40 import org.openstreetmap.josm.data.oauth.OAuthParameters; 42 41 import org.openstreetmap.josm.data.oauth.OAuthToken; 42 import org.openstreetmap.josm.gui.MainApplication; 43 43 import org.openstreetmap.josm.gui.help.ContextSensitiveHelpAction; 44 44 import org.openstreetmap.josm.gui.help.HelpUtil; … … 317 317 getClass().getName() + ".geometry", 318 318 WindowGeometry.centerInWindow( 319 Main .parent,319 MainApplication.getMainFrame(), 320 320 getPreferredSize() 321 321 ) … … 344 344 // executed via main worker. The OAuth connections would block otherwise. 345 345 final OAuthAuthorizationWizard wizard = new OAuthAuthorizationWizard( 346 Main .parent, serverUrl.toExternalForm(), Utils.newDirectExecutor());346 MainApplication.getMainFrame(), serverUrl.toExternalForm(), Utils.newDirectExecutor()); 347 347 wizard.showDialog(); 348 348 return wizard; -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r14052 r14153 29 29 import javax.swing.event.ChangeListener; 30 30 31 import org.openstreetmap.josm.Main;32 31 import org.openstreetmap.josm.actions.ExpertToggleAction; 33 32 import org.openstreetmap.josm.actions.ExpertToggleAction.ExpertModeChangeListener; … … 119 118 final ButtonSpec[] options = RestartAction.getButtonSpecs(); 120 119 if (0 == HelpAwareOptionPane.showOptionDialog( 121 Main .parent,120 MainApplication.getMainFrame(), 122 121 sb.toString(), 123 122 tr("Restart"), … … 132 131 } else if (task != null && !task.isCanceled()) { 133 132 JOptionPane.showMessageDialog( 134 Main .parent,133 MainApplication.getMainFrame(), 135 134 sb.toString(), 136 135 tr("Warning"), … … 175 174 } 176 175 177 if (Main .parent!= null) {178 Main .parent.repaint();176 if (MainApplication.getMainFrame() != null) { 177 MainApplication.getMainFrame().repaint(); 179 178 } 180 179 } -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r14121 r14153 72 72 import javax.swing.table.TableModel; 73 73 74 import org.openstreetmap.josm.Main;75 74 import org.openstreetmap.josm.actions.ExtensionFileFilter; 76 75 import org.openstreetmap.josm.data.Version; … … 1112 1111 } 1113 1112 if (!messages.isEmpty()) { 1114 ExtendedDialog dlg = new ExtendedDialog(Main .parent, tr("Warning"), tr("Cancel"), tr("Continue anyway"));1113 ExtendedDialog dlg = new ExtendedDialog(MainApplication.getMainFrame(), tr("Warning"), tr("Cancel"), tr("Continue anyway")); 1115 1114 dlg.setButtonIcons( 1116 1115 ImageProvider.get("cancel"), … … 1414 1413 1415 1414 GuiHelper.runInEDT(() -> HelpAwareOptionPane.showOptionDialog( 1416 Main .parent,1415 MainApplication.getMainFrame(), 1417 1416 msg, 1418 1417 tr("Error"), -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r14138 r14153 59 59 import javax.swing.tree.TreePath; 60 60 61 import org.openstreetmap.josm.Main;62 61 import org.openstreetmap.josm.actions.ActionParameter; 63 62 import org.openstreetmap.josm.actions.AdaptableAction; … … 514 513 @Override 515 514 public void actionPerformed(ActionEvent e) { 516 final PreferenceDialog p = new PreferenceDialog(Main .parent);515 final PreferenceDialog p = new PreferenceDialog(MainApplication.getMainFrame()); 517 516 p.selectPreferencesTabByName("toolbar"); 518 517 p.setVisible(true); … … 523 522 @Override 524 523 public void actionPerformed(ActionEvent e) { 525 final PreferenceDialog p = new PreferenceDialog(Main .parent);524 final PreferenceDialog p = new PreferenceDialog(MainApplication.getMainFrame()); 526 525 p.getTabbedPane().getShortcutPreference().setDefaultFilter(act.getDisplayName()); 527 526 p.selectPreferencesTabByName("shortcuts"); -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreference.java
r14149 r14153 37 37 import javax.swing.filechooser.FileFilter; 38 38 39 import org.openstreetmap.josm.Main;40 39 import org.openstreetmap.josm.actions.DiskAccessAction; 41 40 import org.openstreetmap.josm.data.Preferences; 42 41 import org.openstreetmap.josm.data.PreferencesUtils; 42 import org.openstreetmap.josm.gui.MainApplication; 43 43 import org.openstreetmap.josm.gui.dialogs.LogShowDialog; 44 44 import org.openstreetmap.josm.gui.help.HelpUtil; … … 237 237 238 238 if (keys.isEmpty()) { 239 JOptionPane.showMessageDialog(Main .parent,239 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 240 240 tr("Please select some preference keys not marked as default"), tr("Warning"), JOptionPane.WARNING_MESSAGE); 241 241 return; … … 250 250 if (hasLists) { 251 251 answer = JOptionPane.showOptionDialog( 252 Main .parent, tr("What to do with preference lists when this file is to be imported?"), tr("Question"),252 MainApplication.getMainFrame(), tr("What to do with preference lists when this file is to be imported?"), tr("Question"), 253 253 JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, 254 254 new String[]{tr("Append preferences from file to existing values"), tr("Replace existing values")}, 0); -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileAction.java
r14052 r14153 17 17 import javax.swing.filechooser.FileFilter; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.actions.DiskAccessAction; 21 20 import org.openstreetmap.josm.data.Preferences; 22 import org.openstreetmap.josm. spi.preferences.Setting;21 import org.openstreetmap.josm.gui.MainApplication; 23 22 import org.openstreetmap.josm.gui.io.CustomConfigurator; 24 23 import org.openstreetmap.josm.gui.widgets.AbstractFileChooser; 24 import org.openstreetmap.josm.spi.preferences.Setting; 25 25 import org.openstreetmap.josm.tools.Utils; 26 26 … … 56 56 } 57 57 if (keys.isEmpty()) { 58 JOptionPane.showMessageDialog(Main .parent,58 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 59 59 tr("All the preferences of this group are default, nothing to save"), tr("Warning"), JOptionPane.WARNING_MESSAGE); 60 60 return; -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/ListEditor.java
r12881 r14153 16 16 import javax.swing.table.AbstractTableModel; 17 17 18 import org.openstreetmap.josm.gui.widgets.JosmTextField; 18 19 import org.openstreetmap.josm.spi.preferences.ListSetting; 19 import org.openstreetmap.josm.gui.widgets.JosmTextField;20 20 import org.openstreetmap.josm.tools.GBC; 21 21 import org.openstreetmap.josm.tools.SubclassFilteredCollection; -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTable.java
r14052 r14153 29 29 30 30 import org.openstreetmap.josm.data.preferences.NamedColorProperty; 31 import org.openstreetmap.josm.gui.ExtendedDialog; 32 import org.openstreetmap.josm.gui.util.GuiHelper; 33 import org.openstreetmap.josm.gui.widgets.JosmTextField; 31 34 import org.openstreetmap.josm.spi.preferences.ListListSetting; 32 35 import org.openstreetmap.josm.spi.preferences.ListSetting; … … 34 37 import org.openstreetmap.josm.spi.preferences.Setting; 35 38 import org.openstreetmap.josm.spi.preferences.StringSetting; 36 import org.openstreetmap.josm.gui.ExtendedDialog;37 import org.openstreetmap.josm.gui.util.GuiHelper;38 import org.openstreetmap.josm.gui.widgets.JosmTextField;39 39 import org.openstreetmap.josm.tools.GBC; 40 40 -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/StringEditor.java
r12881 r14153 10 10 import javax.swing.JPanel; 11 11 12 import org.openstreetmap.josm.spi.preferences.StringSetting;13 12 import org.openstreetmap.josm.gui.ExtendedDialog; 14 13 import org.openstreetmap.josm.gui.widgets.JosmTextField; 14 import org.openstreetmap.josm.spi.preferences.StringSetting; 15 15 import org.openstreetmap.josm.tools.GBC; 16 16 -
trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java
r13761 r14153 23 23 import javax.swing.JSlider; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.actions.ExpertToggleAction; 27 26 import org.openstreetmap.josm.data.PreferencesUtils; 28 27 import org.openstreetmap.josm.data.preferences.NamedColorProperty; 28 import org.openstreetmap.josm.gui.MainApplication; 29 29 import org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper; 30 30 import org.openstreetmap.josm.gui.layer.markerlayer.Marker; … … 580 580 } catch (ParseError e) { 581 581 Logging.warn(e); 582 JOptionPane.showMessageDialog(Main .parent,582 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 583 583 tr("Incorrect waypoint label pattern: {0}", e.getMessage()), tr("Incorrect pattern"), JOptionPane.ERROR_MESSAGE); 584 584 waypointLabelPattern.requestFocus(); … … 590 590 } catch (ParseError e) { 591 591 Logging.warn(e); 592 JOptionPane.showMessageDialog(Main .parent,592 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 593 593 tr("Incorrect audio waypoint label pattern: {0}", e.getMessage()), tr("Incorrect pattern"), JOptionPane.ERROR_MESSAGE); 594 594 audioWaypointLabelPattern.requestFocus(); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/AddImageryDialog.java
r13777 r14153 7 7 import java.awt.Dimension; 8 8 9 import org.openstreetmap.josm.Main;10 9 import org.openstreetmap.josm.gui.ExtendedDialog; 10 import org.openstreetmap.josm.gui.MainApplication; 11 11 import org.openstreetmap.josm.gui.preferences.imagery.AddImageryPanel.ContentValidationListener; 12 12 import org.openstreetmap.josm.gui.util.WindowGeometry; … … 33 33 setRememberWindowGeometry( 34 34 panel.getClass().getName() + ".geometry", 35 WindowGeometry.centerInWindow(Main .parent, new Dimension(400, 600))35 WindowGeometry.centerInWindow(MainApplication.getMainFrame(), new Dimension(400, 600)) 36 36 ); 37 37 } -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r14120 r14153 54 54 import org.openstreetmap.gui.jmapviewer.interfaces.MapRectangle; 55 55 import org.openstreetmap.gui.jmapviewer.tilesources.OsmTileSource; 56 import org.openstreetmap.josm.Main;57 56 import org.openstreetmap.josm.data.coor.EastNorth; 58 57 import org.openstreetmap.josm.data.imagery.ImageryInfo; … … 546 545 throw ex; 547 546 else { 548 JOptionPane.showMessageDialog(Main .parent,547 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 549 548 ex.getMessage(), tr("Error"), 550 549 JOptionPane.ERROR_MESSAGE); … … 815 814 scrollPane.setPreferredSize(new Dimension(400, 400)); 816 815 box.add(scrollPane); 817 int option = JOptionPane.showConfirmDialog(Main .parent, box, tr("Please abort if you are not sure"),816 int option = JOptionPane.showConfirmDialog(MainApplication.getMainFrame(), box, tr("Please abort if you are not sure"), 818 817 JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); 819 818 if (option == JOptionPane.YES_OPTION) -
trunk/src/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreference.java
r14119 r14153 17 17 import javax.swing.JPanel; 18 18 19 import org.openstreetmap.josm.Main;20 19 import org.openstreetmap.josm.data.preferences.sources.ExtendedSourceEntry; 21 20 import org.openstreetmap.josm.data.preferences.sources.PresetPrefHelper; … … 24 23 import org.openstreetmap.josm.data.preferences.sources.SourceType; 25 24 import org.openstreetmap.josm.gui.ExtendedDialog; 25 import org.openstreetmap.josm.gui.MainApplication; 26 26 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 27 27 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; … … 59 59 } catch (IOException e) { 60 60 Logging.log(Logging.LEVEL_WARN, tr("Could not read tagging preset source: {0}", source), e); 61 ExtendedDialog ed = new ExtendedDialog(Main .parent, tr("Error"),61 ExtendedDialog ed = new ExtendedDialog(MainApplication.getMainFrame(), tr("Error"), 62 62 tr("Yes"), tr("No"), tr("Cancel")); 63 63 ed.setContent(tr("Could not read tagging preset source: {0}\nDo you want to keep it?", source)); … … 84 84 String msg = tr("Could not read tagging preset source: {0}", source); 85 85 Logging.log(Logging.LEVEL_ERROR, msg, e); 86 JOptionPane.showMessageDialog(Main .parent, msg);86 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), msg); 87 87 return false; 88 88 } catch (SAXParseException e) { … … 112 112 if (errorMessage != null) { 113 113 Logging.error(errorMessage); 114 int result = JOptionPane.showConfirmDialog(Main .parent, new JLabel(errorMessage), tr("Error"),114 int result = JOptionPane.showConfirmDialog(MainApplication.getMainFrame(), new JLabel(errorMessage), tr("Error"), 115 115 JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.ERROR_MESSAGE); 116 116 -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreference.java
r14149 r14153 43 43 import javax.swing.event.DocumentListener; 44 44 45 import org.openstreetmap.josm.Main;46 45 import org.openstreetmap.josm.actions.ExpertToggleAction; 47 46 import org.openstreetmap.josm.data.Preferences; … … 635 634 } 636 635 String s = (String) JOptionPane.showInputDialog( 637 Main .parent,636 MainApplication.getMainFrame(), 638 637 tr("Edit JOSM Plugin description URL."), 639 638 tr("JOSM Plugin description URL"), -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreference.java
r14120 r14153 22 22 import javax.swing.JSeparator; 23 23 24 import org.openstreetmap.josm.Main;25 24 import org.openstreetmap.josm.actions.ExpertToggleAction; 26 25 import org.openstreetmap.josm.data.Bounds; … … 35 34 import org.openstreetmap.josm.data.projection.Projections; 36 35 import org.openstreetmap.josm.gui.ExtendedDialog; 36 import org.openstreetmap.josm.gui.MainApplication; 37 37 import org.openstreetmap.josm.gui.preferences.PreferenceSetting; 38 38 import org.openstreetmap.josm.gui.preferences.PreferenceSettingFactory; … … 476 476 if (pc == null) { 477 477 JOptionPane.showMessageDialog( 478 Main .parent,478 MainApplication.getMainFrame(), 479 479 tr("The projection {0} could not be activated. Using Mercator", id), 480 480 tr("Error"), -
trunk/src/org/openstreetmap/josm/gui/progress/NullProgressMonitor.java
r12620 r14153 4 4 import java.awt.Component; 5 5 6 import org.openstreetmap.josm. Main;6 import org.openstreetmap.josm.gui.MainApplication; 7 7 import org.openstreetmap.josm.tools.Logging; 8 8 … … 127 127 @Override 128 128 public Component getWindowParent() { 129 return Main .parent;129 return MainApplication.getMainFrame(); 130 130 } 131 131 } -
trunk/src/org/openstreetmap/josm/gui/progress/swing/PleaseWaitProgressMonitor.java
r12675 r14153 11 11 import javax.swing.SwingUtilities; 12 12 13 import org.openstreetmap.josm.Main;14 13 import org.openstreetmap.josm.gui.MainApplication; 15 14 import org.openstreetmap.josm.gui.MapFrame; … … 171 170 */ 172 171 public PleaseWaitProgressMonitor(String windowTitle) { 173 this(Main .parent);172 this(MainApplication.getMainFrame()); 174 173 this.windowTitle = windowTitle; 175 174 } … … 401 400 Component parent = dialog; 402 401 if (isInBackground || parent == null) 403 return Main .parent;402 return MainApplication.getMainFrame(); 404 403 else 405 404 return parent; -
trunk/src/org/openstreetmap/josm/gui/progress/swing/SwingRenderingProgressMonitor.java
r12675 r14153 4 4 import java.awt.Component; 5 5 6 import org.openstreetmap.josm. Main;6 import org.openstreetmap.josm.gui.MainApplication; 7 7 import org.openstreetmap.josm.gui.progress.AbstractProgressMonitor; 8 8 import org.openstreetmap.josm.gui.progress.CancelHandler; … … 85 85 @Override 86 86 public Component getWindowParent() { 87 return Main .parent;87 return MainApplication.getMainFrame(); 88 88 } 89 89 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java
r14143 r14153 32 32 import javax.swing.SwingUtilities; 33 33 34 import org.openstreetmap.josm.Main;35 34 import org.openstreetmap.josm.actions.AdaptableAction; 36 35 import org.openstreetmap.josm.command.ChangePropertyCommand; … … 432 431 */ 433 432 PresetDialog(Component content, String title, ImageIcon icon, boolean disableApply, boolean showNewRelation) { 434 super(Main .parent, title,433 super(MainApplication.getMainFrame(), title, 435 434 showNewRelation ? 436 435 (new String[] {tr("Apply Preset"), tr("New relation"), tr("Cancel")}) : -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetMenu.java
r13649 r14153 21 21 import javax.swing.JSeparator; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.gui.MainApplication; 24 import org.openstreetmap.josm.gui.MainFrame; 25 25 import org.openstreetmap.josm.tools.AlphanumComparator; 26 26 import org.openstreetmap.josm.tools.Logging; … … 105 105 if (pointerInfo != null) { 106 106 Point p = pointerInfo.getLocation(); 107 pm.show(Main.parent, p.x-Main.parent.getX(), p.y-Main.parent.getY()); 107 MainFrame parent = MainApplication.getMainFrame(); 108 pm.show(parent, p.x-parent.getX(), p.y-parent.getY()); 108 109 } 109 110 } catch (SecurityException ex) { -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
r14121 r14153 24 24 import javax.swing.JOptionPane; 25 25 26 import org.openstreetmap.josm.Main;27 26 import org.openstreetmap.josm.data.preferences.sources.PresetPrefHelper; 27 import org.openstreetmap.josm.gui.MainApplication; 28 28 import org.openstreetmap.josm.gui.tagging.presets.items.Check; 29 29 import org.openstreetmap.josm.gui.tagging.presets.items.CheckGroup; … … 391 391 if (displayErrMsg) { 392 392 JOptionPane.showMessageDialog( 393 Main .parent,393 MainApplication.getMainFrame(), 394 394 tr("Could not read tagging preset source: {0}", source), 395 395 tr("Error"), … … 402 402 if (displayErrMsg) { 403 403 JOptionPane.showMessageDialog( 404 Main .parent,404 MainApplication.getMainFrame(), 405 405 "<html>" + tr("Error parsing {0}: ", source) + "<br><br><table width=600>" + 406 406 Utils.escapeReservedCharactersHTML(e.getMessage()) + "</table></html>", -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchDialog.java
r13925 r14153 6 6 import java.awt.event.ActionEvent; 7 7 8 import org.openstreetmap.josm.Main;9 8 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 10 9 import org.openstreetmap.josm.gui.ExtendedDialog; 10 import org.openstreetmap.josm.gui.MainApplication; 11 11 12 12 /** … … 32 32 33 33 private TaggingPresetSearchDialog() { 34 super(Main .parent, tr("Search presets"), tr("Select"), tr("Cancel"));34 super(MainApplication.getMainFrame(), tr("Search presets"), tr("Select"), tr("Cancel")); 35 35 selector = new TaggingPresetSelector(true, true); 36 36 setContent(selector, false); -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSearchPrimitiveDialog.java
r13952 r14153 8 8 import java.util.HashSet; 9 9 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.actions.JosmAction; 12 11 import org.openstreetmap.josm.data.osm.OsmData; … … 66 65 67 66 TaggingPresetSearchPrimitiveDialog() { 68 super(Main .parent, tr("Search for objects by preset"), tr("Search"), tr("Cancel"));67 super(MainApplication.getMainFrame(), tr("Search for objects by preset"), tr("Search"), tr("Cancel")); 69 68 selector = new TaggingPresetSelector(false, false); 70 69 setContent(selector, false); -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r14052 r14153 51 51 import javax.swing.plaf.FontUIResource; 52 52 53 import org.openstreetmap.josm.Main;54 53 import org.openstreetmap.josm.data.preferences.StrokeProperty; 55 54 import org.openstreetmap.josm.gui.ExtendedDialog; … … 296 295 */ 297 296 public static boolean warnUser(String title, String content, ImageIcon baseActionIcon, String continueToolTip) { 298 ExtendedDialog dlg = new ExtendedDialog(Main .parent,297 ExtendedDialog dlg = new ExtendedDialog(MainApplication.getMainFrame(), 299 298 title, tr("Cancel"), tr("Continue")); 300 299 dlg.setContent(content); -
trunk/src/org/openstreetmap/josm/gui/util/MultikeyActionsHandler.java
r12807 r14153 23 23 import javax.swing.event.PopupMenuListener; 24 24 25 import org.openstreetmap.josm.Main;26 25 import org.openstreetmap.josm.gui.MainApplication; 27 26 import org.openstreetmap.josm.gui.util.MultikeyShortcutAction.MultikeyInfo; … … 102 101 } 103 102 layers.addPopupMenuListener(new StatusLinePopupMenuListener()); 104 layers.show(Main .parent, Integer.MAX_VALUE, Integer.MAX_VALUE);105 layers.setLocation(Main .parent.getX() + Main.parent.getWidth() - layers.getWidth(),106 Main .parent.getY() + Main.parent.getHeight() - layers.getHeight());103 layers.show(MainApplication.getMainFrame(), Integer.MAX_VALUE, Integer.MAX_VALUE); 104 layers.setLocation(MainApplication.getMainFrame().getX() + MainApplication.getMainFrame().getWidth() - layers.getWidth(), 105 MainApplication.getMainFrame().getY() + MainApplication.getMainFrame().getHeight() - layers.getHeight()); 107 106 } 108 107 } -
trunk/src/org/openstreetmap/josm/gui/util/WindowGeometry.java
r13963 r14153 19 19 import javax.swing.JComponent; 20 20 21 import org.openstreetmap.josm. Main;21 import org.openstreetmap.josm.gui.MainApplication; 22 22 import org.openstreetmap.josm.spi.preferences.Config; 23 23 import org.openstreetmap.josm.tools.CheckParameterUtil; … … 410 410 Dimension result = new Dimension(); 411 411 GraphicsConfiguration gc = component.getGraphicsConfiguration(); 412 if (gc == null && Main .parent!= null) {413 gc = Main .parent.getGraphicsConfiguration();412 if (gc == null && MainApplication.getMainFrame() != null) { 413 gc = MainApplication.getMainFrame().getGraphicsConfiguration(); 414 414 } 415 415 if (gc != null) { -
trunk/src/org/openstreetmap/josm/gui/widgets/EditableList.java
r12304 r14153 17 17 import javax.swing.JScrollPane; 18 18 19 import org.openstreetmap.josm. Main;19 import org.openstreetmap.josm.gui.MainApplication; 20 20 import org.openstreetmap.josm.tools.GBC; 21 21 … … 61 61 addSrcButton.addActionListener(e -> { 62 62 String source = JOptionPane.showInputDialog( 63 Main .parent,63 MainApplication.getMainFrame(), 64 64 title, 65 65 title, … … 79 79 if (row == -1) { 80 80 if (sourcesList.getModel().getSize() == 0) { 81 String source1 = JOptionPane.showInputDialog(Main .parent, title, title, JOptionPane.QUESTION_MESSAGE);81 String source1 = JOptionPane.showInputDialog(MainApplication.getMainFrame(), title, title, JOptionPane.QUESTION_MESSAGE); 82 82 if (source1 != null && !source1.isEmpty()) { 83 83 ((DefaultListModel<String>) sourcesList.getModel()).addElement(source1); … … 85 85 } else { 86 86 JOptionPane.showMessageDialog( 87 Main .parent,87 MainApplication.getMainFrame(), 88 88 tr("Please select the row to edit."), 89 89 tr("Information"), … … 92 92 } 93 93 } else { 94 String source2 = (String) JOptionPane.showInputDialog(Main .parent,94 String source2 = (String) JOptionPane.showInputDialog(MainApplication.getMainFrame(), 95 95 title, 96 96 title, … … 106 106 deleteSrcButton.addActionListener(e -> { 107 107 if (sourcesList.getSelectedIndex() == -1) { 108 JOptionPane.showMessageDialog(Main .parent, tr("Please select the row to delete."), tr("Information"),108 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), tr("Please select the row to delete."), tr("Information"), 109 109 JOptionPane.QUESTION_MESSAGE); 110 110 } else { -
trunk/src/org/openstreetmap/josm/gui/widgets/FileChooserManager.java
r14138 r14153 10 10 import javax.swing.filechooser.FileFilter; 11 11 12 import org.openstreetmap.josm.Main;13 12 import org.openstreetmap.josm.actions.DiskAccessAction; 14 13 import org.openstreetmap.josm.actions.ExtensionFileFilter; 15 14 import org.openstreetmap.josm.actions.SaveActionBase; 16 15 import org.openstreetmap.josm.data.preferences.BooleanProperty; 16 import org.openstreetmap.josm.gui.MainApplication; 17 17 import org.openstreetmap.josm.spi.preferences.Config; 18 18 import org.openstreetmap.josm.tools.PlatformManager; … … 330 330 * When the user choses a file or directory, the {@code lastDirProperty} is updated to the chosen directory path. 331 331 * 332 * @param parent The Component used as the parent of the AbstractFileChooser. If null, uses {@code Main .parent}.332 * @param parent The Component used as the parent of the AbstractFileChooser. If null, uses {@code MainApplication.getMainFrame()}. 333 333 * @return the {@code AbstractFileChooser} if the user effectively choses a file or directory. {@code null} if the user cancelled the dialog. 334 334 */ … … 338 338 339 339 if (parent == null) { 340 parent = Main .parent;340 parent = MainApplication.getMainFrame(); 341 341 } 342 342 -
trunk/src/org/openstreetmap/josm/gui/widgets/NativeFileChooser.java
r14138 r14153 13 13 import javax.swing.filechooser.FileFilter; 14 14 15 import org.openstreetmap.josm. Main;15 import org.openstreetmap.josm.gui.MainApplication; 16 16 import org.openstreetmap.josm.tools.PlatformManager; 17 17 import org.openstreetmap.josm.tools.Utils; … … 35 35 */ 36 36 public NativeFileChooser(File file) { 37 fileDialog = new FileDialog((Frame) Main .parent);37 fileDialog = new FileDialog((Frame) MainApplication.getMainFrame()); 38 38 if (file != null) { 39 39 fileDialog.setDirectory(file.getAbsolutePath()); -
trunk/src/org/openstreetmap/josm/io/audio/AudioUtil.java
r12846 r14153 15 15 import javax.swing.JOptionPane; 16 16 17 import org.openstreetmap.josm. Main;17 import org.openstreetmap.josm.gui.MainApplication; 18 18 import org.openstreetmap.josm.spi.preferences.Config; 19 19 import org.openstreetmap.josm.tools.Logging; … … 66 66 Logging.error(msg); 67 67 if (!GraphicsEnvironment.isHeadless()) { 68 JOptionPane.showMessageDialog(Main .parent,68 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), 69 69 "<html><p>" + msg + "</p></html>", 70 70 tr("Error playing sound"), JOptionPane.ERROR_MESSAGE); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java
r14134 r14153 29 29 import javax.swing.table.TableModel; 30 30 31 import org.openstreetmap.josm.Main;32 31 import org.openstreetmap.josm.command.ChangePropertyCommand; 33 32 import org.openstreetmap.josm.data.UndoRedoHandler; … … 139 138 */ 140 139 public AddTagsDialog(String[][] tags, String senderName, Collection<? extends OsmPrimitive> primitives) { 141 super(Main.parent, tr("Add tags to selected objects"), new String[] {tr("Add selected tags"), tr("Add all tags"), tr("Cancel")}, 140 super(MainApplication.getMainFrame(), tr("Add tags to selected objects"), 141 new String[] {tr("Add selected tags"), tr("Add all tags"), tr("Cancel")}, 142 142 false, 143 143 true); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r13941 r14153 21 21 import javax.swing.JOptionPane; 22 22 23 import org.openstreetmap.josm.Main;24 23 import org.openstreetmap.josm.actions.downloadtasks.DownloadParams; 25 24 import org.openstreetmap.josm.data.osm.DownloadPolicy; 26 25 import org.openstreetmap.josm.data.osm.UploadPolicy; 26 import org.openstreetmap.josm.gui.MainApplication; 27 27 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 28 28 import org.openstreetmap.josm.spi.preferences.Config; … … 181 181 if (Config.getPref().getBoolean(globalConfirmationKey, globalConfirmationDefault)) { 182 182 // Ensure dialog box does not exceed main window size 183 Integer maxWidth = (int) Math.max(200, Main .parent.getWidth()*0.6);183 Integer maxWidth = (int) Math.max(200, MainApplication.getMainFrame().getWidth()*0.6); 184 184 String message = "<html><div>" + getPermissionMessage() + 185 185 "<br/>" + tr("Do you want to allow this?") + "</div></html>"; … … 189 189 } 190 190 Object[] choices = new Object[] {tr("Yes, always"), tr("Yes, once"), tr("No")}; 191 int choice = JOptionPane.showOptionDialog(Main .parent, label, tr("Confirm Remote Control action"),191 int choice = JOptionPane.showOptionDialog(MainApplication.getMainFrame(), label, tr("Confirm Remote Control action"), 192 192 JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, choices, choices[1]); 193 193 if (choice != JOptionPane.YES_OPTION && choice != JOptionPane.NO_OPTION) { // Yes/no refer to always/once -
trunk/src/org/openstreetmap/josm/io/session/SessionReader.java
r13901 r14153 32 32 import javax.xml.parsers.ParserConfigurationException; 33 33 34 import org.openstreetmap.josm.Main;35 34 import org.openstreetmap.josm.data.ViewportData; 36 35 import org.openstreetmap.josm.data.coor.EastNorth; … … 38 37 import org.openstreetmap.josm.data.projection.Projection; 39 38 import org.openstreetmap.josm.gui.ExtendedDialog; 39 import org.openstreetmap.josm.gui.MainApplication; 40 40 import org.openstreetmap.josm.gui.layer.Layer; 41 41 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; … … 675 675 SwingUtilities.invokeAndWait(() -> { 676 676 ExtendedDialog dlg = new ExtendedDialog( 677 Main .parent,677 MainApplication.getMainFrame(), 678 678 title, 679 679 tr("Cancel"), tr("Skip layer and continue")) -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r14149 r14153 53 53 import javax.swing.UIManager; 54 54 55 import org.openstreetmap.josm.Main;56 55 import org.openstreetmap.josm.actions.RestartAction; 57 56 import org.openstreetmap.josm.data.Preferences; … … 186 185 a.setCaretPosition(0); 187 186 if (!GraphicsEnvironment.isHeadless()) { 188 JOptionPane.showMessageDialog(Main .parent, new JScrollPane(a), tr("Plugin information"),187 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), new JScrollPane(a), tr("Plugin information"), 189 188 JOptionPane.INFORMATION_MESSAGE); 190 189 } … … 1397 1396 try { 1398 1397 FutureTask<Integer> task = new FutureTask<>(() -> HelpAwareOptionPane.showOptionDialog( 1399 Main .parent,1398 MainApplication.getMainFrame(), 1400 1399 msg.toString(), 1401 1400 tr("Update plugins"), … … 1480 1479 case 0: 1481 1480 // update the plugin 1482 updatePlugins(Main .parent, Collections.singleton(pluginInfo), null, true);1481 updatePlugins(MainApplication.getMainFrame(), Collections.singleton(pluginInfo), null, true); 1483 1482 return pluginDownloadTask; 1484 1483 case 1: … … 1487 1486 Config.getPref().putList("plugins", new ArrayList<>(plugins)); 1488 1487 GuiHelper.runInEDTAndWait(() -> JOptionPane.showMessageDialog( 1489 Main .parent,1488 MainApplication.getMainFrame(), 1490 1489 tr("The plugin has been removed from the configuration. Please restart JOSM to unload the plugin."), 1491 1490 tr("Information"), -
trunk/src/org/openstreetmap/josm/tools/PlatformHookOsx.java
r14148 r14153 29 29 import javax.swing.UIManager; 30 30 31 import org.openstreetmap.josm.Main;32 31 import org.openstreetmap.josm.data.Preferences; 32 import org.openstreetmap.josm.gui.MainApplication; 33 33 import org.openstreetmap.josm.io.CertificateAmendment.NativeCertAmend; 34 34 … … 85 85 eawtApplication.getDeclaredMethod("setDockIconImage", Image.class).invoke(appli, ImageProvider.get("logo").getImage()); 86 86 // enable full screen 87 enableOSXFullscreen( (Window) Main.parent);87 enableOSXFullscreen(MainApplication.getMainFrame()); 88 88 } catch (ReflectiveOperationException | SecurityException | IllegalArgumentException ex) { 89 89 // We'll just ignore this for now. The user will still be able to close JOSM by closing all its windows. -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r14148 r14153 77 77 import javax.swing.JOptionPane; 78 78 79 import org.openstreetmap.josm.Main;80 79 import org.openstreetmap.josm.data.Preferences; 81 80 import org.openstreetmap.josm.data.StructUtils; 82 81 import org.openstreetmap.josm.data.StructUtils.StructEntry; 83 82 import org.openstreetmap.josm.data.StructUtils.WriteExplicitly; 83 import org.openstreetmap.josm.gui.MainApplication; 84 84 import org.openstreetmap.josm.io.CertificateAmendment.NativeCertAmend; 85 85 import org.openstreetmap.josm.spi.preferences.Config; … … 403 403 "For your own safety, <b>please click Yes</b> in next dialog.")) 404 404 .append("</html>"); 405 JOptionPane.showMessageDialog(Main .parent, message.toString(), tr("Warning"), JOptionPane.WARNING_MESSAGE);405 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), message.toString(), tr("Warning"), JOptionPane.WARNING_MESSAGE); 406 406 for (String alias : insecureCertificates) { 407 407 Logging.warn(tr("Removing insecure certificate from {0} keystore: {1}", WINDOWS_ROOT, alias)); … … 441 441 "If unsure, you can also click No then disable HTTPS support in Remote Control preferences.")) 442 442 .append("</html>"); 443 JOptionPane.showMessageDialog(Main .parent, message.toString(),443 JOptionPane.showMessageDialog(MainApplication.getMainFrame(), message.toString(), 444 444 tr("HTTPS support in Remote Control"), JOptionPane.INFORMATION_MESSAGE); 445 445 }
Note:
See TracChangeset
for help on using the changeset viewer.