/** * Returns a handle denoting the class member identified by its scope. */ public IJavaElement createElement(ClassScope scope, ICompilationUnit unit, HashSet existingElements, HashMap knownScopes) { return createElement(scope, scope.referenceContext.sourceStart, unit, existingElements, knownScopes); } /**
public NameMatchRequestorWrapper(IJavaSearchScope scope) { this.scope = scope; if (!(scope instanceof AbstractJavaSearchScope)) { this.handleFactory = new HandleFactory(); } }
private void rememberAllTypes(CompilationUnitDeclaration parsedUnit, org.eclipse.jdt.core.ICompilationUnit cu, boolean includeLocalTypes) { TypeDeclaration[] types = parsedUnit.types; if (types != null) { for (int i = 0, length = types.length; i < length; i++) { TypeDeclaration type = types[i]; rememberWithMemberTypes(type, cu.getType(new String(type.name))); } } if (includeLocalTypes && parsedUnit.localTypes != null) { HandleFactory factory = new HandleFactory(); HashSet existingElements = new HashSet(parsedUnit.localTypeCount); HashMap knownScopes = new HashMap(parsedUnit.localTypeCount); for (int i = 0; i < parsedUnit.localTypeCount; i++) { LocalTypeBinding localType = parsedUnit.localTypes[i]; ClassScope classScope = localType.scope; TypeDeclaration typeDecl = classScope.referenceType(); IType typeHandle = (IType)factory.createElement(classScope, cu, existingElements, knownScopes); rememberWithMemberTypes(typeDecl, typeHandle); } } } private void rememberWithMemberTypes(TypeDeclaration typeDecl, IType typeHandle) {
try { HandleFactory factory = new HandleFactory(); IJavaProject currentProject = null; if (monitor != null) monitor.beginTask("", length*2 /* 1 for build binding, 1 for connect hierarchy*/); //$NON-NLS-1$ resourcePath.equals(focusPath) ? focusCU : factory.createOpenable(resourcePath, this.scope); if (handle == null) continue; // match is outside classpath
return; HandleFactory factory = new HandleFactory(); HashSet existingElements = new HashSet(parsedUnit.localTypeCount + parsedUnit.functionalExpressionsCount); HashMap knownScopes = new HashMap(parsedUnit.localTypeCount + parsedUnit.functionalExpressionsCount); ClassScope classScope = localType.scope; TypeDeclaration typeDecl = classScope.referenceType(); IType typeHandle = (IType)factory.createElement(classScope, cu, existingElements, knownScopes); rememberWithMemberTypes(typeDecl, typeHandle); final LambdaExpression expression = (LambdaExpression) parsedUnit.functionalExpressions[i]; if (expression.resolvedType != null && expression.resolvedType.isValidBinding()) { IType typeHandle = (IType)factory.createLambdaTypeElement(expression, cu, existingElements, knownScopes); remember(typeHandle, expression.getTypeBinding());
|| !resourcePath.regionMatches(0, this.lastPkgFragmentRootPath, 0, rootPathLength)) { String jarPath= resourcePath.substring(0, separatorIndex); PackageFragmentRoot root= getJarPkgFragmentRoot(resourcePath, separatorIndex, jarPath, scope); if (root == null) return null; // match is outside classpath && (rootPathLength = this.lastPkgFragmentRootPath.length()) > 0 && resourcePath.charAt(rootPathLength) == '/')) { PackageFragmentRoot root= getPkgFragmentRoot(resourcePath); if (root == null) return null; // match is outside classpath
try { if (this.handleFactory != null) { Openable openable = this.handleFactory.createOpenable(path, this.scope); if (openable == null) return type; if (openable instanceof ICompilationUnit) {
System.arraycopy(projects, 0, projects = new IJavaProject[index], 0, index); PackageFragmentRoot root = getJarPkgFragmentRoot(jarPath, target, projects); if (root != null) { return root; return getJarPkgFragmentRoot(jarPath, target, projects);
break; case Scope.CLASS_SCOPE : IJavaElement parentElement = createElement(scope.parent, elementPosition, unit, existingElements, knownScopes); switch (parentElement.getElementType()) { case IJavaElement.COMPILATION_UNIT : case Scope.METHOD_SCOPE : if (scope.isLambdaScope()) { parentElement = createElement(scope.parent, elementPosition, unit, existingElements, knownScopes); LambdaExpression expression = (LambdaExpression) scope.originalReferenceContext(); if (expression.resolvedType != null && expression.resolvedType.isValidBinding() && IType parentType = (IType) createElement(scope.parent, elementPosition, unit, existingElements, knownScopes); MethodScope methodScope = (MethodScope) scope; if (methodScope.isInsideInitializer()) { case Scope.BLOCK_SCOPE : newElement = createElement(scope.parent, elementPosition, unit, existingElements, knownScopes); break; resolveDuplicates(newElement); return newElement;
try { HandleFactory factory = new HandleFactory(); IJavaProject currentProject = null; if (monitor != null) monitor.beginTask("", length*2 /* 1 for build binding, 1 for connect hierarchy*/); //$NON-NLS-1$ resourcePath.equals(focusPath) ? focusCU : factory.createOpenable(resourcePath, this.scope); if (handle == null) continue; // match is outside classpath
return; HandleFactory factory = new HandleFactory(); HashSet existingElements = new HashSet(parsedUnit.localTypeCount + parsedUnit.functionalExpressionsCount); HashMap knownScopes = new HashMap(parsedUnit.localTypeCount + parsedUnit.functionalExpressionsCount); ClassScope classScope = localType.scope; TypeDeclaration typeDecl = classScope.referenceType(); IType typeHandle = (IType)factory.createElement(classScope, cu, existingElements, knownScopes); rememberWithMemberTypes(typeDecl, typeHandle); final LambdaExpression expression = (LambdaExpression) parsedUnit.functionalExpressions[i]; if (expression.resolvedType != null && expression.resolvedType.isValidBinding()) { IType typeHandle = (IType)factory.createLambdaTypeElement(expression, cu, existingElements, knownScopes); remember(typeHandle, expression.getTypeBinding());
|| !resourcePath.regionMatches(0, this.lastPkgFragmentRootPath, 0, rootPathLength)) { String jarPath= resourcePath.substring(0, separatorIndex); PackageFragmentRoot root= getJarPkgFragmentRoot(resourcePath, separatorIndex, jarPath, scope); if (root == null) return null; // match is outside classpath && (rootPathLength = this.lastPkgFragmentRootPath.length()) > 0 && resourcePath.charAt(rootPathLength) == '/')) { PackageFragmentRoot root= getPkgFragmentRoot(resourcePath); if (root == null) return null; // match is outside classpath
try { if (this.handleFactory != null) { Openable openable = this.handleFactory.createOpenable(path, this.scope); if (openable == null) return type; if (openable instanceof ICompilationUnit) {
System.arraycopy(projects, 0, projects = new IJavaProject[index], 0, index); PackageFragmentRoot root = getJarPkgFragmentRoot(jarPath, target, projects); if (root != null) { return root; return getJarPkgFragmentRoot(jarPath, target, projects);
break; case Scope.CLASS_SCOPE : IJavaElement parentElement = createElement(scope.parent, elementPosition, unit, existingElements, knownScopes); switch (parentElement.getElementType()) { case IJavaElement.COMPILATION_UNIT : case Scope.METHOD_SCOPE : if (scope.isLambdaScope()) { parentElement = createElement(scope.parent, elementPosition, unit, existingElements, knownScopes); LambdaExpression expression = (LambdaExpression) scope.originalReferenceContext(); if (expression.resolvedType != null && expression.resolvedType.isValidBinding() && IType parentType = (IType) createElement(scope.parent, elementPosition, unit, existingElements, knownScopes); MethodScope methodScope = (MethodScope) scope; if (methodScope.isInsideInitializer()) { case Scope.BLOCK_SCOPE : newElement = createElement(scope.parent, elementPosition, unit, existingElements, knownScopes); break; resolveDuplicates(newElement); return newElement;
try { HandleFactory factory = new HandleFactory(); IJavaProject currentProject = null; if (monitor != null) monitor.beginTask("", length*2 /* 1 for build binding, 1 for connect hierarchy*/); //$NON-NLS-1$ resourcePath.equals(focusPath) ? focusCU : factory.createOpenable(resourcePath, this.scope); if (handle == null) continue; // match is outside classpath
return; HandleFactory factory = new HandleFactory(); HashSet existingElements = new HashSet(parsedUnit.localTypeCount + parsedUnit.functionalExpressionsCount); HashMap knownScopes = new HashMap(parsedUnit.localTypeCount + parsedUnit.functionalExpressionsCount); ClassScope classScope = localType.scope; TypeDeclaration typeDecl = classScope.referenceType(); IType typeHandle = (IType)factory.createElement(classScope, cu, existingElements, knownScopes); rememberWithMemberTypes(typeDecl, typeHandle); final LambdaExpression expression = (LambdaExpression) parsedUnit.functionalExpressions[i]; if (expression.resolvedType != null && expression.resolvedType.isValidBinding()) { IType typeHandle = (IType)factory.createLambdaTypeElement(expression, cu, existingElements, knownScopes); remember(typeHandle, expression.getTypeBinding());
|| !resourcePath.regionMatches(0, this.lastPkgFragmentRootPath, 0, rootPathLength)) { String jarPath= resourcePath.substring(0, separatorIndex); PackageFragmentRoot root= getJarPkgFragmentRoot(resourcePath, separatorIndex, jarPath, scope); if (root == null) return null; // match is outside classpath && (rootPathLength = this.lastPkgFragmentRootPath.length()) > 0 && resourcePath.charAt(rootPathLength) == '/')) { PackageFragmentRoot root= getPkgFragmentRoot(resourcePath); if (root == null) return null; // match is outside classpath
/** * Returns a handle denoting the class member identified by its scope. */ public IJavaElement createElement(ClassScope scope, ICompilationUnit unit, HashSet existingElements, HashMap knownScopes) { return createElement(scope, scope.referenceContext.sourceStart, unit, existingElements, knownScopes); } /**
try { if (this.handleFactory != null) { Openable openable = this.handleFactory.createOpenable(path, this.scope); if (openable == null) return type; switch (openable.getElementType()) {