How to set a root map programmatically ?
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 64
- Joined: Wed Dec 03, 2014 11:25 am
How to set a root map programmatically ?
Hi,
Is there any easy way to set a root map programmatically to a loaded map in the DITA map manager ?
Something like :
Thank in advance for your help.
Vince
Is there any easy way to set a root map programmatically to a loaded map in the DITA map manager ?
Something like :
Code: Select all
URL url = new URL("...");
PluginWorkspaceProvider.getPluginWorkspace().open(url, "PAGE_DITA_ROOT_MAP");
Vince
-
- Posts: 78
- Joined: Wed Jun 22, 2016 2:48 pm
Re: How to set a root map programmatically ?
Post by adrian_sorop »
Hi Vince,
The easiest way to set the root map from API is to use the KEYS_CONTEXT_MAP option.
Something like:
Regards,
Adrian
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
The easiest way to set the root map from API is to use the KEYS_CONTEXT_MAP option.
Something like:
Code: Select all
URL contextMapToSet = new URL("");
PluginWorkspaceProvider.getPluginWorkspace().getOptionsStorage().setOption(APIAccessibleOptionTags.KEYS_CONTEXT_MAP, contextMapToSet.toExternalForm());
Adrian
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 64
- Joined: Wed Dec 03, 2014 11:25 am
Re: How to set a root map programmatically ?
Thanks for your reply Adrian
But, using this method, nothing appends on currently loaded map.
The specified root map is not selected in DITA MAP Manager combo box.
And any opened topic in the editor reports that the definition of keys are not found.
Any other help would be welcome.
Regards,
Vince
But, using this method, nothing appends on currently loaded map.
The specified root map is not selected in DITA MAP Manager combo box.
And any opened topic in the editor reports that the definition of keys are not found.
Any other help would be welcome.
Regards,
Vince
-
- Posts: 78
- Joined: Wed Jun 22, 2016 2:48 pm
Re: How to set a root map programmatically ?
Post by adrian_sorop »
Hello again,
Yes, you are right. Using the getOptionsStorage().setOption() doesn't work.
I've made a small sample and used setGlobalObjectProperty(). It changes the value of the Contex combo and loads the keys from the map.
Here's a sample code
Regards,
Adrian
Yes, you are right. Using the getOptionsStorage().setOption() doesn't work.
I've made a small sample and used setGlobalObjectProperty(). It changes the value of the Contex combo and loads the keys from the map.
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty(APIAccessibleOptionTags.KEYS_CONTEXT_MAP, contextMapToSet.toExternalForm());
Code: Select all
import java.net.URL;
import ro.sync.exml.options.APIAccessibleOptionTags;
import ro.sync.exml.plugin.workspace.WorkspaceAccessPluginExtension;
import ro.sync.exml.workspace.api.PluginWorkspace;
import ro.sync.exml.workspace.api.listeners.WSEditorChangeListener;
import ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace;
public class MyPluginExtension implements WorkspaceAccessPluginExtension {
@Override
public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
pluginWorkspaceAccess.addEditorChangeListener(new WSEditorChangeListener() {
@Override
public void editorOpened(URL editorLocation) {
if (foo()) {
URL contextMapToSet = new URL("...");
pluginWorkspaceAccess.setGlobalObjectProperty(APIAccessibleOptionTags.KEYS_CONTEXT_MAP,
contextMapToSet.toExternalForm());
}
}
private boolean foo() {
return true;
}
},PluginWorkspace.DITA_MAPS_EDITING_AREA);
}
@Override
public boolean applicationClosing() {
return true;
}
}
Adrian
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service