本文整理汇总了Java中org.eclipse.jface.resource.StringConverter.asString方法的典型用法代码示例。如果您正苦于以下问题:Java StringConverter.asString方法的具体用法?Java StringConverter.asString怎么用?Java StringConverter.asString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.resource.StringConverter
的用法示例。
在下文中一共展示了StringConverter.asString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPropertyValue
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
* The user has changed a property in the interface; change the model to reflect the user's action.
*
* @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
*/
public void setPropertyValue(Object id, Object value) {
// int propertyid = Integer.parseInt((String) id);
// EStructuralFeature feature =
// object.eClass().getEStructuralFeature(propertyid);
// EStructuralFeature feature = (EStructuralFeature) id;
PropertyID propertyid = (PropertyID) id;
EStructuralFeature feature = propertyid.getFeature();
Object result = getPropertyValue(id);
if (feature.getEType().getInstanceClass() == int.class) {
result = new Integer(Integer.parseInt((String) value));
} else if (feature.getEType().getInstanceClass() == double.class) {
result = new Double(Double.parseDouble(value.toString()));
} else if (feature.getEType().getInstanceClass() == boolean.class) {
result = value;
} else if (result instanceof RGB) {
result = StringConverter.asString((RGB) value);
} else
result = value;
if (feature.getName().equals("name") && result instanceof String)
result = result.toString().trim();
setReferencedObject(propertyid, feature, result);
}
示例2: convert
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的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());
}
示例3: convert
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
@Override
public Object convert(Object fromObject) {
if (fromObject instanceof String) {
return StringConverter.asDouble(fromObject.toString());
} else if (fromObject instanceof Double) {
return StringConverter.asString((Double)fromObject);
} else if(fromObject == null)
return null;
throw new IllegalArgumentException(fromObject.getClass() + " type cannot be converted by " + getClass());
}
示例4: setDefaults
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
private void setDefaults(IPreferenceStore store) {
for (SyntaxStyle s : defaultStyles) {
store.setDefault(getStyleKey(StyleAspect.enable, s.displayName), s.enable);
String color = StringConverter.asString(s.color);
store.setDefault(getStyleKey(StyleAspect.color, s.displayName), color);
store.setDefault(getStyleKey(StyleAspect.bold, s.displayName), s.bold);
store.setDefault(getStyleKey(StyleAspect.italic, s.displayName), s.italic);
store.setDefault(getStyleKey(StyleAspect.strikethrough, s.displayName), s.strikethrough);
store.setDefault(getStyleKey(StyleAspect.underline, s.displayName), s.underline);
}
}
示例5: getColorName
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
private String getColorName(GraphNode node) {
NodeDisplayProperty prop = getDisplayProperty(node);
if (null == prop) {
return null;
}
Color color = prop.getColor();
if (null == color) {
return null;
}
String result = StringConverter.asString(Colors.rgbFromColor(color));
return "(" + result + ")";
}
示例6: getColorName
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
private String getColorName(EdgeDisplayProperty prop) {
if (null == prop) {
return null;
}
Color color = prop.getColor();
if (null == color) {
return null;
}
String result = StringConverter.asString(Colors.rgbFromColor(color));
return "(" + result + ")";
}
示例7: updateFont
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
* Updates the change font button and the previewer to reflect the newly selected font.
*
* @param font
* The FontData[] to update with.
*/
private void updateFont(final FontData font[]) {
FontData[] bestFont = JFaceResources.getFontRegistry().filterData(font, getDisplay());
//if we have nothing valid do as best we can
if (bestFont == null) {
bestFont = getDefaultFontData();
}
//Now cache this value in the receiver
_selectedFontData = bestFont;
if (_lblSelectedFont != null) {
final String fontText = StringConverter.asString(_selectedFontData[0]);
_lblSelectedFont.setText(fontText);
_lblSelectedFont.setToolTipText(fontText);
UI.disposeResource(_selectedFont);
_selectedFont = new Font(getDisplay(), _selectedFontData);
_lblSelectedFont.setFont(_selectedFont);
_spinnerFontSize.setSelection(_selectedFontData[0].getHeight());
if (_isPackShell) {
// ensure that the selected font is displayed
_spinnerFontSize.getParent().layout(true, true);
this.getShell().pack(true);
}
}
}
示例8: updateFontName
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
* Updates the label showing the font's name to show the name of the current
* font.
*/
protected void updateFontName() {
String name;
if (prefs.getFontData().equals(
(JFaceResources.getDialogFont().getFontData()[0]))) {
name = PaletteMessages.SETTINGS_WORKBENCH_FONT_LABEL;
} else {
name = StringConverter.asString(prefs.getFontData());
}
fontName.setText(PaletteMessages.SETTINGS_FONT_CURRENT + name);
}
示例9: convertToString
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
protected String convertToString(String name, Object obj)
{
if (obj instanceof RGB)
{
return StringConverter.asString((RGB) obj);
}
return obj == null ? null : obj.toString();
}
示例10: toString
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
private static String toString(RGB selection)
{
return StringConverter.asString(selection);
}
示例11: asString
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
* Create a String representation of the SWT Color
*/
public static String asString(Color color) {
return StringConverter.asString(color.getRGB());
}
示例12: asString
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
private String asString(RGB value) {
return StringConverter.asString(value);
}
示例13: convert
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
@Override
public Object convert(Object fromObject) {
RGB rgb = (RGB) fromObject;
return StringConverter.asString(rgb);
}
示例14: valueToString
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
@Override
protected String valueToString(RGB value) {
return StringConverter.asString(value);
}
示例15: convertERGBToString
import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
public String convertERGBToString(EDataType eDataType, Object instanceValue) {
return StringConverter.asString((RGB) instanceValue);
}