2012-12-07 53 views
0

我正在嘗試將任務ID列添加到Git History視圖中。但得到了以下問題Git歷史頁面修改問題 - 文本重疊

History error image link

,如果你看到的圖像,最後一欄(任務ID)是覆蓋在自己與一個字符的偏移。它看起來像一些與列數有關的事情,因爲當我通過重新整理進行實驗時,最後一列始終存在問題。

如果有人對此有任何意見,請讓我知道。加入

代碼在CommitGraphTable

private void createColumns(final Table rawTable, final TableLayout layout) { 

...//existing code in the method 
final TableColumn task = new TableColumn(rawTable, SWT.NONE); 
task.setResizable(true); 
task.setText(UIText.CommitGraphTable_TaskIdColumn); 
// task.setWidth(50); 
layout.addColumnData(new ColumnWeightData(5, 100, true)); 
} 

代碼在CommitLabelProvider

public String getColumnText(final Object element, final int columnIndex) { 

...//existing code in the method 
if (columnIndex == 6){ 
    return (taskId);//$NON-NLS-1$ 
} 

回答

0

有自己錯過了改變代碼加入。標記XXX評論

private void createPaintListener(final Table rawTable) { 
    // Tell SWT we will completely handle painting for some columns. 
    // 
    rawTable.addListener(SWT.EraseItem, new Listener() { 
     public void handleEvent(final Event event) { 
      if (0 <= event.index && event.index <= 6) 
        //XXX changed the index comparison from 5 to 6 
       event.detail &= ~SWT.FOREGROUND; 
     } 
    });