get information about TextEdit [message #259289] |
Wed, 01 April 2009 23:09  |
Eclipse User |
|
|
|
can I get the number of changed lines of code, names of changed method
from a TextEdit (resulted from a refactoring, for example) before the
refactoring taking
place (preview)?
Any suggestions? Thanks in advance.
|
|
|
|
Re: get information about TextEdit [message #259541 is a reply to message #259407] |
Mon, 13 April 2009 20:05  |
Eclipse User |
|
|
|
Yeah. Thanks.
It seems not easy to do the comparison.
Assume a MultiTextEdit has multiple children edit - which edit happens
first - the first in list? when three edits (delete and inserts) happens
on the same line
- this looks complicated.
I am trying to work out a CustomEditVisitor to do it but need to figure
out how these edits work exactly first.For example for an insert Edit, my
thought is
public boolean visit(InsertEdit edit) {
int offset = edit.getOffset();
int length = edit.getLength();
try {
int offsetLine = document.getLineOfOffset(edit.getOffset());
int lengthLine = document.computeNumberOfLines(edit.getText());
String content = edit.getText();
setFSizeLine(getFSizeLine() + lengthLine);
} catch (BadLocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return false; //super.visit(edit);
}
Below is an Edit I got from an indirection refactoring on a toy program
{MultiTextEdit} [568, 603] [undefined]
{MultiTextEdit} [568, 603]
{InsertEdit} [568,0]<<Person.debug(
{MoveTargetEdit} [568,0]
{InsertEdit} <<)
{DeleteEdit} [568,41]
{DeleteEdit} [583,25]
{MoveSourceEdit} [583,25]
{InsertEdit} [1130,0] <<Person.debug(
{MoveTargetEdit} [1130,0]
{InsertEdit} [1130,0] <<)
{DeleteEdit} [1130,41]
{DeleteEdit} [1145,25]
{MoveSourceEdit} [1145,25]
can you give any help? Thanks a lot.
Liming
|
|
|
Powered by
FUDForum. Page generated in 0.03322 seconds