Commit a2e434c1 authored by Johannes Roith's avatar Johannes Roith

Make renaming a compound change (undo by clicking undo once).

parent 7e1cff33
...@@ -195,8 +195,11 @@ public class RenameSymbolHandler extends AbstractHandler { ...@@ -195,8 +195,11 @@ public class RenameSymbolHandler extends AbstractHandler {
return null; return null;
} }
editor.beginCompoundChange();
RenamingVisitor visitor = new RenamingVisitor(doc, oldName, renameDialog.getNewName()); RenamingVisitor visitor = new RenamingVisitor(doc, oldName, renameDialog.getNewName());
ast.accept(visitor, null); ast.accept(visitor, null);
editor.endCompoundChange();
} }
} }
......
...@@ -12,6 +12,7 @@ import org.eclipse.jface.text.BadLocationException; ...@@ -12,6 +12,7 @@ import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.IVerticalRulerInfo; import org.eclipse.jface.text.source.IVerticalRulerInfo;
import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
...@@ -109,6 +110,14 @@ public class CupTextEditor extends TextEditor ...@@ -109,6 +110,14 @@ public class CupTextEditor extends TextEditor
} }
} }
public void beginCompoundChange() {
((SourceViewer) getSourceViewer()).getUndoManager().beginCompoundChange();
}
public void endCompoundChange() {
((SourceViewer) getSourceViewer()).getUndoManager().endCompoundChange();
}
public IDocument getDocument() { public IDocument getDocument() {
IDocumentProvider provider = getDocumentProvider(); IDocumentProvider provider = getDocumentProvider();
if (provider != null) if (provider != null)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment