Possible to customize the warning messages in Oxygen?

csun
Posts: 31
Joined: Wed Dec 20, 2017 9:56 pm

Possible to customize the warning messages in Oxygen?

Post by csun »

We have a use case where we would like to customize the warning messages displayed in Oxygen, when a user clicks on a link that cannot open.

Currently the message is:

Description: :Cannot open the link. The URL is not specified.
Severity: Warning

To change the text in the "Description" field, would it require an simple change in the framework, or something more complicated? Thanks.
sorin_carbunaru
Posts: 402
Joined: Mon May 09, 2016 9:37 am

Re: Possible to customize the warning messages in Oxygen?

Post by sorin_carbunaru »

Hello,

Unfortunately there is no way to customize that message... How exactly would you want to customize it? I would like to understand your use case :).

All the best wishes,
Sorin Carbunaru
oXygen XML
csun
Posts: 31
Joined: Wed Dec 20, 2017 9:56 pm

Re: Possible to customize the warning messages in Oxygen?

Post by csun »

Hi Sorin,
Thanks for your reply.

My use case is, when the XIncluded doc content is in XMLs under certain file directories, I'd like to prevent the Oxygen users from following the xi:include links to open and edit them. One option would be to customize the CSS like this:
xi|include[href^="urn:mydomain:specialDir"]:before {
link: "" !important;
}

Now if a user click on the link from Oxygen's Author view, it displays the warning message aforementioned. It would be nice if we can let the warning message say something like:
Description: :Do not edit the file under /mydomain/specialDir. Your changes there will not be saved in the version control system.
Severity: Warning
sorin_carbunaru
Posts: 402
Joined: Mon May 09, 2016 9:37 am

Re: Possible to customize the warning messages in Oxygen?

Post by sorin_carbunaru »

Hi Charles,

If writing some Java code is an option, you could create a plugin that makes the files from the special domain read-only, and also set a reason why the document is like that.

For detecting if the current file is "special" and making it read-only, you can do something like this:

Code: Select all


    PluginWorkspace pluginWorkspace = PluginWorkspaceProvider.getPluginWorkspace();
// Get the current editor
WSEditor editor = pluginWorkspace.getCurrentEditorAccess(StandalonePluginWorkspace.MAIN_EDITING_AREA);
// Resolve the URN prefix to a URL
URL resolvedURN = pluginWorkspace.getXMLUtilAccess().resolvePathThroughCatalogs(null, "urn:mydomain:specialDir", true , true);
// Check if the current editor contains one of the interesting files
if (editor.getEditorLocation().toExternalForm().startsWith(resolvedURN.toExternalForm())) {
// Make read-only and give a reason. This reason should be rendered when trying to edit the document.
editor.getCurrentPage().setReadOnly("Do not edit!");
}
Best wishes,
Sorin C.
csun
Posts: 31
Joined: Wed Dec 20, 2017 9:56 pm

Re: Possible to customize the warning messages in Oxygen?

Post by csun »

Hi Sorin,

Yes, this looks to be a great option! :-) Thanks for the help.

Charles
Post Reply