@Override public void transferContext(IIndexFragmentFile sourceFile) throws CoreException { PDOMFile source = (PDOMFile) sourceFile; PDOMInclude include = source.getFirstIncludedBy(); if (include != null) { // Detach the include final PDOMInclude next = include.getNextInIncludedBy(); include.setNextInIncludedBy(null); source.setFirstIncludedBy(next); if (next != null) next.setPrevInIncludedBy(null); // Adjust the include include.setIncludes(this); // Insert the include addIncludedBy(include, false); } }
public void addIncludesTo(IncludeInformation[] includeInfos) throws CoreException { assert getFirstInclude() == null; PDOMInclude lastInclude = null; for (final IncludeInformation info : includeInfos) { final PDOMFile targetFile = (PDOMFile) info.fTargetFile; PDOMInclude pdomInclude = new PDOMInclude(fLinkage, info.fStatement, this, targetFile); assert targetFile == null || targetFile.getIndexFragment() instanceof IWritableIndexFragment; if (targetFile != null) { targetFile.addIncludedBy(pdomInclude, info.fIsContext); } if (lastInclude == null) { setFirstInclude(pdomInclude); } else { lastInclude.setNextInIncludes(pdomInclude); } lastInclude = pdomInclude; } }