Class OpenLocationAction

All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action, Destroyable
Direct Known Subclasses:
OsmLinkPaster.NoWarnOpenLocationAction

public class OpenLocationAction extends JosmAction
Open an URL input dialog and load data from the given URL.
See Also:
  • Field Details

  • Constructor Details

    • OpenLocationAction

      Create an open action. The name is "Open a file".
    • OpenLocationAction

      protected OpenLocationAction(Shortcut shortcut)
      Create an open action. The name is "Open a file".
      Parameters:
      shortcut - action shortcut, can be null for subclasses
  • Method Details

    • restoreUploadAddressHistory

      protected void restoreUploadAddressHistory(HistoryComboBox cbHistory)
      Restore the current history from the preferences
      Parameters:
      cbHistory - the history combo box
    • remindUploadAddressHistory

      protected void remindUploadAddressHistory(HistoryComboBox cbHistory)
      Remind the current history in the preferences
      Parameters:
      cbHistory - the history combo box
    • actionPerformed

      public void actionPerformed(ActionEvent e)
    • findDownloadTasks

      public Collection<DownloadTask> findDownloadTasks(String url, boolean isRemotecontrol)
      Replies the list of download tasks accepting the given url.
      Parameters:
      url - The URL to open
      isRemotecontrol - True if download request comes from remotecontrol.
      Returns:
      The list of download tasks accepting the given url.
      Since:
      5691
    • findSummaryDocumentation

      Summarizes acceptable urls for error message purposes.
      Returns:
      The HTML message to be displayed
      Since:
      6031
    • openUrl

      public List<Future<?>> openUrl(boolean newLayer, String url)
      Open the given URL.
      Parameters:
      newLayer - true if the URL needs to be opened in a new layer, false otherwise
      url - The URL to open
      Returns:
      the list of tasks that have been started successfully (can be empty).
      Since:
      11986 (return type)
    • openUrl

      public List<Future<?>> openUrl(DownloadParams settings, String url)
      Open the given URL.
      Parameters:
      settings - download settings
      url - The URL to open
      Returns:
      the list of tasks that have been started successfully (can be empty).
      Since:
      13927
    • openUrl

      public List<Future<?>> openUrl(String url)
      Open the given URL. This class checks the USE_NEW_LAYER preference to check if a new layer should be used.
      Parameters:
      url - The URL to open
      Returns:
      the list of tasks that have been started successfully (can be empty).
      Since:
      11986 (return type)
    • openUrl

      public List<Future<?>> openUrl(boolean newLayer, boolean zoomToData, String url)
      Open the given URL.
      Parameters:
      newLayer - true if the URL needs to be opened in a new layer, false otherwise
      zoomToData - true to zoom to entire newly downloaded data, false otherwise
      url - The URL to open
      Returns:
      the list of tasks that have been started successfully (can be empty).
      Since:
      13261
    • openUrl

      public List<Future<?>> openUrl(DownloadParams settings, boolean zoomToData, String url)
      Open the given URL.
      Parameters:
      settings - download settings
      zoomToData - true to zoom to entire newly downloaded data, false otherwise
      url - The URL to open
      Returns:
      the list of tasks that have been started successfully (can be empty).
      Since:
      13927
    • confirmNoNewLayer

      private static DownloadParams confirmNoNewLayer(DownloadParams originalParams, String url)
    • askWhichTasksToLoad

      Asks the user which of the possible tasks to perform.
      Parameters:
      tasks - a list of possible tasks
      Returns:
      the selected tasks from the user or an empty list if the dialog has been canceled
    • warnNoSuitableTasks

      protected void warnNoSuitableTasks(String url)
      Displays an error message dialog that no suitable tasks have been found for the given url.
      Parameters:
      url - the given url
    • addDownloadTaskClass

      public final boolean addDownloadTaskClass(Class<? extends DownloadTask> taskClass)
      Adds a new download task to the supported ones.
      Parameters:
      taskClass - The new download task to add
      Returns:
      true (as specified by Collection.add(E))