/******************************************************************************* * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc. * Distributed under license by Red Hat, Inc. All rights reserved. * This program is made available under the terms of the * Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Exadel, Inc. and Red Hat, Inc. - initial API and implementation ******************************************************************************/ package org.jboss.tools.common.model.ui.templates.assistent; import java.util.ArrayList; import org.eclipse.jface.contentassist.IContentAssistSubjectControl; import org.eclipse.jface.contentassist.ISubjectControlContentAssistProcessor; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.contentassist.ICompletionProposal; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.text.contentassist.IContextInformation; import org.eclipse.jface.text.contentassist.IContextInformationValidator; /** * @author au */ public class TemplateContentAssistentProcessor implements IContentAssistProcessor, ISubjectControlContentAssistProcessor { public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { return null; } public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { return null; } public char[] getCompletionProposalAutoActivationCharacters() { return null; } public char[] getContextInformationAutoActivationCharacters() { return null; } public String getErrorMessage() { return null; } public IContextInformationValidator getContextInformationValidator() { return null; } public ICompletionProposal[] computeCompletionProposals(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) { // this method activated on ctrl+space action ArrayList<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>(); proposals.add(new TemplateCompletionProposal("1")); //$NON-NLS-1$ proposals.add(new TemplateCompletionProposal("2")); //$NON-NLS-1$ proposals.add(new TemplateCompletionProposal("3")); //$NON-NLS-1$ return proposals.toArray(new TemplateCompletionProposal[proposals.size()]); } public IContextInformation[] computeContextInformation(IContentAssistSubjectControl contentAssistSubjectControl, int documentOffset) { return null; } }