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 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 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; }
public static String getEditorID(IEditorInput input) throws PartInitException { Assert.isNotNull(input); if (input instanceof IFileEditorInput) return IDE.getEditorDescriptor(((IFileEditorInput)input).getFile()).getId(); String name= input.getName(); if (input instanceof IClassFileEditorInput) { boolean hasSource; try { hasSource= ((IClassFileEditorInput) input).getClassFile().getSourceRange() != null; } catch (JavaModelException e) { hasSource= false; } if (!hasSource) { if (JavaModelUtil.MODULE_INFO_CLASS.equals(name)) { name= "module-info.class without source"; //$NON-NLS-1$ } else { name= "*.class without source"; //$NON-NLS-1$ } } } return IDE.getEditorDescriptor(name).getId(); }
private IMember getMember(IStructuredSelection selection) { if (selection.size() != 1) return null; Object o= selection.getFirstElement(); if (o instanceof IMember) { IMember member= (IMember)o; try { if (member.getNameRange() == null) return null; } catch (JavaModelException ex) { return null; } IClassFile file= member.getClassFile(); if (file != null) { try { if (file.getSourceRange() != null) return member; } catch (JavaModelException e) { return null; } } return member; } return null; }
private IMember getMember(IStructuredSelection selection) { if (selection.size() != 1) return null; Object o= selection.getFirstElement(); if (o instanceof IMember) { IMember member= (IMember)o; try { if (member.getNameRange() == null) return null; } catch (JavaModelException ex) { return null; } IClassFile file= member.getClassFile(); if (file != null) { try { if (file.getSourceRange() != null) return member; } catch (JavaModelException e) { return null; } } return member; } return null; }
private IMember getMember(IStructuredSelection selection) { if (selection.size() != 1) return null; Object o= selection.getFirstElement(); if (o instanceof IMember) { IMember member= (IMember)o; try { if (member.getNameRange() == null) return null; } catch (JavaModelException ex) { return null; } IClassFile file= member.getClassFile(); if (file != null) { try { if (file.getSourceRange() != null) return member; } catch (JavaModelException e) { return null; } } return member; } return null; }
public static String getEditorID(IEditorInput input) throws PartInitException { Assert.isNotNull(input); if (input instanceof IFileEditorInput) return IDE.getEditorDescriptor(((IFileEditorInput)input).getFile()).getId(); String name= input.getName(); if (input instanceof IClassFileEditorInput) { boolean hasSource; try { hasSource= ((IClassFileEditorInput) input).getClassFile().getSourceRange() != null; } catch (JavaModelException e) { hasSource= false; } if (!hasSource) name= "*.class without source"; //$NON-NLS-1$ } return IDE.getEditorDescriptor(name).getId(); }
@Override public void acceptSearchMatch(SearchMatch match) throws CoreException { Object o = match.getElement(); if (o instanceof IJavaElement) { IJavaElement element = (IJavaElement) o; ICompilationUnit compilationUnit = (ICompilationUnit) element.getAncestor(IJavaElement.COMPILATION_UNIT); Location location = null; if (compilationUnit != null) { location = JDTUtils.toLocation(compilationUnit, match.getOffset(), match.getLength()); } else if (includeClassFiles) { IClassFile cf = (IClassFile) element.getAncestor(IJavaElement.CLASS_FILE); if (cf != null && cf.getSourceRange() != null) { location = JDTUtils.toLocation(cf, match.getOffset(), match.getLength()); } } if (location != null) { locations.add(location); } } } }, monitor);
private Location computeDefinitionNavigation(ITypeRoot unit, int line, int column, IProgressMonitor monitor) { try { IJavaElement element = JDTUtils.findElementAtSelection(unit, line, column, this.preferenceManager, monitor); if (element == null) { return null; } ICompilationUnit compilationUnit = (ICompilationUnit) element.getAncestor(IJavaElement.COMPILATION_UNIT); IClassFile cf = (IClassFile) element.getAncestor(IJavaElement.CLASS_FILE); if (compilationUnit != null || (cf != null && cf.getSourceRange() != null) ) { return fixLocation(element, JDTUtils.toLocation(element), unit.getJavaProject()); } if (element instanceof IMember && ((IMember) element).getClassFile() != null) { return fixLocation(element, JDTUtils.toLocation(((IMember) element).getClassFile()), unit.getJavaProject()); } } catch (JavaModelException e) { JavaLanguageServerPlugin.logException("Problem computing definition for" + unit.getElementName(), e); } return null; }
ICompilationUnit compilationUnit = (ICompilationUnit) element.getAncestor(IJavaElement.COMPILATION_UNIT); IClassFile cf = (IClassFile) element.getAncestor(IJavaElement.CLASS_FILE); if (compilationUnit != null || (cf != null && cf.getSourceRange() != null)) { return JDTUtils.toLocation(element);
if (file.getSourceRange() == null) {
if (file.getSourceRange() == null) {
if (file.getSourceRange() == null) {