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


Java IEditorPart.getAdapter方法代码示例

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


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

示例1: editorOpened

import org.eclipse.ui.IEditorPart; //导入方法依赖的package包/类
private void editorOpened(IEditorPart part) {
	if (part instanceof ITextEditor) {
		ITextViewer textViewer = (ITextViewer) part.getAdapter(ITextOperationTarget.class);
		if (textViewer != null) {
			ICodeLensController controller = codeLensControllers.get(part);
			if (controller == null) {
				ITextEditor textEditor = (ITextEditor) part;
				controller = CodeLensControllerRegistry.getInstance().create(textEditor);
				if (controller != null) {
					controller.setProgressMonitor(new NullProgressMonitor());
					codeLensControllers.put(textEditor, controller);
					//controller.install();
				}
			}
		}
	}
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:18,代码来源:EditorTracker.java

示例2: AstManager

import org.eclipse.ui.IEditorPart; //导入方法依赖的package包/类
/**
 * Constructor. Loads the AST and sets up the StyledText to automatically
 * reload after certain events.
 * @param editor IEditorPart which owns the following StyledText.
 * @param styledText StyledText to which this AST pertains.
 */
public AstManager(IEditorPart editor, StyledText styledText) {
    try {
        editorPath = ((IFileEditorInput) editor.getEditorInput()).getFile()
                .getFullPath().toFile().getCanonicalPath();
    } catch (IOException e) {
        // ignore IOErrors while constructing path
        editorPath = "?";
    }
    this.editor = editor;
    this.styledText = styledText;
    //This is the only why I know to get the ProjectionViewer. Perhaps there is better way. ~Ben
    ITextOperationTarget t = (ITextOperationTarget) editor.getAdapter(ITextOperationTarget.class);
    if(t instanceof ProjectionViewer) projectionViewer = (ProjectionViewer)t;
    hookupAutoReload();
    reload();
}
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:23,代码来源:AstManager.java

示例3: getSourceViewer

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

示例4: setActiveEditor

import org.eclipse.ui.IEditorPart; //导入方法依赖的package包/类
public void setActiveEditor(IEditorPart editorPart){
 	activeEditor = editorPart;
 	if(activeEditor == null) return;
 	if(!tokenHighlighters.containsKey(editorPart)){
 		StyledText styledText = (StyledText) editorPart.getAdapter(Control.class);
 		if(styledText != null){
	ITextOperationTarget t = (ITextOperationTarget) activeEditor.getAdapter(ITextOperationTarget.class);
	if(t instanceof ProjectionViewer){
		ProjectionViewer projectionViewer = (ProjectionViewer)t;
		tokenHighlighters.put(activeEditor, new TokenHighlighter(styledText, showTokenHighlights, projectionViewer));
	}
}
 	}
 	
 }
 
开发者ID:SERESLab,项目名称:iTrace-Archive,代码行数:16,代码来源:ITrace.java

示例5: openFileInEditor

import org.eclipse.ui.IEditorPart; //导入方法依赖的package包/类
private ITextEditor openFileInEditor(IFile file) throws PartInitException {
	IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
	IWorkbenchPage page = window.getActivePage();
	IEditorPart editor = IDE.openEditor(page, file, true);
	ITextEditor textEditor = editor.getAdapter(ITextEditor.class);
	return textEditor;
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:8,代码来源:JavaBreakpointListener.java

示例6: findActionByActionId

import org.eclipse.ui.IEditorPart; //导入方法依赖的package包/类
public IAction findActionByActionId(String actionId) {
	IEditorPart editor = getEditorPart();
	ActionRegistry actionRegistry = (ActionRegistry) editor.getAdapter(ActionRegistry.class);
	IAction action = actionRegistry.getAction(actionId);
	return action;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:7,代码来源:BaseConnectionEditPart.java


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