});
stylesViewer.setLabelProvider(new LabelProvider(){
public Image getImage( Object element ) {
if (element instanceof StyleWrapper) {
StyleWrapper styleWrapper = (StyleWrapper) element;
List<FeatureTypeStyleWrapper> featureTypeStyles = styleWrapper.getFeatureTypeStylesWrapperList();
int iconSize = 48;
BufferedImage image = new BufferedImage(iconSize, iconSize, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = image.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
for( FeatureTypeStyleWrapper featureTypeStyle : featureTypeStyles ) {
List<RuleWrapper> rulesWrapperList = featureTypeStyle.getRulesWrapperList();
BufferedImage tmpImage = Utilities.pointRulesWrapperToImage(rulesWrapperList, iconSize, iconSize);
g2d.drawImage(tmpImage, 0, 0, null);
}
g2d.dispose();
Image convertToSWTImage = AWTSWTImageUtils.convertToSWTImage(image);
return convertToSWTImage;
}
return null;
}
public String getText( Object element ) {
if (element instanceof StyleWrapper) {
StyleWrapper styleWrapper = (StyleWrapper) element;
String styleName = styleWrapper.getName();
if (styleName == null || styleName.length() == 0) {
styleName = Utilities.DEFAULT_STYLENAME;
styleName = Utilities.checkSameNameStyle(getStyles(), styleName);
styleWrapper.setName(styleName);
}
return styleName;
}
return ""; //$NON-NLS-1$
}