2013-06-26 3 views
0

Я использую следующий код, чтобы показать разницу между двумя входными в формате СтрокаЗатмение compareEditor показывает линии изменения по линии

protected Object prepareInput(IProgressMonitor monitor) 
     throws InvocationTargetException, InterruptedException { 

    CompareItem left = new CompareItem(text1); 
    CompareItem right = new CompareItem(text2); 
    diffNode= new DiffNode(left, right); 
    return diffNode;   
} 

Для ввода как

line1   testline 
line2   line1 
line3   line2 
       line3 

он показывает все линии разные, вместо показа только первая строка отличается.

Как я звоню сравнить редактор является

CompareUI.openCompareDialog(new MyCompare(configuration, ((MyEditor) 
    editorPart).originalText(), ((MyEditor) editorPart).currentConverted())); 

Спасибо за любую помощь.

ответ

0

Это:

CompareConfiguration configuration = new CompareConfiguration(); 
CompareUI.openCompareDialog(new CompareEditorInput(configuration) { 
    @Override 
    protected Object prepareInput(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { 
     String text1 = "line1\nline2\nline3\n"; 
     String text2 = "testline\nline1\nline2\nline3\n"; 

     CompareItem left = new CompareItem("1", text1); 
     CompareItem right = new CompareItem("2", text2); 
     DiffNode diffNode = new DiffNode(left, right); 
     return diffNode; 
    } 
}); 

отлично работает для меня на Kepler.

Result on Kepler

Так что думает, что вы не даете нам достаточно данных.