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


Java ElementHandle.getKind方法代码示例

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


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

示例1: documentElement

import org.netbeans.modules.csl.api.ElementHandle; //导入方法依赖的package包/类
@Override
public Documentation documentElement(
        @NonNull final ParserResult info,
        @NonNull final ElementHandle element,
        @NonNull final Callable<Boolean> cancel) {
    switch (element.getKind()) {
        case KEYWORD:
            return Optional.ofNullable(Command.forHandle(element))
                .map((cmd) -> cmd.getDocumentation(cancel))
                .orElse(null);
        case OTHER:
            try {
                final URL url = ((DocHandle)element).getURI().toURL();
                final Future<String> becomesContent = DocDownloader.download(url, cancel);
                String content = null;
                while (cancel.call() != Boolean.TRUE) {
                    try {
                        content = becomesContent.get(250, TimeUnit.MILLISECONDS);
                        break;
                    } catch (TimeoutException timeout) {
                        //retry
                    }
                }
                return content == null ?
                        null :
                        DocDownloader.parseSection(content, url);
            } catch (Exception e) {
                return null;
            }
        default:
            return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:DockerfileCompletion.java

示例2: signatureEquals

import org.netbeans.modules.csl.api.ElementHandle; //导入方法依赖的package包/类
@Override
public boolean signatureEquals(@NonNull final ElementHandle handle) {
    return getKind() == handle.getKind() && getName().equals(handle.getName());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:Command.java

示例3: createAnnotations

import org.netbeans.modules.csl.api.ElementHandle; //导入方法依赖的package包/类
private void createAnnotations(ParserResult r, StyledDocument doc, Map<ElementHandle, Collection<? extends AlternativeLocation>> descriptions, Map<ElementHandle, ElementHandle> node2Parent, boolean overridden, List<IsOverriddenAnnotation> annotations) {
    if (descriptions != null) {
        for (Entry<ElementHandle, Collection<? extends AlternativeLocation>> e : descriptions.entrySet()) {
            OffsetRange range = e.getKey().getOffsetRange(r);

            if (range == null) {
                //XXX: log
                continue;
            }

            AnnotationType type;
            String dn;

            if (overridden) {
                ElementHandle enclosing = node2Parent.get(e.getKey());
                if ((enclosing != null && enclosing.getKind() == ElementKind.INTERFACE) || (e.getKey().getKind() == ElementKind.INTERFACE)) {
                    type = AnnotationType.HAS_IMPLEMENTATION;
                    dn = NbBundle.getMessage(ComputeAnnotations.class, "TP_HasImplementations");
                } else {
                    type = AnnotationType.IS_OVERRIDDEN;
                    dn = NbBundle.getMessage(ComputeAnnotations.class, "TP_IsOverridden");
                }
            } else {
                StringBuilder tooltip = new StringBuilder();
                boolean wasOverrides = false;

                boolean newline = false;

                for (AlternativeLocation loc : e.getValue()) {
                    if (newline) {
                        tooltip.append("\n"); //NOI18N
                    }

                    newline = true;

                    if (loc.getElement().getModifiers().contains(Modifier.ABSTRACT)) {
                        tooltip.append(NbBundle.getMessage(ComputeAnnotations.class, "TP_Implements", loc.getDisplayHtml(new GsfHtmlFormatter())));
                    } else {
                        tooltip.append(NbBundle.getMessage(ComputeAnnotations.class, "TP_Overrides", loc.getDisplayHtml(new GsfHtmlFormatter())));
                        wasOverrides = true;
                    }
                }
                
                if (wasOverrides) {
                    type = AnnotationType.OVERRIDES;
                } else {
                    type = AnnotationType.IMPLEMENTS;
                }

                dn = tooltip.toString();
            }

            Position pos = getPosition(doc, range.getStart());

            if (pos == null) {
                //#179304: possibly the position is outside document bounds (i.e. <0 or >doc.getLenght())
                continue;
            }

            List<OverrideDescription> ods = new LinkedList<OverrideDescription>();

            for (AlternativeLocation l : e.getValue()) {
                ods.add(new OverrideDescription(l, overridden));
            }
            
            annotations.add(new IsOverriddenAnnotation(doc, pos, type, dn, ods));
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:70,代码来源:ComputeAnnotations.java


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