@Override public IClassFile getClassFile() { return fMember.getClassFile(); } @Override
@Override public IClassFile getClassFile() { return fMember.getClassFile(); } @Override
private IClassFile getClassFile(Object element) { if (!(element instanceof IJavaElement)) return null; if (element instanceof IClassFile) return (IClassFile) element; IJavaElement jElement= (IJavaElement) element; if (jElement instanceof IMember) return ((IMember) jElement).getClassFile(); return null; }
public IClassFile getClassFile() { return fMember.getClassFile(); } public ISourceRange getSourceRange() {
public static IJavaElement getTypeContainerUnit(IMember member) { ICompilationUnit cu= member.getCompilationUnit(); if (cu != null) return cu; else return member.getClassFile(); } }
/** * Configures the given marker attribute map for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param attributes the mutable marker attribute map (key type: <code>String</code>, * value type: <code>String</code>) * @param element the Java element for which the marker needs to be configured */ public static void addJavaElementMarkerAttributes( Map attributes, IJavaElement element) { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (attributes != null && element != null) attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Configures the given marker attribute map for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param attributes the mutable marker attribute map (key type: <code>String</code>, * value type: <code>String</code>) * @param element the Java element for which the marker needs to be configured */ public static void addJavaElementMarkerAttributes( Map attributes, IJavaElement element) { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (attributes != null && element != null) attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Configures the given marker attribute map for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param attributes the mutable marker attribute map (key type: <code>String</code>, * value type: <code>String</code>) * @param element the Java element for which the marker needs to be configured */ public static void addJavaElementMarkerAttributes( Map attributes, IJavaElement element) { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (attributes != null && element != null) attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Configures the given marker attribute map for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param attributes the mutable marker attribute map (key type: <code>String</code>, * value type: <code>String</code>) * @param element the Java element for which the marker needs to be configured */ public static void addJavaElementMarkerAttributes( Map attributes, IJavaElement element) { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (attributes != null && element != null) attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Configures the given marker attribute map for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param attributes the mutable marker attribute map (key type: <code>String</code>, * value type: <code>String</code>) * @param element the Java element for which the marker needs to be configured */ public static void addJavaElementMarkerAttributes( Map attributes, IJavaElement element) { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (attributes != null && element != null) attributes.put(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Configures the given marker for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param marker the marker to be configured * @param element the Java element for which the marker needs to be configured * @exception CoreException if the <code>IMarker.setAttribute</code> on the marker fails */ public void configureJavaElementMarker(IMarker marker, IJavaElement element) throws CoreException { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (marker != null && element != null) marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Configures the given marker for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param marker the marker to be configured * @param element the Java element for which the marker needs to be configured * @exception CoreException if the <code>IMarker.setAttribute</code> on the marker fails */ public void configureJavaElementMarker(IMarker marker, IJavaElement element) throws CoreException { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (marker != null && element != null) marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Configures the given marker for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param marker the marker to be configured * @param element the Java element for which the marker needs to be configured * @exception CoreException if the <code>IMarker.setAttribute</code> on the marker fails */ public void configureJavaElementMarker(IMarker marker, IJavaElement element) throws CoreException { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (marker != null && element != null) marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Configures the given marker for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param marker the marker to be configured * @param element the Java element for which the marker needs to be configured * @exception CoreException if the <code>IMarker.setAttribute</code> on the marker fails */ public void configureJavaElementMarker(IMarker marker, IJavaElement element) throws CoreException { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (marker != null && element != null) marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Configures the given marker for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param marker the marker to be configured * @param element the Java element for which the marker needs to be configured * @exception CoreException if the <code>IMarker.setAttribute</code> on the marker fails */ public void configureJavaElementMarker(IMarker marker, IJavaElement element) throws CoreException { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (marker != null && element != null) marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Configures the given marker for the given Java element. * Used for markers, which denote a Java element rather than a resource. * * @param marker the marker to be configured * @param element the Java element for which the marker needs to be configured * @exception CoreException if the <code>IMarker.setAttribute</code> on the marker fails */ public void configureJavaElementMarker(IMarker marker, IJavaElement element) throws CoreException { if (element instanceof IMember) element = ((IMember) element).getClassFile(); if (marker != null && element != null) marker.setAttribute(ATT_HANDLE_ID, element.getHandleIdentifier()); }
/** * Build an AST for the specified member's compilation unit or * (source-attached) class file. */ private static CompilationUnit buildASTRoot(IMember member, boolean resolveBindings) { return (member.isBinary()) ? buildASTRoot(member.getClassFile(), resolveBindings) // the class file must have a source attachment : buildASTRoot(member.getCompilationUnit(), resolveBindings); }
private IJavaSearchScope getAccurateSearchScope(IJavaSearchScope defaultSearchScope, IMember member) throws JavaModelException { if (! JdtFlags.isPrivate(member)) return defaultSearchScope; if (member.getCompilationUnit() != null) { return SearchEngine.createJavaSearchScope(new IJavaElement[] { member.getCompilationUnit() }); } else if (member.getClassFile() != null) { // member could be called from an inner class-> search // package fragment (see also bug 109053): return SearchEngine.createJavaSearchScope(new IJavaElement[] { member.getAncestor(IJavaElement.PACKAGE_FRAGMENT) }); } else { return defaultSearchScope; } }
private IJavaSearchScope getAccurateSearchScope(IJavaSearchScope defaultSearchScope, IMember member) throws JavaModelException { if (! JdtFlags.isPrivate(member)) return defaultSearchScope; if (member.getCompilationUnit() != null) { return SearchEngine.createJavaSearchScope(new IJavaElement[] { member.getCompilationUnit() }); } else if (member.getClassFile() != null) { // member could be called from an inner class-> search // package fragment (see also bug 109053): return SearchEngine.createJavaSearchScope(new IJavaElement[] { member.getAncestor(IJavaElement.PACKAGE_FRAGMENT) }); } else { return defaultSearchScope; } }
private IJavaSearchScope getAccurateSearchScope(IJavaSearchScope defaultSearchScope, IMember member) throws JavaModelException { if (! JdtFlags.isPrivate(member)) return defaultSearchScope; if (member.getCompilationUnit() != null) { return SearchEngine.createJavaSearchScope(new IJavaElement[] { member.getCompilationUnit() }); } else if (member.getClassFile() != null) { // member could be called from an inner class-> search // package fragment (see also bug 109053): return SearchEngine.createJavaSearchScope(new IJavaElement[] { member.getAncestor(IJavaElement.PACKAGE_FRAGMENT) }); } else { return defaultSearchScope; } }