Java Code Examples for com.sun.source.tree.Tree.Kind#MODULE
The following examples show how to use
com.sun.source.tree.Tree.Kind#MODULE .
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: GoToSupport.java From netbeans with Apache License 2.0 | 6 votes |
private static TreePath adjustPathForModuleName(TreePath path) { TreePath tp = path; while (tp != null && (tp.getLeaf().getKind() == Kind.IDENTIFIER || tp.getLeaf().getKind() == Kind.MEMBER_SELECT)) { Tree parent = tp.getParentPath().getLeaf(); if (parent.getKind() == Kind.MODULE && ((ModuleTree)parent).getName() == tp.getLeaf()) { return tp.getParentPath(); } if (parent.getKind() == Kind.REQUIRES && ((RequiresTree)parent).getModuleName() == tp.getLeaf() || parent.getKind() == Kind.EXPORTS && ((ExportsTree)parent).getModuleNames() != null && ((ExportsTree)parent).getModuleNames().contains(tp.getLeaf()) || parent.getKind() == Kind.OPENS && ((OpensTree)parent).getModuleNames() != null && ((OpensTree)parent).getModuleNames().contains(tp.getLeaf())) { return tp; } tp = tp.getParentPath(); } return path; }
Example 2
Source File: HintTestTest.java From netbeans with Apache License 2.0 | 4 votes |
@TriggerTreeKind(Kind.MODULE) public static ErrorDescription hint(HintContext ctx) { return ErrorDescriptionFactory.forTree(ctx, ctx.getPath(), "Test"); }