Programmatically Saving to a Project

Oxygen general issues.
asynchronousDev
Posts: 7
Joined: Fri Jul 12, 2013 8:54 pm

Programmatically Saving to a Project

Post by asynchronousDev »

Is there a way, using the plugin API, to programmatically create a new document and add it to an existing project?

Currently, I am able to create one and save it, but can't seem to find a way to add it to a specific project.
alex_jitianu
Posts: 1016
Joined: Wed Nov 16, 2005 11:11 am

Re: Programmatically Saving to a Project

Post by alex_jitianu »

Hello,

Unfortunately there is no API to add a file to the project. I'll add a feature request on our internal issue tracker to add such an API. Any additional details you can provide about your use case will help us define more precisely this API, like:
- there are two types of folders in the project. Real folders linked from disk or logical folder that don't have an equivalent on disk. Do you want to add the file in a Logical Folder or in a real folder?
- do you want to add it in the current selected folder from Project or do you want access to the project structure in order to decide the destination?

Best regards,
Alex
asynchronousDev
Posts: 7
Joined: Fri Jul 12, 2013 8:54 pm

Re: Programmatically Saving to a Project

Post by asynchronousDev »

I am currently working on being able to import a file and applying a transform to migrate it to a new custom filetype. I am not changing the original file, but creating a new and would like to be able to add the new one to the current project when finished.

As far as adding it to specific type of folder, I have no preference for my use case. More than likely it would be preferable to have all options available.

I would prefer to be able to access the project structure to either decide for myself or allow the user to decide where to put it. Again, having both available would be preferable, but the later for sure would have priority.

Thanks for the quick response.
alex_jitianu
Posts: 1016
Joined: Wed Nov 16, 2005 11:11 am

Re: Programmatically Saving to a Project

Post by alex_jitianu »

Hello,

If the parent directory where the result of the transformation was saved is already present in the Project structure then you could call ro.sync.exml.workspace.api.Workspace.refreshInProject(URL) for the newly created file and the Project will present and select it.

Best regards,
Alex
Post Reply