本文整理汇总了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;
}
}
示例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());
}
示例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));
}
}
}