| Copy And Paste of graphical Elements [message #1071572] |
Sat, 20 July 2013 09:51  |
Rahul Dev Mishra Messages: 8 Registered: July 2013 Location: Bangalore, India |
Junior Member |
|
|
Hi All,
I have implemented the Copy and Paste functionality on the Graphical editor.
Now the new copied element comes up fine on the editor. However any manipulation I do on this new element gets reflected on the other element from where this new element was copied.
The reason I think is because I have copied only the graphical pictogram element and not the underlying business element.
It would be really helpful if anybody can point me in the right direction in resolving this issue i.e. copying of business model element.
Thanks & Regards,
Rahul
|
|
|
|
|
|
| Re: Copy And Paste of graphical Elements [message #1096636 is a reply to message #1077141] |
Wed, 28 August 2013 13:06   |
Rahul Dev Mishra Messages: 8 Registered: July 2013 Location: Bangalore, India |
Junior Member |
|
|
Hello All,
Now I have got another issue.
I copy a graphical element from an editor and paste it in another editor. Now when I do that I receive IllegalStateException.
Quote:!MESSAGE GFCommandStack.execute(Command) java.lang.IllegalStateException: Cannot modify resource set without a write transaction
!STACK 0
java.lang.IllegalStateException: Cannot modify resource set without a write transaction
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.assertWriting(TransactionChangeRecorder.java:348)
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.appendNotification(TransactionChangeRecorder.java:302)
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.processObjectNotification(TransactionChangeRecorder.java:284)
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.notifyChanged(TransactionChangeRecorder.java:240)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at com.sap.ndb.studio.view.model.view.impl.ViewNodeImpl.setLayout(ViewNodeImpl.java:263)
at com.sap.ndb.studio.view.model.view.impl.ViewNodeImpl.eUnset(ViewNodeImpl.java:424)
at com.sap.ndb.studio.view.model.view.impl.ProjectionImpl.eUnset(ProjectionImpl.java:163)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eUnset(BasicEObjectImpl.java:1154)
at org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.process(FeatureChangeImpl.java:544)
at org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.apply(FeatureChangeImpl.java:518)
at org.eclipse.emf.ecore.change.impl.FeatureChangeImpl.apply(FeatureChangeImpl.java:493)
at org.eclipse.emf.ecore.change.impl.ChangeDescriptionImpl.apply(ChangeDescriptionImpl.java:300)
at org.eclipse.emf.transaction.util.CompositeChangeDescription.apply(CompositeChangeDescription.java:104)
at org.eclipse.emf.transaction.impl.TransactionImpl.doRollback(TransactionImpl.java:570)
at org.eclipse.emf.transaction.impl.TransactionImpl.rollback(TransactionImpl.java:547)
at org.eclipse.emf.workspace.AbstractEMFOperation.rollback(AbstractEMFOperation.java:630)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:187)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513)
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.graphiti.ui.internal.editor.GFCommandStack.execute(GFCommandStack.java:138)
at org.eclipse.graphiti.ui.internal.action.CustomAction.executeOnCommandStack(CustomAction.java:65)
at org.eclipse.graphiti.ui.internal.action.CustomAction.run(CustomAction.java:60)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:499)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1057)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4170)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3759)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
However if I paste the graphical element in the same editor, then without any exception the paste action is successful. However pasting the graphical element in some other editor throws an exception as shown above.
Also the paste action happens within a TransactionalEditingDomain.
Could you please let me know where am I going wrong ?
Thanks & Regards,
Rahul
[Updated on: Wed, 28 August 2013 13:07] Report message to a moderator
|
|
|
| Re: Copy And Paste of graphical Elements [message #1097061 is a reply to message #1096636] |
Thu, 29 August 2013 03:20  |
Michael Wenz Messages: 1370 Registered: July 2009 Location: Walldorf, Germany |
Senior Member |
|
|
Rahul,
it seems you try to trigger a Graphiti custom action / custom feature from
somewhere (I can't see in the stack trace, there seems to be an asynchronous
trigger). That call is done directly and changes the EMF model; Graphiti
uses EMF Transactions and that framework requires all model modifications to
happen inside a transaction. Try wrapping your call into somthing like this:
TransactionalEditingDomain ted = TransactionUtil.getEditingDomain(diagram);
ted.getCommandStack().execute(new RecordingCommand(editingDomain) {
@Override
protected void doExecute() {
<your call here>
}
});
Michael
|
|
|
Powered by
FUDForum. Page generated in 0.01838 seconds