single click for getting xText editor support
Asked Answered
L

2

7

In my current work, I want provide xText editor support ( because of its code completion, syntax high-lighting) to the programmers of my domain specific language. I have written grammar in xText.

To provide xText editor support, I am going to provide programmers with full eclipse IDE with xText plugin installed (available on xText website). However, I get xText editor facility at the cost of the the following manual manual steps (as discussed in 5 mins xText tutorial).

  1. The programmers have to go to File -> New -> Project - > xText Project
  2. The programmers have to replace “hello world” example grammars by my language grammar.
  3. They have to go to RunAs -> Generate Xtext Artifacts.
  4. Finally, they have to do : run -> Eclipse Application to take editor support . So, they can write dsl specification.

My question is that is there any way, which can atomize (with minimum effort) these tasks (any scripting or any other thing) in a single click?

Lubalubba answered 6/2, 2013 at 22:1 Comment(3)
Those steps are just meant for testing the plugin, not actual usage. You should be able to install your grammar into eclipse permanently.Competent
Thanks Sam. But, how could I install my grammar into eclipse plugin. Any suggestions/pointers?Lubalubba
Sorry, I haven't used xtext; I would imagine it's somewhere in the plugin's context menus, though.Competent
R
7

OK I'm really not sure I understand your question. So I'll re-state what I think you're asking, and answer that. Apologies if I've misunderstood - please let me know.

So - I think you're saying:

  1. You've developed an xtext grammar for your language
  2. You want your users to be able to use the editor xtext has generated for the language
  3. right now, the only way you know how to do this is to have your users emulate what you did (install xtext, create a new project, copy in your grammar, run the generator, create a runtime instance & then finally create files in your DSL)

You want to fix step 3. So your users can just create a new project then create a new file with your DSL extension and start editing.

If that's correct then the easiest approach is:

  1. Select File->Export...->Plug-in Development->Deployable Features & click Next
  2. Select your DSL project in the list of features (<your.dsl>.sdk)
  3. Select a directory for the resulting repository and click Finish

Eclipse will generate an installable feature for you in the target dir. You then need to make the repository dir available to your users by publishing somewhere they can access. This is your Repository URL.

Your users then need to:

  1. Install a standard eclipse distribution (the modeling tools one is suitable)
  2. Select Help->Install New Software
  3. Click Add to add a new repository, and enter your Repository URL
  4. Select your feature in the list & install

From there they can create new projects & files. If they create a file with your DSL extension, your xtext-generated editor will be loaded automatically.

You can make their job even easier by generating an eclipse product. To do that you'll first need to create a product specification then use the File->Export->Plugin Development->Eclipse Product. That will create a standalone eclipse IDE with your plugin pre-installed. So your users can just install and go. There's a good tutorial here for this.

hth.

Radiotelegraphy answered 14/2, 2013 at 23:6 Comment(0)
I
1

There are three options that would do such automation for you:

1- Use a general macro recording software such as AutoHotkey or Sikuli Script, so you can record these steps and replay them back. You can find similar software as well in this Wikipedia article

2- Use eclipse macro plug-in such as Practically Macro, which is an open source plugin for eclipse

3- Write your own implementation using Java Robot class which simply can generate events that are needed for automation such as keyPress, mousePress and mouseMove

Ils answered 14/2, 2013 at 23:13 Comment(1)
Although in general this is a helpful response, the question asker is using an incorrect sequence for deploying Xtext projects. Suggesting a way to automate this sequence is a very bad idea here.Fitment

© 2022 - 2024 — McMap. All rights reserved.