Summary: | [refactoring scripts] Scriptable Refactoring XML is not human understandable | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Karsten Becker <eclipse> |
Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
Status: | NEW --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | alex.blewitt |
Version: | 3.3 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows XP | ||
Whiteboard: |
Description
Karsten Becker
2007-07-01 12:42:50 EDT
There are several ways to make the xml more expressive. The most obvious would be to create elements and nested elements. This would make the document better understandable. <?xml version="1.0" encoding="utf-8" standalone="no"?> <session version="1.0"> <refactoring project="net.kbsvn.auctioneer" version="2.0" flags="589826" id="org.eclipse.jdt.ui.change.method.signature"> <comment>Change method 'private static Section net.kbsvn.auctioneer.io.AuctioneerReader.readFile(File file, IProgressMonitor monitor) throws FileNotFoundException, IOException' to 'private static Section readFile(File file, IProgressMonitor monitor, String test1, util.ArrayList test2) throws FileNotFoundException, IOException' - Original project: 'net.kbsvn.auctioneer' - Added parameters: String test1 java.util.ArrayList test2</comment> <description>Change method 'readFile'</description> <delegates delegate="false" deprecate="true"/> <input>net.kbsvn.auctioneer.io.AuctioneerReader.readFile(File, IProgressMonitor)</input> <exceptions> <exception kind="OLD" class="java.io.FileNotFoundException"/> <exception kind="OLD" class="java.io.IOException"/> </exceptions> <signature methodName="readFile"> <parameter oldType="File" oldName="file" oldIndex="0"/><!-- Without newName means not renamed --> <parameter oldType="IProgressMonitor" oldName="monitor" oldIndex="1"/><!-- Without deleted means not deleted --> <parameter newType="String" newName="test1" default=""Hallo""/><!-- No oldName means added --> <parameter newType="java.util.ArrayList" newName="test2" default="new ArrayList()"/><!-- Default only valid for added --> </signature> </refactoring> </session> This still has the drawBack of not being verifable. The solution would be to use namespaces. This also allows for some very nice features like embedded xhtml for the comment. <?xml version="1.0" encoding="utf-8" standalone="no"?> <ref:session version="1.0" xmlns="http://www.w3.org/TR/html4/" xmlns:ref="http://www.eclipse.org/refactorings" xmlns:csr="http://www.eclipse.org/refactorings/org.eclipse.jdt.ui.change.method.signature"/> <ref:refactoring project="net.kbsvn.auctioneer" version="2.0" flags="589826"> <ref:comment>Change method 'private static Section net.kbsvn.auctioneer.io.AuctioneerReader.readFile(File file, IProgressMonitor monitor) throws FileNotFoundException, IOException' to 'private static Section readFile(File file, IProgressMonitor monitor, String test1, util.ArrayList test2) throws FileNotFoundException, IOException'<br/> - Original project: <b>'net.kbsvn.auctioneer'</b><br/> - Added parameters:<br/> <ul> <li>String test1</li> <li>java.util.ArrayList test2</li> </ul></ref:comment> <ref:description>Change method 'readFile'</ref:description> <csr:delegates delegate="false" deprecate="true"/> <ref:input>net.kbsvn.auctioneer.io.AuctioneerReader.readFile(File, IProgressMonitor)</ref:input> <csr:exceptions> <csr:exception kind="OLD" class="java.io.FileNotFoundException"/> <csr:exception kind="OLD" class="java.io.IOException"/> </csr:exceptions> <csr:signature methodName="readFile"> <csr:parameter oldType="File" oldName="file" oldIndex="0"/><!-- Without newName means not renamed --> <csr:parameter oldType="IProgressMonitor" oldName="monitor" oldIndex="1"/><!-- Without deleted means not deleted --> <csr:parameter newType="String" newName="test1" default=""Hallo""/><!-- No oldName means added --> <csr:parameter newType="java.util.ArrayList" newName="test2" default="new ArrayList()"/><!-- Default only valid for added --> </csr:signature> </ref:refactoring> </ref:session> This has the advantage that every refactoring can have its own namespace and have its own expressivness as required while still keeping the idea of being validatable. It is also easy to builtin other namespaces like the xhtml namespace which allows better control over the formatting of comments i.e. The namespace is built by prepending the refactoring ID with http://www.eclipse.org/refactorings/ this ensures that every refactoring has a unique namespace and the id does not need to be stored spererately. I agree and I wished we would have gone that way from the beginning. At the moment we don't have the time budget to rewrite this and can only do this if it is required to fix a bug. |