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


Java CursorLinePainter类代码示例

本文整理汇总了Java中org.eclipse.jface.text.CursorLinePainter的典型用法代码示例。如果您正苦于以下问题:Java CursorLinePainter类的具体用法?Java CursorLinePainter怎么用?Java CursorLinePainter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: configureTextViewer

import org.eclipse.jface.text.CursorLinePainter; //导入依赖的package包/类
@Override
protected void configureTextViewer(final TextViewer textViewer)
{
	ThemePlugin.getDefault().getControlThemerFactory().apply(textViewer);

	// Force line highlight color. We need to perform this after the line painter is attached, which happens after
	// the return of this method. Scheduling async seems to work.
	UIUtils.getDisplay().asyncExec(new Runnable()
	{

		public void run()
		{
			CursorLinePainter p = getCursorLinePainterInstalled(textViewer);
			if (p != null)
			{
				p.setHighlightColor(getColorManager().getColor(getCurrentTheme().getLineHighlightAgainstBG()));
			}
		}
	});
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:21,代码来源:CommonMergeViewer.java

示例2: getCursorLinePainterInstalled

import org.eclipse.jface.text.CursorLinePainter; //导入依赖的package包/类
private CursorLinePainter getCursorLinePainterInstalled(TextViewer viewer)
{
	Listener[] listeners = viewer.getTextWidget().getListeners(3001/* StyledText.LineGetBackground */);
	for (Listener listener : listeners)
	{
		if (listener instanceof TypedListener)
		{
			TypedListener typedListener = (TypedListener) listener;
			if (typedListener.getEventListener() instanceof CursorLinePainter)
			{
				return (CursorLinePainter) typedListener.getEventListener();
			}
		}
	}
	return null;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:17,代码来源:CommonMergeViewer.java

示例3: applyThemeEditorIfNeeded

import org.eclipse.jface.text.CursorLinePainter; //导入依赖的package包/类
/**
 * Initialize foreground, background color, current line highlight from the
 * current theme if needed.
 * 
 */
private void applyThemeEditorIfNeeded() {
	if (!initializeViewerColors) {
		StyledText styledText = viewer.getTextWidget();
		((ITheme) tokenProvider).initializeViewerColors(styledText);
		initializeViewerColors = true;
	}
	if (!updateTextDecorations) {
		try {
			// Ugly code to update "current line highlight" :
			// - get the PaintManager from the ITextViewer with reflection.
			// - get the list of IPainter of PaintManager with reflection
			// - loop for IPainter to retrieve CursorLinePainter which manages "current line
			// highlight".
			PaintManager paintManager = ClassHelper.getFieldValue(viewer, "fPaintManager", TextViewer.class);
			if (paintManager != null) {
				List<IPainter> painters = ClassHelper.getFieldValue(paintManager, "fPainters", PaintManager.class);
				if (painters != null) {
					for (IPainter painter : painters) {
						if (painter instanceof CursorLinePainter) {
							// Update current line highlight
							Color background = tokenProvider.getEditorCurrentLineHighlight();
							if (background != null) {
								((CursorLinePainter) painter).setHighlightColor(background);
							}
							updateTextDecorations = true;
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:eclipse,项目名称:tm4e,代码行数:40,代码来源:TMPresentationReconciler.java

示例4: createCursorLinePainter

import org.eclipse.jface.text.CursorLinePainter; //导入依赖的package包/类
private void createCursorLinePainter() {
    cursorLinePainter = new CursorLinePainter(txtViewer);
    Color color = new Color(Display.getCurrent(),PreferenceConverter.getColor(store,ILogViewerConstants.PREF_CURSORLINE_COLOR));
    cursorLinePainter.setHighlightColor(color);
    ITextViewerExtension2 extension = (ITextViewerExtension2)txtViewer;
    extension.addPainter(cursorLinePainter);
}
 
开发者ID:anb0s,项目名称:LogViewer,代码行数:8,代码来源:LogFileViewer.java


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