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


Java JavaModelUtil.is50OrHigher方法代码示例

本文整理汇总了Java中org.eclipse.jdt.internal.corext.util.JavaModelUtil.is50OrHigher方法的典型用法代码示例。如果您正苦于以下问题:Java JavaModelUtil.is50OrHigher方法的具体用法?Java JavaModelUtil.is50OrHigher怎么用?Java JavaModelUtil.is50OrHigher使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.internal.corext.util.JavaModelUtil的用法示例。


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

示例1: addOverrideAnnotation

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
/**
 * Adds <code>@Override</code> annotation to <code>methodDecl</code> if not already present and
 * if requested by code style settings or compiler errors/warnings settings.
 *
 * @param settings the code generation style settings, may be <code>null</code>
 * @param project the Java project used to access the compiler settings
 * @param rewrite the ASTRewrite
 * @param imports the ImportRewrite
 * @param methodDecl the method declaration to add the annotation to
 * @param isDeclaringTypeInterface <code>true</code> if the type declaring the method overridden
 *            by <code>methodDecl</code> is an interface
 * @param group the text edit group, may be <code>null</code>
 */
public static void addOverrideAnnotation(CodeGenerationSettings settings, IJavaProject project, ASTRewrite rewrite, ImportRewrite imports, MethodDeclaration methodDecl,
		boolean isDeclaringTypeInterface, TextEditGroup group) {
	if (!JavaModelUtil.is50OrHigher(project)) {
		return;
	}
	if (isDeclaringTypeInterface) {
		String version= project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
		if (JavaModelUtil.isVersionLessThan(version, JavaCore.VERSION_1_6))
		{
			return; // not allowed in 1.5
		}
		if (JavaCore.DISABLED.equals(project.getOption(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION_FOR_INTERFACE_METHOD_IMPLEMENTATION, true)))
		{
			return; // user doesn't want to use 1.6 style
		}
	}
	if ((settings != null && settings.overrideAnnotation) || !JavaCore.IGNORE.equals(project.getOption(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION, true))) {
		createOverrideAnnotation(rewrite, imports, methodDecl, group);
	}
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:34,代码来源:StubUtility2.java

示例2: createNewMethodDeclarationNode

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private MethodDeclaration createNewMethodDeclarationNode(MemberActionInfo info, TypeVariableMaplet[] mapping, CompilationUnitRewrite rewriter, MethodDeclaration oldMethod) throws JavaModelException {
	Assert.isTrue(!info.isFieldInfo());
	IMethod method= (IMethod) info.getMember();
	ASTRewrite rewrite= rewriter.getASTRewrite();
	AST ast= rewrite.getAST();
	MethodDeclaration newMethod= ast.newMethodDeclaration();
	copyBodyOfPushedDownMethod(rewrite, method, oldMethod, newMethod, mapping);
	newMethod.setConstructor(oldMethod.isConstructor());
	copyExtraDimensions(oldMethod, newMethod);
	if (info.copyJavadocToCopiesInSubclasses())
		copyJavadocNode(rewrite, oldMethod, newMethod);
	final IJavaProject project= rewriter.getCu().getJavaProject();
	if (info.isNewMethodToBeDeclaredAbstract() && JavaModelUtil.is50OrHigher(project) && JavaPreferencesSettings.getCodeGenerationSettings(project).overrideAnnotation) {
		final MarkerAnnotation annotation= ast.newMarkerAnnotation();
		annotation.setTypeName(ast.newSimpleName("Override")); //$NON-NLS-1$
		newMethod.modifiers().add(annotation);
	}
	copyAnnotations(oldMethod, newMethod);
	newMethod.modifiers().addAll(ASTNodeFactory.newModifiers(ast, info.getNewModifiersForCopyInSubclass(oldMethod.getModifiers())));
	newMethod.setName(ast.newSimpleName(oldMethod.getName().getIdentifier()));
	copyReturnType(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping);
	copyParameters(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping);
	copyThrownExceptions(oldMethod, newMethod);
	copyTypeParameters(oldMethod, newMethod);
	return newMethod;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:27,代码来源:PushDownRefactoringProcessor.java

示例3: getAssignedValue

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private Expression getAssignedValue(ParameterObjectFactory pof, String parameterName, IJavaProject javaProject, RefactoringStatus status, ASTRewrite rewrite, ParameterInfo pi, boolean useSuper, ITypeBinding typeBinding, Expression qualifier, ASTNode replaceNode, ITypeRoot typeRoot) {
	AST ast= rewrite.getAST();
	boolean is50OrHigher= JavaModelUtil.is50OrHigher(javaProject);
	Expression assignedValue= handleSimpleNameAssignment(replaceNode, pof, parameterName, ast, javaProject, useSuper);
	if (assignedValue == null) {
		NullLiteral marker= qualifier == null ? null : ast.newNullLiteral();
		Expression fieldReadAccess= pof.createFieldReadAccess(pi, parameterName, ast, javaProject, useSuper, marker);
		assignedValue= GetterSetterUtil.getAssignedValue(replaceNode, rewrite, fieldReadAccess, typeBinding, is50OrHigher);
		boolean markerReplaced= replaceMarker(rewrite, qualifier, assignedValue, marker);
		if (markerReplaced) {
			switch (qualifier.getNodeType()) {
				case ASTNode.METHOD_INVOCATION:
				case ASTNode.CLASS_INSTANCE_CREATION:
				case ASTNode.SUPER_METHOD_INVOCATION:
				case ASTNode.PARENTHESIZED_EXPRESSION:
					status.addWarning(RefactoringCoreMessages.ExtractClassRefactoring_warning_semantic_change, JavaStatusContext.create(typeRoot, replaceNode));
					break;
			}
		}
	}
	return assignedValue;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:ExtractClassRefactoring.java

示例4: satisfiesPreconditions

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
@Override
public IStatus satisfiesPreconditions() {
	ForStatement statement= getForStatement();
	CompilationUnit ast= (CompilationUnit)statement.getRoot();

	IJavaElement javaElement= ast.getJavaElement();
	if (javaElement == null)
		return ERROR_STATUS;

	if (!JavaModelUtil.is50OrHigher(javaElement.getJavaProject()))
		return ERROR_STATUS;

	if (!validateInitializers(statement))
		return ERROR_STATUS;

	if (!validateExpression(statement))
		return ERROR_STATUS;

	if (!validateUpdaters(statement))
		return ERROR_STATUS;

	if (!validateBody(statement))
		return ERROR_STATUS;

	return Status.OK_STATUS;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:27,代码来源:ConvertForLoopOperation.java

示例5: containerChanged

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
@Override
protected IStatus containerChanged() {
	IStatus status= super.containerChanged();
    IPackageFragmentRoot root= getPackageFragmentRoot();
	if ((fTypeKind == ANNOTATION_TYPE || fTypeKind == ENUM_TYPE) && !status.matches(IStatus.ERROR)) {
    	if (root != null && !JavaModelUtil.is50OrHigher(root.getJavaProject())) {
    		// error as createType will fail otherwise (bug 96928)
			return new StatusInfo(IStatus.ERROR, Messages.format(NewWizardMessages.NewTypeWizardPage_warning_NotJDKCompliant, BasicElementLabels.getJavaElementName(root.getJavaProject().getElementName())));
    	}
    	if (fTypeKind == ENUM_TYPE) {
	    	try {
	    	    // if findType(...) == null then Enum is unavailable
	    	    if (findType(root.getJavaProject(), "java.lang.Enum") == null) //$NON-NLS-1$
	    	        return new StatusInfo(IStatus.WARNING, NewWizardMessages.NewTypeWizardPage_warning_EnumClassNotFound);
	    	} catch (JavaModelException e) {
	    	    JavaPlugin.log(e);
	    	}
    	}
    }

	fCurrPackageCompletionProcessor.setPackageFragmentRoot(root);
	if (root != null) {
		fEnclosingTypeCompletionProcessor.setPackageFragment(root.getPackageFragment("")); //$NON-NLS-1$
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:27,代码来源:NewTypeWizardPage.java

示例6: findAllTypes

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private TypeNameMatch[] findAllTypes(String simpleTypeName, IJavaSearchScope searchScope, SimpleName nameNode, IProgressMonitor monitor, ICompilationUnit cu) throws JavaModelException {
	boolean is50OrHigher= JavaModelUtil.is50OrHigher(cu.getJavaProject());

	int typeKinds= SimilarElementsRequestor.ALL_TYPES;
	if (nameNode != null) {
		typeKinds= ASTResolving.getPossibleTypeKinds(nameNode, is50OrHigher);
	}

	ArrayList<TypeNameMatch> typeInfos= new ArrayList<TypeNameMatch>();
	TypeNameMatchCollector requestor= new TypeNameMatchCollector(typeInfos);
	new SearchEngine().searchAllTypeNames(null, 0, simpleTypeName.toCharArray(), SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE, getSearchForConstant(typeKinds), searchScope, requestor, IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH, monitor);

	ArrayList<TypeNameMatch> typeRefsFound= new ArrayList<TypeNameMatch>(typeInfos.size());
	for (int i= 0, len= typeInfos.size(); i < len; i++) {
		TypeNameMatch curr= typeInfos.get(i);
		if (curr.getPackageName().length() > 0) { // do not suggest imports from the default package
			if (isOfKind(curr, typeKinds, is50OrHigher) && isVisible(curr, cu)) {
				typeRefsFound.add(curr);
			}
		}
	}
	return typeRefsFound.toArray(new TypeNameMatch[typeRefsFound.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:JavaContext.java

示例7: findAllTypes

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private TypeNameMatch[] findAllTypes(String simpleTypeName, IJavaSearchScope searchScope, SimpleName nameNode, IProgressMonitor monitor) throws JavaModelException {
	boolean is50OrHigher= JavaModelUtil.is50OrHigher(fCompilationUnit.getJavaProject());

	int typeKinds= SimilarElementsRequestor.ALL_TYPES;
	if (nameNode != null) {
		typeKinds= ASTResolving.getPossibleTypeKinds(nameNode, is50OrHigher);
	}

	ArrayList<TypeNameMatch> typeInfos= new ArrayList<TypeNameMatch>();
	TypeNameMatchCollector requestor= new TypeNameMatchCollector(typeInfos);
	int matchMode= SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
	new SearchEngine().searchAllTypeNames(null, matchMode, simpleTypeName.toCharArray(), matchMode, getSearchForConstant(typeKinds), searchScope, requestor, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, monitor);

	ArrayList<TypeNameMatch> typeRefsFound= new ArrayList<TypeNameMatch>(typeInfos.size());
	for (int i= 0, len= typeInfos.size(); i < len; i++) {
		TypeNameMatch curr= typeInfos.get(i);
		if (curr.getPackageName().length() > 0) { // do not suggest imports from the default package
			if (isOfKind(curr, typeKinds, is50OrHigher) && isVisible(curr)) {
				typeRefsFound.add(curr);
			}
		}
	}
	return typeRefsFound.toArray(new TypeNameMatch[typeRefsFound.size()]);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:25,代码来源:AddImportsOperation.java

示例8: createAbstractMethod

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private void createAbstractMethod(final IMethod sourceMethod, final CompilationUnitRewrite sourceRewriter, final CompilationUnit declaringCuNode, final AbstractTypeDeclaration destination, final TypeVariableMaplet[] mapping, final CompilationUnitRewrite targetRewrite, final Map<IMember, IncomingMemberVisibilityAdjustment> adjustments, final IProgressMonitor monitor, final RefactoringStatus status) throws JavaModelException {
	final MethodDeclaration oldMethod= ASTNodeSearchUtil.getMethodDeclarationNode(sourceMethod, declaringCuNode);
	if (JavaModelUtil.is50OrHigher(sourceMethod.getJavaProject()) && (fSettings.overrideAnnotation || JavaCore.ERROR.equals(sourceMethod.getJavaProject().getOption(JavaCore.COMPILER_PB_MISSING_OVERRIDE_ANNOTATION, true)))) {
		final MarkerAnnotation annotation= sourceRewriter.getAST().newMarkerAnnotation();
		annotation.setTypeName(sourceRewriter.getAST().newSimpleName("Override")); //$NON-NLS-1$
		sourceRewriter.getASTRewrite().getListRewrite(oldMethod, MethodDeclaration.MODIFIERS2_PROPERTY).insertFirst(annotation, sourceRewriter.createCategorizedGroupDescription(RefactoringCoreMessages.PullUpRefactoring_add_override_annotation, SET_PULL_UP));
	}
	final MethodDeclaration newMethod= targetRewrite.getAST().newMethodDeclaration();
	newMethod.setBody(null);
	newMethod.setConstructor(false);
	newMethod.setExtraDimensions(oldMethod.getExtraDimensions());
	newMethod.setJavadoc(null);
	int modifiers= getModifiersWithUpdatedVisibility(sourceMethod, Modifier.ABSTRACT | JdtFlags.clearFlag(Modifier.NATIVE | Modifier.FINAL, sourceMethod.getFlags()), adjustments, monitor, false, status);
	if (oldMethod.isVarargs())
		modifiers&= ~Flags.AccVarargs;
	newMethod.modifiers().addAll(ASTNodeFactory.newModifiers(targetRewrite.getAST(), modifiers));
	newMethod.setName(((SimpleName) ASTNode.copySubtree(targetRewrite.getAST(), oldMethod.getName())));
	copyReturnType(targetRewrite.getASTRewrite(), getDeclaringType().getCompilationUnit(), oldMethod, newMethod, mapping);
	copyParameters(targetRewrite.getASTRewrite(), getDeclaringType().getCompilationUnit(), oldMethod, newMethod, mapping);
	copyThrownExceptions(oldMethod, newMethod);
	ImportRewriteContext context= new ContextSensitiveImportRewriteContext(destination, targetRewrite.getImportRewrite());
	ImportRewriteUtil.addImports(targetRewrite, context, newMethod, new HashMap<Name, String>(), new HashMap<Name, String>(), false);
	targetRewrite.getASTRewrite().getListRewrite(destination, destination.getBodyDeclarationsProperty()).insertAt(newMethod, ASTNodes.getInsertionIndex(newMethod, destination.bodyDeclarations()), targetRewrite.createCategorizedGroupDescription(RefactoringCoreMessages.PullUpRefactoring_add_abstract_method, SET_PULL_UP));
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:25,代码来源:PullUpRefactoringProcessor.java

示例9: createFix

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private static Java50Fix createFix(CompilationUnit compilationUnit, IProblemLocation problem, String annotation, String label) {
	ICompilationUnit cu= (ICompilationUnit)compilationUnit.getJavaElement();
	if (!JavaModelUtil.is50OrHigher(cu.getJavaProject()))
		return null;

	ASTNode selectedNode= problem.getCoveringNode(compilationUnit);
	if (selectedNode == null)
		return null;

	ASTNode declaringNode= getDeclaringNode(selectedNode);
	if (!(declaringNode instanceof BodyDeclaration))
		return null;

	BodyDeclaration declaration= (BodyDeclaration) declaringNode;

	AnnotationRewriteOperation operation= new AnnotationRewriteOperation(declaration, annotation);

	return new Java50Fix(label, compilationUnit, new CompilationUnitRewriteOperation[] {operation});
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:20,代码来源:Java50Fix.java

示例10: ImportReferencesCollector

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private ImportReferencesCollector(IJavaProject project, CompilationUnit astRoot, Region rangeLimit, boolean skipMethodBodies, Collection<SimpleName> resultingTypeImports, Collection<SimpleName> resultingStaticImports) {
	super(processJavadocComments(astRoot));
	fTypeImports= resultingTypeImports;
	fStaticImports= resultingStaticImports;
	fSubRange= rangeLimit;
	if (project == null || !JavaModelUtil.is50OrHigher(project)) {
		fStaticImports= null; // do not collect
	}
	fASTRoot= astRoot; // can be null
	fSkipMethodBodies= skipMethodBodies;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:12,代码来源:ImportReferencesCollector.java

示例11: superClassChanged

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
/**
 * Hook method that gets called when the superclass name has changed. The method
 * validates the superclass name and returns the status of the validation.
 * <p>
 * Subclasses may extend this method to perform their own validation.
 * </p>
 *
 * @return the status of the validation
 */
protected IStatus superClassChanged() {
	StatusInfo status= new StatusInfo();
	IPackageFragmentRoot root= getPackageFragmentRoot();
	fSuperClassDialogField.enableButton(root != null);

	fSuperClassStubTypeContext= null;

	String sclassName= getSuperClass();
	if (sclassName.length() == 0) {
		// accept the empty field (stands for java.lang.Object)
		return status;
	}

	if (root != null) {
		Type type= TypeContextChecker.parseSuperClass(sclassName);
		if (type == null) {
			status.setError(NewWizardMessages.NewTypeWizardPage_error_InvalidSuperClassName);
			return status;
		}
		if (type instanceof ParameterizedType && ! JavaModelUtil.is50OrHigher(root.getJavaProject())) {
			status.setError(NewWizardMessages.NewTypeWizardPage_error_SuperClassNotParameterized);
			return status;
		}
	} else {
		status.setError(""); //$NON-NLS-1$
	}
	return status;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:38,代码来源:NewTypeWizardPage.java

示例12: createMethodComment

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private void createMethodComment(MethodDeclaration newDeclaration, IMethodBinding copyFrom) throws CoreException {
	if (fSettings.createComments) {
		String string= CodeGeneration.getMethodComment(fRewrite.getCu(), fType.getQualifiedName(), newDeclaration, copyFrom, StubUtility.getLineDelimiterUsed(fRewrite.getCu()));
		if (string != null) {
			Javadoc javadoc= (Javadoc) fRewrite.getASTRewrite().createStringPlaceholder(string, ASTNode.JAVADOC);
			newDeclaration.setJavadoc(javadoc);
		}
	}
	IJavaProject project= fUnit.getJavaElement().getJavaProject();
	if (fSettings.overrideAnnotation && JavaModelUtil.is50OrHigher(project))
		StubUtility2.addOverrideAnnotation(project, fRewrite.getASTRewrite(), newDeclaration, copyFrom);
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:GenerateHashCodeEqualsOperation.java

示例13: addOverridingDeprecatedMethodProposal

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
public static void addOverridingDeprecatedMethodProposal(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {

		ICompilationUnit cu= context.getCompilationUnit();

		ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot());
		if (!(selectedNode instanceof MethodDeclaration)) {
			return;
		}
		boolean is50OrHigher= JavaModelUtil.is50OrHigher(cu.getJavaProject());
		MethodDeclaration methodDecl= (MethodDeclaration) selectedNode;
		AST ast= methodDecl.getAST();
		ASTRewrite rewrite= ASTRewrite.create(ast);
		if (is50OrHigher) {
			Annotation annot= ast.newMarkerAnnotation();
			annot.setTypeName(ast.newName("Deprecated")); //$NON-NLS-1$
			rewrite.getListRewrite(methodDecl, methodDecl.getModifiersProperty()).insertFirst(annot, null);
		}
		Javadoc javadoc= methodDecl.getJavadoc();
		if (javadoc != null || !is50OrHigher) {
			if (!is50OrHigher) {
				javadoc= ast.newJavadoc();
				rewrite.set(methodDecl, MethodDeclaration.JAVADOC_PROPERTY, javadoc, null);
			}
			TagElement newTag= ast.newTagElement();
			newTag.setTagName(TagElement.TAG_DEPRECATED);
			JavadocTagsSubProcessor.insertTag(rewrite.getListRewrite(javadoc, Javadoc.TAGS_PROPERTY), newTag, null);
		}

		String label= CorrectionMessages.ModifierCorrectionSubProcessor_overrides_deprecated_description;
		Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
		ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, IProposalRelevance.OVERRIDES_DEPRECATED, image);
		proposals.add(proposal);
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:ModifierCorrectionSubProcessor.java

示例14: addOverridingDeprecatedMethodProposal

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
public static void addOverridingDeprecatedMethodProposal(IInvocationContext context, IProblemLocation problem, Collection<ICommandAccess> proposals) {

		ICompilationUnit cu= context.getCompilationUnit();

		ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot());
		if (!(selectedNode instanceof MethodDeclaration)) {
			return;
		}
		boolean is50OrHigher= JavaModelUtil.is50OrHigher(cu.getJavaProject());
		MethodDeclaration methodDecl= (MethodDeclaration) selectedNode;
		AST ast= methodDecl.getAST();
		ASTRewrite rewrite= ASTRewrite.create(ast);
		if (is50OrHigher) {
			Annotation annot= ast.newMarkerAnnotation();
			annot.setTypeName(ast.newName("Deprecated")); //$NON-NLS-1$
			rewrite.getListRewrite(methodDecl, methodDecl.getModifiersProperty()).insertFirst(annot, null);
		}
		Javadoc javadoc= methodDecl.getJavadoc();
		if (javadoc != null || !is50OrHigher) {
			if (!is50OrHigher) {
				javadoc= ast.newJavadoc();
				rewrite.set(methodDecl, MethodDeclaration.JAVADOC_PROPERTY, javadoc, null);
			}
			TagElement newTag= ast.newTagElement();
			newTag.setTagName(TagElement.TAG_DEPRECATED);
			JavadocTagsSubProcessor.insertTag(rewrite.getListRewrite(javadoc, Javadoc.TAGS_PROPERTY), newTag, null);
		}

		String label= CorrectionMessages.ModifierCorrectionSubProcessor_overrides_deprecated_description;
		Image image= JavaPluginImages.get(JavaPluginImages.IMG_CORRECTION_CHANGE);
		ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 15, image);
		proposals.add(proposal);
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:34,代码来源:ModifierCorrectionSubProcessor.java

示例15: getPrimitiveTypeCode

import org.eclipse.jdt.internal.corext.util.JavaModelUtil; //导入方法依赖的package包/类
private PrimitiveType.Code getPrimitiveTypeCode(String type) {
	PrimitiveType.Code code= PrimitiveType.toCode(type);
	if (code != null) {
		return code;
	}
	if (fEnclosingElement != null && JavaModelUtil.is50OrHigher(fEnclosingElement.getJavaProject())) {
		if (code == PrimitiveType.SHORT) {
			if ("java.lang.Short".equals(type)) { //$NON-NLS-1$
				return code;
			}
		} else if (code == PrimitiveType.INT) {
			if ("java.lang.Integer".equals(type)) { //$NON-NLS-1$
				return code;
			}
		} else if (code == PrimitiveType.LONG) {
			if ("java.lang.Long".equals(type)) { //$NON-NLS-1$
				return code;
			}
		} else if (code == PrimitiveType.FLOAT) {
			if ("java.lang.Float".equals(type)) { //$NON-NLS-1$
				return code;
			}
		} else if (code == PrimitiveType.DOUBLE) {
			if ("java.lang.Double".equals(type)) { //$NON-NLS-1$
				return code;
			}
		} else if (code == PrimitiveType.CHAR) {
			if ("java.lang.Character".equals(type)) { //$NON-NLS-1$
				return code;
			}
		} else if (code == PrimitiveType.BYTE) {
			if ("java.lang.Byte".equals(type)) { //$NON-NLS-1$
				return code;
			}
		}
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:39,代码来源:ParameterGuesser.java


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