Modify

Opened 13 years ago

Closed 2 years ago

Last modified 2 years ago

#6725 closed defect (fixed)

[Patch] Plugins need to be loaded before tool definitions for toolbar buttons (WAS: Missing tool definition in utilsplugin2 when item placed in toolbar)

Reported by: rickmastfan67 Owned by: team
Priority: normal Milestone: 22.02
Component: Core Version: latest
Keywords: toolbar plugin button Cc:

Description (last modified by Zverikk)

Just found something left over from the old "dumbutils" plugin that was merged into utilsplugin2.

Whenever you place the "Replace Geometry" icon into the "toolbar", this message pops up when you start up JOSM via the command line.

Could not load tool definition dumbutils/replacegeometry

Just thought you would like to know about it and fix it if you want to as it doesn't seem to have any problems in the toolbar, even with that message showing up.

Also, that message still shows up when you disable utilsplugin2, but shows up a second time after all the other plugins load. And it keeps showing up in the CL when you hit "F12" to pull up the preferences.

NOTE: To get this message to show up the first time in the CL, you must first put the "Replace Geometry" icon into your toolbar and restart JOSM. Then, when it restarts, you'll see the message for the first time.

Attachments (1)

6725.patch (2.1 KB ) - added by GerdP 2 years ago.

Download all attachments as: .zip

Change History (19)

comment:1 by Zverikk, 13 years ago

Owner: changed from team to Zverikk
Status: newassigned

comment:2 by Zverikk, 13 years ago

Component: Plugin utilsplugin2Core
Description: modified (diff)
Owner: changed from Zverikk to team
Priority: trivialminor
Status: assignednew

This is not the plugin's bug. JOSM tries to load tool definitions for toolbar buttons before it loads plugins, and, obviously, fails. Everything works fine after plugins are loaded.

comment:3 by skyper, 13 years ago

Summary: Missing tool definition in utilsplugin2 when item placed in toolbarPlugins need to be loaded before tool definitions for toolbar buttons (WAS: Missing tool definition in utilsplugin2 when item placed in toolbar)

comment:4 by skyper, 3 years ago

Keywords: toolbar plugin button added
Priority: minornormal

Is this still a problem?

comment:5 by rickmastfan67, 3 years ago

Well, the error still shows up to this date to be honest whenever starting up JOSM as long as I have the "Replace Geometry" button in my toolbar for quick access.

2021-03-25 22:43:22.918 INFO: Could not load tool definition dumbutils/replacegeometry

Don't know if it hurts anything to be honest.

comment:6 by GerdP, 2 years ago

I think it's not a problem because the toolbar is refreshed again after the plugins are loaded.
I am not sure why it is needded to refresh the toolbar before the plugins are loaded (this causes the INFO message).

comment:7 by gaben, 2 years ago

The toolbar preferences are initialised here source://trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java@18360#L982.

When I comment this line out, only the preferences disappear. The loading order probably can be delayed but need to be checked.

Last edited 2 years ago by gaben (previous) (diff)

in reply to:  6 comment:8 by skyper, 2 years ago

Replying to GerdP:

I think it's not a problem because the toolbar is refreshed again after the plugins are loaded.
I am not sure why it is needed to refresh the toolbar before the plugins are loaded (this causes the INFO message).

With r18303 I only get the messages once.

java -Djosm.home=/tmp/.josm_test -jar /usr/share/josm/josm-tested-18303.jar 
2022-01-04 14:37:51.199 INFO: Log level is at INFO (INFO, 800)
2022-01-04 14:38:00.417 INFO: Obtained 82 Tag2Link rules from resource://META-INF/resources/webjars/tag2link/2021.3.21/index.json
2022-01-04 14:38:05.699 INFO: Could not load tool definition icons/splitroundabout
2022-01-04 14:38:05.709 INFO: Could not load tool definition icons/sortptroutemembers
2022-01-04 14:38:05.774 INFO: loading plugin 'pt_assistant' (version 1ff2e15)
2022-01-04 14:38:05.927 SEVERE: Failed to locate image 'bus.png'

With r18360 I get them twice

java -Djosm.home=/tmp/.josm_test -jar /usr/share/josm/josm-tested-18360.jar 
2022-01-04 14:43:02.462 INFO: Log level is at INFO (INFO, 800)
2022-01-04 14:43:12.079 INFO: Obtained 82 Tag2Link rules from resource://META-INF/resources/webjars/tag2link/2021.3.21/index.json
2022-01-04 14:43:17.964 INFO: Could not load tool definition icons/splitroundabout
2022-01-04 14:43:17.965 INFO: Could not load tool definition icons/sortptroutemembers
2022-01-04 14:43:18.066 INFO: Could not load tool definition icons/splitroundabout
2022-01-04 14:43:18.066 INFO: Could not load tool definition icons/sortptroutemembers
2022-01-04 14:43:18.135 INFO: loading plugin 'pt_assistant' (version 1ff2e15)
2022-01-04 14:43:18.256 SEVERE: Failed to locate image 'bus.png'

This was a test with empty preferences and installing only pt_assistant and restarts after installation and after JOSM and plugin upgrade. Plugin did not change.

Plugins:
+ pt_assistant (1ff2e15)

comment:9 by GerdP, 2 years ago

That's a different story, but yes, the messages appear twice now because the refresh is also triggered when the presets are modified. I guess the pt_plugin does that.

comment:10 by gaben, 2 years ago

I get two log entries with my plugin too, when the toolbar button is visible.

edit:

  • it isn't calling MainApplication.getToolbar().refreshToolbarControl() and
  • uses JosmAction(String name, String iconName, String tooltip, Shortcut shortcut, boolean registerInToolbar) constructor with registerInToolbar=true
Last edited 2 years ago by gaben (previous) (diff)

comment:11 by GerdP, 2 years ago

The reason for these messages is that the preference toolbar is processed before the plugins are loaded. This contains icons/actions from the plugins, so that fails at that stage. Later, when all plugins are loaded, the toolbar is refreshed and the actions are found.
The refresh is now also triggered when the presets are loaded, that's why the messages appear more often.
I've no idea under what circumstances the info message really indicates a problem.
Would it help if the message text would be changed to "Could not yet load tool definition "?

comment:12 by stoecker, 2 years ago

What about showing this message only after the plugins are loaded and suppress it before? The message makes only sense for cases where toolbar actions really can't be shown, i.e. actions from removed plugins and so on.

comment:13 by GerdP, 2 years ago

Yes, sounds good. Will try to find out how and where to pass that information to the ToolbarPreferences instance...

by GerdP, 2 years ago

Attachment: 6725.patch added

comment:14 by GerdP, 2 years ago

Milestone: 22.01
Summary: Plugins need to be loaded before tool definitions for toolbar buttons (WAS: Missing tool definition in utilsplugin2 when item placed in toolbar)[Patch] Plugins need to be loaded before tool definitions for toolbar buttons (WAS: Missing tool definition in utilsplugin2 when item placed in toolbar)

No idea if this is a good way to do it but it solves the problem and still shows the message when something is really missing, e.g. after uninstalling the pt_assistant plugin.

comment:15 by GerdP, 2 years ago

Resolution: fixed
Status: newclosed

In 18361/josm:

fix #6725: Plugins need to be loaded before tool definitions for toolbar buttons

  • use a flag to indicate that all plugins were loaded and suppress INFO messages unless that was done

comment:16 by gaben, 2 years ago

@since xxx :)

comment:17 by GerdP, 2 years ago

In 18363/josm:

see #6725, #21438
correct @since xxx

comment:18 by stoecker, 2 years ago

Milestone: 22.0122.02

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.