/** {@inheritDoc} */ @Override public void paste(IPasteContext context) { // already verified, that pasting is allowed just directly in the diagram PictogramElement[] pes = context.getPictogramElements(); Diagram diagram = (Diagram) pes[0]; // get the PictogramElements from the clipboard and the linked business object. Object[] objects = getFromClipboard(); for (Object object : objects) { PictogramElement pictogramElement = (PictogramElement) object; rootCon boRef = (rootCon) getBusinessObjectForPictogramElement(pictogramElement); rootCon bo = EcoreUtil.copy(boRef); addBusinessObjectToContainer(bo, pictogramElement); // create a new AddContext for the creation of a new shape. AddContext ac = new AddContext(new AddContext(), bo); ac.setLocation(0, 0); // for simplicity paste at (0, 0) ac.setTargetContainer(diagram); // paste on diagram // copy all properties from the shape (e.g. ALIAS etc.) for (Property prop : pictogramElement.getProperties()) { ac.putProperty(prop.getKey(), prop.getValue()); } getFeatureProvider().addIfPossible(ac); } }
public static String getToolTip(GraphicsAlgorithm ga) { if (ga != null) { for (Property prop : ga.getProperties()) { if (GraphitiConstants.TOOLTIP_PROPERTY.equals(prop.getKey())) return prop.getValue(); } } return null; }
public static void setToolTip(GraphicsAlgorithm ga, String text) { if (ga != null) { Property prop = MmFactory.eINSTANCE.createProperty(); prop.setKey(GraphitiConstants.TOOLTIP_PROPERTY); prop.setValue(text); ga.getProperties().add(prop); } }