X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java index 1e68c52..fcffda1 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/templates/template/BasicCompletionProcessor.java @@ -1,10 +1,10 @@ /******************************************************************************* * Copyright (c) 2000, 2004 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials + * All rights reserved. This program and the accompanying materials * are made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/cpl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -24,6 +24,7 @@ import org.eclipse.jface.text.ITextSelection; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.Region; import org.eclipse.jface.text.contentassist.ICompletionProposal; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.text.templates.Template; import org.eclipse.jface.text.templates.TemplateCompletionProcessor; import org.eclipse.jface.text.templates.TemplateContext; @@ -35,7 +36,12 @@ import org.eclipse.swt.graphics.Image; */ public class BasicCompletionProcessor extends TemplateCompletionProcessor { private static final String DEFAULT_IMAGE = "icons/template.gif"; //$NON-NLS-1$ - + private char[] fProposalAutoActivationSet; +// private PHPCompletionProposalComparator fComparator; + public BasicCompletionProcessor() { + super(); +// fComparator = new PHPCompletionProposalComparator(); + } /** * We watch for angular brackets since those are often part of XML templates. */ @@ -100,7 +106,7 @@ public class BasicCompletionProcessor extends TemplateCompletionProcessor { /* * (non-Javadoc) - * + * * @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer, * int) */ @@ -113,7 +119,7 @@ public class BasicCompletionProcessor extends TemplateCompletionProcessor { String prefix = extractPrefix(viewer, offset); prefix = prefix.toLowerCase(); - Region region = new Region(offset - prefix.length(), prefix.length()); + IRegion region = new Region(offset - prefix.length(), prefix.length()); TemplateContext context = createContext(viewer, region); if (context == null) return new ICompletionProposal[0]; @@ -139,4 +145,37 @@ public class BasicCompletionProcessor extends TemplateCompletionProcessor { return (ICompletionProposal[]) matches.toArray(new ICompletionProposal[matches.size()]); } + /** + * @see IContentAssistProcessor#getCompletionProposalAutoActivationCharacters() + */ + public char[] getCompletionProposalAutoActivationCharacters() { + return fProposalAutoActivationSet; + } + + /** + * Sets this processor's set of characters triggering the activation of the + * completion proposal computation. + * + * @param activationSet the activation set + */ + public void setCompletionProposalAutoActivationCharacters(char[] activationSet) { + fProposalAutoActivationSet= activationSet; + } + + /** + * Order the given proposals. + */ +// private ICompletionProposal[] order(ICompletionProposal[] proposals) { +// Arrays.sort(proposals, fComparator); +// return proposals; +// } + + /** + * Tells this processor to order the proposals alphabetically. + * + * @param order true if proposals should be ordered. + */ +// public void orderProposalsAlphabetically(boolean order) { +// fComparator.setOrderAlphabetically(order); +// } } \ No newline at end of file