]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/connection/IConnectionAdvisor.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / connection / IConnectionAdvisor.java
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
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.g2d.connection;\r
13 \r
14 import org.simantics.g2d.diagram.handler.Topology.Terminal;\r
15 import org.simantics.g2d.element.ElementHints;\r
16 import org.simantics.g2d.element.IElement;\r
17 \r
18 /**\r
19  * @author Hannu Niemisto\r
20  */\r
21 public interface IConnectionAdvisor {\r
22 \r
23     /**\r
24      * @param backend current backend data access object or <code>null</code> if\r
25      *        there's no ongoing transaction\r
26      * @param element1\r
27      * @param term1\r
28      * @param element2\r
29      * @param term2\r
30      * @return a back-end object that describes the type of the connection that\r
31      *         would be created if the two terminals were connected. If\r
32      *         <code>null</code> is returned, connection is not to be allowed.\r
33      *         Otherwise the tools will allow the connection to proceed,\r
34      *         regardless of whether the connection is in reality sane or not.\r
35      *         It is the job of the {@link IConnectionAdvisor} to verify this,\r
36      *         not the tool's.\r
37      * \r
38      * @see ElementHints#KEY_CONNECTION_TYPE\r
39      */\r
40     Object canBeConnected(Object backend, IElement element1, Terminal term1, IElement element2, Terminal term2);\r
41 \r
42     /**\r
43      * @param backend current backend data access object or <code>null</code> if\r
44      *        there's no ongoing transaction\r
45      * @param element\r
46      * @param term\r
47      * @return\r
48      */\r
49     boolean canBeginConnection(Object backend, IElement element, Terminal term);\r
50 \r
51 }\r