Page 1 of 1

Get path from DITAExtensionsBundle

Posted: Fri Sep 14, 2012 9:29 am
by sverhagen
Hi,


We have our own DITAExtensionsBundle, which creates a DITAUniqueAttributesRecognizer, and thus generates IDs for us.

I want to let the ID depend on the project that is opened.

Is there any way, inside above classes (childs thereof) to obtain a handle to any such information; either the project file, or the currently opened documents file name or something like that.

I see I have an authorAccess field, but that seems not to helpful as of yet.

Thanks for your help, kind regards, Sander.

Re: Get path from DITAExtensionsBundle

Posted: Fri Sep 14, 2012 3:14 pm
by sorin_ristache
Hi Sander,

In any point of your extension class you can find the URL of the current project by calling ro.sync.util.editorvars.EditorVariables.getCurrentProjectURL().

Other option is getting the current project name, or the current project directory or the current project URL by calling EditorVariables.expandEditorVariables(variable, authorAccess.getEditorAccess().getEditorLocation()), where variable can be one of the constants:
  • EditorVariables.PROJECT_NAME
  • EditorVariables.PROJECT_DIRECTORY
  • EditorVariables.PROJECT_DIRECTORY_URL
Other option is finding the URL of the current document by calling authorAccess.getEditorAccess().getEditorLocation().

Other option is getting the list of URLs of all currently opened documents with a call authorAccess.getWorkspaceAccess().getAllEditorLocations().


Regards,
Sorin

Re: Get path from DITAExtensionsBundle

Posted: Fri Sep 14, 2012 8:26 pm
by sverhagen
I decided using this one:
authorAccess.getEditorAccess().getEditorLocation()
Thanks a lot!