public void addIncludedBy(PDOMInclude include, boolean isContext) throws CoreException { PDOMInclude firstIncludedBy = getFirstIncludedBy(); if (firstIncludedBy != null) { if (isContext) { setFirstIncludedBy(include); include.setNextInIncludedBy(firstIncludedBy); firstIncludedBy.setPrevInIncludedBy(include); } else { PDOMInclude secondIncludedBy = firstIncludedBy.getNextInIncludedBy(); if (secondIncludedBy != null) { include.setNextInIncludedBy(secondIncludedBy); secondIncludedBy.setPrevInIncludedBy(include); } include.setPrevInIncludedBy(firstIncludedBy); firstIncludedBy.setNextInIncludedBy(include); } } else { setFirstIncludedBy(include); } }
public void convertIncludersToUnresolved() throws CoreException { // Remove the includes PDOMInclude include = getFirstIncludedBy(); while (include != null) { PDOMInclude nextInclude = include.getNextInIncludedBy(); include.convertToUnresolved(); include.setNextInIncludedBy(null); include.setPrevInIncludedBy(null); include = nextInclude; } setFirstIncludedBy(null); }
@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); } }
@Override public void transferIncluders(IIndexFragmentFile sourceFile) throws CoreException { PDOMFile source = (PDOMFile) sourceFile; PDOMInclude include = source.getFirstIncludedBy(); if (include != null) { // Detach the includes source.setFirstIncludedBy(null); // Adjust the includes for (PDOMInclude i = include; i != null; i = i.getNextInIncludedBy()) { i.setIncludes(this); } // Append the includes PDOMInclude last = getFirstIncludedBy(); if (last == null) { setFirstIncludedBy(include); } else { for (PDOMInclude i = last; i != null; i = i.getNextInIncludedBy()) { last = i; } last.setNextInIncludedBy(include); include.setPrevInIncludedBy(last); } } }