| Summary: |
Copy business objects to clipboard creates exception in SWT / EcoreUtil.copy not handled by SWT clipboard |
| Product: |
[Modeling] Graphiti
|
Reporter: |
Ivar Refsdal <refsdal.ivar> |
| Component: |
Core | Assignee: |
Project Inbox <graphiti-inbox> |
| Status: |
CLOSED
FIXED
|
QA Contact: |
|
| Severity: |
minor
|
|
|
| Priority: |
P3
|
CC: |
matthias.gorning, michael.wenz
|
| Version: |
0.8.0 | Flags: |
michael.wenz:
juno+
|
| Target Milestone: |
0.9.0 | |
|
| Hardware: |
All | |
|
| OS: |
All | |
|
| See Also: |
https://bugs.eclipse.org/bugs/show_bug.cgi?id=375533
|
| Whiteboard: |
Juno RC2 Theme_round_offs |
Build Identifier: Full stacktrace: !ENTRY org.eclipse.ui 4 0 2011-09-25 14:53:04.339 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.IllegalArgumentException: Argument not valid at org.eclipse.swt.SWT.error(SWT.java:4064) at org.eclipse.swt.SWT.error(SWT.java:3998) at org.eclipse.swt.SWT.error(SWT.java:3969) at org.eclipse.swt.dnd.DND.error(DND.java:281) at org.eclipse.swt.dnd.DND.error(DND.java:227) at org.eclipse.swt.dnd.Clipboard.setContents(Clipboard.java:448) at org.eclipse.swt.dnd.Clipboard.setContents(Clipboard.java:379) at org.eclipse.graphiti.ui.internal.util.clipboard.ModelClipboard.setNativeContentObjects(ModelClipboard.java:488) at org.eclipse.graphiti.ui.internal.util.clipboard.ModelClipboard.setContent(ModelClipboard.java:107) at org.eclipse.graphiti.ui.features.AbstractCopyFeature.putToClipboard(AbstractCopyFeature.java:84) at no.uio.ivarref.prediqt.copyandpaste.PrediqtCopyPNodeFeature.copy(PrediqtCopyPNodeFeature.java:53) at org.eclipse.graphiti.ui.internal.action.CopyAction.run(CopyAction.java:80) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) 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:1258) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) 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:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575) at org.eclipse.equinox.launcher.Main.run(Main.java:1408) at org.eclipse.equinox.launcher.Main.main(Main.java:1384) Reproducible: Always Steps to Reproduce: 1. Modify the copy feature to the following: @Override public void copy(ICopyContext context) { // get the business-objects for all pictogram-elements PictogramElement[] pes = context.getPictogramElements(); Collection<EObject> bos = new ArrayList<EObject>(); for (int i = 0; i < pes.length; i++) { PictogramElement pe = pes[i]; if (getBusinessObjectForPictogramElement(pe) instanceof EObject) { EObject eObject = (EObject) getBusinessObjectForPictogramElement(pe); bos.add(EcoreUtil.copy(eObject)); // EcoreUtil.copy causes the exception later on. } } // put all business objects to the clipboard putToClipboard(bos.toArray()); // exception thrown here. } 2. Run the application. 3. Copy a node. Hackish-solution: Remove the EcoreUtil.copy from the copy feature. Let the paste feature use EcoreUtil.copy. This works as one would expected. It would also be good if this was mentioned in the documentation.