Get path from DITAExtensionsBundle

<oXygen/> general issues.
sverhagen
Posts: 18
Joined: Wed May 23, 2012 8:53 am
Location: Portland, Oregon

Get path from DITAExtensionsBundle

Post by sverhagen » Fri Sep 14, 2012 9:29 am

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.

sorin_ristache
Posts: 4144
Joined: Fri Mar 28, 2003 2:12 pm

Re: Get path from DITAExtensionsBundle

Post by sorin_ristache » Fri Sep 14, 2012 3:14 pm

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

sverhagen
Posts: 18
Joined: Wed May 23, 2012 8:53 am
Location: Portland, Oregon

Re: Get path from DITAExtensionsBundle

Post by sverhagen » Fri Sep 14, 2012 8:26 pm

I decided using this one:
authorAccess.getEditorAccess().getEditorLocation()
Thanks a lot!

Post Reply