/** Creates a set of completion proposals from the given keyword. */ protected Collection<org.emftext.language.xpath3.resource.xpath3.ui.Xpath3CompletionProposal> handleKeyword( org.emftext.language.xpath3.resource.xpath3.mopp.Xpath3ExpectedTerminal expectedTerminal, org.emftext.language.xpath3.resource.xpath3.mopp.Xpath3ExpectedCsString csString, String prefix, EObject container) { String proposal = csString.getValue(); boolean matchesPrefix = matches(proposal, prefix); return Collections.singleton( new org.emftext.language.xpath3.resource.xpath3.ui.Xpath3CompletionProposal( expectedTerminal, proposal, prefix, matchesPrefix, null, container)); }
/** Removes all proposals for keywords that end before the given index. */ protected void removeKeywordsEndingBeforeIndex( Collection<org.emftext.language.xpath3.resource.xpath3.ui.Xpath3CompletionProposal> proposals, int index) { List<org.emftext.language.xpath3.resource.xpath3.ui.Xpath3CompletionProposal> toRemove = new ArrayList<org.emftext.language.xpath3.resource.xpath3.ui.Xpath3CompletionProposal>(); for (org.emftext.language.xpath3.resource.xpath3.ui.Xpath3CompletionProposal proposal : proposals) { org.emftext.language.xpath3.resource.xpath3.mopp.Xpath3ExpectedTerminal expectedTerminal = proposal.getExpectedTerminal(); org.emftext.language.xpath3.resource.xpath3.IXpath3ExpectedElement terminal = expectedTerminal.getTerminal(); if (terminal instanceof org.emftext.language.xpath3.resource.xpath3.mopp.Xpath3ExpectedCsString) { org.emftext.language.xpath3.resource.xpath3.mopp.Xpath3ExpectedCsString csString = (org.emftext.language.xpath3.resource.xpath3.mopp.Xpath3ExpectedCsString) terminal; int startExcludingHiddenTokens = expectedTerminal.getStartExcludingHiddenTokens(); if (startExcludingHiddenTokens + csString.getValue().length() - 1 < index) { toRemove.add(proposal); } } } proposals.removeAll(toRemove); }