public PrefixMatcherOutlineAdapter(String prefix, PrefixMatcher strategy) { super("", true); this.prefix = prefix; this.prefixParts = splitIntoParts(prefix); this.strategy = strategy; boolean ignoreCase = prefix.equals(prefix.toLowerCase()); this.prefixStringMatcher = new StringMatcher(prefix, ignoreCase); stringMatchers = Lists.newArrayList(); for(String part: prefixParts) { stringMatchers.add(new StringMatcher(part, ignoreCase)); } }
public void complete_ID(EObject model, RuleCall ruleCall, final ContentAssistContext context, ICompletionProposalAcceptor acceptor) { if (doCreateIdProposals()) { PrefixMatcher newMatcher = new PrefixMatcher() { @Override public boolean isCandidateMatchingPrefix(String name, String prefix) { String strippedName = name; if (name.startsWith("^") && !prefix.startsWith("^")) { strippedName = name.substring(1); } return context.getMatcher().isCandidateMatchingPrefix(strippedName, prefix); } }; ContentAssistContext myContext = context.copy().setMatcher(newMatcher).toContext(); String feature = getAssignedFeature(ruleCall); String proposalText = feature != null ? feature : Strings.toFirstUpper(ruleCall.getRule().getName().toLowerCase()); String displayText = proposalText; if (feature != null) displayText = proposalText + " - " + ruleCall.getRule().getName(); proposalText = getValueConverter().toString(proposalText, ruleCall.getRule().getName()); ICompletionProposal proposal = createCompletionProposal(proposalText, displayText, null, myContext); if (proposal instanceof ConfigurableCompletionProposal) { ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal; configurable.setSelectionStart(configurable.getReplacementOffset()); configurable.setSelectionLength(proposalText.length()); configurable.setAutoInsertable(false); configurable.setSimpleLinkedMode(myContext.getViewer(), '\t', ' '); } acceptor.accept(proposal); } }
public Class<? extends PrefixMatcher> bindPrefixMatcher() { return FQNPrefixMatcher.class; }
/** * Filter fully qualified proposals also by their last segment and not only by their fully qualified name. */ public Class<? extends PrefixMatcher> bindPrefixMatcher() { return FQNPrefixMatcher.class; }