Mascara Eclipse Plugin - alpha preview
Monday, July 19, 2010 at 07:33AM Experienced developers know that tool support are very important for the overall productivity when working with a language. Mascara has a solid core compiler, but not much language specific editor support.
Therefore I have developed an Eclipse plugin with Mascara language support as the first example of integrated editor support. (Support for other editors/IDE's may follow in the future depending on user interest, although I'm not promising anything at this point.)
The Eclipse plugin is still in the alpha stage which means it has bugs and missing features, and you basically should't expect to be able use it for serious work yet. It is released mainly as a proof of concept, and because many users like to see how its going.
How to get to "Hello world" using the Mascara Eclipse Plugin
1) Install python 2.6 if you dont already have it.
2) Install the plugin
Open eclipse 3.5 (earlier versions may work but I havent tested it) and install the editor support via:
Help -> Install new software -> Add
In the "Add site" dialog:
Name: Mascara editor
Location: http://mascaradownload.appspot.com/releases/mascaraeclipse
Check off "Mascara editor" in the list, and click Next. The feature shound now install automatically.
You will get a warning that the content is unsigned. Press OK.
When prompted to restart Eclipse, choose OK
Note: On Unix, the plugin assumes python is located in /usr/bin. If it is located somewhere else,
you have to configure it on the preference page for Mascara (Window->Preferences).
3) Create a new project in Eclipse:
File -> New -> New project
(Just select a standard project: General -> Project. There is no specific Mascara project type yet.)
4) Create a new file:
File -> New -> Other
Select Mascara / New Esx File.
The file shoult have the ".esx", extension, so call it something like "main.esx".
5) Write something like this in the file:
import browserapi;
window.onload = function() window.alert("hello world");
(Here you should hopefully notice syntax coloring and language aware code completion! At least halfway working.)
6) Click "Run" (the green arrow)

The first time run is clicked you get a wizard to create a run configuration:
In Select Esx source, the new file is selected by default
Select Create new HTML file. This will generate a new HTML file with a script reference to the (compiled) esx file. Click Next.
The dialog suggest where to save the HTML file. Click Finish.
7) The default browser should now start with the HTML page and the included script, displaying the hello world alert.

Have fun! As always, questions or suggestions welcome.
Bonus: Hello world using JQuery
If you like JQuery you may prefer to write something like this instead:
import browserapi;
import jqueryapi;
$(function(){
$("Body").append(
$("<div>Hello world</div>")
.fadeIn(1000));
});
You will have to add a <script>-element to the HTML referencing the JQuery library before running. You can dowload JQuery, or just hotlink to the hosted version:
<script src ="http://code.jquery.com/jquery-1.4.2.min.js"></script>
Happy coding!
Olav |
Post a Comment | 


