Development Notes (1.6)

Runtime requirements

NatTable requires Java 1.5 and SWT.

Development tools

We use the following tools for NatTable development:

Development environment setup - step by step

Download and install the development tools listed above.

Checking out the code and building from the command line

You should check out the code outside of Eclipse so you can preserve the hierarchical directory structure. Use the following command to check out the code:

svn checkout https://nattable.svn.sourceforge.net/svnroot/nattable/branches/nattable-1.6/

Note: we will refer to the location where you checked out the NatTable code as NATTABLE_HOME

Build using maven:

cd NATTABLE_HOME
mvn clean install

Importing projects into Eclipse

In order to prepare the code for import into Eclipse, we run the following command to create Eclipse project files:

mvn pax:clean pax:eclipse eclipse:m2eclipse

Note that whenever you make changes to dependencies in your pom.xml file, you should rerun the above command to regenerate the Eclipse metadata files. Also, you should make sure that your code compiles cleanly before running the pax:eclipse goal, otherwise the OSGi metadata may not be constructed correctly.

And now we can import the NatTable code projects into Eclipse:

  • select File -> Import from the menubar
  • choose General -> Existing Projects into Workspace
  • click Next
  • Select root directory: (NATTABLE_HOME/nattable)
  • click Finish

All of the projects should compile cleanly*.

* If you are running Eclipse 3.4 you may see the following errors: Bundle symbolic name contains illegal characters (it's compaining about the hyphen). This is benign and can be ignored. Eclipse 3.4 incorrectly assumes that hyphens are invalid characters in OSGi bundle names, but in fact they are legal. These errors are not present in Eclipse 3.4.1.

Additional Eclipse setup/tips

Code formatting

Please use the Eclipse formatter profile in net.sourceforge.nattable/dev_config/NatTable_style.xml. Import this and set as the active profile in Eclipse in the Java -> Code Style -> Formatter preferences page.

Setting up Mylyn

Here's how to set up mylyn to connect to the Jira bug tracker. The URL for the NatTable Jira is: http://nattable.org/jira

If you are missing bundles

If you find you are missing certain bundles in your workspace, you may be able to download them from the Eclipse Orbit Downloads page:

Put the downloaded bundles into your eclipse/dropins folder (Eclipse 3.4) and restart Eclipse.

If Eclipse still won't compile

You can try running 'mvn -Dmaven.test.skip=true clean eclipse:clean install pax:eclipse' under NATTABLE_HOME/nattable, refreshing your workspace, closing all net.sourceforge.nattable* projects, and then opening them one at a time starting with core and ending with examples.

Source code organization

NatTable source is divided into the following projects:

  • net.sourceforge.nattable.core - Core NatTable code
  • net.sourceforge.nattable.extensions - Extensions to NatTable
  • net.sourceforge.nattable.data - test and example data
  • net.sourceforge.nattable.examples - example programs

All of these projects are packaged as Eclipse plugins/OSGi bundles. Each of these also has a matching test fragment project. There is also an additional net.sourceforge.nattable.guiautomation project that contains abbot swt based tests.

Code conventions

  • Interfaces are prefixed with 'I', e.g. INatTableModel
  • Names are formatted as follows to indicate particular coordinate systems:
    [ visible | viewable | reordered | model ][ Grid | Body | Corner | ColumnHeader | RowHeader ][ Row | Column | Cell ]
    • examples: modelBodyColumn, viewableBodyRow, visibleGridColumn

Abbot SWT plugin setup

Following are the steps to download and install Abbot for SWT:

  • Download the Abbot SWT package from http://sourceforge.net/project/showfiles.php?group_id=50939
  • Unzip the content of this package to your eclipse root directory (ie:c:\apps\eclipse)
  • Download the default Abbot project using the following SVN command svn co https://abbot.svn.sourceforge.net/svnroot/abbot/abbot/trunk abbot/abbot/trunk/. Notice that the install directory "abbot/abbot/trunk" is following the projects structure. If you browse the repository, ../svnroot/abbot/ contains the abbot.swt suite of projects. We don't need to import these as they are already bundled in the plugin installed above.
  • Import the "abbot.plain" project into your Eclipse workspace. You will find this plugin project in the trunk folder created in the previous step.
  • Once the project is imported, right click on the project folder and under the PDE Tools menu you will see an option labeled "Convert Projects to Plug-in projects", go ahead and select this option. If you do not see the PDE Tools menu, this probably means you have not installed the Eclipse Plugin Development Environment (PDE). To install the PDE plugin go to Help -> Software Updates -> Find And Install.. and look for the PDE plugin download. For further information please refer to the Eclipse website.
  • Now that you have made the abbot.plain project a PDE project, you will see a newly created META-INF/MANIFEST.MF file. Doulbe click on this file to open the manifest editor, you should verify that in the Overview tab, the ID field should say abbot.plain and the Version field should have 1.0.1
  • You can now import the NatTable GUI automation project and run the tests within it.