Example usage for org.eclipse.jdt.core Flags AccAnnotation

List of usage examples for org.eclipse.jdt.core Flags AccAnnotation

Introduction

In this page you can find the example usage for org.eclipse.jdt.core Flags AccAnnotation.

Prototype

int AccAnnotation

To view the source code for org.eclipse.jdt.core Flags AccAnnotation.

Click Source Link

Document

Annotation property flag (added in J2SE 1.5).

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.search.BasicSearchEngine.java

License:Open Source License

boolean match(char patternTypeSuffix, int modifiers) {
    switch (patternTypeSuffix) {
    case IIndexConstants.CLASS_SUFFIX:
        return (modifiers & (Flags.AccAnnotation | Flags.AccInterface | Flags.AccEnum)) == 0;
    case IIndexConstants.CLASS_AND_INTERFACE_SUFFIX:
        return (modifiers & (Flags.AccAnnotation | Flags.AccEnum)) == 0;
    case IIndexConstants.CLASS_AND_ENUM_SUFFIX:
        return (modifiers & (Flags.AccAnnotation | Flags.AccInterface)) == 0;
    case IIndexConstants.INTERFACE_SUFFIX:
        return (modifiers & Flags.AccInterface) != 0;
    case IIndexConstants.INTERFACE_AND_ANNOTATION_SUFFIX:
        return (modifiers & (Flags.AccInterface | Flags.AccAnnotation)) != 0;
    case IIndexConstants.ENUM_SUFFIX:
        return (modifiers & Flags.AccEnum) != 0;
    case IIndexConstants.ANNOTATION_TYPE_SUFFIX:
        return (modifiers & Flags.AccAnnotation) != 0;
    }/*from w w  w .j  a v  a2  s .  c  om*/
    return true;
}

From source file:org.eclipse.emf.test.tools.merger.facade.FacadeAPITest.java

License:Open Source License

@Test
public void testFacadeFlags() {
    assertEquals(Flags.AccAbstract, FacadeFlags.ABSTRACT);
    assertEquals(Flags.AccAnnotation, FacadeFlags.ANNOTATION);
    assertEquals(Flags.AccBridge, FacadeFlags.BRIDGE);
    assertEquals(Flags.AccDefault, FacadeFlags.DEFAULT);
    assertEquals(Flags.AccDeprecated, FacadeFlags.DEPRECATED);
    assertEquals(Flags.AccEnum, FacadeFlags.ENUM);
    assertEquals(Flags.AccFinal, FacadeFlags.FINAL);
    assertEquals(Flags.AccInterface, FacadeFlags.INTERFACE);
    assertEquals(Flags.AccNative, FacadeFlags.NATIVE);
    assertEquals(Flags.AccPrivate, FacadeFlags.PRIVATE);
    assertEquals(Flags.AccProtected, FacadeFlags.PROTECTED);
    assertEquals(Flags.AccPublic, FacadeFlags.PUBLIC);
    assertEquals(Flags.AccStatic, FacadeFlags.STATIC);
    assertEquals(Flags.AccStrictfp, FacadeFlags.STRICTFP);
    assertEquals(Flags.AccSuper, FacadeFlags.SUPER);
    assertEquals(Flags.AccSynchronized, FacadeFlags.SYNCHRONIZED);
    assertEquals(Flags.AccSynthetic, FacadeFlags.SYNTHETIC);
    assertEquals(Flags.AccTransient, FacadeFlags.TRANSIENT);
    assertEquals(Flags.AccVarargs, FacadeFlags.VARARGS);
    assertEquals(Flags.AccVolatile, FacadeFlags.VOLATILE);
}

From source file:org.eclipse.xtext.common.types.xtext.ui.JdtTypesProposalProvider.java

License:Open Source License

/**
 * 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./*w ww. ja  v  a2  s. c o m*/
 * @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;
}

From source file:org.eclipse.xtext.xbase.ui.labeling.XbaseImages.java

License:Open Source License

public Image forAnnotation(JvmVisibility visibility) {
    return getJdtImage(JavaElementImageProvider.getTypeImageDescriptor(false, true,
            toFlags(visibility) | Flags.AccAnnotation, false));
}

From source file:org.eclipse.xtext.xbase.ui.labeling.XbaseImages2.java

License:Open Source License

/**
 * @param visibility//from  ww  w .  j  a va  2s.c  om
 *            the visibility of the annotation type
 * @param adornments
 *            OR-ed flags from {@link JavaElementImageDescriptor} to denote decorations
 */
public ImageDescriptor forAnnotation(JvmVisibility visibility, int adornments) {
    return getDecorated(getTypeImageDescriptor(true, true, toFlags(visibility) | Flags.AccAnnotation, false),
            adornments);
}

From source file:org.summer.dsl.xbase.ui.labeling.XbaseImages2.java

License:Open Source License

/**
 * @param visibility//from  w ww  .  j  av a 2 s .co  m
 *            the visibility of the annotation type
 * @param adornments
 *            OR-ed flags from {@link JavaElementImageDescriptor} to denote decorations
 */
public ImageDescriptor forAnnotation(JvmVisibility visibility, int adornments) {
    return getDecorated(getTypeImageDescriptor(false, true, toFlags(visibility) | Flags.AccAnnotation, false),
            adornments);
}