Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Multiple undo required for a single change.
Multiple undo required for a single change. [message #251998] Tue, 11 March 2008 10:55
Eclipse UserFriend
Originally posted by: topgun.in.gmail.com

Hi,

I wrote a simple plugin to change the method modifiers from a pop up menu.
But once changed it requires multiple undo to reach the earlier state.
for e.g. If the original method was : public void foo(){}
and I change the public modifier to private using the pop up menu option.
The result is : private void foo(){}

But, now if I use ctrl-z to undo the change, I have to press ctrl-z twice.
The first undo makes 'private void foo(){}' to 'void foo(){}' and then the
second undo takes it to the original state 'public void foo(){}'.

I use ListRewrite#replace() method to replace the modifier with the new
modifier.

ListRewrite lrw = astRewrite.getListRewrite(
methodDeclarationNode, MethodDeclaration.MODIFIERS2_PROPERTY);
...
lrw.replace(existingModifier, newModifier, null);

and I apply the changes as follows :

IDocument document = textFileBuffer.getDocument();
TextEdit edits = astRewrite.rewriteAST(
document, cu.getJavaProject().getOptions(true));
edits.apply(document);

Shouldn't the undo happen in a single ctrl-z? What could be wrong?

Thanks,
Pushkar
Previous Topic:How to prevent cursor re-positioning?
Next Topic:How do I reduce the size of Eclipse 3.2 memory footprint?
Goto Forum:
  


Current Time: Sat May 10 01:56:48 EDT 2025

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

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

Back to the top