Multiple undo required for a single change. [message #251998] |
Tue, 11 March 2008 10:55 |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02787 seconds