eclipse-ecp / org.eclipse.emf.ecp.core

Eclipse Public License 2.0
0 stars 0 forks source link

Save as XMI removes context menu commands #46

Open eclipse-ecp-bot opened 5 months ago

eclipse-ecp-bot commented 5 months ago

| --- | --- | | Bugzilla Link | 507466 | | Status | NEW | | Importance | P3 normal | | Reported | Nov 14, 2016 08:36 EDT | | Modified | Aug 18, 2023 13:04 EDT | | Version | 1.10.0 | | Reporter | Peter Friedland |

Description

Created attachment 265335\ makeithappen with simply adding and action and XMI serialization

I have got an EMF Forms RAP application and I have added master-detail actions using the "org.eclipse.emf.ecp.view.treemasterdetail.ui.swt.masterDetailActions" extension point.\ When I execute my save command all my context menu entries in the master details are not showing up any more, just the small loading item entry "...".

The save command can be called from the root object only and does the following:

Code: [Select all] [Show/ hide]\ final Resource resource = new XMIResourceImpl(URI.createURI("data.xmi")); //$NON-NLS-1$\ resource.getContents().add(element);

try {\ resource.save(Collections.EMPTY_MAP);\ } catch (final IOException e) {\ e.printStackTrace();\ }

I tracked it down to the resource.getContents.add(element). If I comment this line out, the context menu stays after command execution properly. If I execute the command without modifications I need to refresh the browser to get the context menu back.

The effect is reproducable with attached project:

1) Create some data. 2) Execute root Context Action Save 3) Context Menu keeps empty.

:compression: bug_emfforms.zip

eclipse-ecp-bot commented 5 months ago

By Eugen Neufeld on Nov 18, 2016 04:04

Hi Peter,\ So I think the problem is, that when you call \ resource.getContents().add(element)\ the containment of the element changes.

I think, that the Tree doesn't update correctly and still shows data which is not available anymore.

So instead of adding the element directly you should add a copy to the newly created resource:\ resource.getContents().add(EcoreUtil.copy(element))

Cheers,\ Eugen

eclipse-ecp-bot commented 5 months ago

By Peter Friedland on Nov 18, 2016 10:01

(In reply to Eugen Neufeld from comment #1)

Hi Peter, So I think the problem is, that when you call resource.getContents().add(element) the containment of the element changes.

I think, that the Tree doesn't update correctly and still shows data which is not available anymore.

So instead of adding the element directly you should add a copy to the newly created resource: resource.getContents().add(EcoreUtil.copy(element))

Cheers, Eugen

Dear Eugen,

that workaround seems to work, thank you so far! Will this bug be fixed anytime?

eclipse-ecp-bot commented 5 months ago

By Eugen Neufeld on Nov 18, 2016 13:44

Hi Peter, \ the bug is then that the tree doesn't update and doesn't show as being empty.\ So this is basically not a workaround and will be needed (this is how emf works).\ I also don't think, that we will fix the tree issue any time soon as this seems to be a corner case which in my opinion puts the whole tree in a broken state.\ Jonas what do you think about this?

eclipse-ecp-bot commented 5 months ago

By Jonas Helming on Nov 21, 2016 07:30

I agree. @Peter: Any contribution on this is welcome. Basically I think we should use the resource itself as a root node.

eclipse-ecp-bot commented 5 months ago

Nov 21, 2018 12:34

This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--\ The automated Eclipse Genie.

eclipse-ecp-bot commented 5 months ago

Aug 27, 2021 16:09

This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--\ The automated Eclipse Genie.

eclipse-ecp-bot commented 5 months ago

Aug 18, 2023 13:04

This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--\ The automated Eclipse Genie.