| Summary: | DeleteFromDiagram menu is no more available for Notes and Text | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] Sirius | Reporter: | Maxime Porhel <maxime.porhel> | ||||||
| Component: | Diagram | Assignee: | Maxime Porhel <maxime.porhel> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | pierre-charles.david | ||||||
| Version: | 1.0.0 | Keywords: | triaged | ||||||
| Target Milestone: | 2.0.0 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows NT | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Maxime Porhel
See https://git.eclipse.org/r/27081 First step: it changes the path of copyLayoutAction and pasteLayoutAction which are put in the copyGroup of the contextual menu whereas a copyLayoutGroup has been created. It also creates a deleteFromGroup to place the DeleteFromDiagram and DeleteFromMode actions: DeleteFromDiagram was previously added before the copy layout group (the separator between both delete from actions). Created attachment 243379 [details]
Contextual menu (before)
For the next step, I have to provide the DeleteFromDiagram action to Note/TextEditPart in Sirius only. For that, we could use org.eclipse.ui.menus or org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders. A first try with org.eclipse.ui.menus shows some ClassCastException in the GMF EditMenu ActionMenuManager which does not handle the e4 HandledActionManager. See Bug . A second try with org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders allows to place the delete from diagram action at the right place, but I do not have the accelerator in the label yet and the enablement is not updated. I am trying to change the action implementation to get these elements. While it is not corrected, the delete from diagram is not available/displayed for Note/TextEditParts but it is available from the tabbar. Furthermore, since Bug 433474, the Sirius delete from diagram si no more displayed on non Sirius diagram editors. Created attachment 243380 [details]
Contextual menu (after first step)
Note that . DeleteFromModel should be deactivated for NoteAttachment . DeleteFromDiagram should work on NoteAttchament. If these problems are not side effect of the menus declarations, new bugzilla issues will be created later. Moving to 2.0.0. Not critical enough to do this this close to the 1.0.0 release. Note that it is still possible to delete the notes and text elements using the actions from the tabbar. When we fix this, we should remember the re-enable the corresponding automated tests. See https://git.eclipse.org/r/31204 This commit removes the default deleteFromDiagram only for the ISiriusEditPart and for other parts (Note, Text, NoteAttachment it moves the default DeleteFromDiagram action to the edit>deleteGroup. The keyboard shortcut is not displayed as it not the same action, but it works. Another solution could be to create our own SiriusNote/Text/NoteAttachment editpart, created from our edit part provider, exending the GMF parts but with the inheritance to ISiriusEditPart to get the Sirius deleteFromDiagram menu. But there could be other impacts in the code. I have retried with org.eclipse.ui.menus, but this time I get something weird: I would like to use the visibleWhen with the activeEditorId and the ActiveSelection, but it is never displayed, and without visibleWhen, when I tried to correclty define the location of my menu (in the editMenu after the deleteFromGroup separator and before the deleteFromModel action), the MUIMenu seems well constructed but my delete from diagram appears after the deleteFromModel action. I propose to take the menu without accelerator displayed and to open another bug to get the accelerator back and to review the deleteFromModel and deleteFromDiagral action declarations. The menu is added and not inserted at its index because HandledMenuItemImpl.getParent() currently returns null in org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerRenderer l.619:
> MElementContainer<MUIElement> parent = model.getParent();
> // technically this shouldn't happen
> if (parent == null) {
> parentManager.add(menuManager);
Looking in debug, eContainer is not null and the menu item seems to be well contained in the "children" feature but UIElementImpl.getParent return null.
https://git.eclipse.org/r/31204 has bene accepted and merged in commit b60c11419cef88bb52889bdde7f2b149e81641ed (In reply to Maxime Porhel from comment #8) > See https://git.eclipse.org/r/31204 > > This commit removes the default deleteFromDiagram only for the > ISiriusEditPart > and for other parts (Note, Text, NoteAttachment it moves the default > DeleteFromDiagram action to the edit>deleteGroup. The keyboard shortcut is > not > displayed as it not the same action, but it works. > Another solution could be to create our own SiriusNote/Text/NoteAttachment > editpart, created from our edit part provider, exending the GMF parts but > with > the inheritance to ISiriusEditPart to get the Sirius deleteFromDiagram menu. > But there could be other impacts in the code. The issue is corrected on Sirius. The DeleteFromDiagram menu is now available for Notes and Text. A nwe bug will be created to deal with the potential e4 bug. Available in Sirius 2.0.0. |