--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * in Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.g2d.connection;\r
+\r
+import org.simantics.g2d.diagram.handler.Topology.Terminal;\r
+import org.simantics.g2d.element.ElementHints;\r
+import org.simantics.g2d.element.IElement;\r
+\r
+/**\r
+ * @author Hannu Niemisto\r
+ */\r
+public interface IConnectionAdvisor {\r
+\r
+ /**\r
+ * @param backend current backend data access object or <code>null</code> if\r
+ * there's no ongoing transaction\r
+ * @param element1\r
+ * @param term1\r
+ * @param element2\r
+ * @param term2\r
+ * @return a back-end object that describes the type of the connection that\r
+ * would be created if the two terminals were connected. If\r
+ * <code>null</code> is returned, connection is not to be allowed.\r
+ * Otherwise the tools will allow the connection to proceed,\r
+ * regardless of whether the connection is in reality sane or not.\r
+ * It is the job of the {@link IConnectionAdvisor} to verify this,\r
+ * not the tool's.\r
+ * \r
+ * @see ElementHints#KEY_CONNECTION_TYPE\r
+ */\r
+ Object canBeConnected(Object backend, IElement element1, Terminal term1, IElement element2, Terminal term2);\r
+\r
+ /**\r
+ * @param backend current backend data access object or <code>null</code> if\r
+ * there's no ongoing transaction\r
+ * @param element\r
+ * @param term\r
+ * @return\r
+ */\r
+ boolean canBeginConnection(Object backend, IElement element, Terminal term);\r
+\r
+}\r