public void toImage(Control composiste ,File file)throws Excepton{
Display display = PlatformUI.getWorkbench().getDisplay();
Point size = composite.getSize();
final Image image = new Image(display,size.x,size.y);
GC gc = new GC(Composite);
gc.copyArea(image,0,0);
gc.dispose();
// save image to file;
ImageData imageData = image.getImageData();
ImageLoader imageLoader = new ImageLoader();
imageLoader.data = new ImageData[1];
FileOutputStream fos = new FileOutputStream(file);
iamgeLoader.save(fos,SWT.IMAGE_JPEG);
image.dispose();
fos.close();
}