本文整理汇总了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()));
}
}
});
}
示例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;
}
示例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();
}
}
}
示例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);
}