private int TREEVIEWER_WIDTH = 200;\r
private int BROWSER_WIDTH = 418;\r
private int ICON_WIDTH = 40;\r
+ private int ICON_DEFAULT_SIZE = 32;\r
final int TEXT_MARGIN = 30;\r
\r
protected TizenCommonPWComposite(Category root, TizenCommonWizardPage page, String label, String propertyKey, int numberOfColumns, boolean singleWidget) {\r
viewerColumnIcon.setLabelProvider(new ColumnLabelProvider() {\r
@Override\r
public Image getImage(Object element) {\r
- return TizenCommonPWComposite.this.getImage(element);\r
+ Image image = TizenCommonPWComposite.this.getImage( element );\r
+ try {\r
+ return ImageUtil.getSimpleScaledSWTImage( image, ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE );\r
+ } finally {\r
+ SWTUtil.tryDispose( image );\r
+ }\r
}\r
\r
@Override\r
return scaledImage;
}
-
+
+ /**
+ * Returns a copy of the receiver which has been stretched or shrunk to the specified size.<br>
+ * If either the width or height is negative, the resulting image will be inverted in the associated axis.
+ * @param src the Image to use as the source
+ * @param width the width of the new Image
+ * @param height the height of the new Image
+ * @return a scaled copy of the image
+ */
+ public static Image getSimpleScaledSWTImage(Image src, int width, int height) {
+ Image scaledImage = null;
+
+ if ( src != null ) {
+ ImageData srcData = src.getImageData();
+ if ( srcData.width == width && srcData.height == height ) {
+ // use the original data for performance
+ scaledImage = new Image( src.getDevice(), src, SWT.IMAGE_COPY );
+ } else {
+ // use the scaled data
+ scaledImage = new Image( src.getDevice(), srcData.scaledTo( width, height ) );
+ }
+ }
+
+ return scaledImage;
+ }
+
public static Image convertImageToSWT(Display display, BufferedImage bImage) {
int width = bImage.getWidth();
int height = bImage.getHeight();