Community
Participate
Working Groups
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.
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).
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.
Should be in UI.
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.
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.
Created attachment 142117 [details] TOC Patch Forgot to delete System.outs before attaching the patch :(
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.
Applied patch to HEAD. Thanks Ankur.
Created attachment 142787 [details] Patch Found a bug in patch while fixing for Context Help Editor. Also, fixed the copyrights year.
Found a bug in patch while fixing for Context Help Editor.
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.
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'