Hi Eliot,

So we have the API:

PluginWorkspaceProvider.getPluginWorkspace().importGlobalOptions(optionsFile);
You could call it twice, once with the location of the plugin's options.xml and once maybe with another location of an options.xml containing code templates.

Maybe load a project specific XML options file every time a new project is opened:

    @Override
    public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) { pluginWorkspaceAccess.getProjectManager().addProjectChangeListener(new ProjectChangeListener() {

        @Override
        public void projectChanged(URL oldProjectURL, URL newProjectURL) {
          File projectSpecificOptions = new File(new URL(newProjectURL, "options/options.xml").toURI());
          if(projectSpecificOptions != null) {
pluginWorkspaceAccess.importGlobalOptions(projectSpecificOptions);
          }
        }
      });
    }

Regards,

Radu

Radu Coravu
Oxygen XML Editor

On 12/8/21 17:08, Eliot Kimber wrote:

I may have a ready solution in that we have a add-on that serves to set options and that add-on is of course run on start up. Rather than having the code templates baked into the add-on’s options.xml I think it should be possible to import code templates from another location—I’ll dig into the API docs but if somebody has the necessary invocation at hand that would be helpful.

Thanks,

Eliot

_____________________________________________

*Eliot Kimber*

Sr Staff Content Engineer

O: 512 554 9368

M: 512 554 9368

servicenow.com <https://www.servicenow.com>

LinkedIn <https://www.linkedin.com/company/servicenow> | Twitter <https://twitter.com/servicenow> | YouTube <https://www.youtube.com/user/servicenowinc> | Facebook <https://www.facebook.com/servicenow>

*From: *oXygen-user <oxygen-user-boun...@oxygenxml.com> on behalf of Oxygen XML Editor Support (Radu Coravu) <supp...@oxygenxml.com>
*Date: *Tuesday, December 7, 2021 at 11:32 PM
*To: *oxygen-user@oxygenxml.com <oxygen-user@oxygenxml.com>
*Subject: *Re: [oXygen-user] Possible to Put Code Templates in a Framework?

*[External Email]*

**

Hi Eliot,

For now you cannot save code templates at framework level. We have an internal issue registered for this and I added your contact details to it, adding the issue ID below for future reference:

    EXM-36264 Code templates at framework level

In the meantime maybe you can create custom Author actions but they will work only in the Author visual editing mode.

Or maybe you can store the code templates at project level and have a project.xpr saved in the Git project that everybody needs to open in Oxygen before editing.

Regards,

Radu

Radu Coravu
Oxygen XML Editor

On 12/8/21 00:38, Eliot Kimber wrote:

    We maintain a set of code templates that currently get bake into
    options.xml that is then distributed via an add-on that sets
    global options (and nothing else).

    We maintain our frameworks in git and all authors clone that repo
    and pull regularly to keep it up to date, making deployment and
    update easier for writers (avoids having to update add-ons and
    then restart Oxygen).

    Reviewing the docs I see that code templates are stored in either
    the global options or in project options but I didn’t see anything
    about putting them in frameworks.

    Is there a way to have code templates in frameworks so that we can
    deploy new ones without having to update our add-on?

    Thanks,

    E.

    _____________________________________________

    *Eliot Kimber*

    Sr Staff Content Engineer

    O: 512 554 9368

    M: 512 554 9368

    servicenow.com <https://www.servicenow.com>

    LinkedIn
    
<https://urldefense.com/v3/__https:/www.linkedin.com/company/servicenow__;!!N4vogdjhuJM!TwGoo-UgX_UOAI6BVcwwLYM9_MsaRyuT6Qx1ohw4LJLspJ8XuQM4EvFhB2SQwPvkQonkug$>
 |
    Twitter
    
<https://urldefense.com/v3/__https:/twitter.com/servicenow__;!!N4vogdjhuJM!TwGoo-UgX_UOAI6BVcwwLYM9_MsaRyuT6Qx1ohw4LJLspJ8XuQM4EvFhB2SQwPtaz6Gvxg$>
 |
    YouTube
    
<https://urldefense.com/v3/__https:/www.youtube.com/user/servicenowinc__;!!N4vogdjhuJM!TwGoo-UgX_UOAI6BVcwwLYM9_MsaRyuT6Qx1ohw4LJLspJ8XuQM4EvFhB2SQwPvTtDoB5A$>
 |
    Facebook
    
<https://urldefense.com/v3/__https:/www.facebook.com/servicenow__;!!N4vogdjhuJM!TwGoo-UgX_UOAI6BVcwwLYM9_MsaRyuT6Qx1ohw4LJLspJ8XuQM4EvFhB2SQwPs8BMYr3Q$>



    _______________________________________________

    oXygen-user mailing list

    oXygen-user@oxygenxml.com

    https://www.oxygenxml.com/mailman/listinfo/oxygen-user  
<https://urldefense.com/v3/__https:/www.oxygenxml.com/mailman/listinfo/oxygen-user__;!!N4vogdjhuJM!TwGoo-UgX_UOAI6BVcwwLYM9_MsaRyuT6Qx1ohw4LJLspJ8XuQM4EvFhB2SQwPv87ymuCw$>


_______________________________________________
oXygen-user mailing list
oXygen-user@oxygenxml.com
https://www.oxygenxml.com/mailman/listinfo/oxygen-user
_______________________________________________
oXygen-user mailing list
oXygen-user@oxygenxml.com
https://www.oxygenxml.com/mailman/listinfo/oxygen-user

Reply via email to