Creating a New Project

Layout algorithms are developed as Eclipse Plug-in Projects. Let’s work through creating a new project using our wizard and what that project consists of.

Creating a New Project

Follow these steps to create a new plug-in:

  1. From the File menu, select New - Project….

  2. From the Plug-in Development category, select Plug-in Project and click Next.

  3. Configure your project’s basic settings, in particular its name, and click Next.

    Step 1 of the New Plug-In Project Wizard.

  4. Configure the project’s properties as you see fit and click Next.

    Step 2 of the New Plug-In Project Wizard.

  5. Select the Layout Algorithm project template. This will cause your project to be initialized with all the necessary files for a simple layout algorithm.

    Step 3 of the New Plug-In Project Wizard.

  6. The template requires a name for your layout algorithm. This will usually derive from your project’s name. Click Finish once you have settled on a name.

    Step 4 of the New Plug-In Project Wizard.

The Package Explorer now shows a new project for your plug-in.

The new project in all its glory.

The Components of Your New Project

The wizard creates the following things for your:

  • A MANIFEST.MF file with the necessary dependencies to the Eclipse Layout Kernel so you can use our data structures.

  • A file called ILayoutMetaDataProvider which registeres your new layout algorithm with ELK so it can be used.

  • A .melk file which describes your layout algorithm and the options it supports (see this page for more information).

  • A sample implementation with a simple basic layout provider. Studying this implementation will teach you a lot about how to develop layout algorithms with ELK (see this page for more information).

Somewhat strangely, perhaps, the ILayoutMetaDataProvider file is located in /src/META-INF/services instead of /META-INF/services. There is a reason for that. When we start a project in Eclipse, the non-Java content of its source folders is copied into a bin folder, which is then put on the class path. Since /META-INF is not part of a source folder, putting the service file there would mean that the service is not available when started from Eclipse. If you happen to despise this solution, simply define a separate top-level folder, configure it as a source folder, and move /src/META-INF there. Whatever you do, however, you will always end up with two META-INF folders in your project.