Opened 5 years ago
Last modified 4 years ago
#19296 assigned task
Actions should avoid to install listeners which are not needed
Reported by: | GerdP | Owned by: | GerdP |
---|---|---|---|
Priority: | normal | Milestone: | Longterm |
Component: | Core | Version: | |
Keywords: | Cc: |
Description
A lot of actions use a constructor which calls JosmAction.installAdapters() by default. Some of these actions don't care about layer changes or selection changes and thus should not install the listeners.
Attachments (1)
Change History (17)
by , 5 years ago
Attachment: | 19296.patch added |
---|
comment:1 by , 5 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 5 years ago
I don't think you need to provide such patches for review. It seems obvious. Simply fix it as you find it.
follow-up: 6 comment:4 by , 5 years ago
We have a lot of actions which only need the ActiveLayerChangeAdapter
but not the SelectionChangeAdapter
.
IIGTR actions should overwrite method listenToSelectionChange()
to return false when they only need the ActiveLayerChangeAdapter
?
comment:6 by , 5 years ago
Replying to GerdP:
We have a lot of actions which only need the
ActiveLayerChangeAdapter
but not theSelectionChangeAdapter
.
IIGTR actions should overwrite methodlistenToSelectionChange()
to return false when they only need theActiveLayerChangeAdapter
?
That sounds like a lot of code. I'd assume some way telling this via the constructor would be better, like changing bool to an enum which can transport multiple states?
comment:8 by , 5 years ago
And it's difficult to change something because some plugins use the existing methods. I've added some more in [o35472:35475]
comment:9 by , 4 years ago
Milestone: | → 20.05 |
---|
When starting JOSM, I get the following messages:
2020-05-29 20:14:47.470 INFO: Toolbar action without name: org.openstreetmap.josm.actions.ChangesetManagerToggleAction 2020-05-29 20:14:47.804 INFO: Toolbar action without name: org.openstreetmap.josm.actions.ChangesetManagerToggleAction
comment:11 by , 4 years ago
@Simon: Thanks for the hint, didn't see that difference in the two constructors.
comment:13 by , 4 years ago
I thought of this as a task. I've changed almost all core actions, but only a few plugins.
I kept Undo/Redo action as is because they might be needed for #17196.
comment:14 by , 4 years ago
Milestone: | 20.05 → Longterm |
---|---|
Type: | enhancement → task |
work in progress patch, probably more actions can be changed