List of usage examples for org.eclipse.jdt.internal.compiler.lookup Binding kind
public abstract int kind();
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lookup.OTClassScope.java
License:Open Source License
/** override hook: consider parent AND roleUnitImportScope. */ // TODO(SH): currently not active (super method is not in place). protected Binding getTypeOrPackageInParent(char[] compoundName, int flags, boolean needResolve) { Binding foundInParent = this.parent.getTypeOrPackage(compoundName, flags, needResolve); if (this.roleUnitImportScope != null) { Binding foundInImports = this.roleUnitImportScope.getTypeOrPackage(compoundName, flags, needResolve); if (foundInImports != null && foundInImports.isValidBinding()) { if (foundInParent != null && foundInParent.isValidBinding() && foundInImports != foundInParent) { switch (foundInParent.kind()) { case Binding.PACKAGE: return new ProblemPackageBinding(compoundName, ProblemReasons.Ambiguous); case Binding.TYPE: return problemTypeBinding(compoundName, (TypeBinding) foundInParent, ProblemReasons.Ambiguous); }/* ww w .ja v a2 s. com*/ } else return foundInImports; } } return foundInParent; }
From source file:org.eclipse.objectteams.otdt.internal.core.compiler.lookup.PrecedenceBinding.java
License:Open Source License
/** * Does this precedence declaration regulate the precedence of the given two callins? *///from ww w.j a v a 2 s .c o m private boolean containsBoth(CallinCalloutBinding callin1, CallinCalloutBinding callin2) { int numFound = 0; for (int i = 0; i < this.elements.length; i++) { Binding element = this.elements[i]; if (element == null) // failed to resolve continue; if (element.kind() == BINDING) { if (sameOrOverridingBinding((CallinCalloutBinding) element, callin1)) numFound++; if (sameOrOverridingBinding((CallinCalloutBinding) element, callin2)) numFound++; } else { ReferenceBinding roleType = (ReferenceBinding) element; roleType = roleType.roleModel.getClassPartBinding(); if (TypeBinding.equalsEquals(roleType, callin1._declaringRoleClass)) numFound++; if (TypeBinding.equalsEquals(roleType, callin2._declaringRoleClass)) numFound++; } if (numFound == 2) return true; } return false; }
From source file:org.eclipse.recommenders.internal.chain.rcp.ChainCompletionProposalComputer.java
License:Open Source License
private void findEntrypointsForCompletionOnQualifiedName(final CompletionOnQualifiedNameReference node) { final Binding b = node.binding; if (b == null) { return;/*ww w.j av a 2 s. c o m*/ } switch (b.kind()) { case Binding.TYPE: addPublicStaticMembersToEntrypoints((TypeBinding) b); break; case Binding.FIELD: addPublicInstanceMembersToEntrypoints(((FieldBinding) b).type); break; case Binding.LOCAL: addPublicInstanceMembersToEntrypoints(((VariableBinding) b).type); break; default: log(WARNING_CANNOT_HANDLE_FOR_FINDING_ENTRY_POINTS, b); } }
From source file:org.eclipse.recommenders.utils.rcp.CompilerBindings.java
License:Open Source License
public static Optional<String> getVariableName(final Binding node) { if (node == null) { return absent(); }//from www . j av a2 s .c o m switch (node.kind()) { case Binding.FIELD: case Binding.LOCAL: return of(String.valueOf(node.shortReadableName())); } return absent(); }