private JavaModelException probeInputForSource(IEditorInput input) { if (input == null) return null; IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input; IClassFile file= classFileEditorInput.getClassFile(); try { file.getSourceRange(); } catch (JavaModelException e) { return e; } return null; }
private IJavaElement getJavaElement(Object element) { if (element instanceof IJavaElement) return (IJavaElement)element; if (element instanceof IClassFileEditorInput) return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement(); return null; } }
private IJavaElement getJavaElement(Object element) { if (element instanceof IJavaElement) return (IJavaElement)element; if (element instanceof IClassFileEditorInput) return ((IClassFileEditorInput)element).getClassFile().getPrimaryElement(); return null; } }
private JavaModelException probeInputForSource(IEditorInput input) { if (input == null) return null; IClassFileEditorInput classFileEditorInput= (IClassFileEditorInput) input; IClassFile file= classFileEditorInput.getClassFile(); try { file.getSourceRange(); } catch (JavaModelException e) { return e; } return null; }
/** * Default constructor. */ public ClassFileSynchronizer(IClassFileEditorInput input) { fInput= input; IJavaElement parent= fInput.getClassFile().getParent(); while (parent != null && !(parent instanceof IPackageFragmentRoot)) { parent= parent.getParent(); } fPackageFragmentRoot= (IPackageFragmentRoot) parent; }
/** * Default constructor. * * @param input the class file editor input */ public ClassFileSynchronizer(IClassFileEditorInput input) { fInput= input; IJavaElement parent= fInput.getClassFile().getParent(); while (parent != null && !(parent instanceof IPackageFragmentRoot)) { parent= parent.getParent(); } fPackageFragmentRoot= (IPackageFragmentRoot) parent; }
@Override protected IJavaElement getCorrespondingElement(IJavaElement element) { if (getEditorInput() instanceof IClassFileEditorInput) { IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput(); IJavaElement parent= element.getAncestor(IJavaElement.CLASS_FILE); if (input.getClassFile().equals(parent)) return element; } return null; }
@Override protected IJavaElement getCorrespondingElement(IJavaElement element) { if (getEditorInput() instanceof IClassFileEditorInput) { IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput(); IJavaElement parent= element.getAncestor(IJavaElement.CLASS_FILE); if (input.getClassFile().equals(parent)) return element; } return null; }
@Override protected IJavaElement getElementAt(int offset) { if (getEditorInput() instanceof IClassFileEditorInput) { try { IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput(); return input.getClassFile().getElementAt(offset); } catch (JavaModelException x) { } } return null; }
protected IJavaElement getElementAt(int offset) { if (getEditorInput() instanceof IClassFileEditorInput) { try { IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput(); return input.getClassFile().getElementAt(offset); } catch (JavaModelException x) { } } return null; }
@Override protected IJavaElement getElementAt(int offset) { if (getEditorInput() instanceof IClassFileEditorInput) { try { IClassFileEditorInput input= (IClassFileEditorInput) getEditorInput(); return input.getClassFile().getElementAt(offset); } catch (JavaModelException x) { } } return null; }
@Override public boolean canAssist(IQuickAssistInvocationContext invocationContext) { IEditorPart part= fAssistant.getEditor(); IClassFile classFile= ((IClassFileEditorInput) part.getEditorInput()).getClassFile(); return classFile.getJavaProject().getOption(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, true).equals(JavaCore.ENABLED); }
@Override protected boolean setDocumentContent(IDocument document, IEditorInput editorInput, String encoding) throws CoreException { if (editorInput instanceof IClassFileEditorInput) { IClassFile classFile= ((IClassFileEditorInput) editorInput).getClassFile(); String source= classFile.getSource(); if (source == null) source= ""; //$NON-NLS-1$ document.set(source); return true; } return super.setDocumentContent(document, editorInput, encoding); }
private ISourceReference getSourceReference() { IEditorInput input= fEditor.getEditorInput(); if (input instanceof IClassFileEditorInput) { return ((IClassFileEditorInput)input).getClassFile(); } else { return JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input); } }
private static IJavaElement getEditorInput(JavaEditor editor) { IEditorInput input= editor.getEditorInput(); if (input instanceof IClassFileEditorInput) return ((IClassFileEditorInput)input).getClassFile(); return JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input); }
private ISourceReference getSourceReference() { IEditorInput input= fEditor.getEditorInput(); if (input instanceof IClassFileEditorInput) { return ((IClassFileEditorInput)input).getClassFile(); } else { return JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input); } }
private static IJavaElement getInput(JavaEditor editor) { if (editor == null) return null; IEditorInput input= editor.getEditorInput(); if (input instanceof IClassFileEditorInput) return ((IClassFileEditorInput)input).getClassFile(); IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager(); return manager.getWorkingCopy(input); }
private static IJavaElement getEditorInput(JavaEditor editor) { IEditorInput input= editor.getEditorInput(); if (input instanceof IClassFileEditorInput) return ((IClassFileEditorInput)input).getClassFile(); return JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input); }
/** * @see AddMarkerAction#getInitialAttributes() */ @Override protected Map<String, Object> getInitialAttributes() { Map<String, Object> attributes= super.getInitialAttributes(); IEditorInput input= getTextEditor().getEditorInput(); if (input instanceof IClassFileEditorInput) { IClassFile classFile= ((IClassFileEditorInput) input).getClassFile(); JavaCore.addJavaElementMarkerAttributes(attributes, classFile); } return attributes; } }
private IType[] getTypes() throws JavaModelException { IEditorInput input= fEditor.getEditorInput(); if (input instanceof IClassFileEditorInput) { return new IType[] { ((IClassFileEditorInput)input).getClassFile().getType() }; } else { return JavaPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(input).getAllTypes(); } }