public class UpdateSelectionAction extends JosmAction
JosmAction.LayerChangeAdapter, JosmAction.SelectionChangeAdapter
sc
changeSupport, enabled
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
Constructor and Description |
---|
UpdateSelectionAction()
Constructs a new
UpdateSelectionAction . |
UpdateSelectionAction(String name,
String iconName,
String tooltip,
Shortcut shortcut,
boolean register,
String toolbarId)
Constructs a new
UpdateSelectionAction . |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e) |
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 server
|
protected 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(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 the
OsmPrimitive s with id id
with the data currently kept on the server. |
static void |
updatePrimitives(Collection<OsmPrimitive> selection)
Updates the data for for the
OsmPrimitive s in selection
with the data currently kept on the server. |
destroy, getCurrentDataSet, getEditLayer, getShortcut, initEnabledState, installAdapters, setTooltip
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
public UpdateSelectionAction()
UpdateSelectionAction
.public UpdateSelectionAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean register, String toolbarId)
UpdateSelectionAction
.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 nullpublic static void handlePrimitiveGoneException(long id, OsmPrimitiveType type)
public static void updatePrimitives(Collection<OsmPrimitive> selection)
OsmPrimitive
s in selection
with the data currently kept on the server.selection
- a collection of OsmPrimitive
s to updatepublic static void updatePrimitive(PrimitiveId id)
OsmPrimitive
s with id id
with the data currently kept on the server.id
- the id of a primitive in the DataSet
of the current edit layer. Must not be null.IllegalArgumentException
- if id is nullIllegalStateException
- if there is no primitive with id
in the current datasetIllegalStateException
- if there is no current datasetprotected 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()
protected void updateEnabledState(Collection<? extends OsmPrimitive> selection)
JosmAction
updateEnabledState
in class JosmAction
selection
- the collection of selected primitives; may be empty, but not nullJosmAction.updateEnabledState()
,
JosmAction.initEnabledState()
public void actionPerformed(ActionEvent e)
public Collection<OsmPrimitive> getData()