| /********************************************************************* |
| * 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; |
| |
| import org.eclipse.graphiti.features.IFeatureProvider; |
| import org.eclipse.graphiti.features.context.IDeleteContext; |
| import org.eclipse.graphiti.mm.pictograms.PictogramElement; |
| import org.eclipse.graphiti.ui.features.DefaultDeleteFeature; |
| |
| /** |
| * The Class SketchDeleteFeature. |
| */ |
| public class SketchDeleteFeature extends DefaultDeleteFeature { |
| |
| /** |
| * Instantiates a new sketch delete feature. |
| * |
| * @param fp |
| * the fp |
| */ |
| public SketchDeleteFeature(IFeatureProvider fp) { |
| super(fp); |
| } |
| |
| @Override |
| public boolean canDelete(IDeleteContext context) { |
| final PictogramElement pe = context.getPictogramElement(); |
| final Object bo = getBusinessObjectForPictogramElement(pe); |
| if (bo != null) { |
| return super.canDelete(context); |
| } |
| return false; |
| } |
| |
| } |