本文整理汇总了Java中org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getEditorInput方法的典型用法代码示例。如果您正苦于以下问题:Java EditorUtility.getEditorInput方法的具体用法?Java EditorUtility.getEditorInput怎么用?Java EditorUtility.getEditorInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.ui.javaeditor.EditorUtility
的用法示例。
在下文中一共展示了EditorUtility.getEditorInput方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gotoBookmark
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
@Override
public boolean gotoBookmark(IWorkbenchWindow window, Bookmark bookmark, IBookmarkLocation bookmarkLocation) {
if (!(bookmarkLocation instanceof JavaMarkerBookmarkLocation)) {
return false;
}
JavaMarkerBookmarkLocation javaMarkerBookmarkLocation = (JavaMarkerBookmarkLocation) bookmarkLocation;
IJavaElement javaElement = JavaCore.create(javaMarkerBookmarkLocation.getHandle());
if (javaElement == null) {
return false;
}
IEditorInput editorInput = EditorUtility.getEditorInput(javaElement);
if (editorInput == null) {
return false;
}
String editorId = getEditorId(editorInput);
if (editorId == null) {
return false;
}
try {
IEditorPart editorPart = IDE.openEditor(window.getActivePage(), editorInput, editorId);
if (editorPart == null) {
return false;
}
IDE.gotoMarker(editorPart, javaMarkerBookmarkLocation.getMarker());
return true;
} catch (PartInitException e) {
return false;
}
}
示例2: inputIsSelected
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
private boolean inputIsSelected(IEditorInput input) {
IStructuredSelection selection= (IStructuredSelection)fViewer.getSelection();
if (selection.size() != 1)
return false;
IEditorInput selectionAsInput= EditorUtility.getEditorInput(selection.getFirstElement());
return input.equals(selectionAsInput);
}
示例3: dragStart
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
@Override
public void dragStart(DragSourceEvent event) {
fEditorInputDatas= new ArrayList<EditorInputData>();
ISelection selection= fProvider.getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSelection= (IStructuredSelection) selection;
for (Iterator<?> iter= structuredSelection.iterator(); iter.hasNext();) {
Object element= iter.next();
IEditorInput editorInput= EditorUtility.getEditorInput(element);
if (editorInput != null && editorInput.getPersistable() != null) {
try {
String editorId= EditorUtility.getEditorID(editorInput);
// see org.eclipse.ui.internal.ide.EditorAreaDropAdapter.openNonExternalEditor(..):
IEditorRegistry editorReg= PlatformUI.getWorkbench().getEditorRegistry();
IEditorDescriptor editorDesc= editorReg.findEditor(editorId);
if (editorDesc != null && !editorDesc.isOpenExternal()) {
fEditorInputDatas.add(EditorInputTransfer.createEditorInputData(editorId, editorInput));
}
} catch (PartInitException e) {
JavaPlugin.log(e);
}
}
}
}
event.doit= fEditorInputDatas.size() > 0;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:EditorInputTransferDragAdapter.java
示例4: showWithReuse
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
private IEditorPart showWithReuse(Object element, IWorkbenchPage wbPage) throws PartInitException {
IEditorInput input= EditorUtility.getEditorInput(element);
if (input == null)
return null;
String editorID= EditorUtility.getEditorID(input);
return showInEditor(wbPage, input, editorID);
}
示例5: getMarkerAnnotationFixes
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
private ICompletionProposal[] getMarkerAnnotationFixes(MarkerAnnotation markerAnnotation) {
if (markerAnnotation.isQuickFixableStateSet() && !markerAnnotation.isQuickFixable())
return NO_PROPOSALS;
IMarker marker= markerAnnotation.getMarker();
ICompilationUnit cu= getCompilationUnit(marker);
if (cu == null)
return NO_PROPOSALS;
IEditorInput input= EditorUtility.getEditorInput(cu);
if (input == null)
return NO_PROPOSALS;
IAnnotationModel model= JavaUI.getDocumentProvider().getAnnotationModel(input);
if (model == null)
return NO_PROPOSALS;
ISourceViewer sourceViewer= null;
if (viewer instanceof ISourceViewer)
sourceViewer= (ISourceViewer) viewer;
AssistContext context= new AssistContext(cu, sourceViewer, position.getOffset(), position.getLength());
ArrayList<IJavaCompletionProposal> proposals= new ArrayList<IJavaCompletionProposal>();
JavaCorrectionProcessor.collectProposals(context, model, new Annotation[] { markerAnnotation }, true, false, proposals);
return proposals.toArray(new ICompletionProposal[proposals.size()]);
}
示例6: internalGetResolutions
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
private static IMarkerResolution[] internalGetResolutions(IMarker marker) {
if (!internalHasResolutions(marker)) {
return NO_RESOLUTIONS;
}
ICompilationUnit cu= getCompilationUnit(marker);
if (cu != null) {
IEditorInput input= EditorUtility.getEditorInput(cu);
if (input != null) {
IProblemLocation location= findProblemLocation(input, marker);
if (location != null) {
IInvocationContext context= new AssistContext(cu, location.getOffset(), location.getLength());
if (!hasProblem (context.getASTRoot().getProblems(), location))
return NO_RESOLUTIONS;
ArrayList<IJavaCompletionProposal> proposals= new ArrayList<IJavaCompletionProposal>();
JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals);
Collections.sort(proposals, new CompletionProposalComparator());
int nProposals= proposals.size();
IMarkerResolution[] resolutions= new IMarkerResolution[nProposals];
for (int i= 0; i < nProposals; i++) {
resolutions[i]= new CorrectionMarkerResolution(context.getCompilationUnit(), location.getOffset(), location.getLength(), proposals.get(i), marker);
}
return resolutions;
}
}
}
return NO_RESOLUTIONS;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:32,代码来源:CorrectionMarkerResolutionGenerator.java