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


Java ISourceViewer.getTextWidget方法代码示例

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


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

示例1: computeHighlightRange

import org.eclipse.jface.text.source.ISourceViewer; //导入方法依赖的package包/类
/**
 * Computes and returns the source reference that includes the caret and serves as provider for the
 * outline pageModel selection and the editor range indication.
 *
 * @return the computed source reference
 */
public ISourceReference computeHighlightRange() {
	ISourceViewer sourceViewer = getSourceViewer();
	if (sourceViewer == null) return null;

	StyledText styledText = sourceViewer.getTextWidget();
	if (styledText == null) return null;

	int caret = 0;
	if (sourceViewer instanceof ITextViewerExtension5) {
		ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer;
		caret = extension.widgetOffset2ModelOffset(styledText.getSelection().x);
	} else {
		int offset = sourceViewer.getVisibleRegion().getOffset();
		caret = offset + styledText.getSelection().x;
	}

	PagePart part = getPagePartAt(caret, false);
	return (ISourceReference) part;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:26,代码来源:FluentMkEditor.java

示例2: draw

import org.eclipse.jface.text.source.ISourceViewer; //导入方法依赖的package包/类
private void draw() {
	XtextEditor editor = EditorUtils.getActiveXtextEditor();
	if (editor != null && (hoveredElement != null || !selectedElements.isEmpty())) {
		ISourceViewer isv = editor.getInternalSourceViewer();
		styledText = isv.getTextWidget();
		drawSelection();
	} else {
		clear();
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:EditorOverlay.java

示例3: getStyledText

import org.eclipse.jface.text.source.ISourceViewer; //导入方法依赖的package包/类
/**
 * Obtains the styled text of an editor.
 * @param editor the editor
 * @return the styled text of the editor
 */
public static StyledText getStyledText(IEditorPart editor) {
    ISourceViewer viewer = getSourceViewer(editor);
    if (viewer != null) {
        return viewer.getTextWidget();
    }
    return null;
}
 
开发者ID:liaoziyang,项目名称:ContentAssist,代码行数:13,代码来源:EditorUtilities.java

示例4: ensureColorsFetched

import org.eclipse.jface.text.source.ISourceViewer; //导入方法依赖的package包/类
private void ensureColorsFetched() {
	if (bgColor == null || fgColor == null) {

		ISourceViewer sourceViewer = getSourceViewer();
		if (sourceViewer == null) {
			return;
		}
		StyledText textWidget = sourceViewer.getTextWidget();
		if (textWidget == null) {
			return;
		}

		/*
		 * TODO ATR, 03.02.2017: there should be an easier approach to get
		 * editors back and foreground, without syncexec
		 */
		EclipseUtil.getSafeDisplay().syncExec(new Runnable() {

			@Override
			public void run() {
				bgColor = ColorUtil.convertToHexColor(textWidget.getBackground());
				fgColor = ColorUtil.convertToHexColor(textWidget.getForeground());
			}
		});
	}

}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:28,代码来源:BatchEditor.java

示例5: getSignedSelection

import org.eclipse.jface.text.source.ISourceViewer; //导入方法依赖的package包/类
protected final IRegion getSignedSelection(ISourceViewer sourceViewer) {
	Point viewerSelection = sourceViewer.getSelectedRange();

	StyledText text = sourceViewer.getTextWidget();
	Point selection = text.getSelectionRange();
	if (text.getCaretOffset() == selection.x) {
		viewerSelection.x = viewerSelection.x + viewerSelection.y;
		viewerSelection.y = -viewerSelection.y;
	}

	return new Region(viewerSelection.x, viewerSelection.y);
}
 
开发者ID:de-jcup,项目名称:eclipse-batch-editor,代码行数:13,代码来源:BatchBracketsSupport.java


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