1 19 20 package org.netbeans.spi.editor.completion.support; 21 22 import javax.swing.text.Document ; 23 import javax.swing.text.JTextComponent ; 24 import org.netbeans.spi.editor.completion.CompletionResultSet; 25 26 39 40 public abstract class AsyncCompletionQuery { 41 42 private AsyncCompletionTask task; 43 44 56 protected void preQueryUpdate(JTextComponent component) { 57 } 59 60 79 protected abstract void query(CompletionResultSet resultSet, Document doc, int caretOffset); 80 81 128 protected boolean canFilter(JTextComponent component) { 129 return false; 130 } 131 132 172 protected void filter(CompletionResultSet resultSet) { 173 throw new IllegalStateException ("Filtering not supported"); } 175 176 184 protected void prepareQuery(JTextComponent component) { 185 } 187 188 195 public final boolean isTaskCancelled() { 196 assert (task != null) : "isTaskCancelled() must not be called from constructor"; return task.isCancelled(); 198 } 199 200 final void initTask(AsyncCompletionTask task) { 201 assert (task != null); assert (this.task == null); this.task = task; 204 } 205 206 } 207 | Popular Tags |