本文整理汇总了Java中org.netbeans.api.java.source.ElementHandle.signatureEquals方法的典型用法代码示例。如果您正苦于以下问题:Java ElementHandle.signatureEquals方法的具体用法?Java ElementHandle.signatureEquals怎么用?Java ElementHandle.signatureEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.api.java.source.ElementHandle
的用法示例。
在下文中一共展示了ElementHandle.signatureEquals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNodeForElement
import org.netbeans.api.java.source.ElementHandle; //导入方法依赖的package包/类
public ElementNode getNodeForElement(ElementHandle<Element> eh) {
if (getDescritption().elementHandle != null
&& eh.signatureEquals(getDescritption().elementHandle)) {
return this;
}
Children ch = getChildren();
if (ch instanceof ElementChilren) {
for (Node sub : ch.getNodes()) {
ElementNode result = ((ElementNode) sub).getNodeForElement(eh);
if (result != null) {
return result;
}
}
}
return null;
}
示例2: signatureEquals
import org.netbeans.api.java.source.ElementHandle; //导入方法依赖的package包/类
public static boolean signatureEquals(
@NonNull final ElementHandle<Element> handle,
@NonNull final Element element) {
if (handle == null) {
return false;
}
//ElementKind OTHER represents errors <any>, <none>.
//These are special errors which cannot be resolved
if (element.getKind() == ElementKind.OTHER) {
return false;
}
try {
return handle.signatureEquals(element);
} catch (IllegalArgumentException e) {
LOG.log(
Level.INFO,
"Unresolvable element: {0}, reason: {1}", //NOI18N
new Object[]{
element,
e.getMessage()
});
return false;
}
}
示例3: updateNavigatorSelection
import org.netbeans.api.java.source.ElementHandle; //导入方法依赖的package包/类
private void updateNavigatorSelection(CompilationInfo ci, TreePath tp) throws Exception {
final ClassMemberPanel cmp = ClassMemberPanel.getInstance();
if (cmp == null) {
return;
}
final ClassMemberPanelUI cmpUi = cmp.getClassMemberPanelUI();
if (!cmpUi.isAutomaticRefresh()) {
cmpUi.getTask().runImpl(ci, false);
lastEhForNavigator = null;
}
// Try to find the declaration we are in
final Pair<Element,TreePath> p = outerElement(ci, tp);
if (p != null) {
final Element e = p.first();
Runnable action = null;
if (e == null) {
//Directive
lastEhForNavigator = null;
action = () -> {
cmp.selectTreePath(TreePathHandle.create(p.second(), ci));
};
} else if (e.getKind() != ElementKind.OTHER) {
final ElementHandle<Element> eh = ElementHandle.create(e);
if (lastEhForNavigator != null && eh.signatureEquals(lastEhForNavigator)) {
return;
}
lastEhForNavigator = eh;
action = () -> {
cmp.selectElement(eh);
};
}
if (action != null) {
SwingUtilities.invokeLater(action);
}
}
}