1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-20 15:35:24 +02:00

launchbar: fixed some visual glitches in custom widget list

- list background was not inherited creating spotty list
- removed rectangle around list items which was very custom and non
stylable
- removed paint lister after lazy item initialization to prevent lag


Change-Id: I4e458c816dcb96138871b906e43806b0cf2e72e8
This commit is contained in:
Alena Laskavaia 2015-12-11 16:17:33 -05:00
parent 7b5cdff64f
commit b63caf6c72

View file

@ -46,7 +46,6 @@ import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
@ -184,19 +183,16 @@ public class LaunchBarListViewer extends StructuredViewer {
this.index = index; this.index = index;
this.labelProvider = labelProvider; this.labelProvider = labelProvider;
setData(element); setData(element);
setBackground(getParent().getBackground()); setBackground(parent.getBackground());
addPaintListener(new PaintListener() { addPaintListener(new PaintListener() {
@Override @Override
public void paintControl(PaintEvent e) { public void paintControl(PaintEvent e) {
Point size = getSize(); removePaintListener(this);
GC gc = e.gc; if (label == null) {
gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
gc.drawLine(0, size.y - 1, size.x, size.y - 1);
if (label == null)
lazyInit(); lazyInit();
}
} }
}); });
// lazyInit();
} // end ListItem(..) } // end ListItem(..)
protected void lazyInit() { protected void lazyInit() {
@ -321,6 +317,7 @@ public class LaunchBarListViewer extends StructuredViewer {
} }
}); });
} }
icon.setBackground(parent.getBackground());
return icon; return icon;
} }
@ -332,6 +329,7 @@ public class LaunchBarListViewer extends StructuredViewer {
if (labelProvider instanceof IFontProvider) { if (labelProvider instanceof IFontProvider) {
label.setFont(((IFontProvider) labelProvider).getFont(element)); label.setFont(((IFontProvider) labelProvider).getFont(element));
} }
label.setBackground(parent.getBackground());
return label; return label;
} }
} // end ListItem class } // end ListItem class