|
Re: How to handle two different scoping providers? [message #783734 is a reply to message #783557] |
Thu, 26 January 2012 10:42 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi,
you should never and under no circumstances use a standalone setup when
running in Eclipse. This will corrupt the emf registries and is likely
to have all sorts of unpredicatable side effects. That's why it's called
'StandaloneSetup' ;-)
For now, the easiest way would be to have second language that extends
the first one and uses a dedicated file extension etc.
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 26.01.12 01:18, schrieb J. S. Pam:
> Hi all,
>
> I am currently writing a debugger for an Xtext language. To be able to
> evaluate expressions, I need two different scoping providers:
>
> - one normal scoping provider (MyDslScopeProvider) for the language in
> the IDE
> - one debug scoping provider (MyDslDebugScopeProvider) which provides
> the scope for the variable references mentioned in the watch
> expressions. Their scope is simply the list of variables available in
> the current execution context (which I get from the interpreter).
>
> So how do I tell Xtext to use my DebugScopeProvider? I have tried the
> following:
>
> private Expression parseExpressionString(final String expressionText)
> throws DebugException {
> // Create a new program that contains the expression evaluation.
> String expressionProgramText = "__eval " + expressionText;
>
> // Obtain an injector and create an Xtext resource
> Injector guiceInjector = new
> MyDslDebuggerStandaloneSetup(this).createInjector();
> XtextResourceSet resourceSet =
> guiceInjector.getInstance(XtextResourceSet.class);
> ...
>
> where MyDslDebuggerStandaloneSetup has
>
> @Override
> public final Injector createInjector() {
> return Guice.createInjector(new
> MyDslDebuggerRuntimeModule(this.debugTarget));
> }
>
> and MyDslDebuggerRuntimeModule has
>
> @Override
> public final Class<? extends IScopeProvider> bindIScopeProvider() {
> return MyDslDebugScopeProvider.class;
> }
>
> This code is placed in the debugger plugin, which is separate from the
> UI plugin.
>
> However, when the above code runs, the bindIScopeProvider() method of
> the debugger runtime module is never called. Instead, the existing scope
> provider is called.
>
> How can I tell Xtext (or maybe Guice) to explicitly use my debug scope
> provider?
>
> Thanks in advance for any hints.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03005 seconds