Package org.openstreetmap.josm.actions
Class MergeLayerAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.openstreetmap.josm.actions.JosmAction
-
- org.openstreetmap.josm.actions.AbstractMergeAction
-
- org.openstreetmap.josm.actions.MergeLayerAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
,Destroyable
public class MergeLayerAction extends AbstractMergeAction
Action that merges two or more OSM data layers.- Since:
- 1890
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.AbstractMergeAction
AbstractMergeAction.LayerListCellRenderer, AbstractMergeAction.TargetLayerDialogResult<T extends Layer>
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.actions.JosmAction
JosmAction.ActiveLayerChangeAdapter, JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
-
-
Field Summary
-
Fields inherited from class org.openstreetmap.josm.actions.JosmAction
sc
-
-
Constructor Summary
Constructors Constructor Description MergeLayerAction()
Constructs a newMergeLayerAction
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
protected java.util.concurrent.Future<?>
doMerge(java.util.List<? extends Layer> targetLayers, java.util.Collection<? extends Layer> sourceLayers)
Submits merge of layers.protected Layer
getSourceLayer()
Returns the source layer.protected boolean
listenToSelectionChange()
Overwrite this ifJosmAction.updateEnabledState()
should be called when the selection changed.java.util.concurrent.Future<?>
merge(java.util.List<? extends Layer> sourceLayers)
Merges a list of layers together.java.util.concurrent.Future<?>
merge(Layer sourceLayer)
Merges the given source layer with another one, determined at runtime.protected void
updateEnabledState()
Override in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e.static boolean
warnMergingUploadDiscouragedLayers(Layer sourceLayer, Layer targetLayer)
Warns about a discouraged merge operation, ask for confirmation.-
Methods inherited from class org.openstreetmap.josm.actions.AbstractMergeAction
askTargetLayer, askTargetLayer, askTargetLayer, warnNoTargetLayersForSourceLayer
-
Methods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, setHelpId, setToolbarId, setTooltip, updateEnabledState, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Constructor Detail
-
MergeLayerAction
public MergeLayerAction()
Constructs a newMergeLayerAction
.
-
-
Method Detail
-
doMerge
protected java.util.concurrent.Future<?> doMerge(java.util.List<? extends Layer> targetLayers, java.util.Collection<? extends Layer> sourceLayers)
Submits merge of layers.- Parameters:
targetLayers
- possible target layerssourceLayers
- source layers- Returns:
- a Future representing pending completion of the merge task, or
null
- Since:
- 11885 (return type)
-
merge
public java.util.concurrent.Future<?> merge(java.util.List<? extends Layer> sourceLayers)
Merges a list of layers together.- Parameters:
sourceLayers
- The layers to merge- Returns:
- a Future representing pending completion of the merge task, or
null
- Since:
- 11885 (return type)
-
merge
public java.util.concurrent.Future<?> merge(Layer sourceLayer)
Merges the given source layer with another one, determined at runtime.- Parameters:
sourceLayer
- The source layer to merge- Returns:
- a Future representing pending completion of the merge task, or
null
- Since:
- 11885 (return type)
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
-
listenToSelectionChange
protected boolean listenToSelectionChange()
Description copied from class:JosmAction
Overwrite this ifJosmAction.updateEnabledState()
should be called when the selection changed. Default is true.- Overrides:
listenToSelectionChange
in classJosmAction
- Returns:
true
if aDataSelectionListener
should be registered.
-
updateEnabledState
protected void updateEnabledState()
Description copied from class:JosmAction
Override in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e. when a layer is removed or added. SeeJosmAction.updateEnabledState(Collection)
to respond to changes in the collection of selected primitives. Default behavior is empty.- Overrides:
updateEnabledState
in classJosmAction
- See Also:
JosmAction.updateEnabledState(Collection)
,JosmAction.initEnabledState()
,JosmAction.listenToLayerChange()
-
getSourceLayer
protected Layer getSourceLayer()
Returns the source layer.- Returns:
- the source layer
-
warnMergingUploadDiscouragedLayers
public static final boolean warnMergingUploadDiscouragedLayers(Layer sourceLayer, Layer targetLayer)
Warns about a discouraged merge operation, ask for confirmation.- Parameters:
sourceLayer
- The source layertargetLayer
- The target layer- Returns:
true
if the user wants to cancel,false
if they want to continue
-
-