Error retrieving keys for insertion in contextualized topic

Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
Vince
Posts: 64
Joined: Wed Dec 03, 2014 11:25 am

Error retrieving keys for insertion in contextualized topic

Post by Vince »

Hello,

We define a custom view in oXygen Web Author. This custom view allow user to drag and drop reusable keyref phrase.
To do this, we try to load all keys available for insertion.

The context map is :

Code: Select all

<bookmap>
  <frontmatter>
        <keydef format="ditamap"
              href="VARIABLES.ditamap"
              keys="variables"
              processing-role="resource-only"/>
    </frontmatter>
    <chapter>
        <topicref href="EDITING_TOPIC.dita">
     </chapter>
</bookmap>
 
Why this error ?

Code: Select all

2023-04-04 15:12:47,317 WARN [ http-nio-8081-exec-5 ] ro.sync.ecss.dita.e - DITA keys will not be resolved for this request.
java.lang.IllegalStateException: null
	at ro.sync.ecss.dita.e.b(Unknown Source)
	at ro.sync.ecss.dita.DITAAccess.getKeysForInsertion(Unknown Source)
	...
Same operation with same topic and map in the oXygen desktop version is a successfull.

Thanks a lot
Vincent
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: Error retrieving keys for insertion in contextualized topic

Post by cristi_talau »

Hello,

You are using the DITAAccess.getKeysForInsertion API. However, this API works correctly only in Oxygen XML Editor / Author and it returns the keys from the "Context" DITA Map (opened in the DITA Maps Manager side-view. In Web Author this API does not work correctly as it does not know for which map you want to get the keys.
If you want to get a list with all the keys in the DITA Map, you can use the following code:

Code: Select all

    
    AuthorEditorAccess editorAccess = authorAccess.getEditorAccess();
    ContextKeyManager keyManager = editorAccess.getEditingContext().getContextKeyManager();
    if (keyManager != null) {
      LinkedHashMap<String, KeyInfo> keys = keyManager.getKeys(editorAccess.getEditorLocation());
    }
Best,
Cristian
Vince
Posts: 64
Joined: Wed Dec 03, 2014 11:25 am

Re: Error retrieving keys for insertion in contextualized topic

Post by Vince »

Hello,

Thanks for reply. Your suggestion works well.

As I took DITAAccess.getKeysForInsertion API call from the ro.sync.ecss.extensions.dita.DITAExternalObjectInsertionHandler#ro.sync.ecss.extensions.dita.DITAExternalObjectInsertionHandler#detectKeyInfo, it means your handler does not work in Web Author.

Do you plan to make it works ?

Regards,
Vincent
cristi_talau
Posts: 496
Joined: Thu Sep 04, 2014 4:22 pm

Re: Error retrieving keys for insertion in contextualized topic

Post by cristi_talau »

Hello,

DITAAccess.getKeysForInsertion cannot be made to work in Web Author unless we create a new override which has an extra parameter that is the ContextKeyManager.

Regarding, the handler DITAExternalObjectInsertionHandler we will start from a user-facing feature: support for drag&drop with keys from a side-view, and if we decide to use the DITAExternalObjectInsertionHandler, then we will make it compatible with Web Author. However this feature is not on our short-term roadmap.

Best,
Cristian
Post Reply