Xtext custom cross-references
Asked Answered
M

1

6

I've been working on an Xtext-based Eclipse plugin for a language we use in-house. This language might have a statement of the form:

run : /some/file/path/foo.txt

... and ultimately I want to provide a custom Location provider so that pressing F3 on the filepath will open up the file in a new editor in Eclipse. I haven't had a chance yet to try this out, but does anyone see anything wrong with the following approach?

  1. Override IHyperlinkHelper to make my filepath rule cross-referencable
  2. Override ILocationInFileProvider to make the filepath rule do the Eclipse magic to open the file in a new editor

Any advice is appreciated, thanks

Midday answered 26/4, 2011 at 10:29 Comment(1)
For anyone who's interested in doing this, be aware that you need to override the LanguageSpecificURIEditorOpener#open() method.Midday
E
4

The approach sounds good to me. You could provide content assist for paths as well by customizing the proposal provider. A validation rule for the file reference may be helpful, too.

Epiphany answered 26/4, 2011 at 14:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.