blob: 748460d6c668b950789b6d45c9735c75c5eec13d [file] [log] [blame]
/******************************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
****************************************************************************/
package org.eclipse.gmf.runtime.diagram.ui.tools;
import java.util.List;
import org.eclipse.gef.Request;
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
/**
* This specialized connection tool adds support for a multi-type connection tool.
* That is, the tool is given a list of connection types and when the user
* completes the gesture, a popup appears asking the user to pick one of the
* connection types.
*
* @author cmahoney
*/
public class UnspecifiedTypeConnectionTool
extends ConnectionCreationTool {
/**
* The possible connection types to appear in the popup (of type
* <code>IElementType</code>).
*/
private List connectionTypes;
/**
* Creates a new instance with a list of possible connection types.
*
* @param connectionTypes
* The possible connection types to appear in the popup (of
* type <code>IElementType</code>).
*/
public UnspecifiedTypeConnectionTool(List connectionTypes) {
super();
this.connectionTypes = connectionTypes;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.tools.TargetingTool#createTargetRequest()
*/
protected Request createTargetRequest() {
return new CreateUnspecifiedTypeConnectionRequest(connectionTypes,
false, getPreferencesHint());
}
}