Package org.openstreetmap.josm.actions
Class OpenLocationAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.openstreetmap.josm.actions.JosmAction
-
- org.openstreetmap.josm.actions.OpenLocationAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
OpenLocationAction.WhichTasksToPerformDialog
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
-
-
Field Summary
Fields Modifier and Type Field Description private static BooleanProperty
DOWNLOAD_ZOOMTODATA
true to zoom to entire newly downloaded data, false otherwiseprotected java.util.List<java.lang.Class<? extends DownloadTask>>
downloadTasks
the list of download tasksprivate static BooleanProperty
USE_NEW_LAYER
true if the URL needs to be opened in a new layer, false otherwise-
Fields inherited from class org.openstreetmap.josm.actions.JosmAction
sc
-
-
Constructor Summary
Constructors Modifier Constructor Description OpenLocationAction()
Create an open action.protected
OpenLocationAction(Shortcut shortcut)
Create an open action.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
boolean
addDownloadTaskClass(java.lang.Class<? extends DownloadTask> taskClass)
Adds a new download task to the supported ones.(package private) java.util.Collection<DownloadTask>
askWhichTasksToLoad(java.util.Collection<DownloadTask> tasks)
Asks the user which of the possible tasks to perform.java.util.Collection<DownloadTask>
findDownloadTasks(java.lang.String url, boolean isRemotecontrol)
Replies the list of download tasks accepting the given url.java.lang.String
findSummaryDocumentation()
Summarizes acceptable urls for error message purposes.java.util.List<java.util.concurrent.Future<?>>
openUrl(boolean newLayer, boolean zoomToData, java.lang.String url)
Open the given URL.java.util.List<java.util.concurrent.Future<?>>
openUrl(boolean newLayer, java.lang.String url)
Open the given URL.java.util.List<java.util.concurrent.Future<?>>
openUrl(java.lang.String url)
Open the given URL.java.util.List<java.util.concurrent.Future<?>>
openUrl(DownloadParams settings, boolean zoomToData, java.lang.String url)
Open the given URL.java.util.List<java.util.concurrent.Future<?>>
openUrl(DownloadParams settings, java.lang.String url)
Open the given URL.protected void
remindUploadAddressHistory(HistoryComboBox cbHistory)
Remind the current history in the preferencesprotected void
restoreUploadAddressHistory(HistoryComboBox cbHistory)
Restore the current history from the preferencesprotected void
warnNoSuitableTasks(java.lang.String url)
Displays an error message dialog that no suitable tasks have been found for the given url.-
Methods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setToolbarId, setTooltip, updateEnabledState, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Field Detail
-
USE_NEW_LAYER
private static final BooleanProperty USE_NEW_LAYER
true if the URL needs to be opened in a new layer, false otherwise
-
DOWNLOAD_ZOOMTODATA
private static final BooleanProperty DOWNLOAD_ZOOMTODATA
true to zoom to entire newly downloaded data, false otherwise
-
downloadTasks
protected final transient java.util.List<java.lang.Class<? extends DownloadTask>> downloadTasks
the list of download tasks
-
-
Constructor Detail
-
OpenLocationAction
public 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 Detail
-
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(java.awt.event.ActionEvent e)
-
findDownloadTasks
public java.util.Collection<DownloadTask> findDownloadTasks(java.lang.String url, boolean isRemotecontrol)
Replies the list of download tasks accepting the given url.- Parameters:
url
- The URL to openisRemotecontrol
- True if download request comes from remotecontrol.- Returns:
- The list of download tasks accepting the given url.
- Since:
- 5691
-
findSummaryDocumentation
public java.lang.String findSummaryDocumentation()
Summarizes acceptable urls for error message purposes.- Returns:
- The HTML message to be displayed
- Since:
- 6031
-
openUrl
public java.util.List<java.util.concurrent.Future<?>> openUrl(boolean newLayer, java.lang.String url)
Open the given URL.- Parameters:
newLayer
- true if the URL needs to be opened in a new layer, false otherwiseurl
- The URL to open- Returns:
- the list of tasks that have been started successfully (can be empty).
- Since:
- 11986 (return type)
-
openUrl
public java.util.List<java.util.concurrent.Future<?>> openUrl(DownloadParams settings, java.lang.String url)
Open the given URL.- Parameters:
settings
- download settingsurl
- The URL to open- Returns:
- the list of tasks that have been started successfully (can be empty).
- Since:
- 13927
-
openUrl
public java.util.List<java.util.concurrent.Future<?>> openUrl(java.lang.String url)
Open the given URL. This class checks theUSE_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 java.util.List<java.util.concurrent.Future<?>> openUrl(boolean newLayer, boolean zoomToData, java.lang.String url)
Open the given URL.- Parameters:
newLayer
- true if the URL needs to be opened in a new layer, false otherwisezoomToData
- true to zoom to entire newly downloaded data, false otherwiseurl
- The URL to open- Returns:
- the list of tasks that have been started successfully (can be empty).
- Since:
- 13261
-
openUrl
public java.util.List<java.util.concurrent.Future<?>> openUrl(DownloadParams settings, boolean zoomToData, java.lang.String url)
Open the given URL.- Parameters:
settings
- download settingszoomToData
- true to zoom to entire newly downloaded data, false otherwiseurl
- The URL to open- Returns:
- the list of tasks that have been started successfully (can be empty).
- Since:
- 13927
-
askWhichTasksToLoad
java.util.Collection<DownloadTask> askWhichTasksToLoad(java.util.Collection<DownloadTask> tasks)
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(java.lang.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(java.lang.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 byCollection.add(E)
)
-
-