1 /*******************************************************************************
2 * Copyright (c) 2012 Association for Decentralized Information Management in
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.diagram.adapter;
14 import org.simantics.db.AsyncReadGraph;
15 import org.simantics.db.Resource;
16 import org.simantics.db.common.request.BinaryAsyncRead;
17 import org.simantics.db.procedure.AsyncProcedure;
18 import org.simantics.g2d.canvas.ICanvasContext;
19 import org.simantics.g2d.diagram.IDiagram;
20 import org.simantics.g2d.element.ElementClass;
23 * @author Tuukka Lehtonen
25 * @see CreateElementClassRequest
27 * @see ConnectionRequest
29 class GetElementClassRequest extends BinaryAsyncRead<Resource, ICanvasContext, ElementClass> {
31 private final ElementFactory elementFactory;
32 private final IDiagram diagram;
34 public GetElementClassRequest(ElementFactory elementFactory, Resource element, ICanvasContext canvas, IDiagram diagram) {
35 super(element, canvas);
36 if (elementFactory == null)
37 throw new IllegalArgumentException("elementFactory == null for " + element + " in diagram " + diagram + " with context " + canvas);
38 this.elementFactory = elementFactory;
39 this.diagram = diagram;
43 public void perform(AsyncReadGraph graph, AsyncProcedure<ElementClass> procedure) {
44 elementFactory.getClass(graph, parameter2, diagram, parameter, procedure);