當前位置: 首頁>>代碼示例>>Java>>正文


Java ITextEditor.getEditorInput方法代碼示例

本文整理匯總了Java中org.eclipse.ui.texteditor.ITextEditor.getEditorInput方法的典型用法代碼示例。如果您正苦於以下問題:Java ITextEditor.getEditorInput方法的具體用法?Java ITextEditor.getEditorInput怎麽用?Java ITextEditor.getEditorInput使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.ui.texteditor.ITextEditor的用法示例。


在下文中一共展示了ITextEditor.getEditorInput方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.eclipse.ui.texteditor.ITextEditor; //導入方法依賴的package包/類
/**
    * Clear the spelling error markers.
    * @param action the action
 */
public void run(IAction action) {
       
       if (targetEditor == null) {
           return;
       }
       if (!(targetEditor instanceof ITextEditor)) {
           return;
       }
       
       ITextEditor textEditor = (ITextEditor) targetEditor;
       IEditorInput input = textEditor.getEditorInput();
       
       if (input instanceof FileEditorInput) {
           SpellChecker.clearMarkers(((FileEditorInput)input).getFile());
       }
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:21,代碼來源:SpellUncheckAction.java

示例2: run

import org.eclipse.ui.texteditor.ITextEditor; //導入方法依賴的package包/類
/**
    * Run the spell check action.
    * @param action the action
 */
public void run(IAction action) {
       
       if (targetEditor == null) {
           return;
       }
       if (!(targetEditor instanceof ITextEditor)) {
           return;
       }
       
       ITextEditor textEditor = (ITextEditor) targetEditor;
       IEditorInput input = textEditor.getEditorInput();
       
       IFile file = ((FileEditorInput) input).getFile();
       
       SpellChecker.checkSpelling(textEditor.getDocumentProvider().getDocument(input), file);
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:21,代碼來源:SpellCheckAction.java

示例3: getFilePath

import org.eclipse.ui.texteditor.ITextEditor; //導入方法依賴的package包/類
private IPath getFilePath(ITextEditor textEditor) {
	IEditorInput editorInput = textEditor.getEditorInput();
	IFile file = ResourceUtil.getFile(editorInput);
	File localFile = null;
	if (file != null) {
		localFile = file.getLocation().toFile();
	} else if (editorInput instanceof FileStoreEditorInput) {
		FileStoreEditorInput fileStoreEditorInput = (FileStoreEditorInput) editorInput;
		URI uri = fileStoreEditorInput.getURI();
		IFileStore location = EFS.getLocalFileSystem().getStore(uri);
		try {
			localFile = location.toLocalFile(EFS.NONE, null);
		} catch (CoreException e) {
			// ignore
		}
	}
	if (localFile == null) {
		return null;
	} else {
		return Path.fromOSString(localFile.toString());
	}
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:23,代碼來源:TextEditorBookmarkPropertiesProvider.java

示例4: getFile

import org.eclipse.ui.texteditor.ITextEditor; //導入方法依賴的package包/類
public static IFile getFile(ITextEditor textEditor) {
	IEditorInput input = textEditor.getEditorInput();
	if (input instanceof IFileEditorInput) {
		return ((IFileEditorInput) input).getFile();
	}
	return null;
}
 
開發者ID:angelozerr,項目名稱:ec4e,代碼行數:8,代碼來源:EditorUtils.java

示例5: getCurrentSelectedJavaMethod

import org.eclipse.ui.texteditor.ITextEditor; //導入方法依賴的package包/類
/**
 * Returns currently selected method or <code>null</code>
 * @param editor
 * @return method or <code>null</code>
 * 
 */
public IMethod getCurrentSelectedJavaMethod(ITextEditor editor) {
	if (editor==null){
		return null;
	}
	
	IEditorInput editorInput = editor.getEditorInput();
	if (editorInput==null){
		return null;
	}
	IJavaElement elem = JavaUI.getEditorInputJavaElement(editorInput);
	if (elem instanceof ICompilationUnit) {
	    ITextSelection sel = (ITextSelection) editor.getSelectionProvider().getSelection();
	    IJavaElement selected;
		try {
			selected = ((ICompilationUnit) elem).getElementAt(sel.getOffset());
		} catch (JavaModelException e) {
			JunitUtil.logError("Was not able to get element at selection",e);
			return null;
		}
		if (selected==null){
			return null;
		}
	    if (selected.getElementType() == IJavaElement.METHOD) {
	         return (IMethod) selected;
	    }
	}
	return null;
}
 
開發者ID:de-jcup,項目名稱:egradle,代碼行數:35,代碼來源:JavaHelper.java

示例6: setActiveEditor

import org.eclipse.ui.texteditor.ITextEditor; //導入方法依賴的package包/類
@Override
public void setActiveEditor(final ITextEditor editor) {
    if (editor.getEditorInput() instanceof IFileEditorInput) {
        final IFileEditorInput f = (IFileEditorInput) editor.getEditorInput();
        editorFile = f.getFile();
    }

}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:9,代碼來源:TFSItemReferenceProvider.java

示例7: setActiveEditor

import org.eclipse.ui.texteditor.ITextEditor; //導入方法依賴的package包/類
public void setActiveEditor(ITextEditor targetEditor) {
	if(! (targetEditor.getEditorInput() instanceof IFileEditorInput)) return;
	editor = targetEditor;
	documentProvider= editor.getDocumentProvider();
	
	if(documentProvider != null) {
		SVNWorkspaceSubscriber.getInstance().addListener(teamChangeListener);
		((IDocumentProvider)documentProvider).addElementStateListener(documentListener);
	}	
	isReferenceInitialized= true;
}
 
開發者ID:subclipse,項目名稱:subclipse,代碼行數:12,代碼來源:SVNPristineCopyQuickDiffProvider.java

示例8: getWorkspaceResource

import org.eclipse.ui.texteditor.ITextEditor; //導入方法依賴的package包/類
private static IResource getWorkspaceResource(IWorkbenchPart part) {
	ITextEditor textEditor = getTextEditor(part);
	if (textEditor == null) {
		return null;
	}
	IEditorInput editorInput = textEditor.getEditorInput();
	IFile file = ResourceUtil.getFile(editorInput);
	return file;
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:10,代碼來源:PathBookmarkPropertiesProviderHelper.java

示例9: addWorkspacePath

import org.eclipse.ui.texteditor.ITextEditor; //導入方法依賴的package包/類
private void addWorkspacePath(Map<String, String> properties, ITextEditor textEditor) {
	IEditorInput editorInput = textEditor.getEditorInput();
	IFile file = ResourceUtil.getFile(editorInput);
	if (file == null) {
		return;
	}
	putIfAbsent(properties, PROP_WORKSPACE_PATH, file.getFullPath().toPortableString());
	putIfAbsent(properties, PROP_PROJECT_NAME, file.getProject().getName());
}
 
開發者ID:cchabanois,項目名稱:mesfavoris,代碼行數:10,代碼來源:TextEditorBookmarkPropertiesProvider.java

示例10: getFile

import org.eclipse.ui.texteditor.ITextEditor; //導入方法依賴的package包/類
private IFile getFile() {
	final ITextEditor editor = (ITextEditor) part;
	IFileEditorInput input = (IFileEditorInput) editor.getEditorInput();
	IFile file = input.getFile();
	return file;
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:7,代碼來源:ToggleJimpleBreakpointsTarget.java


注:本文中的org.eclipse.ui.texteditor.ITextEditor.getEditorInput方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。