Bug 484079 - UnsupportedOperationException on DirectEditTools cut/delete
Summary: UnsupportedOperationException on DirectEditTools cut/delete
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2015-12-10 04:00 EST by Esteban DUGUEPEROUX CLA
Modified: 2015-12-10 08:47 EST (History)
1 user (show)

See Also:


Attachments
Project to reproduce (1.71 KB, application/zip)
2015-12-10 04:03 EST, Esteban DUGUEPEROUX CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Esteban DUGUEPEROUX CLA 2015-12-10 04:00:15 EST
Selecting 2 DirectEditTools from different DiagramDescription from a odesign editor, and typing Ctrl+X throw twice the following exception :

java.lang.UnsupportedOperationException
	at org.eclipse.sirius.diagram.business.internal.metamodel.description.tool.spec.DirectEditLabelSpec.getMapping(DirectEditLabelSpec.java:45)
	at org.eclipse.sirius.diagram.editor.properties.sections.tool.directeditlabel.DirectEditLabelMappingPropertySection.getFeatureAsText(DirectEditLabelMappingPropertySection.java:74)
	at org.eclipse.sirius.editor.properties.sections.common.AbstractEditorDialogPropertySection.refresh(AbstractEditorDialogPropertySection.java:196)
	at org.eclipse.ui.views.properties.tabbed.TabContents$6.run(TabContents.java:217)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
	at org.eclipse.ui.views.properties.tabbed.TabContents.refresh(TabContents.java:220)
	at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage$SelectionChangedListener.selectionChanged(TabbedPropertySheetPage.java:222)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:163)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2171)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1202)
	at org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1231)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:242)
	at org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:236)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:408)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4454)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1388)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1412)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1397)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1182)
	at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyList.select(TabbedPropertyList.java:864)
	at org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyViewer.setSelectionToWidget(TabbedPropertyViewer.java:122)
	at org.eclipse.jface.viewers.StructuredViewer.setSelectionToWidget(StructuredViewer.java:1749)
	at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1705)
	at org.eclipse.jface.viewers.Viewer.setSelection(Viewer.java:388)
	at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.setInput(TabbedPropertySheetPage.java:748)
	at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.selectionChanged(TabbedPropertySheetPage.java:556)
	at org.eclipse.ui.views.properties.PropertySheet.selectionChanged(PropertySheet.java:365)
	at org.eclipse.ui.internal.e4.compatibility.SelectionService.notifyListeners(SelectionService.java:218)
	at org.eclipse.ui.internal.e4.compatibility.SelectionService.handlePostSelectionChanged(SelectionService.java:122)
	at org.eclipse.ui.internal.e4.compatibility.SelectionService.access$1(SelectionService.java:112)
	at org.eclipse.ui.internal.e4.compatibility.SelectionService$3.selectionChanged(SelectionService.java:80)
	at org.eclipse.e4.ui.internal.workbench.SelectionAggregator$4.run(SelectionAggregator.java:166)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.e4.ui.internal.workbench.SelectionAggregator.notifyPostListeners(SelectionAggregator.java:163)
	at org.eclipse.e4.ui.internal.workbench.SelectionAggregator.access$8(SelectionAggregator.java:160)
	at org.eclipse.e4.ui.internal.workbench.SelectionAggregator$8$1.run(SelectionAggregator.java:272)
	at org.eclipse.e4.core.contexts.RunAndTrack.runExternalCode(RunAndTrack.java:56)
	at org.eclipse.e4.ui.internal.workbench.SelectionAggregator$8.changed(SelectionAggregator.java:269)
	at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:110)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:338)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:352)
	at org.eclipse.e4.ui.internal.workbench.SelectionServiceImpl.setPostSelection(SelectionServiceImpl.java:36)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityPart$3.selectionChanged(CompatibilityPart.java:127)
	at org.eclipse.sirius.editor.editorPlugin.SiriusEditor.setSelection(SiriusEditor.java:1233)
	at org.eclipse.sirius.editor.editorPlugin.SiriusEditor$7.selectionChanged(SiriusEditor.java:723)
	at org.eclipse.jface.viewers.Viewer$2.run(Viewer.java:163)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:50)
	at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:178)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:160)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2171)
	at org.eclipse.jface.viewers.StructuredViewer.handleInvalidSelection(StructuredViewer.java:1165)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1449)
	at org.eclipse.jface.viewers.TreeViewer.preservingSelection(TreeViewer.java:366)
	at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1397)
	at org.eclipse.jface.viewers.StructuredViewer.refresh(StructuredViewer.java:1525)
	at org.eclipse.jface.viewers.ColumnViewer.refresh(ColumnViewer.java:533)
	at org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider$ViewerRefresh.refresh(AdapterFactoryContentProvider.java:495)
	at org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider$ViewerRefresh.run(AdapterFactoryContentProvider.java:459)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3774)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3412)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:636)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:579)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:135)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Comment 1 Esteban DUGUEPEROUX CLA 2015-12-10 04:03:00 EST
Created attachment 258569 [details]
Project to reproduce

Steps to reproduce:

1. Import the attached Bug484079.zip
2. Open modeler.odesign
3. Select 2 DirectEditTools from both existing DiagramDescription
4. Type Ctrl+X => KO we get the previous exception twice.
Comment 2 Esteban DUGUEPEROUX CLA 2015-12-10 04:03:41 EST
The exceptions occurs also on Delete.
Comment 3 Pierre-Charles David CLA 2015-12-10 08:39:11 EST
Confirmed.

This probably happens for other VSM elements which rely on the cross-referencer to simulate bi-directional EReferences with EOperations (see https://git.eclipse.org/r/#/c/45945/ for other possible candidates). If confirmed for other cases, all should be fixed at the same time.
Comment 4 Pierre-Charles David CLA 2015-12-10 08:47:02 EST
To give a little more detail, the way we implement these EOperations is by using the inverse cross-referencer installed on the element's resource, but in the case of a cut/delete, the elements are not attached to a resource anymore.

However, because the cross-referencer adapter is a content adapter, we don't even need to go to the resource to find it, ECrossReferenceAdapter.getCrossReferenceAdapter(this) seems to work fine.

The patch in https://git.eclipse.org/r/#/c/45945/ should probably be merged first (maybe referencing this ticket instead of the one it was made for initialy), and then we can fix the issue once for all such cases (not just DirectEditLabelSpec.getMapping()).