/*******************************************************************************
* 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
*******************************************************************************/
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;
*/
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.
*/
/*
* (non-Javadoc)
- *
+ *
* @see org.eclipse.jface.text.contentassist.IContentAssistProcessor#computeCompletionProposals(org.eclipse.jface.text.ITextViewer,
* int)
*/
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];
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 <code>true</code> if proposals should be ordered.
+ */
+// public void orderProposalsAlphabetically(boolean order) {
+// fComparator.setOrderAlphabetically(order);
+// }
}
\ No newline at end of file