wiki:Projects/GOALforNetBeans

GOAL for NetBeans

Introduction

The development environment distributed with GOAL has been built more or less from scratch using a third-party editor called jEdit. As a result, more sophisticated functionality that is available in mature environments such as NetBeans and Eclipse is missing in GOAL's development environment. Examples are file management, syntax error highlighting, subversion support, and other issues. To this end, a first version of a GOAL plug-in for the NetBeans IDE has been developed. This plug-in provides numerous enhancements, like better syntax highlighting, full project and file management, in-line errors and warnings, subversion support, SWI-Prolog facilities, auto-updating, and much more. This beta version is a proof of concept to stimulate further enhancements of the GOAL platform, created by TUDelft Computer Science student Vincent Koeman.

Installation Instructions

In this section, instructions on how to install the plug-in will be provided. The first section will discuss installing the plug-in on TU Delft's computers, which will then transition into the general case in the next section,

On a TUDelft computer

  1. Download the latest portable version of NetBeans from http://sourceforge.net/projects/nbportable/files/latest/download to your personal data disk (H:/).
  2. Use the installer to install NetBeans to somewhere on this personal drive (accept default Java version dialogs), and delete the installer afterwards.
  3. Go to the newly created folder, right-click NetBeansPortable.exe, and select 'Send To->Desktop (create shortcut)'. Close the folder afterwards and rename the new shortcut (to NetBeans IDE for example).
  4. Go to step 4 of the next paragraph to continue. Note that on the computers at the Drebbelweg (Building 35), SWI-Prolog is installed in the correct default directory already and thus step 10 can be skipped.

On your own computer

  1. Download the latest NetBeans installer from http://netbeans.org/downloads/index.html (the Java SE version is fine; 7.3 is the minimal required version for this plug-in). Alternatively, if you do not have a Java JDK installed yet, you can download a complete package from with Java and NetBeans from http://www.oracle.com/technetwork/java/javase/downloads/jdk-7-netbeans-download-432126.html
  2. Follow all installation steps to your own liking (the defaults are fine). Advanced instructions can be found at the NetBeans website.
  3. If you want to compile and run SWI-Prolog projects, go to http://www.swi-prolog.org/Download.html, and download and install any version you like (the latest stable version is recommended). The default installation settings are fine. Note that this SWI-Prolog installation does not affect GOAL projects in any way; native libraries are already supplied with the plugin itself! A (separate) 'old' GOAL installation is not necessary either.
  4. Start NetBeans from the shortcut on your desktop. Note that on Linux, you need to run NetBeans elevated using i.e. ‘sudo sh netbeans’, or this plugin will not work. Creating a shortcut for running NetBeans elevated is recommended in this case.
  5. Select Help (top-right) -> Check for updates. Update if needed (follow instructions). If NetBeans asks to install JUnit at any time, you are free to do so.
  6. Select Tools (top-right) -> Plugins, and go to the Settings tab.
  7. Select Add, and provide the following data:
    1. Name: GOAL Update Center
    2. URL: http://ii.tudelft.nl/trac/goal/export/head/GOALplugin/builds/updates.xml
    3. Leave ‘Check for updates automatically’ enabled
  8. Select OK. It is recommended to set the auto-update interval to 1 day instead of 1 week now. Afterwards, go the ‘Available Plugins’ tab.
  9. Select the ‘GOAL Agent Programming’ plug-in (‘Language Support’ category) and click Install. Follow the steps of the installation. Ignore the warning (continue) about the plug-in not being signed. You need to restart NetBeans (possibly manually) after the installation!
  10. When NetBeans has restarted, and Prolog support is desired, select Tools (top-right) -> Options, and go to the Miscellaneous category. Select the Prolog/GOAL tab. There, one can set the path to the SWI-Prolog executable (swipl for new versions, plcon for older versions, see step 3). The default is a guess, which might be wrong.
  11. To start working, close all open pop-ups, and go to File (top-left) -> New Project. A GOAL-category now exists here, which contains an empty template and examples for both Prolog and GOAL projects. Using these, you can start using the plug-in. Additionally, through File (top-left) -> Import Project -> MAS2G to GOAL-Project, existing mas2g files (and their accompanying agent- and environment files) can be imported to a NetBeans project. Note that this copies the existing files to your NetBeans projects folder, that the default (old) environment directory (which is requested) is something like 'C:\Users\Vincent\GOAL\environments', and that only parseable files mentioned in the MAS2G file will be copied from there (any other required files will have to be ported manually). In addition, the "agents" folder has to be prefixed (manually) for all referenced GOAL files in the 'agentfiles' section of your new MAS2G file.

GOAL Projects

See step 11 (above) first for opening new projects or importing existing GOAL IDE projects!

For NetBeans, a GOAL project is laid out in the system as follows:

  • A MAS2G file that matches the name of the folder
  • A directory named 'agents' that contains all relevant .goal/.mod2g/.pl files
  • A directory named 'environments' that contains all relevant environment files (usually a single jar-file)

This is done automatically by NetBeans for new projects, which results in the appropriate views. Again, the MAS2G automatically obtains the project's name, which is linked to the directory's name. Changing the name of the MAS2G file can be done most easily by renaming the project (right-click -> Rename). Adding files is also done easily in NetBeans itself. When right-clicking a folder in NetBeans, certain actions are available. These involve creating a new file using an empty template or adding existing files (copy).

One can also Run or Debug a GOAL-project. These options are available when right-clicking at the project node or at the MAS2G file. Running a GOAL-project invokes a GOAL Standalone session in NetBeans' output-window (appears at the bottom). Here, one can interface with the runner. I.e., giving the 'r' command runs the MAS2G file, whilst giving the 'x' command kills the current run. Debugging a GOAL-project currently launches the 'old' GOAL IDE with all editing capabilities disabled, automatically going into the 'familiar' introspecting-mode. Killing the run here automatically also kills the GOAL IDE window. Notice that the window positions and sizes are remembered, and thus one can order his/her screen in an appropriate way.

Unlike in the 'regular' GOAL IDE, module files (mod2g) can be managed separately. This, however, has some downsides as well, as the parent file for a module (the goal file to parse it with) is not always known. This can be set in NetBeans by right-clicking on a mod2g file and selecting 'Set parent file for module'. The goal file to parse the mod2g file with can then be selected, and this setting will be remembered.

Finally, breakpoints (regular and conditional) are supported. These can be added by right-clicking on a certain line (not in the bar with the line numbers but in the document itself) and selecting the appropriate option. Disabling them is done in the same way.

Prolog Projects

A Prolog NetBeans project has no folders on its own, but just a set of Prolog files (.pl or .pro). In the filesystem, this is realized by a folder named after the project, containing a single folder named "prolog" that contains all relevant files. In NetBeans, each individual Prolog file can be compiled or compiled and run, using an external SWI-Prolog installation (see installation instructions). Just like the GOAL Standalone, the output of these actions is diverted to the NetBeans output window, where one can also provide input, just like in a regular SWI-Prolog session. Whilst running, on the left side of the output window, two buttons exist: Stop (red button) and Restart (yellow button). Restarting will reload the PL file as well (this is similar for GOAL Projects).

Additional Features

  • Subversion support through a NetBeans default plug-in. Extended information can be found at http://netbeans.org/kb/docs/ide/subversion.html
    • An existing NetBeans project can be put on a SVN server by right-clicking the project and selecting Versioning -> Import into Subversion repository
    • An existing subversion repository with a correct NetBeans project can be checked out using Team (top-right) -> Subversion -> Checkout
    • If you have already checked out a repository with a valid NetBeans project on your system, you can open that through File (top-left) -> Open Project. Subversion support will then be automatically detected and enabled.
    • Notice that for Windows, a 'Bundled Subversion Client' NetBeans plug-in is available (see Tools (top-right) -> Plugins -> Available)
    • Using this plug-in and the 'old' IDE side-by-side is completely possible. When a project suffices to the NetBeans layout (a single mas2g file, an agents folder and an environments folder), the MAS2G file can be opened in the 'old' IDE as well. However, the environment-files would need to be copied to the 'old' IDE's general folder (usually GOAL installation directory -> environments). Everything else will be the same (fully compatible).
  • Occurrence highlighting: select a part of text (or double-click a word), and every occurrence of the selection will be highlighted in the current file
  • Auto-completion: occurs automatically when typing, or after using the Ctrl+Space keyboard shortcut.
  • Code-folding: sections (marked by { ... }) are detected automatically and can be collapsed.

Contact

For any issues, suggestions, etcetera, the developer of this plug-in can be reached at vincent_lammeren@hotmail.com

Last modified 4 years ago Last modified on Jun 27, 2013, 8:36:34 PM

Attachments (2)

Download all attachments as: .zip