Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » CTRL+Z undo redo problem
CTRL+Z undo redo problem [message #1863590] Wed, 14 February 2024 07:37 Go to next message
seokho yang is currently offline seokho yangFriend
Messages: 3
Registered: February 2024
Junior Member

I developed GEF-based and EMF-based editors, which worked without any issues up to Eclipse 2019. However, in later versions of Eclipse, simply installing the plugin without running the custom editor, then opening two files in the Java editor, and making modifications to each file, when undoing changes in the first editor using Ctrl+Z, it affects the content of the other editor's file. How can I fix this issue?
Re: CTRL+Z undo redo problem [message #1863596 is a reply to message #1863590] Wed, 14 February 2024 14:49 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4435
Registered: July 2009
Senior Member

It sounds like you are not doing anything with the setActiveEditor() method.

_
Nitin Dahyabhai
Eclipse Web Tools Platform
Re: CTRL+Z undo redo problem [message #1863604 is a reply to message #1863596] Thu, 15 February 2024 02:16 Go to previous messageGo to next message
seokho yang is currently offline seokho yangFriend
Messages: 3
Registered: February 2024
Junior Member
I appreciate your response. However, I added the following code, but the same issue persists:

@Override
public void setActiveEditor(IEditorPart targetEditor) {
super.setActiveEditor(targetEditor);

if (targetEditor instanceof XamEditor) {

XamEditor editor = (XamEditor) targetEditor;

IActionBars bars = getActionBars();
bars.clearGlobalActionHandlers();
bars.updateActionBars();

bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), editor.getEditorActionRegistry().getAction(ActionFactory.DELETE.getId()));
bars.setGlobalActionHandler(ActionFactory.UNDO.getId(), editor.getEditorActionRegistry().getAction(ActionFactory.UNDO.getId()));
bars.setGlobalActionHandler(ActionFactory.REDO.getId(), editor.getEditorActionRegistry().getAction(ActionFactory.REDO.getId()));

} else {

IActionBars bars = getActionBars();
bars.clearGlobalActionHandlers();
bars.updateActionBars();
}
}

Additionally, the issue occurs only in the Java editor. For example, in other editors like the text editor, undo works correctly.
The symptom is that when I have two Java editors open, if I perform a ctrl+z action in the first editor opened after making changes in both, the undo action affects the second editor opened.

Please assist
Re: CTRL+Z undo redo problem [message #1863610 is a reply to message #1863604] Thu, 15 February 2024 14:25 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Does the problem only happen after you open your editor? Does it continue to be a problem after you close your editor?

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: CTRL+Z undo redo problem [message #1863613 is a reply to message #1863610] Fri, 16 February 2024 00:52 Go to previous messageGo to next message
seokho yang is currently offline seokho yangFriend
Messages: 3
Registered: February 2024
Junior Member
After installing the plugin and opening two Java editors for testing, the same issue occurs. The situation reproduces even without running the custom editor.

In the Java editor, the undo menu in the right-click context menu works correctly.

Re: CTRL+Z undo redo problem [message #1863616 is a reply to message #1863613] Fri, 16 February 2024 07:20 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
So simply installing your plugin but not actually using anything in it causes a problem. Such interaction is kind of inexplicable to me. I'm not sure how to answer questions about such a strange thing. Does your plugin.xml register key bindings? Does it do anything else that might be relevant? Special startup actions? Add listeners on startup?

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[SOLVED] Error with Signing Eclipse Contributor Agreement
Next Topic:Can't see views in Data Source Explorer
Goto Forum:
  


Current Time: Sat Apr 27 16:29:04 GMT 2024

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

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

Back to the top