/** * Find the packages that start with the given prefix. * A valid prefix is a qualified name separated by periods * (ex. java.util). * The packages found are passed to: * ISearchRequestor.acceptPackage(char[][] packageName) */ public void findPackages(char[] prefix, ISearchRequestor requestor) { this.nameLookup.seekPackageFragments( new String(prefix), true, new SearchableEnvironmentRequestor(requestor)); }
/** * Find the packages that start with the given prefix. * A valid prefix is a qualified name separated by periods * (ex. java.util). * The packages found are passed to: * ISearchRequestor.acceptPackage(char[][] packageName) */ public void findPackages(char[] prefix, ISearchRequestor requestor) { this.nameLookup.seekPackageFragments( new String(prefix), true, new SearchableEnvironmentRequestor(requestor)); }
/** * Find the packages that start with the given prefix. * A valid prefix is a qualified name separated by periods * (ex. java.util). * The packages found are passed to: * ISearchRequestor.acceptPackage(char[][] packageName) */ public void findPackages(char[] prefix, ISearchRequestor requestor) { this.nameLookup.seekPackageFragments( new String(prefix), true, new SearchableEnvironmentRequestor(requestor)); }
/** * Find the packages that start with the given prefix and belong to the given module. * A valid prefix is a qualified name separated by periods * (ex. java.util). * The packages found are passed to: * ISearchRequestor.acceptPackage(char[][] packageName) */ public void findPackages(char[] prefix, ISearchRequestor requestor, IPackageFragmentRoot[] moduleContext) { this.nameLookup.seekPackageFragments( new String(prefix), true, new SearchableEnvironmentRequestor(requestor), moduleContext); } /**
/** * Find the packages that start with the given prefix. * A valid prefix is a qualified name separated by periods * (ex. java.util). * The packages found are passed to: * ISearchRequestor.acceptPackage(char[][] packageName) */ public void findPackages(char[] prefix, ISearchRequestor requestor) { this.nameLookup.seekPackageFragments( new String(prefix), true, new SearchableEnvironmentRequestor(requestor)); }
/** * Find the packages that start with the given prefix. * A valid prefix is a qualified name separated by periods * (ex. java.util). * The packages found are passed to: * ISearchRequestor.acceptPackage(char[][] packageName) */ public void findPackages(char[] prefix, ISearchRequestor requestor) { this.nameLookup.seekPackageFragments( new String(prefix), true, new SearchableEnvironmentRequestor(requestor)); }
/** * Find the packages that start with the given prefix. * A valid prefix is a qualified name separated by periods * (ex. java.util). * The packages found are passed to: * ISearchRequestor.acceptPackage(char[][] packageName) */ public void findPackages(char[] prefix, ISearchRequestor requestor) { this.nameLookup.seekPackageFragments( new String(prefix), true, new SearchableEnvironmentRequestor(requestor)); }
/** * Notifies the given requestor of all package fragments with the * given name. Checks the requestor at regular intervals to see if the * requestor has canceled. The domain of * the search is bounded by the <code>IJavaProject</code> * this <code>NameLookup</code> was obtained from. * * @param partialMatch partial name matches qualify when <code>true</code>; * only exact name matches qualify when <code>false</code> */ public void seekTypes(String pkgName, String name, boolean partialMatch, IJavaElementRequestor requestor, int acceptFlags, IPackageFragmentRoot[] moduleContext, String moduleName) { Selector selector = new Selector(moduleName); seekPackageFragments(pkgName, true /*partialMatch*/, selector, moduleContext); if (selector.pkgFragments.size() == 0) return; for (IPackageFragment pkg : selector.pkgFragments) { seekTypes(name, pkg, partialMatch, acceptFlags, requestor); } }
/** * Notifies the given requestor of all package fragments with the * given name. Checks the requestor at regular intervals to see if the * requestor has canceled. The domain of * the search is bounded by the <code>IJavaProject</code> * this <code>NameLookup</code> was obtained from. * * @param partialMatch partial name matches qualify when <code>true</code>; * only exact name matches qualify when <code>false</code> */ public void seekTypes(String pkgName, String name, boolean partialMatch, IJavaElementRequestor requestor, int acceptFlags, IPackageFragmentRoot[] moduleContext, String moduleName) { Selector selector = new Selector(moduleName); seekPackageFragments(pkgName, true /*partialMatch*/, selector, moduleContext); if (selector.pkgFragments.size() == 0) return; for (IPackageFragment pkg : selector.pkgFragments) { seekTypes(name, pkg, partialMatch, acceptFlags, requestor); } }
/** * Returns all types whose name starts with the given (qualified) <code>prefix</code>. * * If the <code>prefix</code> is unqualified, all types whose simple name matches * the <code>prefix</code> are returned. */ private void findTypes(String prefix, ISearchRequestor storage, int type) { //TODO (david) should add camel case support SearchableEnvironmentRequestor requestor = new SearchableEnvironmentRequestor(storage, this.unitToSkip, this.project, this.nameLookup); int index = prefix.lastIndexOf('.'); if (index == -1) { this.nameLookup.seekTypes(prefix, null, true, type, requestor); } else { String packageName = prefix.substring(0, index); JavaElementRequestor elementRequestor = new JavaElementRequestor(); this.nameLookup.seekPackageFragments(packageName, false, elementRequestor); IPackageFragment[] fragments = elementRequestor.getPackageFragments(); if (fragments != null) { String className = prefix.substring(index + 1); for (int i = 0, length = fragments.length; i < length; i++) if (fragments[i] != null) this.nameLookup.seekTypes(className, fragments[i], true, type, requestor); } } }
/** * Returns all types whose name starts with the given (qualified) <code>prefix</code>. * * If the <code>prefix</code> is unqualified, all types whose simple name matches * the <code>prefix</code> are returned. */ private void findTypes(String prefix, ISearchRequestor storage, int type) { //TODO (david) should add camel case support SearchableEnvironmentRequestor requestor = new SearchableEnvironmentRequestor(storage, this.unitToSkip, this.project, this.nameLookup); int index = prefix.lastIndexOf('.'); if (index == -1) { this.nameLookup.seekTypes(prefix, null, true, type, requestor); } else { String packageName = prefix.substring(0, index); JavaElementRequestor elementRequestor = new JavaElementRequestor(); this.nameLookup.seekPackageFragments(packageName, false, elementRequestor); IPackageFragment[] fragments = elementRequestor.getPackageFragments(); if (fragments != null) { String className = prefix.substring(index + 1); for (int i = 0, length = fragments.length; i < length; i++) if (fragments[i] != null) this.nameLookup.seekTypes(className, fragments[i], true, type, requestor); } } }
/** * Returns all types whose name starts with the given (qualified) <code>prefix</code>. * * If the <code>prefix</code> is unqualified, all types whose simple name matches * the <code>prefix</code> are returned. */ private void findTypes(String prefix, ISearchRequestor storage, int type) { //TODO (david) should add camel case support SearchableEnvironmentRequestor requestor = new SearchableEnvironmentRequestor(storage, this.unitToSkip, this.project, this.nameLookup); int index = prefix.lastIndexOf('.'); if (index == -1) { this.nameLookup.seekTypes(prefix, null, true, type, requestor); } else { String packageName = prefix.substring(0, index); JavaElementRequestor elementRequestor = new JavaElementRequestor(); this.nameLookup.seekPackageFragments(packageName, false, elementRequestor); IPackageFragment[] fragments = elementRequestor.getPackageFragments(); if (fragments != null) { String className = prefix.substring(index + 1); for (int i = 0, length = fragments.length; i < length; i++) if (fragments[i] != null) this.nameLookup.seekTypes(className, fragments[i], true, type, requestor); } } }
public boolean hasCompilationUnit(char[][] pkgName, IPackageFragmentRoot[] moduleContext) { String packageName = CharOperation.toString(pkgName); if (packageName == null || packageName.length() == 0) { packageName= IPackageFragment.DEFAULT_PACKAGE_NAME; } // Look for concerned package fragments JavaElementRequestor elementRequestor = new JavaElementRequestor(); seekPackageFragments(packageName, false, elementRequestor, moduleContext); IPackageFragment[] packages= elementRequestor.getPackageFragments(); for (IPackageFragment fragment : packages) { try { if (fragment.containsJavaResources()) return true; } catch (JavaModelException e) { // silent } } return false; } }
public boolean hasCompilationUnit(char[][] pkgName, IPackageFragmentRoot[] moduleContext) { String packageName = CharOperation.toString(pkgName); if (packageName == null || packageName.length() == 0) { packageName= IPackageFragment.DEFAULT_PACKAGE_NAME; } // Look for concerned package fragments JavaElementRequestor elementRequestor = new JavaElementRequestor(); seekPackageFragments(packageName, false, elementRequestor, moduleContext); IPackageFragment[] packages= elementRequestor.getPackageFragments(); for (IPackageFragment fragment : packages) { try { if (fragment.containsJavaResources()) return true; } catch (JavaModelException e) { // silent } } return false; } }
public static class Answer { public IType type; AccessRestriction restriction; Answer(IType type, AccessRestriction restriction) { this.type = type; this.restriction = restriction; } public boolean ignoreIfBetter() { return this.restriction != null && this.restriction.ignoreIfBetter(); } /* * Returns whether this answer is better than the other awswer. * (accessible is better than discouraged, which is better than * non-accessible) */ public boolean isBetter(Answer otherAnswer) { if (otherAnswer == null) return true; if (this.restriction == null) return true; return otherAnswer.restriction != null && this.restriction.getProblemId() < otherAnswer.restriction.getProblemId(); } }
public static class Answer { public IType type; AccessRestriction restriction; IClasspathEntry entry; Answer(IType type, AccessRestriction restriction, IClasspathEntry entry) { this.type = type; this.restriction = restriction; this.entry = entry; } public boolean ignoreIfBetter() { return this.restriction != null && this.restriction.ignoreIfBetter(); } /* * Returns whether this answer is better than the other awswer. * (accessible is better than discouraged, which is better than * non-accessible) */ public boolean isBetter(Answer otherAnswer) { if (otherAnswer == null) return true; if (this.restriction == null) return true; return otherAnswer.restriction != null && this.restriction.getProblemId() < otherAnswer.restriction.getProblemId(); } }
public static class Answer { public IType type; AccessRestriction restriction; Answer(IType type, AccessRestriction restriction) { this.type = type; this.restriction = restriction; } public boolean ignoreIfBetter() { return this.restriction != null && this.restriction.ignoreIfBetter(); } /* * Returns whether this answer is better than the other awswer. * (accessible is better than discouraged, which is better than * non-accessible) */ public boolean isBetter(Answer otherAnswer) { if (otherAnswer == null) return true; if (this.restriction == null) return true; return otherAnswer.restriction != null && this.restriction.getProblemId() < otherAnswer.restriction.getProblemId(); } }
public static class Answer { public IType type; AccessRestriction restriction; Answer(IType type, AccessRestriction restriction) { this.type = type; this.restriction = restriction; } public boolean ignoreIfBetter() { return this.restriction != null && this.restriction.ignoreIfBetter(); } /* * Returns whether this answer is better than the other awswer. * (accessible is better than discouraged, which is better than * non-accessible) */ public boolean isBetter(Answer otherAnswer) { if (otherAnswer == null) return true; if (this.restriction == null) return true; return otherAnswer.restriction != null && this.restriction.getProblemId() < otherAnswer.restriction.getProblemId(); } }
/** * Notifies the given requestor of all package fragments with the * given name. Checks the requestor at regular intervals to see if the * requestor has canceled. The domain of * the search is bounded by the <code>IJavaProject</code> * this <code>NameLookup</code> was obtained from. * * @param partialMatch partial name matches qualify when <code>true</code>; * only exact name matches qualify when <code>false</code> */ public void seekPackageFragments(String name, boolean partialMatch, IJavaElementRequestor requestor, IPackageFragmentRoot[] moduleContext) { if (moduleContext == null) { seekPackageFragments(name, partialMatch, requestor); return; } if (partialMatch) { seekModuleAwarePartialPackageFragments(name, requestor, moduleContext); return; } for (IPackageFragmentRoot moduleRoot : moduleContext) { IPackageFragment fragment = moduleRoot.getPackageFragment(name); if (fragment.exists()) requestor.acceptPackageFragment(fragment); } }
/** * Notifies the given requestor of all package fragments with the * given name. Checks the requestor at regular intervals to see if the * requestor has canceled. The domain of * the search is bounded by the <code>IJavaProject</code> * this <code>NameLookup</code> was obtained from. * * @param partialMatch partial name matches qualify when <code>true</code>; * only exact name matches qualify when <code>false</code> */ public void seekPackageFragments(String name, boolean partialMatch, IJavaElementRequestor requestor, IPackageFragmentRoot[] moduleContext) { if (moduleContext == null) { seekPackageFragments(name, partialMatch, requestor); return; } if (partialMatch) { seekModuleAwarePartialPackageFragments(name, requestor, moduleContext); return; } for (IPackageFragmentRoot moduleRoot : moduleContext) { IPackageFragment fragment = moduleRoot.getPackageFragment(name); if (fragment.exists()) requestor.acceptPackageFragment(fragment); } }