當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。