public class UploadAction extends JosmAction
JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
Modifier and Type | Field and Description |
---|---|
private static java.util.List<UploadHook> |
lateUploadHooks |
private static java.util.List<UploadHook> |
uploadHooks
The list of upload hooks.
|
sc
Constructor and Description |
---|
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) |
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()
Refreshes the enabled state
|
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.
|
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip, updateEnabledState
private static final java.util.List<UploadHook> uploadHooks
private static final java.util.List<UploadHook> lateUploadHooks
public 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()
updateEnabledState
in class JosmAction
JosmAction.updateEnabledState(Collection)
,
JosmAction.initEnabledState()
public static boolean checkPreUploadConditions(AbstractModifiableLayer layer)
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)