Java Reference
In-Depth Information
createdViews.addAll(createdConnectionViews);
makeViewsImmutable(createdViews);
if (createdViews.size() > 0) {
layout();
}
}
public void layout() {
TransactionalEditingDomain ted =
TransactionUtil.getEditingDomain(getDiagram());
final View diagram = getDiagram();
final AbstractEMFOperation operation = new AbstractEMFOperation(ted,
"Mindmap layout", null ) {
protected IStatus doExecute(IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
LayoutService.getInstance().layout(diagram, LayoutType.DEFAULT);
return Status.OK_STATUS;
}
};
PlatformUI.getWorkbench().getDisplay().asyncExec( new Runnable() {
public void run() {
try {
operation.execute( new NullProgressMonitor(), null );
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
This gets us a lot closer to our desired behavior of having a fixed layout.
Certain actions, such as resizing topics manually, represent another opportunity
to update layout. For now, we move on to a new topic.
Custom Connection Figure
Although you can define many figures using the GMF graphical definition
model, some figures require custom code. Additionally, you might want to reuse
existing figures in GMF diagram definitions, as you saw with CustomBorder .
To illustrate this capability, here we use a custom figure for the target decoration
of our subtopic link. This is the source code for a simple circle figure that we'll
add to a new org.eclipse.mindmap.diagram.figures package in our dia-
gram plug-in:
public class CircleDecoration extends Ellipse implements
RotatableDecoration {
private int myRadius = 5;
private Point myCenter = new Point();
public void setRadius( int radius) {
Search WWH ::




Custom Search