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


Java StringConverter.asRGB方法代码示例

本文整理汇总了Java中org.eclipse.jface.resource.StringConverter.asRGB方法的典型用法代码示例。如果您正苦于以下问题:Java StringConverter.asRGB方法的具体用法?Java StringConverter.asRGB怎么用?Java StringConverter.asRGB使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.resource.StringConverter的用法示例。


在下文中一共展示了StringConverter.asRGB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
public List<SyntaxStyle> get() {
	ArrayList<SyntaxStyle> result = new ArrayList<SyntaxStyle>();
	setDefaults(store);
	for (SyntaxStyle s : defaultStyles) {
		boolean enable = store.getBoolean(getStyleKey(StyleAspect.enable, s.displayName));
		RGB color = StringConverter.asRGB(store.getString(getStyleKey(StyleAspect.color, s.displayName)));
		boolean bold = store.getBoolean(getStyleKey(StyleAspect.bold, s.displayName));
		;
		boolean italic = store.getBoolean(getStyleKey(StyleAspect.italic, s.displayName));
		;
		boolean strikethrough = store.getBoolean(getStyleKey(StyleAspect.strikethrough, s.displayName));
		;
		boolean underline = store.getBoolean(getStyleKey(StyleAspect.underline, s.displayName));
		;
		result.add(new SyntaxStyle(s.displayName, s.type, enable, color, bold, italic, strikethrough, underline));
	}
	return result;
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:19,代码来源:SyntaxStyleSettings.java

示例2: adaptToColorChange

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
private void adaptToColorChange(Token token, PropertyChangeEvent event) {
	RGB rgb = null;

	Object value = event.getNewValue();
	if (value instanceof RGB) {
		rgb = (RGB) value;
	} else if (value instanceof String) {
		rgb = StringConverter.asRGB((String) value);
	}

	if (rgb != null) {

		String property = event.getProperty();
		Color color = colorMgr.getColor(property);
		if (!rgb.equals(color.getRGB())) {
			colorMgr.setValue(property, rgb);
			color = colorMgr.getColor(property);
		}

		Object data = token.getData();
		if (data instanceof TextAttribute) {
			TextAttribute oldAttr = (TextAttribute) data;
			token.setData(new TextAttribute(color, oldAttr.getBackground(), oldAttr.getStyle()));
		}
	}
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:27,代码来源:AbstractBufferedRuleBasedScanner.java

示例3: colorFromString

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的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

示例4: getColorForKeyWithoutDefault

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
protected Color getColorForKeyWithoutDefault(String key) {
	Color result = null;
	try {
		if (!Raptor.getInstance().getColorRegistry().hasValueFor(key)) {
			// We don't want the default color if not found we want to
			// return null, so use
			// StringConverter instead of PreferenceConverter.
			String value = getString(key);
			if (StringUtils.isNotBlank(value)) {
				RGB rgb = StringConverter.asRGB(value, null);
				if (rgb != null) {
					Raptor.getInstance().getColorRegistry().put(key, rgb);
				} else {
					return null;
				}
			} else {
				return null;
			}
		}
		result = Raptor.getInstance().getColorRegistry().get(key);
	} catch (Throwable t) {
		result = null;
	}
	return result;
}
 
开发者ID:evilwan,项目名称:raptor-chess-interface,代码行数:26,代码来源:RaptorPreferenceStore.java

示例5: getColor

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
private Color getColor(final String configurationKey, final String defaultColorKey) {
	String colorKey = configuration.getString(configurationKey, defaultColorKey);
	RGB rgbColorData;
	try {
		rgbColorData = StringConverter.asRGB(colorKey);
	}
	catch (final RuntimeException e) {
		logger.log(Level.FINER, e.toString(), e);
		logger.log(Level.INFO, Messages.get("err.invalid.color"), colorKey);
		colorKey = defaultColorKey;
		rgbColorData = StringConverter.asRGB(colorKey);
	}
	final ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
	if (!colorRegistry.hasValueFor(colorKey)) {
		colorRegistry.put(colorKey, rgbColorData);
	}
	return colorRegistry.get(colorKey);
}
 
开发者ID:Albertus82,项目名称:RouterLogger,代码行数:19,代码来源:DataTable.java

示例6: parseRGB

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
 * Converts a String to RGB, could be of several formats
 * * @see {@link StringUtils}
 */
public static RGB parseRGB(String valueString) {
	try {
		if (valueString != null && valueString.startsWith("#")) {
			valueString = valueString.substring(1);
		}
		Integer hexcode = Integer.parseInt(valueString, 16);
		if (hexcode != null) {
			return new RGB((hexcode/256/256)%256, (hexcode/256)%256, hexcode%256);
		}
	} catch (NumberFormatException e) {
		try {
			return StringConverter.asRGB(valueString);
		} catch (Exception x) {
			// ignore it
		}
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:ColorUtils.java

示例7: adaptToTextForegroundChange

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
private void adaptToTextForegroundChange(Highlighting highlighting, PropertyChangeEvent event) {
	RGB rgb= null;

	Object value= event.getNewValue();
	if (value instanceof RGB)
		rgb= (RGB) value;
	else if (value instanceof String)
		rgb= StringConverter.asRGB((String) value);

	if (rgb != null) {

		String property= event.getProperty();
		Color color= fColorManager.getColor(property);

		if ((color == null || !rgb.equals(color.getRGB())) && fColorManager instanceof IColorManagerExtension) {
			IColorManagerExtension ext= (IColorManagerExtension) fColorManager;
			ext.unbindColor(property);
			ext.bindColor(property, rgb);
			color= fColorManager.getColor(property);
		}

		TextAttribute oldAttr= highlighting.getTextAttribute();
		highlighting.setTextAttribute(new TextAttribute(color, oldAttr.getBackground(), oldAttr.getStyle()));
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:26,代码来源:SemanticHighlightingManager.java

示例8: returnPropertyValue

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
 * @param feature
 * @param result
 * @return value
 */
protected Object returnPropertyValue(EStructuralFeature feature, Object result) {
    if (result instanceof Integer) {
        result = ((Integer) result).toString();
    } else if (result instanceof Double) {
        result = ((Double) result).toString();
    } else if (result instanceof Boolean) {
        // result = ((Boolean) result).booleanValue() ? new Integer(1) : new
        // Integer(0);
        // result = result;
    } else if (feature.getName().toLowerCase().indexOf("color") >= 0) { //$NON-NLS-1$
        if (result == null || ((String) result).length() == 0)
            result = new RGB(0, 0, 0);
        else
            result = StringConverter.asRGB((String) result);
    }
    return result;
}
 
开发者ID:McGill-DP-Group,项目名称:seg.jUCMNav,代码行数:23,代码来源:EObjectPropertySource.java

示例9: load

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
public SQLEditorSyntaxModel load() {
    color = StringConverter.asRGB(prefStore.getString(
            type.getPrefName() + PREF_COLOR));
    bold = prefStore.getBoolean(type.getPrefName() + PREF_BOLD);
    italic = prefStore.getBoolean(type.getPrefName() + PREF_ITALIC);
    strikethrough = prefStore.getBoolean(type.getPrefName() + PREF_STRIKETHROUGH);
    underline = prefStore.getBoolean(type.getPrefName() + PREF_UNDERLINE);
    return this;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:10,代码来源:SQLEditorSyntaxModel.java

示例10: loadDefault

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
public SQLEditorSyntaxModel loadDefault() {
    color = StringConverter.asRGB(prefStore.getDefaultString(
            type.getPrefName()+ PREF_COLOR));
    bold = prefStore.getDefaultBoolean(type.getPrefName() + PREF_BOLD);
    italic = prefStore.getDefaultBoolean(type.getPrefName() + PREF_ITALIC);
    strikethrough = prefStore.getDefaultBoolean(type.getPrefName() + PREF_STRIKETHROUGH);
    underline = prefStore.getDefaultBoolean(type.getPrefName() + PREF_UNDERLINE);
    return this;
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:10,代码来源:SQLEditorSyntaxModel.java

示例11: getFillColor

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
 * getFillColor
 * 
 * @return RGB
 */
protected RGB getFillColor() {
    RGB nodeColor = PreferenceUtil.INSTANCE.getNodeLineColor();
    AbstractConnection viewModel = (AbstractConnection) getModel();
    if (viewModel != null) {
        if (viewModel.getFillColor() != null) {
            nodeColor = StringConverter.asRGB(viewModel.getFillColor());
        }
    }
    return nodeColor;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:16,代码来源:AbstractDiagramConnectionEditPart.java

示例12: getFontColor

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
 * getFontColor
 * 
 * @return RGB
 */
protected RGB getFontColor() {
    RGB fontColor = PreferenceUtil.INSTANCE.getNodeFontColor();
    AbstractView viewModel = (AbstractView) ((AbstractView) getModel()).getParent();
    if (viewModel != null) {
        if (viewModel.getFontColor() != null) {
            fontColor = StringConverter.asRGB(viewModel.getFontColor());
        }
    }
    return fontColor;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:16,代码来源:NotationNameEditPart.java

示例13: getFontColor

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
 * getFontColor
 * 
 * @return RGB
 */
protected RGB getFontColor() {
    RGB fontColor = PreferenceUtil.INSTANCE.getNodeFontColor();
    AbstractView abstractView = (AbstractView) ((AbstractView) getModel()).getParent();
    if (abstractView != null) {
        if (abstractView.getFontColor() != null) {
            fontColor = StringConverter.asRGB(abstractView.getFontColor());
        }
    }
    return fontColor;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:16,代码来源:StereotypeEditPart.java

示例14: getFillColor

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
 * getFillColor
 * 
 * @return RGB
 */
protected RGB getFillColor() {
    RGB nodeColor = PreferenceUtil.INSTANCE.getNodeFillColor();
    NotationNode viewModel = (NotationNode) getModel();
    if (viewModel != null) {
        if (viewModel.getFillColor() != null) {
            nodeColor = StringConverter.asRGB(viewModel.getFillColor());
        } else {
            if (NodeType.INITIAL_NODE.equals(viewModel.getNodeType())
                || NodeType.ACTIVITY_FINAL_NODE.equals(viewModel.getNodeType())) {
                RGB blackColor = UiCorePlugin.getDefault().getColor("Black").getRGB();
                nodeColor = blackColor;
            }
            if (viewModel.getNodeType().equals(NodeType.ACTOR)) {
                nodeColor = ColorConstants.lightGray.getRGB();
            }
            if (viewModel.getNodeType().equals(NodeType.JOIN_NODE)) {
                nodeColor = new RGB(240, 240, 240);
            }
            if (viewModel.getNodeType().equals(NodeType.FORK_NODE)) {
                nodeColor = new RGB(240, 240, 240);
            }
        }
    }

    return nodeColor;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:32,代码来源:AbstractNotationNodeEditPart.java

示例15: getFontColor

import org.eclipse.jface.resource.StringConverter; //导入方法依赖的package包/类
/**
 * getFontColor
 * 
 * @return RGB
 */
protected RGB getFontColor() {
    RGB fontColor = PreferenceUtil.INSTANCE.getNodeFontColor();
    NotationNode viewModel = (NotationNode) getModel();
    if (viewModel != null) {
        if (viewModel.getFontColor() != null) {
            fontColor = StringConverter.asRGB(viewModel.getFontColor());
        }
    }
    return fontColor;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:16,代码来源:AbstractNotationNodeEditPart.java


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