Java Code Examples for javax.lang.model.element.ModuleElement#DirectiveKind

The following examples show how to use javax.lang.model.element.ModuleElement#DirectiveKind . 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: ElementIcons.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Returns an icon for the given {@link ModuleElement.DirectiveKind}.
 * @param kind the {@link ModuleElement.DirectiveKind} to return an icon for.
 * @return the icon
 * @since 1.45
 */
public static Icon getModuleDirectiveIcon(@NonNull final ModuleElement.DirectiveKind kind) {
    Parameters.notNull("kind", kind);   //NOI18N
    switch (kind) {
        case EXPORTS:
            return ImageUtilities.loadImageIcon(EXPORTS_ICON, true);
        case REQUIRES:
            return ImageUtilities.loadImageIcon(REQUIRES_ICON, true);
        case USES:
            return ImageUtilities.loadImageIcon(USES_ICON, true);
        case PROVIDES:
            return ImageUtilities.loadImageIcon(PROVIDES_ICON, true);
        case OPENS:
            return ImageUtilities.loadImageIcon(OPENS_ICON, true);
        default:
            throw new IllegalArgumentException(kind.toString());
    }
}
 
Example 2
Source File: ElementNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NonNull
static Description directive(
        @NonNull final ClassMemberPanelUI ui,
        @NonNull final String name,
        @NonNull final TreePathHandle treePathHandle,
        @NonNull final ModuleElement.DirectiveKind kind,
        @NonNull final ClasspathInfo cpInfo,
        final long pos,
        @NonNull final Openable openable) {
    return new Description(
            ui,
            name,
            Union2.<ElementHandle<?>,TreePathHandle>createSecond(treePathHandle),
            ElementKind.OTHER,
            directivePosInKind(kind),
            cpInfo,
            EnumSet.of(Modifier.PUBLIC),
            pos,
            false,
            false,
            ()->ElementIcons.getModuleDirectiveIcon(kind),
            openable);
}
 
Example 3
Source File: ElementNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@NonNull
static Description directive(
        @NonNull final ClassMemberPanelUI ui,
        @NonNull final String name,
        @NonNull final ModuleElement.DirectiveKind kind,
        @NonNull final ClasspathInfo cpInfo,
        @NonNull final Openable openable) {
    return new Description(
            ui,
            name,
            null,
            ElementKind.OTHER,
            directivePosInKind(kind),
            cpInfo,
            EnumSet.of(Modifier.PUBLIC),
            -1,
            false,
            false,
            ()->ElementIcons.getModuleDirectiveIcon(kind),
            openable);
}
 
Example 4
Source File: ElementNode.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static int directivePosInKind(ModuleElement.DirectiveKind kind) {
    switch (kind) {
        case EXPORTS:
            return 0;
        case OPENS:
            return 1;
        case REQUIRES:
            return 2;
        case USES:
            return 3;
        case PROVIDES:
            return 4;
        default:
            return 100;
    }
}
 
Example 5
Source File: BreadCrumbsNodeImpl.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static ModuleElement.DirectiveKind directiveKind(Kind treeKind) {
    switch (treeKind) {
        case EXPORTS:
            return ModuleElement.DirectiveKind.EXPORTS;
        case PROVIDES:
            return ModuleElement.DirectiveKind.PROVIDES;
        case REQUIRES:
            return ModuleElement.DirectiveKind.REQUIRES;
        case USES:
            return ModuleElement.DirectiveKind.USES;
    }
    return null;
}
 
Example 6
Source File: Directive.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public ModuleElement.DirectiveKind getKind() {
    return ModuleElement.DirectiveKind.EXPORTS;
}
 
Example 7
Source File: Directive.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public ModuleElement.DirectiveKind getKind() {
    return ModuleElement.DirectiveKind.OPENS;
}
 
Example 8
Source File: Directive.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public ModuleElement.DirectiveKind getKind() {
    return ModuleElement.DirectiveKind.PROVIDES;
}
 
Example 9
Source File: Directive.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public ModuleElement.DirectiveKind getKind() {
    return ModuleElement.DirectiveKind.REQUIRES;
}
 
Example 10
Source File: Directive.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public ModuleElement.DirectiveKind getKind() {
    return ModuleElement.DirectiveKind.USES;
}
 
Example 11
Source File: Directive.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public ModuleElement.DirectiveKind getKind() {
    return ModuleElement.DirectiveKind.EXPORTS;
}
 
Example 12
Source File: Directive.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public ModuleElement.DirectiveKind getKind() {
    return ModuleElement.DirectiveKind.OPENS;
}
 
Example 13
Source File: Directive.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public ModuleElement.DirectiveKind getKind() {
    return ModuleElement.DirectiveKind.PROVIDES;
}
 
Example 14
Source File: Directive.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public ModuleElement.DirectiveKind getKind() {
    return ModuleElement.DirectiveKind.REQUIRES;
}
 
Example 15
Source File: Directive.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override @DefinedBy(Api.LANGUAGE_MODEL)
public ModuleElement.DirectiveKind getKind() {
    return ModuleElement.DirectiveKind.USES;
}