Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

single click for getting xText editor support

Tags:

java

xtext

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?

like image 485
Pankesh Avatar asked Feb 06 '13 22:02

Pankesh


2 Answers

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.

like image 161
sfinnie Avatar answered Sep 28 '22 06:09

sfinnie


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

like image 32
iTech Avatar answered Sep 28 '22 05:09

iTech