0

Question:

Is there a way to run an eclipse action that is available from the context menu in the editor on every file of an project.

Actual Case:

I have to work with the leon3 and my dull mind has trouble enough understanding the code, that I do not want to scan lines to see if there is a semicolon hidden in there to see if there are multiple instructions or if the end if happens to be behind another instruction rather than on a line of its own (I missed an end if, which caused me to think that statements were conditional,...), therefore I would like to format the source nicely. I have access to Sigasi PRO which offers the option to "beautify" code as an operation in the editor. I would like to run this operation on all files in the leon project automatically.


enter image description here

Community
  • 1
  • 1
ted
  • 4,791
  • 5
  • 38
  • 84
  • @507214 (Hendrik): Since you seem to work for sigasi, and already commented on [this](http://stackoverflow.com/a/10330027/258418) which led to my question, I thought I let you know that I would think this would be a cool feature. (I am however asking on SO, since I hope for an alternate short term solution (after all you have a release cycle, and I am not sure this would even qualify for something you would like to implement)) – ted Aug 29 '13 at 10:21
  • The menu item Source / Format formats all contents when run on a folder. – greg-449 Aug 29 '13 at 11:38
  • @greg-449 in what (context) menu do I find `source`? (I run eclipse `kepler`, and have the _sigasi `vhdl`-perspective_ open. – ted Aug 29 '13 at 12:22
  • I think you need to be in the Package Explorer view. – greg-449 Aug 29 '13 at 13:08
  • @greg-449: I posted an image of my eclipse window. I think the `File Edit ...` Part is the `main menu bar` you refer to. As you can see, I do not have a `Source` button there. Maybe you have a plugin installed I am missing or you are using eclipse for java? Or am I looking in the wrong spot? – ted Aug 29 '13 at 13:14
  • Source only shows up in the Package Explorer view. – greg-449 Aug 29 '13 at 13:18
  • @greg-449: I am afraid this is `Java` related. Thanks for the input though. – ted Aug 29 '13 at 13:33
  • It's best if you ask a question like this on the Sigasi support forum. Afaik we don't support this feature (yet). – llemieng Aug 29 '13 at 17:28
  • @llemieng I thought that there might be an eclipse plugin that executes any operation in batch mode, this would get me arround your upgrade cycle. – ted Aug 29 '13 at 19:25
  • @ted As far as I know there aren't plugins that can do this. It wouldn't be trivial to build a plugin that can do batch format for all other plugins, there isn't a general format action defined in eclipse. Every language defines his own format action, in our case we use the action defined by the xtext framework. – llemieng Aug 30 '13 at 12:14
  • Since there seems to be no general solution I created a ticket for the tool: http://www.sigasi.com/forum/beautify-entire-project – ted Aug 30 '13 at 13:07

1 Answers1

1

Sigasi indeed only offers formatting in the editor at this time. In the Sigasi editor, you can format a selection or the entire editor's content. But, you can not trigger the formatting action without an editor.

I have not tried this, but I think you can achieve this with the Eclipse EASE project. EASE is a scripting environment for Eclipse.

Hendrik
  • 1,247
  • 7
  • 14