本文整理汇总了Java中org.eclipse.jface.resource.ResourceManager.createColor方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceManager.createColor方法的具体用法?Java ResourceManager.createColor怎么用?Java ResourceManager.createColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.resource.ResourceManager
的用法示例。
在下文中一共展示了ResourceManager.createColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: draw
import org.eclipse.jface.resource.ResourceManager; //导入方法依赖的package包/类
@Override
public void draw(TextAttribute textAttr, Graphics graphics, ResourceManager resourceManager) {
Color fgColor = graphics.getForegroundColor();
java.awt.Color color = textAttr.textColor.asColor();
if (color != null) {
Color rgb = resourceManager.createColor(new RGB(color.getRed(), color.getGreen(), color.getBlue()));
graphics.setForegroundColor(rgb);
}
try {
String text = textAttr.text.getExpression();
int fontSize = ((IntToken) textAttr.textSize.getToken()).intValue();
String fontFamily = textAttr.fontFamily.stringValue();
boolean italic = ((BooleanToken) textAttr.italic.getToken()).booleanValue();
boolean bold = ((BooleanToken) textAttr.bold.getToken()).booleanValue();
int style = SWT.NORMAL | (italic ? SWT.ITALIC : SWT.NORMAL) | (bold ? SWT.BOLD : SWT.NORMAL);
Font f = resourceManager.createFont(FontDescriptor.createFrom(fontFamily, fontSize, style));
graphics.setFont(f);
Point tlp = getTopLeftLocation(textAttr);
graphics.drawText(text, tlp);
} catch (IllegalActionException e) {
LOGGER.error("Error reading properties for " + textAttr.getFullName(), e);
}
graphics.setForegroundColor(fgColor);
}
示例2: getSwtColor
import org.eclipse.jface.resource.ResourceManager; //导入方法依赖的package包/类
/**
*
* @param colorAttribute
* @param resourceManager
* @return the SWT color resource matching the RGBA properties of the colorAttribute
*/
protected final Color getSwtColor(ColorAttribute colorAttribute, ResourceManager resourceManager) {
java.awt.Color color = colorAttribute != null ? colorAttribute.asColor() : null;
Color rgb = null;
if (color != null) {
rgb = resourceManager.createColor(new RGBAColorDescriptor(new RGBA(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha())));
}
return rgb;
}
示例3: getColor
import org.eclipse.jface.resource.ResourceManager; //导入方法依赖的package包/类
private Color getColor(ResourceManager manager, RGB rgb) {
try {
return manager.createColor(rgb);
} catch (DeviceResourceException e) {
return manager.getDevice().getSystemColor(SWT.COLOR_BLACK);
}
}
示例4: DiffEntryLabelProvider
import org.eclipse.jface.resource.ResourceManager; //导入方法依赖的package包/类
public DiffEntryLabelProvider ( final ResourceManager resourceManager )
{
this.resourceManager = resourceManager;
this.equalFgColor = resourceManager.createColor ( this.equalFgColorDesc );
}