Layout algorithms are developed as Eclipse Plug-in Projects. There’s a few things to setup to get your project ready, which is what we will work through here.
This ticket is all about adding an ELK Project Wizard to the ELK SDK that will help people create new layout algorithm projects that are already perfectly setup. If you want to make people’s lifes better but don’t know how, here’s your chance!
Follow these steps to create a new plug-in:
The Package Explorer now shows a new project for your plug-in which we will configure in the next section.
Your plug-in needs to declare dependencies to ELK’s most important plug-ins: org.eclipse.elk.graph
(which contains the graph model that will be the input to your layout algorithm) and org.eclipse.elk.core
(which contains the core ELK code). Follow these steps to add the dependencies:
MANIFEST.MF
file, located in your plug-in’s META_INF
folder. The Plug-in Manifest Editor will open up, which is divided into several pages that you can switch between using the controls at the bottom of the editor.org.eclipse.elk.graph
plug-in and click OK.org.eclipse.elk.core
.
While we will discuss the details of implementing the actual layout algorithm later, it is a good idea to already create its main class now for us to be able to reference it. Create a new Java class with the following properties:
LayoutProvider
.org.eclipse.elk.core.AbstractLayoutProvider
.Your class will look something like this:
package cds.layout.simple;
import org.eclipse.elk.core.AbstractLayoutProvider;
import org.eclipse.elk.core.util.IElkProgressMonitor;
import org.eclipse.elk.graph.ElkNode;
public class SimpleLayoutProvider extends AbstractLayoutProvider {
@Override
public void layout(ElkNode layoutGraph, IElkProgressMonitor progressMonitor) {
// TODO Auto-generated method stub
}
}