Page 1 of 1

Allow refactoring descriptor file to specify default file patterns

Posted: Wed Mar 08, 2023 6:50 pm
by chrispitude
We previously requested the following enhancement:

EXM-46522: Allow refactoring descriptor file to specify default file patterns

Different refactoring operations might apply to different file types:
  • DITA maps and topics (*.dita,*.ditamap)
  • DITA maps only (*.ditamap)
  • DITA-OT project files (*.xml)
  • XSLT stylesheet files (*.xsl)
If a refactoring operation is applied beyond the scope that it was designed for, it could unintentionally corrupt a file. Even if no templates happen to match outside the designed scope, runtime could still be much higher than needed (processing tens of thousands of .dita files instead of a hundred .ditamap files).

It would be nice if a refactoring descriptor could specify a default file filter value, just as default parameter values can be specified. Indeed, the same behavior could be used - if the default is edited, the change is remembered within the current session only. And if no default is specified in the descriptor file, then the existing behavior could be used (the last-used filter pattern is carried into the dialog of the next refactoring operation, even if it is a different one).

Here is a testcase:

oxygen_refactoring_default_file_types.zip

There are separate refactoring operations for DITA map and topic files. Note the following issues:
  • If you manually set the file filter for one refactoring operation, it incorrectly becomes the default for the other refactoring operation.
  • If you apply either refactoring operation at the Project scope with a blank filter, the SVG file is modified by rewriting its CDATA element. This could be prevented by having the default filter scope exclude .svg files.

Re: Allow refactoring descriptor file to specify default file patterns

Posted: Thu Mar 09, 2023 9:41 am
by Radu
Hi Chris,
Thanks for the extra details, I added them to the already opened issue.
Regards,
Radu

Re: Allow refactoring descriptor file to specify default file patterns

Posted: Fri Mar 17, 2023 1:23 pm
by Radu
Hi Chris,
Out of curiosity what element inside the SVG contained a cdata section?
Regards,
Radu

Re: Allow refactoring descriptor file to specify default file patterns

Posted: Wed Mar 22, 2023 1:01 pm
by chrispitude
Hi Radu,

The SVG is generated by Microsoft Visio. It seems to store its SVG global <style> information as follows:

image.png

Even if the XSLT stylesheet does not modify anything in the SVG file, somehow the refactoring operation "diff checker" reserializes the CDATA and thus sees a difference, causing such SVGs in the project to become modified for Git revision control.

Re: Allow refactoring descriptor file to specify default file patterns

Posted: Wed Mar 22, 2023 1:42 pm
by Radu
Hi Chris,

Maybe a workaround would be to do this in the XSLT:

Code: Select all

<xsl:output cdata-section-elements="svg:style"/>
but there still may be some differences when serializing.
Anyway we are working on that issue which you suggested that an XML refactoring operation could also define a file filter to use as default.
Regards,
Radu

Re: Allow refactoring descriptor file to specify default file patterns

Posted: Fri Oct 13, 2023 2:14 pm
by chrispitude
I see that this has been implemented in Oxygen v26 via the @filesFilter attribute:

https://www.oxygenxml.com/doc/versions/ ... tools.html

Thank you!

Re: Allow refactoring descriptor file to specify default file patterns

Posted: Fri Oct 13, 2023 2:20 pm
by Radu
Hi Chris,
Thanks for updating this thread.
Regards,
Radu