Modify

Ticket #1575 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Need access to "current" relation

Reported by: email@… Owned by: framm
Priority: major Component: Core
Version: latest Keywords:
Cc:

Description

Hi,

I'm developing a plugin that highlights the relation currently selected in the RelationListDialog and adds commands to more easily edit this relation. This plugin needs two operations that are currently not supported by JOSM:

  1. Determine the currently selected relation.
  2. Be notified whenever the selection changes.

Currently, there is no direct access to the JList of relations contained in the RelationListDialog. I am hacking around this by navigating the Swing component tree to retrieve the Jlist, but it would be good if JOSM provided "official" access to the above information.

If you feel like this would be a good addition, but don't have the time to implement it, I'd be happy to contribute a patch. Please let me know your preferred way how the API could look like.

Happy hacking, Mike

Attachments

relationListDialog.patch (2.2 KB) - added by Mike Forster <email@…> 3 years ago.
Patch that implements the requested functionality

Change History

comment:1 follow-up: ↓ 2 Changed 3 years ago by anonymous

What does you plugin actually wants to do with the data you request?

comment:2 in reply to: ↑ 1 Changed 3 years ago by anonymous

Replying to anonymous:

What does you plugin actually wants to do with the data you request?

It adds a layer that highlights the currently selected relation. For this to be possible, it needs to know which relation is currently selected.

As an alternative it could add its own list of relations to select from, but this seems like unnecessary duplication in the UI.

comment:3 Changed 3 years ago by anonymous

Provide a patch for JOSM please to make the stuff accessable you want to have.

comment:4 follow-up: ↓ 5 Changed 3 years ago by Jan Peter Stotz <jpstotz@…>

Don't forget that JOSM is not limited to one RelationListDialog. The user can open as many RelationListDialogs as he wants, therefore it is not as easy as it seems to determine the "relation currently selected".

comment:5 in reply to: ↑ 4 ; follow-up: ↓ 7 Changed 3 years ago by Mike Forster <email@…>

Replying to anonymous:

Provide a patch for JOSM please to make the stuff accessable you want to have.

Ok, I will do that.

Replying to Jan Peter Stotz <jpstotz@gmx.de>:

Don't forget that JOSM is not limited to one RelationListDialog. The user can open as many RelationListDialogs as he wants, therefore it is not as easy as it seems to determine the "relation currently selected".

Interesting. I have not seen this. How would I open a second RelationListDialog?

In the code I can find only one call to the RelationListDialog constructor - in the MapFrame constructor. So I cannot see how to create a second RelationListDialog. What have I missed?

Note that I am not talking about the RelationEditor class.

Changed 3 years ago by Mike Forster <email@…>

Patch that implements the requested functionality

comment:6 Changed 3 years ago by Mike Forster <email@…>

Hi,

I've added a patch that does what I need in a minimalistic way.

Would be great if you could apply it.

Thanks, Mike

comment:7 in reply to: ↑ 5 Changed 3 years ago by Jan Peter Stotz <jpstotz@…>

Note that I am not talking about the RelationEditor class.

Right, I mixed up both dialogs in mind.

Your patch looks quite useful. I noticed that you added a public reference for the RelationEditor in MapFrame - IMHO a good step. Personally I would say that MapFrame should hold a reference for every ToggleDialog instead of creating and "forgetting" nearly all of them...

Jan

comment:8 follow-up: ↓ 9 Changed 3 years ago by anonymous

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in r997.

comment:9 in reply to: ↑ 8 Changed 3 years ago by Michael Forster <email@…>

Replying to anonymous:

Fixed in r997.

Thanks!

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.