List of usage examples for org.eclipse.jdt.internal.core.builder ReferenceCollection includes
public boolean includes(char[][][] qualifiedNames, char[][] simpleNames, char[][] rootNames)
From source file:com.codenvy.ide.ext.java.server.internal.core.search.IndexSelector.java
License:Open Source License
private static boolean canSeeFocus(IJavaElement focus, JavaProject javaProject, char[][][] focusQualifiedNames) { try {/*from w w w .ja va 2s. c o m*/ if (focus == null) return false; if (focus.equals(javaProject)) return true; if (focus instanceof JarPackageFragmentRoot) { // focus is part of a jar IPath focusPath = focus.getPath(); IClasspathEntry[] entries = javaProject.getExpandedClasspath(); for (int i = 0, length = entries.length; i < length; i++) { IClasspathEntry entry = entries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && entry.getPath().equals(focusPath)) return true; } return false; } // look for dependent projects IPath focusPath = ((JavaProject) focus).getProject().getFullPath(); IClasspathEntry[] entries = javaProject.getExpandedClasspath(); for (int i = 0, length = entries.length; i < length; i++) { IClasspathEntry entry = entries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT && entry.getPath().equals(focusPath)) { if (focusQualifiedNames != null) { // builder state is usable, hence use it to try to reduce project which can see the focus... State projectState = (State) JavaModelManager.getJavaModelManager() .getLastBuiltState(javaProject.getProject(), null); if (projectState != null) { Object[] values = projectState.getReferences().valueTable; int vLength = values.length; for (int j = 0; j < vLength; j++) { if (values[j] == null) continue; ReferenceCollection references = (ReferenceCollection) values[j]; if (references.includes(focusQualifiedNames, null, null)) { return true; } } return false; } } return true; } } return false; } catch (JavaModelException e) { return false; } }
From source file:org.eclipse.che.jdt.internal.core.search.IndexSelector.java
License:Open Source License
private static int canSeeFocus(IJavaElement focus, JavaProject javaProject, char[][][] focusQualifiedNames) { try {//from w w w .jav a 2 s . com if (focus == null) return PROJECT_CAN_NOT_SEE_FOCUS; if (focus.equals(javaProject)) return PROJECT_CAN_SEE_FOCUS; if (focus instanceof JarPackageFragmentRoot) { // focus is part of a jar IPath focusPath = focus.getPath(); IClasspathEntry[] entries = javaProject.getExpandedClasspath(); for (int i = 0, length = entries.length; i < length; i++) { IClasspathEntry entry = entries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && entry.getPath().equals(focusPath)) return PROJECT_CAN_SEE_FOCUS; } return PROJECT_CAN_NOT_SEE_FOCUS; } // look for dependent projects IPath focusPath = ((JavaProject) focus).getProject().getFullPath(); IClasspathEntry[] entries = javaProject.getExpandedClasspath(); for (int i = 0, length = entries.length; i < length; i++) { IClasspathEntry entry = entries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT && entry.getPath().equals(focusPath)) { if (focusQualifiedNames != null) { // builder state is usable, hence use it to try to reduce project which can see the focus... State projectState = (State) JavaModelManager.getJavaModelManager() .getLastBuiltState(javaProject.getProject(), null); if (projectState != null) { Object[] values = projectState.getReferences().valueTable; int vLength = values.length; for (int j = 0; j < vLength; j++) { if (values[j] == null) continue; ReferenceCollection references = (ReferenceCollection) values[j]; if (references.includes(focusQualifiedNames, null, null)) { return PROJECT_CAN_SEE_FOCUS; } } return PROJECT_SOURCE_CAN_NOT_SEE_FOCUS; } } return PROJECT_CAN_SEE_FOCUS; } } return PROJECT_CAN_NOT_SEE_FOCUS; } catch (JavaModelException e) { return PROJECT_CAN_NOT_SEE_FOCUS; } }
From source file:org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.java
License:Open Source License
protected void addAffectedSourceFiles(StringSet qualifiedSet, StringSet simpleSet, StringSet rootSet, StringSet affectedTypes) {/* w w w . j av a2 s .c o m*/ // the qualifiedStrings are of the form 'p1/p2' & the simpleStrings are just 'X' char[][][] internedQualifiedNames = ReferenceCollection.internQualifiedNames(qualifiedSet); // if a well known qualified name was found then we can skip over these if (internedQualifiedNames.length < qualifiedSet.elementSize) internedQualifiedNames = null; char[][] internedSimpleNames = ReferenceCollection.internSimpleNames(simpleSet, true); // if a well known name was found then we can skip over these if (internedSimpleNames.length < simpleSet.elementSize) internedSimpleNames = null; char[][] internedRootNames = ReferenceCollection.internSimpleNames(rootSet, false); Object[] keyTable = this.newState.references.keyTable; Object[] valueTable = this.newState.references.valueTable; next: for (int i = 0, l = valueTable.length; i < l; i++) { String typeLocator = (String) keyTable[i]; if (typeLocator != null) { if (affectedTypes != null && !affectedTypes.includes(typeLocator)) continue next; ReferenceCollection refs = (ReferenceCollection) valueTable[i]; if (refs.includes(internedQualifiedNames, internedSimpleNames, internedRootNames)) { IFile file = this.javaBuilder.currentProject.getFile(typeLocator); SourceFile sourceFile = findSourceFile(file, true); if (sourceFile == null) continue next; if (this.sourceFiles.contains(sourceFile)) continue next; if (this.compiledAllAtOnce && this.previousSourceFiles != null && this.previousSourceFiles.contains(sourceFile)) continue next; // can skip previously compiled files since already saw hierarchy related problems if (JavaBuilder.DEBUG) System.out.println(" adding affected source file " + typeLocator); //$NON-NLS-1$ this.sourceFiles.add(sourceFile); } } } }
From source file:org.eclipse.pde.api.tools.internal.builder.IncrementalApiBuilder.java
License:Open Source License
/** * Adds the dependent files from the current build context based on the * current JDT build state to either the structural or description * dependents./*www. j av a 2 s.c o m*/ * * @param project the current project being built * @param state the current JDT build state * @param types dot and $ qualified names of base types that changed * @param kind mask of STRUCTURAL or DESCRIPTION */ private void addDependents(final IProject project, State state, String[] types, int kind) { StringSet packages = new StringSet(16); StringSet typenames = new StringSet(16); for (int i = 0; i < types.length; i++) { if (types[i] != null) { splitName(types[i], packages, typenames); } } // the qualifiedStrings are of the form 'p1/p2' & the simpleStrings are // just 'X' char[][][] internedQualifiedNames = ReferenceCollection.internQualifiedNames(packages); // if a well known qualified name was found then we can skip over these if (internedQualifiedNames.length < packages.elementSize) { internedQualifiedNames = null; } char[][] internedSimpleNames = ReferenceCollection.internSimpleNames(typenames, true); // if a well known name was found then we can skip over these if (internedSimpleNames.length < typenames.elementSize) { internedSimpleNames = null; } Object[] keyTable = state.getReferences().keyTable; Object[] valueTable = state.getReferences().valueTable; IFile file = null; String typeLocator = null; for (int i = 0; i < valueTable.length; i++) { typeLocator = (String) keyTable[i]; if (typeLocator != null) { ReferenceCollection refs = (ReferenceCollection) valueTable[i]; if (refs.includes(internedQualifiedNames, internedSimpleNames, null)) { file = project.getFile(typeLocator); if (file == null) { continue; } if (ApiPlugin.DEBUG_BUILDER) { System.out.println("ApiAnalysisBuilder: adding affected source file " + file.getName()); //$NON-NLS-1$ } addDependentTypeToContext(file, kind); } } } }