List of usage examples for org.eclipse.jdt.internal.core.builder StringSet StringSet
public StringSet(int size)
From source file:org.eclipse.jdt.internal.core.builder.BatchImageBuilder.java
License:Open Source License
protected void rebuildTypesAffectedBySecondaryTypes() { // to compile types that could not find 'missing' secondary types because of multiple // compile groups, we need to incrementally recompile all affected types as if the missing // secondary types have just been added, see bug 146324 if (this.incrementalBuilder == null) this.incrementalBuilder = new IncrementalImageBuilder(this); int count = this.secondaryTypes.size(); StringSet qualifiedNames = new StringSet(count * 2); StringSet simpleNames = new StringSet(count); StringSet rootNames = new StringSet(3); while (--count >= 0) { char[] secondaryTypeName = (char[]) this.secondaryTypes.get(count); IPath path = new Path(null, new String(secondaryTypeName)); this.incrementalBuilder.addDependentsOf(path, false, qualifiedNames, simpleNames, rootNames); }// ww w . java2 s. co m this.incrementalBuilder.addAffectedSourceFiles(qualifiedNames, simpleNames, rootNames, this.typeLocatorsWithUndefinedTypes); }
From source file:org.eclipse.jdt.internal.core.builder.BatchImageBuilder.java
License:Open Source License
protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] problems) throws CoreException { if (sourceFile == null || problems == null || problems.length == 0) return;/*from w w w . java2s . co m*/ for (int i = problems.length; --i >= 0;) { CategorizedProblem problem = problems[i]; if (problem != null && problem.getID() == IProblem.UndefinedType) { if (this.typeLocatorsWithUndefinedTypes == null) this.typeLocatorsWithUndefinedTypes = new StringSet(3); this.typeLocatorsWithUndefinedTypes.add(sourceFile.typeLocator()); break; } } super.storeProblemsFor(sourceFile, problems); }
From source file:org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.java
License:Open Source License
protected void resetCollections() { if (this.sourceFiles == null) { this.sourceFiles = new ArrayList(33); this.previousSourceFiles = null; this.qualifiedStrings = new StringSet(3); this.simpleStrings = new StringSet(3); this.rootStrings = new StringSet(3); this.hasStructuralChanges = false; this.compileLoop = 0; } else {/* www . j a v a2 s. co m*/ this.previousSourceFiles = this.sourceFiles.isEmpty() ? null : (ArrayList) this.sourceFiles.clone(); this.sourceFiles.clear(); this.qualifiedStrings.clear(); this.simpleStrings.clear(); this.rootStrings.clear(); this.workQueue.clear(); } }
From source file:org.eclipse.pde.api.tools.internal.builder.BuildContext.java
License:Open Source License
/** * Adds the given type name to the collection of structurally changed types. * Does nothing if <code>null</code> is passed in as the type name. * /*from w ww. j a v a 2 s . co m*/ * @param typename */ public void recordStructuralChange(String typename) { if (typename == null) { return; } if (this.structualChanges == null) { this.structualChanges = new StringSet(16); } this.structualChanges.add(typename.replace('/', '.')); }
From source file:org.eclipse.pde.api.tools.internal.builder.BuildContext.java
License:Open Source License
/** * Adds the given type name to the collection of removed types. Does nothing * if <code>null</code> is passed in as the type name. * // w w w. jav a2 s . c o m * @param typename */ public void recordRemovedType(String typename) { if (typename == null) { return; } if (this.removedTypes == null) { this.removedTypes = new StringSet(16); } this.removedTypes.add(typename.replace('/', '.')); }
From source file:org.eclipse.pde.api.tools.internal.builder.BuildContext.java
License:Open Source License
/** * Adds the given type name to the collection of types that have had an API * description change. Does nothing if <code>null</code> is passed in. * //from w ww. ja v a 2 s . c o m * @param typename the type that has an API description change or * <code>null</code> */ public void recordDescriptionChanged(String typename) { if (typename != null) { if (this.descriptionChanges == null) { this.descriptionChanges = new StringSet(16); } this.descriptionChanges.add(typename.replace('/', '.')); } }
From source file:org.eclipse.pde.api.tools.internal.builder.BuildContext.java
License:Open Source License
/** * Adds the given type name to the collection of dependent type names. Does * nothing if <code>null</code> is passed in as the type name. * // w w w .j a v a 2s . co m * @param typename the type to add a dependent of */ public void recordDescriptionDependent(String typename) { if (typename == null) { return; } if (this.descriptionDepedents == null) { this.descriptionDepedents = new StringSet(16); } this.descriptionDepedents.add(typename.replace('/', '.')); }
From source file:org.eclipse.pde.api.tools.internal.builder.IncrementalApiBuilder.java
License:Open Source License
/** * Constructs a build context based on the current JDT build state and known * changes.//from w w w .j a v a2 s . co m * * @param project the current project being built * @param state the current JDT build state * @param list of changes */ void buildContext(final IProject project, State state, List<Change> changes, HashSet<IProject> depprojects) { StringSet structural = null; StringSet description = null; for (Change change : changes) { boolean contained = change.isContained(project, depprojects); if ((change.changeKind & STRUCTURAL) > 0) { // don't analyze dependents of removed types if (change.deltaKind != IResourceDelta.REMOVED) { if (structural == null) { structural = new StringSet(16); } structural.add(change.typeName); } // only add to structural types if contained in the project // being built if (contained) { context.recordStructuralChange(change.typeName); if (change.deltaKind == IResourceDelta.REMOVED) { context.recordRemovedType(change.typeName); } } } if ((change.changeKind & DESCRIPTION) > 0) { if (description == null) { description = new StringSet(16); } description.add(change.typeName); // only add to description changes if contained in the project // being built if (contained) { context.recordDescriptionChanged(change.typeName); } } if (contained) { if (change.fileKind == JAVA__FILE) { this.builder.cleanupMarkers(change.resource); addInnerTypes(change.resource, change.changeKind); } else { // look up the source file String path = (String) state.typeLocators.get(change.typeName); if (path != null) { IResource member = this.builder.getProject().findMember(path); if (member != null && member.getType() == IResource.FILE) { IFile source = (IFile) member; this.builder.cleanupMarkers(source); addInnerTypes(source, change.changeKind); } } } } } // only resolve dependents once for case of 1 type changed and is both // structural and description if (changes.size() == 1 && structural != null && description != null) { String[] types = structural.values; if (types.length > 0) { addDependents(project, state, types, STRUCTURAL | DESCRIPTION); } } else { if (structural != null) { String[] types = structural.values; if (types.length > 0) { addDependents(project, state, types, STRUCTURAL); } } if (description != null) { String[] types = description.values; if (types.length > 0) { addDependents(project, state, types, DESCRIPTION); } } } }
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./*from w w w .ja va 2 s. com*/ * * @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); } } } }