Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Eclipse Layout Kernel » Building custom layout managers for Graphiti(This topic handles using existing extension points from ELK to specify user defined Layout Managers for the Graphiti framework)
Building custom layout managers for Graphiti [message #1735849] Thu, 23 June 2016 09:24 Go to next message
Alex Rusu is currently offline Alex RusuFriend
Messages: 4
Registered: September 2015
Junior Member
Hello!

I have recently stumbled upon an issue in a tool I have developed about 6 months ago. The tool employed an existing extension point in ELK, at the time, entitled:
<extension
   point="org.eclipse.elk.core.service.layoutManagers">

   <manager
      class="CustomGraphitiLayoutManager ">
   </manager>
</extension>

and my implementation:
public class CustomGraphitiLayoutManager extends GraphitiDiagramLayoutManager{

	@Override
	protected boolean isNodeShape(final Shape shape) {
		return true;
	}

	@Override
	protected KNode createNode(final LayoutMapping mapping, final KNode parentNode,
			final Shape shape) {

		final KNode node = super.createNode(mapping, parentNode, shape);
		final KShapeLayout nodeLayout = node.getData(KShapeLayout.class);
		nodeLayout.setProperty(LayoutOptions.DIRECTION, Direction.DOWN);
		nodeLayout.setProperty(LayoutOptions.LAYOUT_HIERARCHY, true);

		return node;
	}
}


With the given setup, I get the following issues:
* Unknown extension point: 'org.eclipse.elk.core.layoutManagers' in plugin.xml
* The GraphitiDiagramLayoutManager class no longer exists or has been renamed or moved
* The LayoutOptions no longer exists ( I have managed to fix that by replacing it with CoreOptions, but I am not sure it is the correct solution)

I am basically interested in getting a correct specification for creating and registering a custom graphiti diagram layout manager, within the correct extension point.
The only source I could find seems to not be up to date:
https://www.eclipse.org/elk/getting-started.php

Re: Building custom layout managers for Graphiti [message #1735857 is a reply to message #1735849] Thu, 23 June 2016 10:37 Go to previous messageGo to next message
Christoph Daniel Schulze is currently offline Christoph Daniel SchulzeFriend
Messages: 98
Registered: September 2015
Member
Hi Alex!

The ELK infrastructure has changed quite a bit since we became an Eclipse project. Layout managers are an area that was affected by those changes. But fear not, the fix should be easy.

First, the extension point has been replaced by a new extension point called org.eclipse.elk.core.service.layoutConnectors. The new extension point does not expect you to register a layout manager (or layout connectors, as they are called now), but a class that implements ISetup. That class is basically responsible for providing bindings between interfaces and implementing classes for a dependency injector. In short: this is where you will actually say that your CustomGraphitiLayoutConnector should be used. You can find an example implementation in our default Graphiti layout code.

The transition from layout manager to layout connector should be straightforward. Again, our default implementation may provide some clues.

Finally, the LayoutOptions class has indeed be renamed to CoreOptions for reasons that I would probably bore you with. Wink

Sorry that the Getting Started Guide mislead you, I didn't get around to updating that yet. However, our GitHub wiki is steadily growing and already contains a lot of documentation. Please let me know if any information are hard to find or hard to understand.
Re: Building custom layout managers for Graphiti [message #1735881 is a reply to message #1735857] Thu, 23 June 2016 12:40 Go to previous messageGo to next message
Alex Rusu is currently offline Alex RusuFriend
Messages: 4
Registered: September 2015
Junior Member
Your response has been quite helpful, I got the project up and running and from this point is just a matter of keeping up to date with the new documentation and future changes.

Thanks for the help!
Re: Building custom layout managers for Graphiti [message #1736176 is a reply to message #1735881] Mon, 27 June 2016 10:31 Go to previous message
Christoph Daniel Schulze is currently offline Christoph Daniel SchulzeFriend
Messages: 98
Registered: September 2015
Member
Glad to hear it's working!

Cheers,
Christoph Daniel
Previous Topic:Use elk based on Diagram (Type)
Next Topic:Orthogonal Bus Routing in ELK Layered - how?
Goto Forum:
  


Current Time: Tue Apr 23 14:22:47 GMT 2024

Powered by FUDForum. Page generated in 0.04218 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top