Package org.openstreetmap.josm.actions
Class UpdateSelectionAction
- java.lang.Object
-
- javax.swing.AbstractAction
-
- org.openstreetmap.josm.actions.JosmAction
-
- org.openstreetmap.josm.actions.UpdateSelectionAction
-
- All Implemented Interfaces:
java.awt.event.ActionListener
,java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,javax.swing.Action
,Destroyable
- Direct Known Subclasses:
UpdateModifiedAction
public class UpdateSelectionAction extends JosmAction
This action synchronizes a set of primitives with their state on the server.- Since:
- 1670
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
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 UpdateSelectionAction()
Constructs a newUpdateSelectionAction
.UpdateSelectionAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean register, java.lang.String toolbarId)
Constructs a newUpdateSelectionAction
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
actionPerformed(java.awt.event.ActionEvent e)
java.util.Collection<OsmPrimitive>
getData()
Returns the data on which this action operates.static void
handlePrimitiveGoneException(long id, OsmPrimitiveType type)
handle an exception thrown because a primitive was deleted on the serverprotected void
updateEnabledState()
Override in subclasses to update the enabled state of the action when something in the JOSM state changes, i.e.protected void
updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
Override in subclasses to update the enabled state of the action if the collection of selected primitives changes.static void
updatePrimitive(PrimitiveId id)
Updates the data for theOsmPrimitive
s with idid
with the data currently kept on the server.static void
updatePrimitives(java.util.Collection<OsmPrimitive> selection)
Updates the data for for theOsmPrimitive
s inselection
with the data currently kept on the server.-
Methods inherited from class org.openstreetmap.josm.actions.JosmAction
buildActiveLayerChangeAdapter, buildLayerChangeAdapter, checkAndConfirmOutlyingOperation, destroy, getLayerManager, getShortcut, initEnabledState, installAdapters, listenToLayerChange, listenToSelectionChange, setHelpId, setToolbarId, setTooltip, updateEnabledStateOnCurrentSelection, updateEnabledStateOnCurrentSelection, updateEnabledStateOnModifiableSelection, waitFuture
-
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
-
-
-
Constructor Detail
-
UpdateSelectionAction
public UpdateSelectionAction()
Constructs a newUpdateSelectionAction
.
-
UpdateSelectionAction
public UpdateSelectionAction(java.lang.String name, java.lang.String iconName, java.lang.String tooltip, Shortcut shortcut, boolean register, java.lang.String toolbarId)
Constructs a newUpdateSelectionAction
.- Parameters:
name
- the action's text as displayed on the menu (if it is added to a menu)iconName
- the filename of the icon to usetooltip
- a longer description of the action that will be displayed in the tooltip. Please note that html is not supported for menu actions on some platforms.shortcut
- a ready-created shortcut object or null if you don't want a shortcut. But you always do want a shortcut, remember you can always register it with group=none, so you won't be assigned a shortcut unless the user configures one. If you pass null here, the user CANNOT configure a shortcut for your action.register
- register this action for the toolbar preferences?toolbarId
- identifier for the toolbar preferences. The iconName is used, if this parameter is null
-
-
Method Detail
-
handlePrimitiveGoneException
public static void handlePrimitiveGoneException(long id, OsmPrimitiveType type)
handle an exception thrown because a primitive was deleted on the server
-
updatePrimitives
public static void updatePrimitives(java.util.Collection<OsmPrimitive> selection)
Updates the data for for theOsmPrimitive
s inselection
with the data currently kept on the server.- Parameters:
selection
- a collection ofOsmPrimitive
s to update
-
updatePrimitive
public static void updatePrimitive(PrimitiveId id)
Updates the data for theOsmPrimitive
s with idid
with the data currently kept on the server.- Parameters:
id
- the id of a primitive in theDataSet
of the current edit layer. Must not be null.- Throws:
java.lang.IllegalArgumentException
- if id is nulljava.lang.IllegalStateException
- if there is no primitive withid
in the current datasetjava.lang.IllegalStateException
- if there is no current dataset
-
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()
-
updateEnabledState
protected void updateEnabledState(java.util.Collection<? extends OsmPrimitive> selection)
Description copied from class:JosmAction
Override in subclasses to update the enabled state of the action if the collection of selected primitives changes. This method is called with the new selection.- Overrides:
updateEnabledState
in classJosmAction
- Parameters:
selection
- the collection of selected primitives; may be empty, but not null- See Also:
JosmAction.updateEnabledState()
,JosmAction.initEnabledState()
,JosmAction.listenToSelectionChange()
-
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
-
getData
public java.util.Collection<OsmPrimitive> getData()
Returns the data on which this action operates. Override if needed.- Returns:
- the data on which this action operates
-
-