|
|
Re: get information about TextEdit [message #259541 is a reply to message #259407] |
Tue, 14 April 2009 00:05 |
Liming Zhao Messages: 9 Registered: July 2009 |
Junior Member |
|
|
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.05081 seconds