Community
Participate
Working Groups
Build ID: M20080911-1700 Steps To Reproduce: 1. Call IWorkbenchPage.openEditor(IEditorInput, "org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart", boolean) with IEditorInput different then IFileEditorInput 2. The editor is opened 3. Verify that: a) no validation against the schemas defined in the xml document is performed, b) there are error markers and assist only for the XML syntax, no errors markers for schema validation, c) no content assist against the schema types/attributes 4. Open the same thing with a IFileEditorInput and all the schema validation and content assist is working properly. More information: OS: Ubuntu Linux 9.4 386_64 WS: GTK Versions: org.eclipse.wst.xml.ui_1.0.410.v200809120143.jar org.eclipse.wst.xsd.core_1.1.301.v200807240448.jar java version "1.6.0_10" Java(TM) SE Runtime Environment (build 1.6.0_10-b33) Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode) Hi WST Guys, we have a RCP application that uses the WST XML editor. We want to have the nice schema content assist and validation as you type in the editor. We also have our own editor input. Our implementation of the IEditorInput has all the standard API methods implemented acordig to the documentation of the interface. We open the XML editor with code similar to this code: IWorkbenchPage.openEditor(IEditorInput, "org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEditorPart", boolean) If we use our own IEditorInput implementation a) no validation against the schemas defined in the xml document is performed, b) there are error markers and assist only for the XML syntax, no errors markers for schema validation, c) no content assist against the schema types/attributes If we open the same thing with a IFileEditorInput and all the schema validation and content assist is working properly. After a bit of debugging I found that suspicious fragment of code in org.eclipse.wst.sse.ui.StructuredTextEditor: protected void setDocumentProvider(IEditorInput input) { if (input instanceof IStructuredModel) { // largely untested setDocumentProvider(StructuredModelDocumentProvider.getInstance()); } else if (input instanceof IStorageEditorInput && !(input instanceof IFileEditorInput)) { setDocumentProvider(StorageModelProvider.getInstance()); } else { super.setDocumentProvider(input); } } If the editor input is not a IFileEditorInput it will enter the second if. If the editro input is a IFileEditorInpu it will enter the third if. This seems to originate the problem. This looks like a bug as there is different behaviour of the XML editor based on the editor input type. Is that behaviour intentional? Thanks in advance, Best regards, Luchesar
What does your editor input's IStorage.getFullPath() return, for example?
It returns a relative path to the edited resource. This resource could be file or remote resource - any kind of URL. We have kind of an abstract wrapper for that resources. IStorage.getFullPath() will return the file part of the URL. One example of a return value is: /ontologypartners/ontologies/mapping/CMB-mapping.xml The package explorer or Navigator are not used to open them. There are proprietary views that uses IWorkbenchPage.openEditor() to open these resources. Does it matter? The java doc says this could be anything. * Returns the full path of this storage. The returned value * depends on the implementor/extender. A storage need not * have a path.
Could you attach or cite the parts of your input document that refer to the schemas you're using?
This is one example: The schema location is hard coded <mapping xmlns="http://www.ontology.com/transformer/madrid/v1.0/schemas/mapping-schema-madrid.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ontology.com/transformer/madrid/v1.0/schemas/mapping-schema-madrid.xsd /home/lucho/mapping-schema-madrid.xsd"> <mapping> Ot he schema location is contributed to the XMLCatalog extension point and the xml instance only refers it: <mapping xmlns="http://www.ontology.com/transformer/madrid/v1.0/schemas/mappin> <mapping> In both cases the schema validation and content assist wont work if the editor input is not IFileEditorInput and will work if it is.
Hi SWT guys, Is there any activity towards this bug? Is it going to be fixed or it is a low priority for you?
I found the reason the markers are not shown. It is a bit tricky but in general StructuredTextEditor requires IFileEditorInput and a IModelProvider document provider associated with it. To use it with custom implementation of IEditorInput is very hacky at best and requires lots of work to be made correct.
Closing.