1 12 13 package org.eclipse.jdt.core.compiler; 14 15 import org.eclipse.core.resources.IFile; 16 import org.eclipse.jdt.internal.core.builder.CompilationParticipantResult; 17 import org.eclipse.jdt.internal.core.builder.SourceFile; 18 19 28 public class BuildContext extends CompilationParticipantResult { 29 30 38 public BuildContext(SourceFile sourceFile) { 39 super(sourceFile); 40 } 41 42 47 public char[] getContents() { 48 return this.sourceFile.getContents(); 49 } 50 51 56 public IFile getFile() { 57 return this.sourceFile.resource; 58 } 59 60 67 public boolean hasAnnotations() { 68 return this.hasAnnotations; } 70 71 76 public void recordAddedGeneratedFiles(IFile[] addedGeneratedFiles) { 77 int length2 = addedGeneratedFiles.length; 78 if (length2 == 0) return; 79 80 int length1 = this.addedFiles == null ? 0 : this.addedFiles.length; 81 IFile[] merged = new IFile[length1 + length2]; 82 if (length1 > 0) System.arraycopy(this.addedFiles, 0, merged, 0, length1); 84 System.arraycopy(addedGeneratedFiles, 0, merged, length1, length2); 85 this.addedFiles = merged; 86 } 87 88 93 public void recordDeletedGeneratedFiles(IFile[] deletedGeneratedFiles) { 94 int length2 = deletedGeneratedFiles.length; 95 if (length2 == 0) return; 96 97 int length1 = this.deletedFiles == null ? 0 : this.deletedFiles.length; 98 IFile[] merged = new IFile[length1 + length2]; 99 if (length1 > 0) System.arraycopy(this.deletedFiles, 0, merged, 0, length1); 101 System.arraycopy(deletedGeneratedFiles, 0, merged, length1, length2); 102 this.deletedFiles = merged; 103 } 104 105 110 public void recordDependencies(String [] typeNameDependencies) { 111 int length2 = typeNameDependencies.length; 112 if (length2 == 0) return; 113 114 int length1 = this.dependencies == null ? 0 : this.dependencies.length; 115 String [] merged = new String [length1 + length2]; 116 if (length1 > 0) System.arraycopy(this.dependencies, 0, merged, 0, length1); 118 System.arraycopy(typeNameDependencies, 0, merged, length1, length2); 119 this.dependencies = merged; 120 } 121 122 129 public void recordNewProblems(CategorizedProblem[] newProblems) { 130 int length2 = newProblems.length; 131 if (length2 == 0) return; 132 133 int length1 = this.problems == null ? 0 : this.problems.length; 134 CategorizedProblem[] merged = new CategorizedProblem[length1 + length2]; 135 if (length1 > 0) System.arraycopy(this.problems, 0, merged, 0, length1); 137 System.arraycopy(newProblems, 0, merged, length1, length2); 138 this.problems = merged; 139 } 140 141 } 142 | Popular Tags |