This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 207842 - New File Type (by XML Root Element) - enable Check XML and Validate XML functionality.
Summary: New File Type (by XML Root Element) - enable Check XML and Validate XML funct...
Status: NEW
Alias: None
Product: xml
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.1
Hardware: PC Linux
: P3 normal with 2 votes (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-27 15:18 UTC by richard_l
Modified: 2012-02-09 17:12 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description richard_l 2012-01-27 15:18:49 UTC
If you use the New File Type Wizard to create a new file type (by XML Root Element), you will create a DataObject and associated files for this new File Type.

However you then find that the XML Check and XML Validate functionality is disabled when editing this type of XML file, which is not useful.

You can obviously fix the problem, by editing the generated code (as I have), but as it seems that Check and Validate are useful and necessary XML file functions in all cases, so I am proposing that it enabled by default in the code generated by the wizard

1) I am proposing that additional code be added to the DataObject created.

in the constructor - it is currently:

CookieSet cookies = getCookieSet();
cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies));

proposed solution - add three further lines so that it now reads

CookieSet cookies = getCookieSet();
cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(), cookies));
InputSource in = DataObjectAdapters.inputSource(this);
cookies.add(new CheckXMLSupport(in));
cookies.add(new ValidateXMLSupport(in));

2) Also add the check and validate actions to Loader Actions in the generated layer.xml so that they are available from the file popup menu (as is normally available for any XML file)

example of possible addition entries:

<file name="org-netbeans-modules-xml-tools-actions-CheckAction.shadow">
    <attr name="originalFile" stringvalue="Actions/XML/org-netbeans-modules-xml-tools-actions-CheckAction.instance"/>
    <attr name="position" intvalue="205"/>
</file>
<file name="org-netbeans-modules-xml-tools-actions-ValidateAction.shadow">
    <attr name="originalFile" stringvalue="Actions/XML/org-netbeans-modules-xml-tools-actions-ValidateAction.instance"/>
    <attr name="position" intvalue="207"/>
</file>


Hope that all the preceding information is useful and complete.  Please contact me if you feel anything is missing from this proposal.

/Richard
Comment 1 richard_l 2012-02-09 17:12:57 UTC
Missed the TransformableSupport cookie in part 1 of my original request.  So part 1 of the request is updated to be:

1) I am proposing that additional code be added to the DataObject created.

in the constructor - it is currently:

CookieSet cookies = getCookieSet();
cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(),
cookies));

proposed solution - add four further lines so that it now reads

CookieSet cookies = getCookieSet();
cookies.add((Node.Cookie) DataEditorSupport.create(this, getPrimaryEntry(),
cookies));
InputSource in = DataObjectAdapters.inputSource(this);
cookies.add(new CheckXMLSupport(in));
cookies.add(new ValidateXMLSupport(in));
cookies.add(new TransformableSupport( DataObjectAdapters.source(this)));