]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/DefaultConnectionEdgeClassFactory.java
Fix NPE from flagTransform
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / adapter / DefaultConnectionEdgeClassFactory.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.diagram.adapter;
13
14 import org.simantics.db.AsyncReadGraph;
15 import org.simantics.db.Resource;
16 import org.simantics.db.procedure.AsyncProcedure;
17 import org.simantics.g2d.canvas.ICanvasContext;
18 import org.simantics.g2d.diagram.IDiagram;
19 import org.simantics.g2d.element.ElementClass;
20 import org.simantics.g2d.elementclass.connection.EdgeClass;
21
22 /**
23  * An element class factory for connection edge segments.
24  * 
25  * @author Tuukka Lehtonen
26  */
27 public class DefaultConnectionEdgeClassFactory extends ElementFactoryAdapter {
28
29     private static final ElementClass CLASS = EdgeClass.STRAIGHT;
30
31     public static ElementClass create() {
32         return CLASS;
33     }
34
35     @Override
36     public void create(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementType,
37             AsyncProcedure<ElementClass> procedure) {
38         procedure.execute(graph, CLASS);
39     }
40
41     @Override
42     public void getClass(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementResource,
43             AsyncProcedure<ElementClass> procedure) {
44         procedure.execute(graph, CLASS);
45     }
46
47 }