1 11 package org.eclipse.jface.text.contentassist; 12 13 import org.eclipse.jface.text.ITextViewer; 14 15 16 23 public final class ContextInformationValidator implements IContextInformationValidator { 24 25 26 private IContentAssistProcessor fProcessor; 27 28 private IContextInformation fContextInformation; 29 30 private ITextViewer fViewer; 31 32 38 public ContextInformationValidator(IContentAssistProcessor processor) { 39 fProcessor= processor; 40 } 41 42 45 public void install(IContextInformation contextInformation, ITextViewer viewer, int offset) { 46 fContextInformation= contextInformation; 47 fViewer= viewer; 48 } 49 50 53 public boolean isContextInformationValid(int offset) { 54 IContextInformation[] infos= fProcessor.computeContextInformation(fViewer, offset); 55 if (infos != null && infos.length > 0) { 56 for (int i= 0; i < infos.length; i++) 57 if (fContextInformation.equals(infos[i])) 58 return true; 59 } 60 return false; 61 } 62 } 63 | Popular Tags |