1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
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.g2d.connection;
14 import org.simantics.g2d.diagram.handler.Topology.Terminal;
15 import org.simantics.g2d.element.ElementHints;
16 import org.simantics.g2d.element.IElement;
19 * @author Hannu Niemisto
21 public interface IConnectionAdvisor {
24 * @param backend current backend data access object or <code>null</code> if
25 * there's no ongoing transaction
30 * @return a back-end object that describes the type of the connection that
31 * would be created if the two terminals were connected. If
32 * <code>null</code> is returned, connection is not to be allowed.
33 * Otherwise the tools will allow the connection to proceed,
34 * regardless of whether the connection is in reality sane or not.
35 * It is the job of the {@link IConnectionAdvisor} to verify this,
38 * @see ElementHints#KEY_CONNECTION_TYPE
40 Object canBeConnected(Object backend, IElement element1, Terminal term1, IElement element2, Terminal term2);
43 * @param backend current backend data access object or <code>null</code> if
44 * there's no ongoing transaction
49 boolean canBeginConnection(Object backend, IElement element, Terminal term);