Search in sources :

Example 1 with PostPasteChildOperation

use of org.eclipse.gmf.runtime.emf.clipboard.core.PostPasteChildOperation in project statecharts by Yakindu.

the class PositionalGeneralViewPasteOperation method getPostPasteOperation.

public PasteChildOperation getPostPasteOperation() {
    return new PostPasteChildOperation(this, EMPTY_ARRAY) {

        public void paste() throws Exception {
            // unset connectors before pasting so that it won't affect
            // real connectors especially if they happen to belong to the
            // same
            // target diagram
            Node view = (Node) getEObject();
            view.eUnset(NotationPackage.eINSTANCE.getView_SourceEdges());
            view.eUnset(NotationPackage.eINSTANCE.getView_TargetEdges());
            // now paste view
            EObject pastedElement = doPasteInto(getParentEObject());
            // did we succeed?
            if (pastedElement != null) {
                setPastedElement(pastedElement);
                addPastedElement(pastedElement);
            } else {
                addPasteFailuresObject(getEObject());
            }
        }

        protected boolean shouldPasteAlwaysCopyObject(ObjectInfo alwaysCopyObjectInfo) {
            return PositionalGeneralViewPasteOperation.this.shouldPasteAlwaysCopyObject(alwaysCopyObjectInfo);
        }

        /*
			 * (non-Javadoc)
			 * 
			 * @see org.eclipse.gmf.runtime.emf.core.internal.copypaste.
			 * PasteChildOperation
			 * #makeAuxiliaryChildPasteProcess(org.eclipse.gmf
			 * .runtime.emf.core.internal.copypaste.ObjectInfo)
			 */
        @SuppressWarnings("restriction")
        protected PasteChildOperation makeAuxiliaryChildPasteProcess(ObjectInfo auxiliaryChildEObjectInfo) {
            EObject semanticPasteTarget = NotationClipboardOperationHelper.getSemanticPasteTarget((View) getPastedElement());
            if (semanticPasteTarget == null) {
                return null;
            }
            return new PasteChildOperation(getParentPasteProcess().clone(semanticPasteTarget), auxiliaryChildEObjectInfo);
        }

        public PasteChildOperation getPostPasteOperation() {
            List operations = getAlwaysCopyObjectPasteOperations();
            return new PostPasteChildOperation(this, operations);
        }
    };
}
Also used : Node(org.eclipse.gmf.runtime.notation.Node) EObject(org.eclipse.emf.ecore.EObject) PostPasteChildOperation(org.eclipse.gmf.runtime.emf.clipboard.core.PostPasteChildOperation) PasteChildOperation(org.eclipse.gmf.runtime.emf.clipboard.core.PasteChildOperation) OverridePasteChildOperation(org.eclipse.gmf.runtime.emf.clipboard.core.OverridePasteChildOperation) List(java.util.List) PostPasteChildOperation(org.eclipse.gmf.runtime.emf.clipboard.core.PostPasteChildOperation) ObjectInfo(org.eclipse.gmf.runtime.emf.clipboard.core.ObjectInfo)

Aggregations

List (java.util.List)1 EObject (org.eclipse.emf.ecore.EObject)1 ObjectInfo (org.eclipse.gmf.runtime.emf.clipboard.core.ObjectInfo)1 OverridePasteChildOperation (org.eclipse.gmf.runtime.emf.clipboard.core.OverridePasteChildOperation)1 PasteChildOperation (org.eclipse.gmf.runtime.emf.clipboard.core.PasteChildOperation)1 PostPasteChildOperation (org.eclipse.gmf.runtime.emf.clipboard.core.PostPasteChildOperation)1 Node (org.eclipse.gmf.runtime.notation.Node)1