1 11 package org.eclipse.jdt.core; 12 13 import org.eclipse.jdt.core.compiler.IProblem; 14 15 54 public abstract class CompletionRequestor { 55 56 61 private int ignoreSet = 0; 62 63 private String [] favoriteReferences; 64 65 70 private int requiredProposalAllowSet[] = null; 71 72 77 public CompletionRequestor() { 78 } 80 81 92 public boolean isIgnored(int completionProposalKind) { 93 if (completionProposalKind < CompletionProposal.FIRST_KIND 94 || completionProposalKind > CompletionProposal.LAST_KIND) { 95 throw new IllegalArgumentException ("Unknown kind of completion proposal: "+completionProposalKind); } 97 return 0 != (this.ignoreSet & (1 << completionProposalKind)); 98 } 99 100 111 public void setIgnored(int completionProposalKind, boolean ignore) { 112 if (completionProposalKind < CompletionProposal.FIRST_KIND 113 || completionProposalKind > CompletionProposal.LAST_KIND) { 114 throw new IllegalArgumentException ("Unknown kind of completion proposal: "+completionProposalKind); } 116 if (ignore) { 117 this.ignoreSet |= (1 << completionProposalKind); 118 } else { 119 this.ignoreSet &= ~(1 << completionProposalKind); 120 } 121 } 122 123 142 public boolean isAllowingRequiredProposals(int proposalKind, int requiredProposalKind) { 143 if (proposalKind < CompletionProposal.FIRST_KIND 144 || proposalKind > CompletionProposal.LAST_KIND) { 145 throw new IllegalArgumentException ("Unknown kind of completion proposal: "+requiredProposalKind); } 147 148 if (requiredProposalKind < CompletionProposal.FIRST_KIND 149 || requiredProposalKind > CompletionProposal.LAST_KIND) { 150 throw new IllegalArgumentException ("Unknown required kind of completion proposal: "+requiredProposalKind); } 152 if (this.requiredProposalAllowSet == null) return false; 153 154 return 0 != (this.requiredProposalAllowSet[proposalKind] & (1 << requiredProposalKind)); 155 } 156 157 177 public void setAllowsRequiredProposals(int proposalKind, int requiredProposalKind, boolean allow) { 178 if (proposalKind < CompletionProposal.FIRST_KIND 179 || proposalKind > CompletionProposal.LAST_KIND) { 180 throw new IllegalArgumentException ("Unknown kind of completion proposal: "+requiredProposalKind); } 182 if (requiredProposalKind < CompletionProposal.FIRST_KIND 183 || requiredProposalKind > CompletionProposal.LAST_KIND) { 184 throw new IllegalArgumentException ("Unknown required kind of completion proposal: "+requiredProposalKind); } 186 187 if (this.requiredProposalAllowSet == null) { 188 this.requiredProposalAllowSet = new int[CompletionProposal.LAST_KIND + 1]; 189 } 190 191 if (allow) { 192 this.requiredProposalAllowSet[proposalKind] |= (1 << requiredProposalKind); 193 } else { 194 this.requiredProposalAllowSet[proposalKind] &= ~(1 << requiredProposalKind); 195 } 196 } 197 198 217 public String [] getFavoriteReferences() { 218 return this.favoriteReferences; 219 } 220 221 231 public void setFavoriteReferences(String [] favoriteImports) { 232 this.favoriteReferences = favoriteImports; 233 } 234 235 243 public void beginReporting() { 244 } 246 247 255 public void endReporting() { 256 } 258 259 269 public void completionFailure(IProblem problem) { 270 } 272 273 288 public abstract void accept(CompletionProposal proposal); 289 290 302 public void acceptContext(CompletionContext context) { 303 } 305 } 306 | Popular Tags |