/*
 * generated by Xtext 2.25.0
 */
package org.etsi.mts.tdl.ui.contentassist;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.Assignment;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
import org.etsi.mts.tdl.Member;
import org.etsi.mts.tdl.StructuredDataInstance;
import org.etsi.mts.tdl.StructuredDataType;

/**
 * See https://www.eclipse.org/Xtext/documentation/310_eclipse_support.html#content-assist
 * on how to customize the content assistant.
 */
public class TDLtxProposalProvider extends AbstractTDLtxProposalProvider {
	@Override
	public void completeMemberAssignment_Member(EObject model, Assignment assignment, ContentAssistContext context,
			ICompletionProposalAcceptor acceptor) {
		// TODO Auto-generated method stub
		//super.completeMemberAssignment_Member(model, assignment, context, acceptor);
		
		// compute the plain proposal
		for (Member m : ((StructuredDataType)
				((StructuredDataInstance)model).getDataType()).allMembers()) {
			acceptor.accept(createCompletionProposal(m.getName(), context));
		}
	    // Create and register the completion proposal:
	    // The proposal may be null as the createCompletionProposal(..) 
	    // methods check for valid prefixes and terminal token conflicts.
	    // The acceptor handles null-values gracefully.
	}
	@Override
	public void complete_FunctionCall(EObject model, RuleCall ruleCall, ContentAssistContext context,
			ICompletionProposalAcceptor acceptor) {
		acceptor.accept(createCompletionProposal("instance returned from ",context));
		super.complete_FunctionCall(model, ruleCall, context, acceptor);
	}

}
