Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 280119 - TOC Editor should debug XML errors
Summary: TOC Editor should debug XML errors
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.6 M1   Edit
Assignee: Ankur Sharma CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-12 14:19 EDT by Susan Yeshin CLA
Modified: 2009-07-29 15:08 EDT (History)
3 users (show)

See Also:


Attachments
Work in progress patch for TOC editor (8.04 KB, patch)
2009-07-14 14:29 EDT, Ankur Sharma CLA
no flags Details | Diff
Toc Patch (12.63 KB, patch)
2009-07-21 04:38 EDT, Ankur Sharma CLA
no flags Details | Diff
TOC Patch (12.52 KB, patch)
2009-07-21 07:50 EDT, Ankur Sharma CLA
curtis.windatt.public: iplog+
Details | Diff
Patch (11.43 KB, patch)
2009-07-28 12:46 EDT, Ankur Sharma CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Susan Yeshin CLA 2009-06-12 14:19:25 EDT
When you open an XML file that contains errors in the TOC editor, you can see the file in the source view, but when you click the Definition tab you get a message that there are errors so it can't open.

It would be helpful to know what the errors are.

Perhaps the source view could act like other XML editors and provide debug support.
Comment 1 Darin Wright CLA 2009-07-08 10:51:26 EDT
The same problem exists with the "Context Help" editor (which was originally cloned from the TOC editor). We should be able to determine where in the file an XML error occurrs and provide an error/marker in the ruler (similar to what the plug-in XML editor does).

Since we don't have a builder to manage such errors, the markers need to be cleaned up when the editor is closed (most problem markers are managed by an associated builder - but we don't want the overhead of a builder for this, currently).
Comment 2 Ankur Sharma CLA 2009-07-14 14:29:39 EDT
Created attachment 141555 [details]
Work in progress patch for TOC editor

attaching a first cut patch. Can you review and let me know am on right track. If OK, I'll make similar changes to Context Help editor.
Comment 3 Curtis Windatt CLA 2009-07-17 11:50:33 EDT
Should be in UI.
Comment 4 Curtis Windatt CLA 2009-07-17 16:22:55 EDT
You are definitely on the right track here Ankur.  It doesn't look like a huge change to get this working which is great.  Got the markers showing up for me nicely.

1) Does the parser always give up after the first error?  How hard might it be to have it continue parsing to find any other problems?  If it can't be done well, oh well, but its worth looking at.

2) The marker shouldn't need its own type specified in plugin.xml. You should be able to just create your own marker type programmatically.  The extension point is used so that persisted markers can be displayed in the problems view without loading the plugin.

3) I get an error opening the editor on a syntactically good file:

java.lang.NullPointerException
	at org.eclipse.pde.internal.ui.editor.plugin.FormFilteredTree.createUIListenerEntryFilter(FormFilteredTree.java:84)
	at org.eclipse.pde.internal.ua.ui.editor.toc.TocTreeSection.createClient(TocTreeSection.java:173)
	at org.eclipse.pde.internal.ui.editor.StructuredViewerSection.<init>(StructuredViewerSection.java:47)
	at org.eclipse.pde.internal.ui.editor.StructuredViewerSection.<init>(StructuredViewerSection.java:35)
	at org.eclipse.pde.internal.ui.editor.TreeSection.<init>(TreeSection.java:66)
	at org.eclipse.pde.internal.ua.ui.editor.toc.TocTreeSection.<init>(TocTreeSection.java:143)
	at org.eclipse.pde.internal.ua.ui.editor.toc.TocBlock.createMasterSection(TocBlock.java:58)
	at org.eclipse.pde.internal.ui.editor.PDEMasterDetailsBlock.createMasterPart(PDEMasterDetailsBlock.java:34)
	at org.eclipse.ui.forms.MasterDetailsBlock.createContent(MasterDetailsBlock.java:161)
	at org.eclipse.ui.forms.MasterDetailsBlock.createContent(MasterDetailsBlock.java:142)
	at org.eclipse.pde.internal.ui.editor.PDEMasterDetailsBlock.createContent(PDEMasterDetailsBlock.java:47)
	at org.eclipse.pde.internal.ua.ui.editor.toc.TocPage.createFormContent(TocPage.java:86)
	at org.eclipse.ui.forms.editor.FormPage$1.run(FormPage.java:152)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)

4) When there is an xml error, the TOCEditor opens to a blank definition page.  We should have a message like before.

5) We will have to take a look at the performance of the marker creation/deletion.  It seemed to take a longer time to close the editor, during which time the UI was locked.

6) Once this is working well we should apply it to the context help editor.
Comment 5 Ankur Sharma CLA 2009-07-21 04:38:14 EDT
Created attachment 142104 [details]
Toc Patch

1. The SAX Parser gives up on first error. Can't see any way to continue parsing unless we write a custom parse and that we will be overkill.

2. Removed the marker from plugin.xml as well as custom type. It now uses IMarker.PROBLEM

3. Attach the model, if you still get NPE. I guess it was due to separate job I was creating. No more jobs.

4. The formatted error page has been replaced by form with error message. This is so because the Toc Page is 'created' once. And if there is error while opening the model and user fixes it later, to refresh the page, I'll have to dispose old one and create new one. Instead it now show the model as much it could parse and an error message if there as an error.

5. The UI not locked as more. The save simply marks the model to refresh the markers and when model is reconciled, the marker as refreshed async.

6. I tested it and looks fine. Let me know you also find it good enough for Ctx help editor.
Comment 6 Ankur Sharma CLA 2009-07-21 07:50:33 EDT
Created attachment 142117 [details]
TOC Patch

Forgot to delete System.outs before attaching the patch :(
Comment 7 Curtis Windatt CLA 2009-07-22 13:47:46 EDT
I had a couple problems with the editor in one of my targets, but it worked fine in a newer workspace.  I'll do a little more testing before committing the fix.  Ankur, feel free to file a new bug to apply the same kind of fix to the ctx editor and start working on it.
Comment 8 Curtis Windatt CLA 2009-07-22 15:15:19 EDT
Applied patch to HEAD.  Thanks Ankur.
Comment 9 Ankur Sharma CLA 2009-07-28 12:46:32 EDT
Created attachment 142787 [details]
Patch

Found a bug in patch while fixing for Context Help Editor. Also, fixed the copyrights year.
Comment 10 Ankur Sharma CLA 2009-07-28 12:48:07 EDT
Found a bug in patch while fixing for Context Help Editor.
Comment 11 Curtis Windatt CLA 2009-07-29 15:06:16 EDT
Applied patch to HEAD.  Changed to log any exceptions.  While the exceptions may not be relevant to the user, hiding it can cause a lot of debugging headaches when something is broken.
Comment 12 Curtis Windatt CLA 2009-07-29 15:08:07 EDT
Also, copyrights should have the date the file was created and the year it was most recently updated.  So instead of '2009' it should say '2006, 2009'