Java Code Examples for org.eclipse.jdt.core.dom.IBinding#PACKAGE
The following examples show how to use
org.eclipse.jdt.core.dom.IBinding#PACKAGE .
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: Bindings.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public static String getImportName(IBinding binding) { ITypeBinding declaring= null; switch (binding.getKind()) { case IBinding.TYPE: return getRawQualifiedName((ITypeBinding) binding); case IBinding.PACKAGE: return binding.getName() + ".*"; //$NON-NLS-1$ case IBinding.METHOD: declaring= ((IMethodBinding) binding).getDeclaringClass(); break; case IBinding.VARIABLE: declaring= ((IVariableBinding) binding).getDeclaringClass(); if (declaring == null) { return binding.getName(); // array.length } break; default: return binding.getName(); } return JavaModelUtil.concatenateName(getRawQualifiedName(declaring), binding.getName()); }
Example 2
Source File: QuickAssistProcessor.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private static boolean getRenameLocalProposals(IInvocationContext context, ASTNode node, IProblemLocation[] locations, Collection<ICommandAccess> resultingCollections) { if (!(node instanceof SimpleName)) { return false; } SimpleName name= (SimpleName) node; IBinding binding= name.resolveBinding(); if (binding != null && binding.getKind() == IBinding.PACKAGE) { return false; } if (containsQuickFixableRenameLocal(locations)) { return false; } if (resultingCollections == null) { return true; } LinkedNamesAssistProposal proposal= new LinkedNamesAssistProposal(context, name); if (locations.length != 0) { proposal.setRelevance(IProposalRelevance.LINKED_NAMES_ASSIST_ERROR); } resultingCollections.add(proposal); return true; }
Example 3
Source File: SemanticTokensVisitor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public boolean visit(QualifiedName node) { IBinding binding = node.resolveBinding(); if (binding != null && binding.getKind() == IBinding.PACKAGE) { addToken(node, TokenType.NAMESPACE, NO_MODIFIERS); return false; } return super.visit(node); }
Example 4
Source File: SemanticTokensVisitor.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override public boolean visit(SimpleName node) { ASTNode parent = node.getParent(); if (parent instanceof Annotation) { addToken(node, TokenType.ANNOTATION); return false; } IBinding binding = node.resolveBinding(); if (binding == null) { return super.visit(node); } TokenType tokenType = null; switch (binding.getKind()) { case IBinding.VARIABLE: { if (((IVariableBinding) binding).isField()) { tokenType = TokenType.PROPERTY; } else { tokenType = TokenType.VARIABLE; } break; } case IBinding.METHOD: { tokenType = TokenType.FUNCTION; break; } case IBinding.TYPE: { tokenType = TokenType.TYPE; break; } case IBinding.PACKAGE: { tokenType = TokenType.NAMESPACE; break; } default: break; } if (tokenType == null) { return super.visit(node); } switch (tokenType) { case FUNCTION: case VARIABLE: case PROPERTY: case MEMBER: { ITokenModifier[] modifiers = getModifiers(binding); addToken(node, tokenType, modifiers); break; } case TYPE: case NAMESPACE: addToken(node, tokenType, NO_MODIFIERS); break; default: break; } return super.visit(node); }