Allow refactoring descriptor file to specify default file patterns

Are you missing a feature? Request its implementation here.
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Allow refactoring descriptor file to specify default file patterns

Post 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
(6.56 KiB) Downloaded 115 times

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.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Allow refactoring descriptor file to specify default file patterns

Post by Radu »

Hi Chris,
Thanks for the extra details, I added them to the already opened issue.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Allow refactoring descriptor file to specify default file patterns

Post by Radu »

Hi Chris,
Out of curiosity what element inside the SVG contained a cdata section?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Allow refactoring descriptor file to specify default file patterns

Post by chrispitude »

Hi Radu,

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

image.png
image.png (119.45 KiB) Viewed 893 times

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.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Allow refactoring descriptor file to specify default file patterns

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Allow refactoring descriptor file to specify default file patterns

Post 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!
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Allow refactoring descriptor file to specify default file patterns

Post by Radu »

Hi Chris,
Thanks for updating this thread.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply