Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Can't Undo Sirius deletion in RCP(Can't Undo Sirius deletion in RCP)
Can't Undo Sirius deletion in RCP [message #1859495] Mon, 12 June 2023 07:47 Go to next message
Jerry Zh is currently offline Jerry ZhFriend
Messages: 2
Registered: June 2023
Junior Member
Hi:
I want open a Sirius diagram programmatically in RCP. Everything works fine except that I can't undo delete operation. I can delete a container or node by Delete key, but when I press CTRL+Z, nothing happened. What's the possible reason? Or someone can give me a working sample code?
My Sirius version is 6.4.1.

Best Regards.
Re: Can't Undo Sirius deletion in RCP [message #1859496 is a reply to message #1859495] Mon, 12 June 2023 07:58 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 705
Registered: July 2009
Senior Member
Hi,

It's possible that the "Delete" operation actually triggers several commands in your case, e.g. one for the deletion of the element and refresh of the diagram, and then someone reacts to the deletion with another change.
In this case your "Undo" would only apply to the second command and not to the deletion.
This might depend on the actual modeler you use if it does some non-standard things.

I just tested the basic scenarion on Ecore Tools (which is based on Sirius), and it works with a single Ctrl-Z.

After you've deleted the element, look at the "Edit" menu in the window's menu bar. It should mention "Undo Delete element (Ctrl-Z)". If it does not, then something has executed another command in reaction to the delete, and you may need several "Undo" operations to actually undo the delete.

Regards,
Pierre-Charles


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Can't Undo Sirius deletion in RCP [message #1859509 is a reply to message #1859496] Tue, 13 June 2023 00:38 Go to previous message
Jerry Zh is currently offline Jerry ZhFriend
Messages: 2
Registered: June 2023
Junior Member
Dear Pierre-Charles:
Thank you for your quick reply. According to your hint, I found the problem is in RCP. In RCP application, I create "Edit" menu through Extensions.
         <menu
               label="Edit">
            <command
                  commandId="org.eclipse.ui.edit.undo"
                  id="undo"
                  label="Undo"
                  style="push">
            </command>
            <command
                  commandId="org.eclipse.ui.edit.redo"
                  label="Redo"
                  style="push">
            </command>

I guess I missing something in code. If realize "Edit" menu in code ApplicationActionBarAdvisor:
	@Override
	protected void makeActions(IWorkbenchWindow window) {
		undo = ActionFactory.UNDO.create(window);
		redo = ActionFactory.REDO.create(window);
	}

	@Override
	protected void fillMenuBar(IMenuManager menuBar) {
		editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
		menuBar.insertAfter("file", editMenu);
		editMenu.add(undo);
		editMenu.add(redo);
	}


Undo can works correctly.

[Updated on: Tue, 13 June 2023 03:25]

Report message to a moderator

Previous Topic:Derived Relations in Ecore
Next Topic:Creating a Trust Boundary
Goto Forum:
  


Current Time: Thu Oct 10 05:49:29 GMT 2024

Powered by FUDForum. Page generated in 0.04233 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top