public class UploadAction extends JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
IS_ASYNC_UPLOAD_ENABLED |
private static java.util.List<UploadHook> |
LATE_UPLOAD_HOOKS |
private static java.util.List<UploadHook> |
UPLOAD_HOOKS
The list of upload hooks.
|
sc
Constructor and Description |
---|
UploadAction()
Constructs a new
UploadAction . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
protected static void |
alertUnresolvedConflicts(OsmDataLayer layer) |
static boolean |
checkPreUploadConditions(AbstractModifiableLayer layer)
Check whether the preconditions are met to upload data from a given layer, if applicable.
|
static boolean |
checkPreUploadConditions(AbstractModifiableLayer layer,
APIDataSet apiData)
Check whether the preconditions are met to upload data in
apiData . |
static void |
registerUploadHook(UploadHook hook)
Registers an upload hook.
|
static void |
registerUploadHook(UploadHook hook,
boolean late)
Registers an upload hook.
|
static void |
unregisterUploadHook(UploadHook hook)
Unregisters an upload hook.
|
protected void |
updateEnabledState()
Override in subclasses to update the enabled state of the action when
something in the JOSM state changes, i.e.
|
void |
uploadData(OsmDataLayer layer,
APIDataSet apiData)
Uploads data to the OSM API.
|
static boolean |
warnUploadDiscouraged(AbstractModifiableLayer layer)
Warn user about discouraged upload, propose to cancel operation.
|
checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setTooltip, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
private static final java.util.List<UploadHook> UPLOAD_HOOKS
private static final java.util.List<UploadHook> LATE_UPLOAD_HOOKS
private static final java.lang.String IS_ASYNC_UPLOAD_ENABLED
public UploadAction()
UploadAction
.public static void registerUploadHook(UploadHook hook)
hook
- the upload hook. Ignored if null.public static void registerUploadHook(UploadHook hook, boolean late)
hook
- the upload hook. Ignored if null.late
- true, if the hook should be executed after the upload dialog
has been confirmed. Late upload hooks should in general succeed and not
abort the upload.public static void unregisterUploadHook(UploadHook hook)
hook
- the upload hook. Ignored if null.protected void updateEnabledState()
JosmAction
JosmAction.updateEnabledState(Collection)
to respond to changes in the collection
of selected primitives.
Default behavior is empty.updateEnabledState
in class JosmAction
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
,
JosmAction.listenToLayerChange()
public static boolean checkPreUploadConditions(AbstractModifiableLayer layer)
layer
- layer to checktrue
if the preconditions are met, or not applicablecheckPreUploadConditions(AbstractModifiableLayer, APIDataSet)
protected static void alertUnresolvedConflicts(OsmDataLayer layer)
public static boolean warnUploadDiscouraged(AbstractModifiableLayer layer)
layer
- incriminated layerpublic static boolean checkPreUploadConditions(AbstractModifiableLayer layer, APIDataSet apiData)
apiData
.
Makes sure upload is allowed, primitives in apiData
don't participate in conflicts and
runs the installed UploadHook
s.layer
- the source layer of the data to be uploadedapiData
- the data to be uploadedpublic void uploadData(OsmDataLayer layer, APIDataSet apiData)
layer
- the source layer for the data to uploadapiData
- the primitives to be added, updated, or deletedpublic void actionPerformed(java.awt.event.ActionEvent e)