Embedded editor is missing some functionality [message #987818] |
Wed, 28 November 2012 09:49 |
Gaspar Din Messages: 21 Registered: September 2012 |
Junior Member |
|
|
Hello,
in my project I use an embedded version of the xtext editor within an eclipse RCP. It is created as described by the following code snippet:
IEditedResourceProvider resourceProvider = new IEditedResourceProvider() {
public XtextResource createResource() {
MyDslActivator activator = MyDslActivator.getInstance();
Injector injector = activator.getInjector(MyDslActivator.COM_MYORG_MYDSL);
XtextResourceSet rs = injector.getInstance(XtextResourceSet.class);
rs.setClasspathURIContext(getClass());
IResourceFactory resourceFactory = injector.getInstance(IResourceFactory.class);
URI uri = URI.createDeviceURI("file:///temp/MyDsl.mydsl");
XtextResource resource = (XtextResource) resourceFactory.createResource(uri);
rs.getResources().add(resource);
EcoreUtil.resolveAll(resource);
if (!resource.getErrors().isEmpty()) {
// handle error?
}
return resource;
}};
MyDslActivator activator = MyDslActivator.getInstance();
Injector injector = activator.getInjector(MyDslActivator.COM_MYORG_MYDSL);
EmbeddedEditorFactory factory = injector.getInstance(EmbeddedEditorFactory.class);
EmbeddedEditor embeddedEditor = factory.newEditor(resourceProvider).withParent(parent);
EmbeddedEditorModelAccess partialEditorModelAccess = embeddedEditor.createPartialEditor(false);
embeddedEditor.createPartialEditor();
Unfortunately, some functionality is missing in the embedded version of the editor while it is available in the regular version, i.e. when opening a mydsl file:
1. The vertical error bar is missing. How can it be added to the view?
2. The error markers are not shown or they're partly missing. How can they be "reactivated"?
Regards,
Gaspar
|
|
|
|
|
Re: Embedded editor is missing some functionality [message #988305 is a reply to message #987884] |
Thu, 29 November 2012 10:37 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
You have to register the validator by means of withResourceValidator(..)
on the editor-builder.
Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 28.11.12 15:23, schrieb Gaspar Din:
> Hi Sebastian,
>
> yes, I've already tried to use the call
> factory.newEditor(resourceProvider).showErrorAndWarningAnnotations().withParent(parent);
>
> and I've also added
> LineNumberRulerColumn lineNumberRulerColumn = new LineNumberRulerColumn();
> xtextSourceViewer.addVerticalRulerColumn(lineNumberRulerColumn);
>
> but unfortunately I am still missing the error markers.
> I've discovered that sometimes some errors get marked while typing or
> erasing some spaces in the editor. But while typing, the shown error
> markers changes or they disappear.
> And even if a marker is shown, there is not always the explaining
> tooltip with the error description. And sometimes, there is no marker
> shown, but the tooltip comes up while howering over the erroneous element
>
> Is it possible that some events are catched away by my application?
>
> Regards,
> Gaspar
>
>
|
|
|
Re: Embedded editor is missing some functionality [message #989783 is a reply to message #988305] |
Fri, 07 December 2012 18:08 |
Gaspar Din Messages: 21 Registered: September 2012 |
Junior Member |
|
|
Hello Sebastian,
I had no such method withResourceValidator(..) in my xtext libraries (I am using org.eclipse.xtext-2.3.1-final.zip).
So I added this method to EmbeddedEditorFactory class, copying it from a newer version of the file (this was the only difference, at least for this file). Then I made the call you suggested, setting the resource validator.
Unfortunately, this had no effects.
Any more ideas?
Greatings,
Gaspar.
|
|
|
Powered by
FUDForum. Page generated in 0.03257 seconds