Java源码示例:org.eclipse.swt.graphics.Drawable

示例1
/**
 * Used for single sourcing, returns null if called in RAP Context.
 * 
 * @param image
 * @return
 */
public static GC createGC(Drawable image) {
	try {
		return GC.class.getConstructor(Drawable.class).newInstance(image);
	} catch (Exception ne) {
		return null;
	}
}
 
示例2
public static int getTextWidth(Drawable control, String text) {
       GC gc = new GC(control);
       try
       {
       	return gc.textExtent(text).x;
       }
       finally{
       	gc.dispose();
       }
}
 
示例3
public void paint( Drawable drawable, Device device, Rectangle region )
{
	ReportPrintGraphicalViewerOperation op = new ReportPrintGraphicalViewerOperation( viewer,
			drawable,
			device,
			new org.eclipse.draw2d.geometry.Rectangle( region ) );
	if (model instanceof ReportDesignHandle)
	{
		op.setOrientation( ((ReportDesignHandle)model).getBidiOrientation( ) );
	}

	op.run( "paint" ); //$NON-NLS-1$

}
 
示例4
public ReportPrintGraphicalViewerOperation( GraphicalViewer g,
		Drawable drawable, Device device, Rectangle region )
{
	this.device = device;
	this.region = region;
	this.drawable = drawable;
	this.viewer = g;

	LayerManager lm = (LayerManager) viewer.getEditPartRegistry( )
			.get( LayerManager.ID );
	IFigure f = lm.getLayer( LayerConstants.PRINTABLE_LAYERS );

	this.printSource = f;
}
 
示例5
/**
 * This method shouldn't really be used, but if it is, just forward it to the new method.
 */
@Override
public String updatePresentation(Display display, String hoverInfo, TextPresentation presentation, int maxWidth,
        int maxHeight) {
    return updatePresentation((Drawable) display, hoverInfo, presentation, maxWidth, maxHeight);
}
 
示例6
/**
 * Gets the composite.
 * 
 * @return
 */
protected Drawable getDrawable( )
{
	return drawable;
}