/******************************************************************************* | |
* <copyright> | |
* | |
* Copyright (c) 2013, 2013 SAP AG. | |
* 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: | |
* SAP AG - initial API, implementation and documentation | |
* | |
* </copyright> | |
* | |
*******************************************************************************/ | |
package org.eclipse.fmc.blockdiagram.editor.features.add; | |
import org.eclipse.graphiti.features.IFeatureProvider; | |
import org.eclipse.graphiti.features.context.IAddContext; | |
import org.eclipse.graphiti.mm.algorithms.Rectangle; | |
import org.eclipse.graphiti.mm.pictograms.ContainerShape; | |
import org.eclipse.graphiti.mm.pictograms.PictogramElement; | |
/** | |
* This add feature adds an invisible rectangle to the diagram. | |
* | |
* @author Benjamin Schmeling | |
* | |
*/ | |
public class InvisibleShapeAddFeature extends ShapeAddFeature { | |
/** | |
* | |
* @param featureProvider | |
* The feature provider. | |
*/ | |
public InvisibleShapeAddFeature(IFeatureProvider featureProvider) { | |
super(featureProvider); | |
} | |
/* | |
* (non-Javadoc) | |
* | |
* @see | |
* org.eclipse.graphiti.func.IAdd#add(org.eclipse.graphiti.features.context | |
* .IAddContext) | |
*/ | |
@Override | |
public PictogramElement add(IAddContext context) { | |
ContainerShape newShape = pe.createContainerShape( | |
context.getTargetContainer(), true); | |
newShape.setVisible(false); | |
Rectangle rec = ga.createRectangle(newShape); | |
rec.setLineWidth(2); | |
ga.setLocationAndSize(rec, context.getX(), context.getY(), 5, 5); | |
pe.createChopboxAnchor(newShape); | |
return newShape; | |
} | |
} |