当前位置: 首页>>代码示例>>Java>>正文


Java ClassScope类代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.compiler.lookup.ClassScope的典型用法代码示例。如果您正苦于以下问题:Java ClassScope类的具体用法?Java ClassScope怎么用?Java ClassScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ClassScope类属于org.eclipse.jdt.internal.compiler.lookup包,在下文中一共展示了ClassScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getClassScope

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
private static ClassScope getClassScope(CompletionProposalCollector completionProposalCollector) {
	ClassScope scope = null;
	try {
		InternalCompletionContext context = (InternalCompletionContext) Reflection.contextField.get(completionProposalCollector);
		InternalExtendedCompletionContext extendedContext = (InternalExtendedCompletionContext) Reflection.extendedContextField.get(context);
		if (extendedContext != null) {
			Scope assistScope = ((Scope) Reflection.assistScopeField.get(extendedContext));
			if (assistScope != null) {
				scope = assistScope.classScope();
			}
		}
	} catch (IllegalAccessException ignore) {
		// ignore
	}
	return scope;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:17,代码来源:PatchExtensionMethodCompletionProposal.java

示例2: generateCleanMethod

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
private MethodDeclaration generateCleanMethod(List<BuilderFieldData> builderFields, EclipseNode builderType, ASTNode source) {
	List<Statement> statements = new ArrayList<Statement>();
	
	for (BuilderFieldData bfd : builderFields) {
		if (bfd.singularData != null && bfd.singularData.getSingularizer() != null) {
			bfd.singularData.getSingularizer().appendCleaningCode(bfd.singularData, builderType, statements);
		}
	}
	
	FieldReference thisUnclean = new FieldReference(CLEAN_FIELD_NAME, 0);
	thisUnclean.receiver = new ThisReference(0, 0);
	statements.add(new Assignment(thisUnclean, new FalseLiteral(0, 0), 0));
	MethodDeclaration decl = new MethodDeclaration(((CompilationUnitDeclaration) builderType.top().get()).compilationResult);
	decl.selector = CLEAN_METHOD_NAME;
	decl.modifiers = ClassFileConstants.AccPrivate;
	decl.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
	decl.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0);
	decl.statements = statements.toArray(new Statement[0]);
	decl.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
	return decl;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:22,代码来源:HandleBuilder.java

示例3: format

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
private void format(
	AbstractMethodDeclaration methodDeclaration,
	ClassScope scope,
	boolean isChunkStart,
	boolean isFirstClassBodyDeclaration) {

	if (isFirstClassBodyDeclaration) {
		int newLinesBeforeFirstClassBodyDeclaration = this.preferences.blank_lines_before_first_class_body_declaration;
		if (newLinesBeforeFirstClassBodyDeclaration > 0) {
			this.scribe.printEmptyLines(newLinesBeforeFirstClassBodyDeclaration);
		}
	} else {
		final int newLineBeforeChunk = isChunkStart ? this.preferences.blank_lines_before_new_chunk : 0;
		if (newLineBeforeChunk > 0) {
			this.scribe.printEmptyLines(newLineBeforeChunk);
		}
	}
	final int newLinesBeforeMethod = this.preferences.blank_lines_before_method;
	if (newLinesBeforeMethod > 0 && !isFirstClassBodyDeclaration) {
		this.scribe.printEmptyLines(newLinesBeforeMethod);
	} else if (this.scribe.line != 0 || this.scribe.column != 1) {
		this.scribe.printNewLine();
	}
	methodDeclaration.traverse(this, scope);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:26,代码来源:CodeFormatterVisitor.java

示例4: visit

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
/**
 * @see org.eclipse.jdt.internal.compiler.ASTVisitor#visit(org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference, org.eclipse.jdt.internal.compiler.lookup.ClassScope)
 */
public boolean visit(
	QualifiedTypeReference qualifiedTypeReference,
	ClassScope scope) {

		final int numberOfParens = (qualifiedTypeReference.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
		if (numberOfParens > 0) {
			manageOpeningParenthesizedExpression(qualifiedTypeReference, numberOfParens);
		}
		formatQualifiedTypeReference(qualifiedTypeReference);

		if (numberOfParens > 0) {
			manageClosingParenthesizedExpression(qualifiedTypeReference, numberOfParens);
		}
		return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:19,代码来源:CodeFormatterVisitor.java

示例5: traverse

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
public void traverse(
	ASTVisitor visitor,
	ClassScope classScope) {

	if (visitor.visit(this, classScope)) {
		if (this.annotations != null) {
			int annotationsLength = this.annotations.length;
			for (int i = 0; i < annotationsLength; i++)
				this.annotations[i].traverse(visitor, this.scope);
		}
		if (this.returnType != null) {
			this.returnType.traverse(visitor, this.scope);
		}
		if (this.defaultValue != null) {
			this.defaultValue.traverse(visitor, this.scope);
		}
	}
	visitor.endVisit(this, classScope);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:AnnotationMethodDeclaration.java

示例6: visit

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
@Override
public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope scope) {
	Annotation[] annotations = constructorDeclaration.annotations;
	if (annotations != null) {
		MethodBinding constructorBinding = constructorDeclaration.binding;
		if (constructorBinding == null) {
			return false;
		}
		((SourceTypeBinding) constructorBinding.declaringClass).resolveTypesFor(constructorBinding);
		this.resolveAnnotations(
				constructorDeclaration.scope,
				annotations,
				constructorBinding);
	}
	Argument[] arguments = constructorDeclaration.arguments;
	if (arguments != null) {
		int argumentLength = arguments.length;
		for (int i = 0; i < argumentLength; i++) {
			arguments[i].traverse(this, constructorDeclaration.scope);
		}
	}
	return false;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:24,代码来源:AnnotationDiscoveryVisitor.java

示例7: getExtensionMethods

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
private static List<Extension> getExtensionMethods(CompletionProposalCollector completionProposalCollector) {
	List<Extension> extensions = new ArrayList<Extension>();
	ClassScope classScope = getClassScope(completionProposalCollector);
	if (classScope != null) {
		TypeDeclaration decl = classScope.referenceContext;
		TypeBinding firstParameterType = getFirstParameterType(decl, completionProposalCollector);
		for (EclipseNode typeNode = getTypeNode(decl); typeNode != null; typeNode = upToType(typeNode)) {
			Annotation ann = getAnnotation(ExtensionMethod.class, typeNode);
			extensions.addAll(0, getApplicableExtensionMethods(typeNode, ann, firstParameterType));
		}
	}
	return extensions;
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:14,代码来源:PatchExtensionMethodCompletionProposal.java

示例8: makeBuilderClass

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
public EclipseNode makeBuilderClass(boolean isStatic, EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, ASTNode source) {
	TypeDeclaration parent = (TypeDeclaration) tdParent.get();
	TypeDeclaration builder = new TypeDeclaration(parent.compilationResult);
	builder.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
	builder.modifiers |= ClassFileConstants.AccPublic;
	if (isStatic) builder.modifiers |= ClassFileConstants.AccStatic;
	builder.typeParameters = copyTypeParams(typeParams, source);
	builder.name = builderClassName.toCharArray();
	builder.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
	return injectType(tdParent, builder);
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:12,代码来源:HandleBuilder.java

示例9: setGeneratedByRecursive

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
public void setGeneratedByRecursive(ASTNode target) {
	SetGeneratedByVisitor visitor = new SetGeneratedByVisitor(source);
	
	if (target instanceof AbstractMethodDeclaration) {
		((AbstractMethodDeclaration) target).traverse(visitor, (ClassScope) null);
	} else if (target instanceof FieldDeclaration) {
		((FieldDeclaration) target).traverse(visitor, (MethodScope) null);
	} else {
		target.traverse(visitor, null);
	}
}
 
开发者ID:git03394538,项目名称:lombok-ianchiu,代码行数:12,代码来源:EclipseSingularsRecipes.java

示例10: makeBuilderClass

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
public EclipseNode makeBuilderClass(EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, ASTNode source) {
	TypeDeclaration parent = (TypeDeclaration) tdParent.get();
	TypeDeclaration builder = new TypeDeclaration(parent.compilationResult);
	builder.bits |= Eclipse.ECLIPSE_DO_NOT_TOUCH_FLAG;
	builder.modifiers |= ClassFileConstants.AccPublic | ClassFileConstants.AccStatic;
	builder.typeParameters = copyTypeParams(typeParams, source);
	builder.name = builderClassName.toCharArray();
	builder.traverse(new SetGeneratedByVisitor(source), (ClassScope) null);
	return injectType(tdParent, builder);
}
 
开发者ID:mobmead,项目名称:EasyMPermission,代码行数:11,代码来源:HandleBuilder.java

示例11: resolveSuperType

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
public TypeBinding resolveSuperType(ClassScope scope) {
	// assumes the implementation of resolveType(ClassScope) will call back to detect cycles
	TypeBinding superType = resolveType(scope);
	if (superType == null) return null;

	if (superType.isTypeVariable()) {
		if (this.resolvedType.isValidBinding()) {
			this.resolvedType = new ProblemReferenceBinding(getTypeName(), (ReferenceBinding)this.resolvedType, ProblemReasons.IllegalSuperTypeVariable);
			reportInvalidType(scope);
		}
		return null;
	}
	return superType;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:15,代码来源:TypeReference.java

示例12: traverse

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
public void traverse(ASTVisitor visitor, ClassScope scope) {
	if (visitor.visit(this, scope)) {
		if (this.type != null) {
			this.type.traverse(visitor, scope);
		}
		if (this.bounds != null) {
			int boundsLength = this.bounds.length;
			for (int i = 0; i < boundsLength; i++) {
				this.bounds[i].traverse(visitor, scope);
			}
		}
	}
	visitor.endVisit(this, scope);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:15,代码来源:TypeParameter.java

示例13: visit

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
public boolean visit(ConstructorDeclaration constructorDeclaration, ClassScope classScope) {
	if (((constructorDeclaration.bits & ASTNode.IsDefaultConstructor) == 0) && !constructorDeclaration.isClinit()) {
		removeLocals(
				constructorDeclaration.arguments,
				constructorDeclaration.declarationSourceStart,
				constructorDeclaration.declarationSourceEnd);
		removeLocals(
				constructorDeclaration.statements,
				constructorDeclaration.declarationSourceStart,
				constructorDeclaration.declarationSourceEnd);
	}
	pushParent(constructorDeclaration);
	return true;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:15,代码来源:UnresolvedReferenceNameFinder.java

示例14: find

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
public void find(
		char[] startWith,
		Initializer initializer,
		ClassScope scope,
		int from,
		char[][] discouragedNames,
		UnresolvedReferenceNameRequestor nameRequestor) {
	MethodDeclaration fakeMethod =
		this.findAfter(startWith, scope, from, initializer.bodyEnd, MAX_LINE_COUNT, false, discouragedNames, nameRequestor);
	if (fakeMethod != null) fakeMethod.traverse(this, scope);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:UnresolvedReferenceNameFinder.java

示例15: traverse

import org.eclipse.jdt.internal.compiler.lookup.ClassScope; //导入依赖的package包/类
public void traverse(
	ASTVisitor visitor,
	ClassScope classScope) {

	if (visitor.visit(this, classScope)) {
		if (this.javadoc != null) {
			this.javadoc.traverse(visitor, this.scope);
		}
		if (this.annotations != null) {
			int annotationsLength = this.annotations.length;
			for (int i = 0; i < annotationsLength; i++)
				this.annotations[i].traverse(visitor, this.scope);
		}
		if (this.typeParameters != null) {
			int typeParametersLength = this.typeParameters.length;
			for (int i = 0; i < typeParametersLength; i++) {
				this.typeParameters[i].traverse(visitor, this.scope);
			}
		}
		if (this.returnType != null)
			this.returnType.traverse(visitor, this.scope);
		if (this.arguments != null) {
			int argumentLength = this.arguments.length;
			for (int i = 0; i < argumentLength; i++)
				this.arguments[i].traverse(visitor, this.scope);
		}
		if (this.thrownExceptions != null) {
			int thrownExceptionsLength = this.thrownExceptions.length;
			for (int i = 0; i < thrownExceptionsLength; i++)
				this.thrownExceptions[i].traverse(visitor, this.scope);
		}
		if (this.statements != null) {
			int statementsLength = this.statements.length;
			for (int i = 0; i < statementsLength; i++)
				this.statements[i].traverse(visitor, this.scope);
		}
	}
	visitor.endVisit(this, classScope);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:40,代码来源:MethodDeclaration.java


注:本文中的org.eclipse.jdt.internal.compiler.lookup.ClassScope类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。