0
SWT StyledText를 사용하여 플러그인에서 내 쿼리에 대한 응답을 채 웁니다. 나는 아래쪽으로 자동 스크롤하는 법을 배웠지 만 마지막 항목을 자동으로 선택하는 정확한 방법을 알아낼 수 없었다. 최적화되지 않은 방식으로이 작업을 수행했습니다. 즉, 이전 줄의 배경을 모두 흰색으로 업데이트 한 다음 최신 추가 줄을 강조 표시했지만 더 나은 방법이 있어야합니다.SWT StyledText - 자동 강조 표시 (또는 자동 선택)
rspST.append(rsp + "\n"); ** //<--- Appending the new response to the styledText **
rspST.setTopIndex(rspST.getLineCount() - 1); ** //<-- Scroll to bottom**
for(int i=0; i<rspST.getLineCount() - 2; i++) ** //Setting the background of previous entries to white**
{
rspST.setLineBackground(i, 1,rspST.getDisplay().getSystemColor(SWT.COLOR_WHITE));
}
rspST.setLineBackground(rspST.getLineCount() - 2,
1,rspST.getDisplay().getSystemColor(SWT.COLOR_GRAY)); ** Setting the background of the last line added to gray**
감사 :
여기 내 코드입니다!