Could not identify selected AST node from IStrategoTerm editor (1)
When using the
Show abstract syntaxbuilder in my dynamically build Stratego editor, I get the following stracktrace:
java.lang.IllegalStateException: Could not identify selected AST node from IStrategoTerm editor at org.strategoxt.imp.runtime.services.InputTermBuilder.getImplodableNode(InputTermBuilder.java:190) at org.strategoxt.imp.runtime.services.InputTermBuilder.makeATermInputTerm(InputTermBuilder.java:165) at org.strategoxt.imp.runtime.services.menus.model.StrategoBuilder.invokeObserver(StrategoBuilder.java:332) at org.strategoxt.imp.runtime.services.menus.model.StrategoBuilder.execute(StrategoBuilder.java:200) at org.strategoxt.imp.runtime.services.menus.model.StrategoBuilder.access$1(StrategoBuilder.java:184) at org.strategoxt.imp.runtime.services.menus.model.StrategoBuilder$1.run(StrategoBuilder.java:171) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
and no abstract syntax shows up.Submitted by Gabriël Konat on 19 May 2014 at 14:49
The bug was introduced during some refactoring that I did recently. However, regardless of what went wrong during the refactoring, the bug shows up in some feature of Spoofax that seems to be unintendedly unsupported since December 2010 if I may believe the Git history. The feature used to add all builders under the Transform menu of editor
Xto the Transform menu of ATerm editor
Ywas derived from
X. This would allow you to apply user-defined transformations using an ATerm editor.
Since nobody seems to have missed this feature I may just refactor the code away, which would clean it up quite a bit. However, let me know if anyone thinks this feature should be brought back instead.
For development, it would be really useful to be able to apply transformations directly to an ATerm editor.
If it would be possible to recognize a ‘type of ATerm’, then one could attach transformations specifically for that type.
It wouldn’t work for ATerm editors that are manually opened though, only for editors that are automatically opened by an action. It simply remembers which editor it came from.
But I guess I could bring back the feature though since the code is already there.
The commit also re-enables the ‘derived builders feature’, but the derived menus currently only show up in the ATerm editor after switching between editors at least once (an issue with the Spoofax’ Menus service).
However, at least this allows us to try it out and see where we want to go with this. To me, it is a bit confusing that one ATerm editor has different menus than some other ATerm editor, so I’m not so sure about this feature.
Log in to post comments