List of usage examples for org.eclipse.jdt.internal.core.builder StringSet add
public boolean add(String value)
From source file:org.eclipse.jdt.internal.core.builder.IncrementalImageBuilder.java
License:Open Source License
protected void addDependentsOf(IPath path, boolean isStructuralChange, StringSet qualifiedNames, StringSet simpleNames, StringSet rootNames) { path = path.setDevice(null);/* w w w.j av a 2s . co m*/ if (isStructuralChange) { String last = path.lastSegment(); if (last.length() == TypeConstants.PACKAGE_INFO_NAME.length) if (CharOperation.equals(last.toCharArray(), TypeConstants.PACKAGE_INFO_NAME)) { path = path.removeLastSegments(1); // the package-info file has changed so blame the package itself /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=323785, in the case of default package, there is no need to blame the package itself as there can be no annotations or documentation comment tags in the package-info file that can influence the rest of the package. Just bail out so we don't touch null objects below. */ if (path.isEmpty()) return; } } if (isStructuralChange && !this.hasStructuralChanges) { this.newState.tagAsStructurallyChanged(); this.hasStructuralChanges = true; } // the qualifiedStrings are of the form 'p1/p2' & the simpleStrings are just 'X' rootNames.add(path.segment(0)); String packageName = path.removeLastSegments(1).toString(); boolean wasNew = qualifiedNames.add(packageName); String typeName = path.lastSegment(); int memberIndex = typeName.indexOf('$'); if (memberIndex > 0) typeName = typeName.substring(0, memberIndex); wasNew = simpleNames.add(typeName) | wasNew; if (wasNew && JavaBuilder.DEBUG) System.out.println(" will look for dependents of " //$NON-NLS-1$ + typeName + " in " + packageName); //$NON-NLS-1$ }
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 ww w.j ava2 s . c o 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 a type to search for dependents of in considered projects for an * incremental build// w ww . j a v a 2 s . c o m * * @param path */ void splitName(String typename, StringSet packages, StringSet simpleTypes) { // the qualifiedStrings are of the form 'p1/p2' & the simpleStrings are // just 'X' int idx = typename.lastIndexOf('/'); String packageName = (idx < 0 ? Util.EMPTY_STRING : typename.substring(0, idx)); String typeName = (idx < 0 ? typename : typename.substring(idx + 1, typename.length())); idx = typeName.indexOf('$'); if (idx > 0) { typeName = typeName.substring(0, idx); } if (simpleTypes.add(typeName) && packages.add(packageName) && ApiPlugin.DEBUG_BUILDER) { System.out.println( "ApiAnalysisBuilder: will look for dependents of " + typeName + " in " + packageName); //$NON-NLS-1$ //$NON-NLS-2$ } }