Page 1 of 1

Do a contextual InputURLChooser actions list

Posted: Tue Mar 08, 2016 3:03 pm
by sebastienlavandier
Hi,
I develop a CMS Oxygen Plugin to work with Dita documents.

I added some actions in existing browse actions list.

Code: Select all


public class CustomInputURLChooser implements InputURLChooserCustomizer {

@Override
public void customizeBrowseActions(List<Action> existingBrowseActions, InputURLChooser chooser) {
// Add the browse CMS functions action on the first position.
final BrowseFunctionAction browseFunctionAction = new BrowseFunctionAction(chooser);
existingBrowseActions.add(0, browseFunctionAction);

// Add the browse CMS guides action on the second position.
final BrowseGuideAction browseGuideAction = new BrowseGuideAction(chooser);
existingBrowseActions.add(1, browseGuideAction);

// Add the browse CMS images action on the third position.
final BrowseImageAction browseImageAction = new BrowseImageAction(chooser);
existingBrowseActions.add(2, browseImageAction);
}
}
But in some case, I don't want to show all action list.
For example, on Dita maps manager open action, I just want to show one of them (browseGuideAction).
Or, when I when to add a topic reference, I just want to show an other (browseFunctionAction).

This list is used everywhere in browse action, but I hope I can customize it.

How I can do that ?
Thanks in advance for your help

Sébastien.L

Re: Do a contextual InputURLChooser actions list

Posted: Tue Mar 08, 2016 3:34 pm
by Radu
Hi Sébastien,

The InputURLChooser object you receive has a method getContextDescription() which should return some platform-indepentent description of the context in which you provide the action. You should try to do a system.err.println with this information in both contexts, see what it returns, maybe it's enough to differentiate between contexts.

Regards,
Radu

Re: Do a contextual InputURLChooser actions list

Posted: Tue Mar 08, 2016 4:13 pm
by sebastienlavandier
Hi Radu,

Thank you for your answer.
But this mehod (getContextDescription()) is only set for "DITA_Maps_Manager/Open".
The others are null.
So, this solves only one of my problems...

Do you have an other idea ?

Thanks in advance for your help.

Sébastien.L

Re: Do a contextual InputURLChooser actions list

Posted: Tue Mar 08, 2016 4:20 pm
by Radu
Hi Sébastien,

Could you tell me all the places, dialogs from which you want a non-null context to be returned on the "getContextDescription()" method?
I could try to possibly fix this in time for Oxygen 18.0 (in a couple of months).
I don't have another idea other than maybe trying to find the active visible window/dialog using Swing mechanisms and obtaining its title but this would be ugly.

Regards,
Radu