use of org.eclipse.gmf.runtime.emf.clipboard.core.PasteChildOperation in project statecharts by Yakindu.
the class ConnectorViewPostPasteChildOperation method doPasteSemanticElement.
private void doPasteSemanticElement() throws Exception {
List list = new ArrayList();
Iterator it = getSemanticElementPasteOperations().iterator();
while (it.hasNext()) {
PasteChildOperation operation = (PasteChildOperation) it.next();
operation.paste();
PasteChildOperation postPasteOperation = operation.getPostPasteOperation();
if (postPasteOperation != null) {
list.add(postPasteOperation);
}
}
performSemanticElementPostPasteOperations(list);
}
use of org.eclipse.gmf.runtime.emf.clipboard.core.PasteChildOperation 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);
}
};
}
use of org.eclipse.gmf.runtime.emf.clipboard.core.PasteChildOperation in project statecharts by Yakindu.
the class ConnectorViewPostPasteChildOperation method getSemanticElementPasteOperations.
/**
* @return
*/
private List getSemanticElementPasteOperations() {
if (semanticElementPasteOperations == null) {
semanticElementPasteOperations = new ArrayList();
// use either source or target views since by now they should have
// been pasted already
EObject semanticPasteTarget = NotationClipboardOperationHelper.getSemanticPasteTarget(getConnectorViewPasteOperation().getSourceView());
if (semanticPasteTarget != null) {
Iterator alwaysCopyEObjectInfoIt = getChildObjectInfo().getCopyAlwaysObjectInfoList().iterator();
while (alwaysCopyEObjectInfoIt.hasNext()) {
ObjectInfo alwaysCopyObjectInfo = (ObjectInfo) alwaysCopyEObjectInfoIt.next();
PasteChildOperation pasteOperation = new PasteChildOperation(getParentPasteProcess().clone(semanticPasteTarget), alwaysCopyObjectInfo);
semanticElementPasteOperations.add(pasteOperation);
}
// while always-copy
}
}
return semanticElementPasteOperations;
}
use of org.eclipse.gmf.runtime.emf.clipboard.core.PasteChildOperation in project statecharts by Yakindu.
the class ConnectorViewPostPasteChildOperation method performSemanticElementPostPasteOperations.
private void performSemanticElementPostPasteOperations(List operations) throws Exception {
if (operations.isEmpty() == false) {
List postPasteOperations = new ArrayList();
Iterator it = operations.iterator();
while (it.hasNext()) {
PasteChildOperation pasteOperation = (PasteChildOperation) it.next();
pasteOperation.paste();
PasteChildOperation postPasteOperation = pasteOperation.getPostPasteOperation();
if (postPasteOperation != null) {
postPasteOperations.add(postPasteOperation);
}
}
// perform those newly added post paste operations
performSemanticElementPostPasteOperations(postPasteOperations);
}
}
Aggregations