当前位置: 首页>>代码示例>>Java>>正文


Java StringConverter.asString方法代码示例

本文整理汇总了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);
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:31,代码来源:EObjectPropertySource.java

示例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());
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:15,代码来源:StringToIntegerConverter.java

示例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());
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:11,代码来源:StringToDoubleConverter.java

示例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);
	}
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:12,代码来源:SyntaxStyleSettings.java

示例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 + ")";
}
 
开发者ID:google,项目名称:depan,代码行数:13,代码来源:NodeDisplayTableControl.java

示例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 + ")";
}
 
开发者ID:google,项目名称:depan,代码行数:12,代码来源:EdgeDisplayTableControl.java

示例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);
		}
	}
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:40,代码来源:SimpleFontEditor.java

示例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);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:15,代码来源:PaletteSettingsDialog.java

示例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();
}
 
开发者ID:henrikor2,项目名称:eclipsensis,代码行数:9,代码来源:AbstractNodeConvertible.java

示例10: toString

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
private static String toString(RGB selection)
{
	return StringConverter.asString(selection);
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:5,代码来源:ThemeManager.java

示例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());
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:7,代码来源:ColorPersistor.java

示例12: asString

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
private String asString(RGB value) {
    return StringConverter.asString(value);
}
 
开发者ID:apache,项目名称:ant-ivyde,代码行数:4,代码来源:PreferenceInitializer.java

示例13: convert

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
@Override
public Object convert(Object fromObject) {
  RGB rgb = (RGB) fromObject;
  return StringConverter.asString(rgb);
}
 
开发者ID:agusevas,项目名称:logan,代码行数:6,代码来源:AddExpressionDialog.java

示例14: valueToString

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
@Override
protected String valueToString(RGB value) {
	return StringConverter.asString(value);
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:5,代码来源:ColorPreference.java

示例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);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:9,代码来源:ChartFactoryImpl.java


注:本文中的org.eclipse.jface.resource.StringConverter.asString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。