1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
\r
3 * in Industry THTH ry.
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.diagram.synchronization.graph;
\r
14 import org.simantics.db.Resource;
\r
15 import org.simantics.db.WriteGraph;
\r
16 import org.simantics.db.exception.DatabaseException;
\r
17 import org.simantics.diagram.synchronization.IHintSynchronizer;
\r
18 import org.simantics.g2d.element.IElement;
\r
21 * This interface is used by DiagramGraphSynchronizer as a first time only
\r
22 * mechanism for customizable IElement->Graph synchronization of element that
\r
23 * have been newly added to a diagram. These methods are only invoked once for
\r
24 * any single element.
\r
26 * @author Tuukka Lehtonen
\r
28 * @see IHintSynchronizer
\r
30 * TODO: try to unify this with other elementloader/graphelementfactory etc. mechanisms
\r
31 * TODO: transform this into ElementGraphLifecycle ?
\r
33 public interface ElementWriter {
\r
38 * @param elementResource
\r
39 * @throws DatabaseException
\r
41 void addToGraph(WriteGraph graph, IElement element, Resource elementResource) throws DatabaseException;
\r
44 * Sometimes {@link #writeGraph(WriteGraph, IElement, Resource)}
\r
45 * can write things into the graph that are not removed by the standard
\r
46 * deletion procedure. The standard procedure is to remove the element
\r
47 * resource from the diagram's ordered set and then remove everything that
\r
48 * the element resource <em>is composed of</em>. This method may implement
\r
49 * customized code for removing any other kinds of affiliations the element
\r
50 * might have in the graph.
\r
53 * @param elementResource
\r
55 void removeFromGraph(WriteGraph graph, Resource elementResource) throws DatabaseException;
\r