org.eclipse.xtext.common.types.util.DeprecationUtil Java Examples
The following examples show how to use
org.eclipse.xtext.common.types.util.DeprecationUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XbaseImageAdornments.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected int _get(JvmOperation jvmOperation) { int abstract0 = or(0, jvmOperation.isAbstract(), ABSTRACT); int final0 = or(abstract0, jvmOperation.isFinal(), FINAL); int synchronized0 = or(final0, jvmOperation.isSynchronized(), SYNCHRONIZED); int static0 = or(synchronized0, jvmOperation.isStatic(), STATIC); int deprecated0 = or(static0, DeprecationUtil.isDeprecatedMember(jvmOperation), DEPRECATED); int adornment = or(deprecated0, jvmOperation.isNative(), 0x4000);// JavaElementImageDescription.NATIVE not available before 3.7 Resource resource = jvmOperation.eResource(); if (resource != null && resource.getResourceSet() != null) { JvmOperation overriddenOperation = overrideHelper.findOverriddenOperation(jvmOperation); if (overriddenOperation != null) { return (adornment | getOverrideAdornment(overriddenOperation)); } } return adornment; }
Example #2
Source File: XtendHighlightingCalculator.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
protected void highlightDeprecatedXtendAnnotationTarget(IHighlightedPositionAcceptor acceptor, XtendAnnotationTarget target, XAnnotation annotation){ JvmType annotationType = annotation.getAnnotationType(); if(annotationType instanceof JvmAnnotationType && DeprecationUtil.isDeprecatedAnnotation((JvmAnnotationType) annotationType)){ if (target instanceof XtendConstructor) { ICompositeNode compositeNode = NodeModelUtils.getNode(target); for(ILeafNode leaf: compositeNode.getLeafNodes()) { if (leaf.getGrammarElement() == xtendGrammarAccess.getMemberAccess().getNewKeyword_2_2_2()) { highlightNode(acceptor, leaf, XbaseHighlightingStyles.DEPRECATED_MEMBERS); highlightNode(acceptor, leaf, HighlightingStyles.KEYWORD_ID); return; } } } else { EStructuralFeature nameFeature = target.eClass().getEStructuralFeature("name"); if (nameFeature!=null) { highlightFeature(acceptor, target, nameFeature, XbaseHighlightingStyles.DEPRECATED_MEMBERS); } } } }
Example #3
Source File: XtendValidator.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Override public void checkDeprecated(XImportDeclaration decl) { XtendFile file = EcoreUtil2.getContainerOfType(decl, XtendFile.class); if (file != null) { for (XtendTypeDeclaration t : file.getXtendTypes()) { for (EObject e : jvmModelAssociations.getJvmElements(t)) { if (e instanceof JvmAnnotationTarget) { if (DeprecationUtil.isDeprecated((JvmAnnotationTarget) e)) { return; } } } if (hasAnnotation(t, Deprecated.class)) { return; } } } super.checkDeprecated(decl); }
Example #4
Source File: XbaseHighlightingCalculator.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected void highlightDeprecation(IHighlightedPositionAcceptor acceptor, EObject referencer, EReference reference, EObject resolvedReferencedObject) { if (resolvedReferencedObject instanceof JvmAnnotationTarget) { JvmAnnotationTarget annoTarget = (JvmAnnotationTarget) resolvedReferencedObject; if(DeprecationUtil.isTransitivelyDeprecated(annoTarget)) highlightFeature(acceptor, referencer, reference, DEPRECATED_MEMBERS); } }
Example #5
Source File: XbaseImageAdornments.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected int _get(JvmField jvmField) { int final0 = or(0, jvmField.isFinal(), FINAL); int static0 = or(final0, jvmField.isStatic(), STATIC); int deprecated0 = or(static0, DeprecationUtil.isDeprecatedMember(jvmField), DEPRECATED); int volatile0 = or(deprecated0, jvmField.isVolatile(), VOLATILE); return or(volatile0, jvmField.isTransient(), TRANSIENT); }
Example #6
Source File: XbaseHighlightingCalculator.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected void computeFeatureCallHighlighting(XAbstractFeatureCall featureCall, IHighlightedPositionAcceptor acceptor) { JvmIdentifiableElement feature = featureCall.getFeature(); if (feature != null && !feature.eIsProxy()) { if (feature instanceof XVariableDeclaration) { if (!SPECIAL_FEATURE_NAMES.contains(((XVariableDeclaration) feature).getName())) { // highlighting of special identifiers is done separately, so it's omitted here highlightFeatureCall(featureCall, acceptor, LOCAL_VARIABLE); if (!((XVariableDeclaration) feature).isWriteable()) { highlightFeatureCall(featureCall, acceptor, LOCAL_FINAL_VARIABLE); } } } else if (feature instanceof JvmFormalParameter) { if (!SPECIAL_FEATURE_NAMES.contains(((JvmFormalParameter) feature).getName())) { // highlighting of special identifiers is done separately, so it's omitted here final EObject eContainingFeature = feature.eContainingFeature(); if (eContainingFeature == TypesPackage.Literals.JVM_EXECUTABLE__PARAMETERS || eContainingFeature == XbasePackage.Literals.XCLOSURE__DECLARED_FORMAL_PARAMETERS) { // which is the case for constructors and methods highlightFeatureCall(featureCall, acceptor, PARAMETER_VARIABLE); } else { // covers parameters of for and template expr FOR loops, as well as switch statements highlightFeatureCall(featureCall, acceptor, LOCAL_VARIABLE); highlightFeatureCall(featureCall, acceptor, LOCAL_FINAL_VARIABLE); } } } else if (feature instanceof JvmTypeParameter) { highlightFeatureCall(featureCall, acceptor, TYPE_VARIABLE); } else if (feature instanceof JvmField) { highlightFeatureCall(featureCall, acceptor, FIELD); if (((JvmField) feature).isStatic()) { highlightFeatureCall(featureCall, acceptor, STATIC_FIELD); if (((JvmField) feature).isFinal()) { highlightFeatureCall(featureCall, acceptor, STATIC_FINAL_FIELD); } } } else if (feature instanceof JvmOperation && !featureCall.isOperation()) { JvmOperation jvmOperation = (JvmOperation) feature; highlightFeatureCall(featureCall, acceptor, METHOD); if (jvmOperation.isAbstract()) { highlightFeatureCall(featureCall, acceptor, ABSTRACT_METHOD_INVOCATION); } if (jvmOperation.isStatic()) { highlightFeatureCall(featureCall, acceptor, STATIC_METHOD_INVOCATION); } if (featureCall.isExtension() || isExtensionWithImplicitFirstArgument(featureCall)) { highlightFeatureCall(featureCall, acceptor, EXTENSION_METHOD_INVOCATION); } } else if (feature instanceof JvmDeclaredType) { highlightReferenceJvmType(acceptor, featureCall, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, feature); } if(feature instanceof JvmAnnotationTarget && DeprecationUtil.isTransitivelyDeprecated((JvmAnnotationTarget)feature)){ highlightFeatureCall(featureCall, acceptor, DEPRECATED_MEMBERS); } } }
Example #7
Source File: XbaseImageAdornments.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected int _get(JvmDeclaredType jvmDeclaredType) { int abstract0 = or(0, jvmDeclaredType.isAbstract(), ABSTRACT); int final0 = or(abstract0, jvmDeclaredType.isFinal(), FINAL); int static0 = or(final0, jvmDeclaredType.isStatic(), STATIC); return or(static0, DeprecationUtil.isDeprecatedMember(jvmDeclaredType), DEPRECATED); }
Example #8
Source File: XbaseImageAdornments.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
protected int _get(JvmConstructor jvmConstructor) { return or(CONSTRUCTOR, DeprecationUtil.isDeprecatedMember(jvmConstructor), DEPRECATED); }
Example #9
Source File: JdtTypesProposalProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
/** * Compute the JVM modifiers that corresponds to the given description. * * <p>This function fixes the issue related to the missed modifiers given to the content assist. * * @param context the current content assist context. * @param description the description. * @return the JVM modifiers. * @since 2.11 */ protected int getDirtyStateModifiers(ContentAssistContext context, IEObjectDescription description) { EObject eobject = description.getEObjectOrProxy(); if (eobject.eIsProxy()) { eobject = EcoreUtil.resolve(eobject, context.getResource().getResourceSet()); } int accessModifiers = Flags.AccPublic; int otherModifiers = 0; if (eobject instanceof JvmMember) { final JvmMember member = (JvmMember) eobject; switch (member.getVisibility()) { case PUBLIC: accessModifiers = Flags.AccPublic; break; case PRIVATE: accessModifiers = Flags.AccPrivate; break; case PROTECTED: accessModifiers = Flags.AccProtected; break; case DEFAULT: default: accessModifiers = Flags.AccDefault; break; } if (DeprecationUtil.isDeprecated(member)) { otherModifiers |= Flags.AccDeprecated; } if (eobject instanceof JvmDeclaredType) { final JvmDeclaredType type = (JvmDeclaredType) eobject; if (type.isFinal()) { otherModifiers |= Flags.AccFinal; } if (type.isAbstract()) { otherModifiers |= Flags.AccAbstract; } if (type.isStatic()) { otherModifiers |= Flags.AccStatic; } if (type instanceof JvmEnumerationType) { otherModifiers |= Flags.AccEnum; } else if (type instanceof JvmAnnotationType) { otherModifiers |= Flags.AccAnnotation; } else if (type instanceof JvmGenericType) { if (((JvmGenericType) type).isInterface()) { otherModifiers |= Flags.AccInterface; } } } } return accessModifiers | otherModifiers; }
Example #10
Source File: JvmMemberDeclarationImpl.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public boolean isDeprecated() { return DeprecationUtil.isDeprecatedMember(this.getDelegate()); }