GF Eclipse Plugin
The GF Eclipse Plugin
John J. Camilleri
Updated: 16 August 2013
The research leading to these results has received funding from the European Union's Seventh Framework Programme (FP7/2007-2013) under grant agreement no. FP7-ICT-247914 (the MOLTO Project).
Introduction
The aim behind developing a desktop IDE for GF is to provide more powerful tools than may be possible and/or practical in a web-based environment (the GF Web IDE). In particular, the ability to resolve identifier cross-references and browse external libraries quickly during development time is one of the primary motivations for the project.
The choice was made to develop this desktop IDE as a plugin for the Eclipse Platform as it emerged as the most popular choice among the GF developer community. Support for the platform is vast and many tools for adapting Eclipse to domain-specific languages already exist. Unlike the zero-click Web IDE approach, using the GF Eclipse plugin requires some manual installation and configuration on the development machine.
License
The GF Eclipse Plugin is open-source under the GNU General Public License (GPL).
The licenses that cover the rest of GF are listed here.
Xtext and Eclipse are released under the Eclipse Public License (EPL).
Links
Publications
- Poster at EAMT 2012 in Trento, Italy
- Paper presented at FreeRBMT 2012 in Gothenburg, Sweden.
Features
- Syntax highlighting and error detection
- Code folding, quick block-commenting, automatic code formatting
- Definition outlining, jump to declaration, find usage
- Warnings for problems in module dependency hierarchy
- Launch configurations, i.e. compilation directly from IDE
- Use GF Shell from within Eclipse
- Auto-completion for declared identifiers
- Background compilation (shallow) using project builder
- Support for Open Declaration (F3), including qualified names
- Code generation for new languages in application grammars
- Inline documentation for function calls, overloads
- Proper cross-reference handling with qualified names
- Test management and testing tool
- External library browser
Release history
12/04/13
: (1.5.3.x) Update for Xtext 2.3.1 / Eclipse 4.2 / JavaSE 1.6. Performance improvements with scoping. Better error handling.
22/02/13
: (1.5.2.x) New option for specifying include/exclude build files. Progress indicators during build.
12/06/12
: (1.5.1.x) Support for scoping when library sources not available. Performance and implementational improvements to External Library View.
19/04/12
: (1.5.0.x) Removed need for .gfexternal folder. Much improved "External Libraries" view allows you to search in current scope. Memory usage improvements in scoping implementation. Validation now occurs on file open. Re-added GF Library Path field in preferences.
04/04/12
: (1.4.3.x) Improvements to the Test Manager. Added support for arbitrary commands in launch. Made the license information clearer.
22/03/12
: (1.4.2.x) Added wizard for context-free grammars (no syntax support, though). Context-menu option for toggling the GF Nature and Builder together. Test Manager now parses languages & parameters, and includes filtering and toggling options.
14/03/12
: (1.4.1.x) GF source files can now be anywhere in project, not necessarily at top level.
06/03/12
: (1.4.0.x) Test manager view. Updated launch configurations. UI improvements, new icons. Inline contextual documentation. Correct resolution of qualified identifiers. Bug fixes and some refactoring.
07/02/12
: (1.3.0.x) Re-written underlying GF grammar.
02/02/12
: (1.2.5.x) Hugely improved scoping performance. New "Clone to new language" wizard. Improved code formatting. More efficient builder. Removed library path preference. GF runtime is now automatically found.
23/01/12
: (1.2.4.x) Logging is now done to the Eclipse Platform Log (use "Error Log" view). Tested with Eclipse 3.6.2. Bug fixes.
11/01/12
: (1.2.3.x) Updated to use Xtext 2.1.0. Links to external files now moved into new "GF Library View".
24/11/11
: (1.2.0.x) with support for "Open Declaration" (F3) function, including for external libraries.
18/11/11
: Third BETA (1.1.0.x) released, overhauled to take advantage of new compiler features. Tag-based scoping with caching for better performance. Interactive console (GF Shell) for launch configs.
11/10/11
: Second BETA (1.0.0.x) released, with improved support for qualified names, local variable bindings, selective inheritance, module outlining, and launch configurations. Also new GF Project type.
01/10/11
: Initial BETA released.
Installation & updating
System requirements
- Eclipse 3.6 or above.
- GF 3.3.3 or above. The path to GF must be set within the plugin preferences (see below).
Using the GF Resource Grammar Library requires that the RGL binaries are also installed on your system.
If you are using the pre-compiled binaries but have separately downloaded the RGL sources to your system, you can optionally specify this path in the plugin preferences (see below).
Installing the plugin for the first time
Available Software Sites
In order for dependencies to be satisfied, you need to ensure that your Eclipse has the following update site URLs set:
- Eclipse releases (change version name to match):
http://download.eclipse.org/releases/indigo
- Xtext:
http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/
You can set these from Preferences → Install/Update → Available Software Sites.
Eclipse preferences
How to find the Eclipse preferences window depends on your Eclipse version and/or OS, and may be either of:
- Window → Preferences
- Eclipse → Preferences
Installation
- Inside Eclipse, go to Help → Install New Software.
- Add new software site using the URL:
http://www.grammaticalframework.org/eclipse/release/
- Select the GF Eclipse Plugin, and make sure the Contact all update sites during install to find required software option is checked.
- Click Next, accept the license agreement and install.
- Accept the prompt warning that the software is unsigned.
- Restart Eclipse when prompted.
Settings & preferences
- Add the GF perspective by clicking Window → Open Perspective → Other and choosing GF.
- Open the plugin settings by going to Preferences → Grammatical Framework (image below).
- The plugin will try to determine the path to your GF executable automatically, but this may need to be corrected.
The path should include the name of the GF binary itself, e.g.
/home/john/.cabal/bin/gf or C:\Users\John\GF\bin\gf.exe.
- The Additional path directive setting can be used if you want to avoid writing
--# -path=... directives in your source files. By default it is set to .:alltenses:prelude, but can also be left blank. This is passed to GF using the --path flag.
- If you are using a pre-compiled version of the Resource Grammar Library (i.e. you didn't build it from source yourself) but you have the sources available on your system, then you can enter their path in the Library source path setting. This is optional and is only used for jumping to source definitions.
You should enter an absolute system path, up to and including the
src folder, e.g. /home/john/GF/lib/src/ or C:\Users\John\GF\lib\src\.
- You can also adjust the verbosity level of the GFEP console log in the preferences window.

Updating the plugin
- In Eclipse, go to Help → Check for updates.
- Any available updates will appear in the dialog. Select them and follow the usual steps.
Note: You will probably want to uncheck the Contact all update sites during install to find required software option, which is not usually needed when simply updating the plugin (it makes things go a lot slower).
Deprecations
- Any folders
.gfexternal can safely deleted as of GFEP ≥ 1.5. Using Eclipse's Clean function from the Run menu will do this for you automatically.
- If your project has a folder named
(External) you can safely delete this via the Eclipse Project Explorer. It is no longer used in GFEP ≥ 1.2.3
- If your workspace contains a log file
gfep.log then you can safely delete it from your system. As of version 1.2.4, GFEP uses Eclipse's standard log file at <workspace>/.metadata/.log
Project settings
Although the plugin should take care of your project settings for you, in case anything gets messed up you can always correct them manually as follows:
Project nature
Your .project file should include the GF Project Nature as follows:
<natures>
<nature>org.grammaticalframework.eclipse.ui.natures.projectNatureID</nature>
</natures>
Builder
Your .project file should include the GF Builder as follows:
<buildSpec>
<buildCommand>
<name>org.grammaticalframework.eclipse.ui.build.GFBuilderID</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
Specifying build files
As of GFEP ≥ 1.5.2, you are now able to explicitly a set of modules in your GF project which should be either included or excluded
from the build process.
In the inclusive case, this would normally contain your "top-level" modules. This can be done right-clicking on your project in the Project Explorer and choosing Properties → GF Build Settings. From here you simply tick which modules in your project the GF builder should compile:

When doing this, GFEP will never attempt to compile any other files in the project. Whenever you add a new top-level module or change your module hierarchy, be sure to check these build settings again.
Getting started
Some steps you can follow to get a feel of of the plugin's features.
Video tutorial
A quick run through of the major features available in the GF Eclipse Plugin.
If the video doesn't appear above, you can view it at https://vimeo.com/38768382
The Eclipse workspace and project concepts
When you run Eclipse, it asks you to create or specify a workspace on your system, which is essentially the top directory that Eclipse will "see". Any code you wish to work on inside Eclipse must reside in this workspace.
A workspace contains one or more projects, which may or may not be related to each other. Generally each folder under the top-level workspace directory is considered an individual project, i.e.:
workspace/
Project1/
file1-1.gf
file1-2.gf
Project2/
subdir2-1/
file2-1-1.gf
file2-1-2.gf
file2-1.gf
file2-2.gf
If you open an existing folder as your workspace in Eclipse, then your folders in that workspace do not automatically become Eclipse projects.
To do this, you must follow the "Create new GF Project" wizard below, and give your project the exact name of the existing folder (e.g. Project1 or Project2 in the example above.)
GF Nature
The GF Nature is what makes a regular Eclipse project a GF