/*
 * generated by Xtext
 */
package net.sourceforge.ufoai.ui.contentassist;

import net.sourceforge.ufoai.ufoScript.UFOScript;

import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;

/**
 * see
 * http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on
 * how to customize content assistant
 */
public class UFOScriptProposalProvider extends AbstractUFOScriptProposalProvider {
	public void complete_UFOScript(UFOScript model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
		// call implementation in superclass
		super.complete_UFOScript(model, ruleCall, context, acceptor);

		// compute the plain proposal
		String proposal = "Description for model #" + model.getRoots();

		// convert it to a valid STRING-terminal
		proposal = getValueConverter().toString(proposal, "STRING");

		// create the completion proposal
		// the result may be null as the createCompletionProposal(..) methods
		// check for valid prefixes
		// and terminal token conflicts
		ICompletionProposal completionProposal = createCompletionProposal(proposal, context);

		// register the proposal, the acceptor handles null-values gracefully
		acceptor.accept(completionProposal);
	}
}
