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