I am upgrading the version of eclipse plugin from 3.8 to 4.25 and found that the paintControl method in the PaintListener I have been using before triggers infinitely, even if I do not have any UI operations.I don't know if this is due to the upgrade or an issue with my own code. Have any others experienced a similar situation, and how did you resolve it?
@Override
public void paintControl(PaintEvent e) {
boolean preAdvanced = e.gc.getAdvanced();
e.gc.setAdvanced(true);
e.gc.setAntialias(SWT.ON);
loadBinningWidgets(e.gc, new Rectangle(e.x, e.y, e.width, e.height));
e.gc.setAdvanced(preAdvanced);
}
private void loadBinningWidgets(GC gc, final Rectangle area) {
/*List<CellData> list = layout.getDisplayCellList(area.x, area.y, area.width,
area.height, siteNode.getAvalibleSite());*/
List<Integer> showSiteNo = siteNode.getShowSiteNo();
List<CellData> list = null;
if(showSiteNo == null){
list = layout.getDisplayCellList(area.x, area.y, area.width,
area.height, siteNode.getAvalibleSite());
}else{
list = layout.getDisplayCellList(area.x, area.y, area.width,
area.height, listToInt(showSiteNo));
}
for (int i = 0; i < list.size(); i++) {
CellData cellData = list.get(i);
widgetList.get(cellData.getIndex()).setCellData(cellData);
widgetList.get(cellData.getIndex()).redraw(gc);
}
}
I think this method should only be called when there is a change in the UI