0

I am making a visualization of a code base using rascal, and I am currently trying to make it interactive by letting the user click on rendered Figures.

What I want to do is to let the user click on objects that represent parts of the analyzed code, upon which the user is taken to the appropriate part of the analyzed code.

I have noticed that the loc type, when evaluated in the normal console, yields a hyperlink to the location it describes. When the loc value is printed from a callback, however, it is not.

2 possible solutions:

  • Make the loc output clickable again.
  • Control the eclipse GUI directly, showing the user the code immediately.

Is any of the above possible? If not, are there alternatives?

Accepted solutions start with the user clicking on rendered Figures and end with the user seeing the code, without the user having to manually navigate to the respective Java files (user friendly!).

pancake
  • 1,923
  • 2
  • 21
  • 42

1 Answers1

1

I found the answer to my own question, quickly enough. Apparently, I only had to read the documentation a little more thorough.

The function edit(loc location) in the module util::Editors will make eclipse open a new tab with the file pointed at by the location. In case the location points at a specific AstNode, it will even select the source code of the node.

pancake
  • 1,923
  • 2
  • 21
  • 42