本文整理汇总了Java中org.eclipse.jface.resource.DataFormatException类的典型用法代码示例。如果您正苦于以下问题:Java DataFormatException类的具体用法?Java DataFormatException怎么用?Java DataFormatException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataFormatException类属于org.eclipse.jface.resource包,在下文中一共展示了DataFormatException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: colorFromString
import org.eclipse.jface.resource.DataFormatException; //导入依赖的package包/类
public static Color colorFromString(String rgbString) {
if (rgbString != null && rgbString.trim().length() > 0) {
Color col = JFaceResources.getColorRegistry().get(rgbString);
try {
if (col == null) {
RGB rgb = StringConverter.asRGB(rgbString);
JFaceResources.getColorRegistry().put(rgbString, rgb);
col = JFaceResources.getColorRegistry().get(rgbString);
}
}
catch (DataFormatException e) {
log.error("Corrupt color value: " + rgbString, e);
}
return col;
}
return null;
}
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:EditorUtils.java
示例2: createColorProperty
import org.eclipse.jface.resource.DataFormatException; //导入依赖的package包/类
public void createColorProperty(Composite cmp, final String prop, String name, final IPreferenceStore store) {
new Label(cmp, SWT.NONE).setText(name);
final ColorSelector colorSelector = new ColorSelector(cmp);
colorSelector.addListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
properties.put(prop, StringConverter.asString(colorSelector.getColorValue()));
save(store);
}
});
try {
colorSelector.setColorValue(StringConverter.asRGB(properties.get(prop)));
} catch (DataFormatException e) {
e.printStackTrace();
}
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:17,代码来源:UITheme.java
示例3: convert
import org.eclipse.jface.resource.DataFormatException; //导入依赖的package包/类
@Override
public Object convert(Object fromObject) {
if (fromObject instanceof String) {
try {
return StringConverter.asInt(fromObject.toString());
} catch(DataFormatException e) {
}
} else if (fromObject instanceof Integer) {
return StringConverter.asString((Integer)fromObject);
} else if(fromObject == null)
return null;
throw new IllegalArgumentException(fromObject.getClass() + " type cannot be converted by " + getClass());
}
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:15,代码来源:StringToIntegerConverter.java
示例4: parseRgb
import org.eclipse.jface.resource.DataFormatException; //导入依赖的package包/类
private RGB parseRgb(String rgbString) {
RGB rgb = null;
if (rgbString != null) {
if (rgbString.equalsIgnoreCase("null")) {
rgb = NULL;
} else {
try {
rgb = ColorUtils.parseRGB(rgbString);
} catch (DataFormatException x) {
LogUtil.error(x);
}
}
}
return rgb;
}
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:16,代码来源:PlotRgbRegistry.java
示例5: asColor
import org.eclipse.jface.resource.DataFormatException; //导入依赖的package包/类
/**
* Create a Color instance using the String created by {@link ColorPersistor#asColor(String)}
*/
public static Color asColor(String colorAsString) {
try {
return GUIHelper.getColor(StringConverter.asRGB(colorAsString));
} catch (DataFormatException e) {
return DEFAULT_COLOR;
}
}
开发者ID:heartsome,项目名称:translationstudio8,代码行数:11,代码来源:ColorPersistor.java
示例6: getNamedColor
import org.eclipse.jface.resource.DataFormatException; //导入依赖的package包/类
protected Color getNamedColor(String name) {
Color color = fNamedColorTable.get(name);
if (color == null || color.isDisposed()) {
String colorCode = preferences != null ? preferences.getString(name) : "";
if (colorCode.length() == 0) {
if (name.equals("RED")) {
color = getColor(new RGB(255, 0, 0));
} else if (name.equals("BLACK")) {
color = getColor(new RGB(0, 0, 0));
} else if (name.equals("WHITE")) {
color = getColor(new RGB(255, 255, 255));
} else {
Log.log("Unknown color:" + name);
color = getColor(new RGB(255, 0, 0));
}
} else {
try {
RGB rgb = StringConverter.asRGB(colorCode);
color = new Color(Display.getCurrent(), rgb);
fNamedColorTable.put(name, color);
} catch (DataFormatException e) {
// Data conversion failure, maybe someone edited our prefs by hand
Log.log(e);
color = getColor(new RGB(255, 50, 0));
}
}
}
return color;
}
开发者ID:fabioz,项目名称:Pydev,代码行数:33,代码来源:ColorCache.java
注:本文中的org.eclipse.jface.resource.DataFormatException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论