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


Java AbstractTextEditor.getDocumentProvider方法代码示例

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


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

示例1: getEditorDocument

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入方法依赖的package包/类
public static IDocument getEditorDocument(AbstractTextEditor editor) {
	IEditorInput editorInput = editor.getEditorInput();
	IDocumentProvider documentProvider = editor.getDocumentProvider();
	return documentProvider.getDocument(editorInput);
}
 
开发者ID:sebez,项目名称:vertigo-chroma-kspplugin,代码行数:6,代码来源:UiUtils.java

示例2: openPopup

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入方法依赖的package包/类
private void openPopup() {
	IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
			.getActivePage().getActiveEditor();

	if (!(part instanceof AbstractTextEditor)) {
		return;
	}

	AbstractTextEditor editor = (AbstractTextEditor) part;

	if (!editor.getTitle().endsWith(".java")) {
		return;
	}

	IDocumentProvider dp = editor.getDocumentProvider();
	doc = dp.getDocument(editor.getEditorInput());

	textUtils = new StringUtils();
	textUtils.setDoc(doc.get());
	textUtils.setCursorPosition(StringHandler.getCursorPosition());
	boolean val = textUtils.proccess();
	if (textUtils.getCursorPosition() < 0) {
		return;
	}
	if (!val) {
		return;
	}

	StyledText styledText = (StyledText) editor.getAdapter(Control.class);
	Point p = StringHandler.getPoint(styledText.getCaret());

	Rectangle r = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
			.getShell().getBounds();

	Point pos = Display.getCurrent().getCursorLocation();
	Point location = new Point(StringHandler.min(p.x, r.x + r.width - 500,
			pos.x + 10), StringHandler.min(p.y, r.y + r.height - 160,
			pos.y + 10));

	final StringPopup textPopUp = new StringPopup(PlatformUI.getWorkbench()
			.getActiveWorkbenchWindow().getShell(), textUtils.getText(),
			location);
	textPopUp.open();
	textPopUp.setTextListenerAndFocus(this);
}
 
开发者ID:yaoxinghuo,项目名称:StringEditEclipse,代码行数:46,代码来源:MultiLineHyperlink.java

示例3: execute

import org.eclipse.ui.texteditor.AbstractTextEditor; //导入方法依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {
	IEditorPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
			.getActivePage().getActiveEditor();

	if (!(part instanceof AbstractTextEditor)) {
		return null;
	}

	AbstractTextEditor editor = (AbstractTextEditor) part;

	if (!editor.getTitle().endsWith(".java")) {
		return null;
	}

	IDocumentProvider dp = editor.getDocumentProvider();
	doc = dp.getDocument(editor.getEditorInput());

	textUtils = new StringUtils();
	textUtils.setDoc(doc.get());
	textUtils.setCursorPosition(getCursorPosition());
	boolean val = textUtils.proccess();
	if (textUtils.getCursorPosition() < 0) {
		return null;
	}
	if (!val) {
		return null;
	}

	StyledText styledText = (StyledText) editor.getAdapter(Control.class);
	Point p = getPoint(styledText.getCaret());

	Rectangle r = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
			.getShell().getBounds();

	Point pos = Display.getCurrent().getCursorLocation();
	Point location = new Point(min(p.x, r.x + r.width - 500, pos.x + 10),
			min(p.y, r.y + r.height - 160, pos.y + 10));

	final StringPopup textPopUp = new StringPopup(PlatformUI.getWorkbench()
			.getActiveWorkbenchWindow().getShell(), textUtils.getText(),
			location);
	textPopUp.open();
	textPopUp.setTextListenerAndFocus(this);

	return null;
}
 
开发者ID:yaoxinghuo,项目名称:StringEditEclipse,代码行数:47,代码来源:StringHandler.java


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