org.eclipse.swt.graphics.Drawable Java Examples

The following examples show how to use org.eclipse.swt.graphics.Drawable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphicsUtil.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * 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;
	}
}
 
Example #2
Source File: SwtUtils.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
public static int getTextWidth(Drawable control, String text) {
       GC gc = new GC(control);
       try
       {
       	return gc.textExtent(text).x;
       }
       finally{
       	gc.dispose();
       }
}
 
Example #3
Source File: ReportGraphicsViewPainter.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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$

}
 
Example #4
Source File: ReportPrintGraphicalViewerOperation.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: AbstractInformationPresenter.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * 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);
}
 
Example #6
Source File: ReportPrintGraphicalViewerOperation.java    From birt with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Gets the composite.
 * 
 * @return
 */
protected Drawable getDrawable( )
{
	return drawable;
}