本文整理匯總了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());
}
}
示例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);
}
示例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());
}
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}