blob: 2d5a69a202c8c497de8ccd652bcf3d4d646b92dd [file] [log] [blame]
/*********************************************************************
* Copyright (c) 2005, 2019 SAP SE
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* SAP SE - initial API, implementation and documentation
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
package org.eclipse.graphiti.testtool.sketch.features.create;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.mm.pictograms.Connection;
import org.eclipse.graphiti.services.Graphiti;
/**
* The Class SketchCreateFreeformConnectionFeature.
*/
public class SketchCreateFreeformConnectionFeature extends AbstractSketchCreateSimpleConnectionFeature {
private static boolean cancel = false;
public static void setCancelling(boolean cancel) {
SketchCreateFreeformConnectionFeature.cancel = cancel;
}
public static boolean isCancelling() {
return cancel;
}
/**
* Instantiates a new sketch create freeform connection feature.
*
* @param fp
* the fp
* @param name
* the name
* @param description
* the description
*/
public SketchCreateFreeformConnectionFeature(IFeatureProvider fp, String name, String description) {
super(fp, name, description);
}
@Override
protected Connection createConnection() {
if (isCancelling())
throw new OperationCanceledException();
return Graphiti.getPeCreateService().createFreeFormConnection(getDiagram());
}
}