1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
9 IBM Corporation - Initial implementation
10 Klaus Hartlage - www.eclipseproject.de
11 **********************************************************************/
12 package net.sourceforge.phpeclipse.phpeditor.php;
14 import java.sql.Connection;
15 import java.sql.DatabaseMetaData;
16 import java.sql.ResultSet;
17 import java.sql.SQLException;
18 import java.util.ArrayList;
19 import java.util.Arrays;
20 import java.util.List;
21 import java.util.SortedMap;
23 import net.sourceforge.phpdt.core.ToolFactory;
24 import net.sourceforge.phpdt.core.compiler.ITerminalSymbols;
25 import net.sourceforge.phpdt.core.compiler.InvalidInputException;
26 import net.sourceforge.phpdt.internal.compiler.parser.Scanner;
27 import net.sourceforge.phpdt.internal.corext.template.ContextType;
28 import net.sourceforge.phpdt.internal.corext.template.ContextTypeRegistry;
29 import net.sourceforge.phpdt.internal.corext.template.php.CompilationUnitContextType;
30 import net.sourceforge.phpdt.internal.corext.template.php.PHPUnitContext;
31 import net.sourceforge.phpdt.internal.ui.PHPUiImages;
32 import net.sourceforge.phpdt.internal.ui.text.java.IPHPCompletionProposal;
33 import net.sourceforge.phpdt.internal.ui.text.java.PHPCompletionProposalComparator;
34 import net.sourceforge.phpdt.internal.ui.text.template.BuiltInEngine;
35 import net.sourceforge.phpdt.internal.ui.text.template.DeclarationEngine;
36 import net.sourceforge.phpdt.internal.ui.text.template.IdentifierEngine;
37 import net.sourceforge.phpdt.internal.ui.text.template.SQLProposal;
38 import net.sourceforge.phpdt.internal.ui.text.template.TemplateEngine;
39 import net.sourceforge.phpdt.ui.IWorkingCopyManager;
40 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
41 import net.sourceforge.phpeclipse.builder.IdentifierIndexManager;
42 import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
43 import net.sourceforge.phpeclipse.phpeditor.PHPSyntaxRdr;
44 import net.sourceforge.phpeclipse.ui.IPreferenceConstants;
45 import net.sourceforge.phpeclipse.ui.overlaypages.Util;
47 import org.eclipse.core.resources.IFile;
48 import org.eclipse.core.resources.IProject;
49 import org.eclipse.jface.text.BadLocationException;
50 import org.eclipse.jface.text.IDocument;
51 import org.eclipse.jface.text.IRegion;
52 import org.eclipse.jface.text.ITextViewer;
53 import org.eclipse.jface.text.Region;
54 import org.eclipse.jface.text.TextPresentation;
55 import org.eclipse.jface.text.contentassist.ICompletionProposal;
56 import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
57 import org.eclipse.jface.text.contentassist.IContextInformation;
58 import org.eclipse.jface.text.contentassist.IContextInformationExtension;
59 import org.eclipse.jface.text.contentassist.IContextInformationPresenter;
60 import org.eclipse.jface.text.contentassist.IContextInformationValidator;
61 import org.eclipse.swt.graphics.Image;
62 import org.eclipse.ui.IEditorPart;
63 import org.eclipse.ui.IFileEditorInput;
65 import com.quantum.model.Bookmark;
66 import com.quantum.model.BookmarkCollection;
67 import com.quantum.model.NotConnectedException;
68 import com.quantum.util.connection.ConnectionUtil;
71 * Example PHP completion processor.
73 public class PHPCompletionProcessor implements IContentAssistProcessor {
75 * Simple content assist tip closer. The tip is valid in a range of 5
76 * characters around its popup location.
78 protected static class Validator implements IContextInformationValidator,
79 IContextInformationPresenter {
80 protected int fInstallOffset;
83 * @see IContextInformationValidator#isContextInformationValid(int)
85 public boolean isContextInformationValid(int offset) {
86 return Math.abs(fInstallOffset - offset) < 5;
90 * @see IContextInformationValidator#install(IContextInformation,
93 public void install(IContextInformation info, ITextViewer viewer, int offset) {
94 fInstallOffset = offset;
98 * @see org.eclipse.jface.text.contentassist.IContextInformationPresenter#updatePresentation(int,
101 public boolean updatePresentation(int documentPosition,
102 TextPresentation presentation) {
107 private static class ContextInformationWrapper implements
108 IContextInformation, IContextInformationExtension {
109 private final IContextInformation fContextInformation;
111 private int fPosition;
113 public ContextInformationWrapper(IContextInformation contextInformation) {
114 fContextInformation = contextInformation;
118 * @see IContextInformation#getContextDisplayString()
120 public String getContextDisplayString() {
121 return fContextInformation.getContextDisplayString();
125 * @see IContextInformation#getImage()
127 public Image getImage() {
128 return fContextInformation.getImage();
132 * @see IContextInformation#getInformationDisplayString()
134 public String getInformationDisplayString() {
135 return fContextInformation.getInformationDisplayString();
139 * @see IContextInformationExtension#getContextInformationPosition()
141 public int getContextInformationPosition() {
145 public void setContextInformationPosition(int position) {
146 fPosition = position;
150 private class TableName {
158 * @return Returns the tableName.
160 public String getTableName() {
161 if (fTableName == null) {
162 return "<!--no-table-->";
169 * The tableName to set.
171 public void setTableName(String tableName) {
172 fTableName = tableName;
176 private char[] fProposalAutoActivationSet;
178 protected IContextInformationValidator fValidator = new Validator();
180 private TemplateEngine fTemplateEngine;
182 private PHPCompletionProposalComparator fComparator;
184 private int fNumberOfComputedResults = 0;
186 private IEditorPart fEditor;
188 protected IWorkingCopyManager fManager;
190 public PHPCompletionProcessor(IEditorPart editor) {
192 fManager = PHPeclipsePlugin.getDefault().getWorkingCopyManager();
193 ContextType contextType = ContextTypeRegistry.getInstance().getContextType(
194 "php"); //$NON-NLS-1$
195 if (contextType != null)
196 fTemplateEngine = new TemplateEngine(contextType);
197 fComparator = new PHPCompletionProposalComparator();
201 * Tells this processor to order the proposals alphabetically.
204 * <code>true</code> if proposals should be ordered.
206 public void orderProposalsAlphabetically(boolean order) {
207 fComparator.setOrderAlphabetically(order);
211 * Sets this processor's set of characters triggering the activation of the
212 * completion proposal computation.
214 * @param activationSet
217 public void setCompletionProposalAutoActivationCharacters(char[] activationSet) {
218 fProposalAutoActivationSet = activationSet;
222 * (non-Javadoc) Method declared on IContentAssistProcessor
224 public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
225 int documentOffset) {
226 int contextInformationPosition = guessContextInformationPosition(viewer,
228 return internalComputeCompletionProposals(viewer, documentOffset,
229 contextInformationPosition);
232 private int getLastToken(ITextViewer viewer, int completionPosition,
233 PHPUnitContext context, TableName tableName) {
234 IDocument document = viewer.getDocument();
235 int start = context.getStart();
236 int end = context.getEnd();
238 int lastSignificantToken = ITerminalSymbols.TokenNameEOF;
240 // begin search 2 lines behind of this
245 ch = document.getChar(j);
251 ch = document.getChar(j);
258 // scan the line for the dereferencing operator '->'
259 startText = document.get(j, start - j);
261 System.out.println(startText);
263 int token = ITerminalSymbols.TokenNameEOF;
264 // token = getLastSQLToken(startText);
265 tableName.setTableName(getLastSQLTableName(startText));
266 Scanner scanner = ToolFactory.createScanner(false, false, false);
267 scanner.setSource(startText.toCharArray());
268 scanner.setPHPMode(true);
269 int beforeLastToken = ITerminalSymbols.TokenNameEOF;
270 int lastToken = ITerminalSymbols.TokenNameEOF;
273 token = scanner.getNextToken();
275 while (token != ITerminalSymbols.TokenNameERROR
276 && token != ITerminalSymbols.TokenNameEOF) {
277 beforeLastToken = lastToken;
278 if (lastToken==ITerminalSymbols.TokenNameVariable) {
279 ident = scanner.getCurrentTokenSource();
280 if (ident.length==5 &&
286 beforeLastToken = ITerminalSymbols.TokenNamethis_PHP_COMPLETION;
290 // System.out.println(scanner.toStringAction(lastToken));
291 token = scanner.getNextToken();
293 } catch (InvalidInputException e1) {
296 case ITerminalSymbols.TokenNameMINUS_GREATER:
297 // dereferencing operator '->' found
298 lastSignificantToken = ITerminalSymbols.TokenNameMINUS_GREATER;
299 if (beforeLastToken == ITerminalSymbols.TokenNameVariable) {
300 lastSignificantToken = ITerminalSymbols.TokenNameVariable;
303 case ITerminalSymbols.TokenNamenew:
304 lastSignificantToken = ITerminalSymbols.TokenNamenew;
308 } catch (BadLocationException e) {
310 return lastSignificantToken;
313 String getSQLTableName(String sqlText, int start) {
314 int tableNameStart = -1;
315 int currentCharacterPosition = start + 1;
319 ch = sqlText.charAt(currentCharacterPosition++);
320 if (tableNameStart == -1 && Character.isJavaIdentifierStart(ch)) {
321 tableNameStart = currentCharacterPosition - 1;
323 if (!Character.isJavaIdentifierPart(ch)) {
324 return sqlText.substring(tableNameStart,
325 currentCharacterPosition - 1);
329 } catch (IndexOutOfBoundsException e) {
330 if (tableNameStart >= 0) {
331 return sqlText.substring(tableNameStart, currentCharacterPosition - 1);
337 private String getLastSQLTableName(String startText) {
339 // scan for sql identifiers
341 int currentSQLPosition = startText.length();
344 boolean whiteSpace = true;
347 ch = startText.charAt(--currentSQLPosition);
348 if (ch >= 'A' && ch <= 'Z') {
350 identEnd = currentSQLPosition + 1;
352 } else if (ch >= 'a' && ch <= 'z') {
354 identEnd = currentSQLPosition + 1;
356 } else if (identEnd >= 0) {
357 ident = startText.substring(currentSQLPosition + 1, identEnd);
358 // select -- from -- where --
359 // update -- set -- where --
360 // insert into -- ( -- ) values ( -- )
361 if (ident.length() >= 4 && ident.length() <= 6) {
362 ident = ident.toLowerCase();
363 switch (ident.length()) {
365 // if (ident.equals("set")) {
366 // // System.out.println("set");
367 // token = ITerminalSymbols.TokenNameSQLset;
372 if (ident.equals("from")) {
373 // System.out.println("from");
374 token = ITerminalSymbols.TokenNameSQLfrom;
375 return getSQLTableName(startText, identEnd);
376 } else if (ident.equals("into")) {
377 // System.out.println("into");
378 token = ITerminalSymbols.TokenNameSQLinto;
379 return getSQLTableName(startText, identEnd);
383 // if (ident.equals("where")) {
384 // // System.out.println("where");
385 // token = ITerminalSymbols.TokenNameSQLwhere;
390 // if (ident.equals("select")) {
391 // // System.out.println("select");
392 // token = ITerminalSymbols.TokenNameSQLselect;
394 // } else if (ident.equals("insert")) {
395 // // System.out.println("insert");
396 // token = ITerminalSymbols.TokenNameSQLinsert;
399 if (ident.equals("update")) {
400 // System.out.println("update");
401 token = ITerminalSymbols.TokenNameSQLupdate;
402 return getSQLTableName(startText, identEnd);
404 // else if (ident.equals("values")) {
405 // // System.out.println("values");
406 // token = ITerminalSymbols.TokenNameSQLvalues;
414 } else if (Character.isWhitespace(ch)) {
419 } catch (IndexOutOfBoundsException e) {
421 return "<!--no-table-->";
425 * Detect the last significant SQL token in the text before the completion
429 private int getLastSQLToken(String startText) {
431 // scan for sql identifiers
433 int currentSQLPosition = startText.length();
436 boolean whiteSpace = true;
439 ch = startText.charAt(--currentSQLPosition);
440 if (ch >= 'A' && ch <= 'Z') {
442 identEnd = currentSQLPosition + 1;
444 } else if (ch >= 'a' && ch <= 'z') {
446 identEnd = currentSQLPosition + 1;
448 } else if (identEnd >= 0) {
449 ident = startText.substring(currentSQLPosition + 1, identEnd);
450 // select -- from -- where --
451 // update -- set -- where --
452 // insert into -- ( -- ) values ( -- )
453 if (ident.length() >= 3 && ident.length() <= 6) {
454 ident = ident.toLowerCase();
455 switch (ident.length()) {
457 if (ident.equals("set")) {
458 // System.out.println("set");
459 token = ITerminalSymbols.TokenNameSQLset;
464 if (ident.equals("from")) {
465 // System.out.println("from");
466 token = ITerminalSymbols.TokenNameSQLfrom;
469 } else if (ident.equals("into")) {
470 // System.out.println("into");
471 token = ITerminalSymbols.TokenNameSQLinto;
476 if (ident.equals("where")) {
477 // System.out.println("where");
478 token = ITerminalSymbols.TokenNameSQLwhere;
483 if (ident.equals("select")) {
484 // System.out.println("select");
485 token = ITerminalSymbols.TokenNameSQLselect;
487 } else if (ident.equals("insert")) {
488 // System.out.println("insert");
489 token = ITerminalSymbols.TokenNameSQLinsert;
491 } else if (ident.equals("update")) {
492 // System.out.println("update");
493 token = ITerminalSymbols.TokenNameSQLupdate;
495 } else if (ident.equals("values")) {
496 // System.out.println("values");
497 token = ITerminalSymbols.TokenNameSQLvalues;
505 } else if (Character.isWhitespace(ch)) {
510 } catch (IndexOutOfBoundsException e) {
512 return ITerminalSymbols.TokenNameEOF;
515 private ICompletionProposal[] internalComputeCompletionProposals(
516 ITextViewer viewer, int offset, int contextOffset) {
518 IDocument document = viewer.getDocument();
519 Object[] identifiers = null;
521 IProject project = null;
523 PHPEditor editor = null;
524 if (fEditor != null && (fEditor instanceof PHPEditor)) {
525 editor = (PHPEditor) fEditor;
526 file = ((IFileEditorInput) editor.getEditorInput()).getFile();
527 project = file.getProject();
528 // outlinePage = editor.getfOutlinePage();
529 // TODO: get the identifiers from the new model
530 // if (outlinePage instanceof PHPContentOutlinePage) {
531 // identifiers = ((PHPContentOutlinePage) outlinePage).getVariables();
536 ContextType phpContextType = ContextTypeRegistry.getInstance()
537 .getContextType("php"); //$NON-NLS-1$
538 ((CompilationUnitContextType) phpContextType).setContextParameters(
539 document, offset, 0);
540 PHPUnitContext context = (PHPUnitContext) phpContextType.createContext();
541 String prefix = context.getKey();
542 TableName sqlTable = new TableName();
543 int lastSignificantToken = getLastToken(viewer, offset, context, sqlTable);
544 boolean useClassMembers = (lastSignificantToken == ITerminalSymbols.TokenNameMINUS_GREATER)
545 || (lastSignificantToken == ITerminalSymbols.TokenNameVariable)
546 || (lastSignificantToken == ITerminalSymbols.TokenNamenew)
547 || (lastSignificantToken == ITerminalSymbols.TokenNamethis_PHP_COMPLETION);
548 boolean emptyPrefix = prefix == null || prefix.equals("");
549 if (fTemplateEngine != null) {
550 IPHPCompletionProposal[] templateResults = new IPHPCompletionProposal[0];
551 ICompletionProposal[] results;
553 fTemplateEngine.reset();
554 fTemplateEngine.complete(viewer, offset); //, unit);
555 templateResults = fTemplateEngine.getResults();
557 IPHPCompletionProposal[] identifierResults = new IPHPCompletionProposal[0];
558 if ((!useClassMembers) && identifiers != null) {
559 IdentifierEngine identifierEngine;
560 ContextType contextType = ContextTypeRegistry.getInstance()
561 .getContextType("php"); //$NON-NLS-1$
562 if (contextType != null) {
563 identifierEngine = new IdentifierEngine(contextType);
564 identifierEngine.complete(viewer, offset, identifiers);
565 identifierResults = identifierEngine.getResults();
568 // declarations stored in file project.index on project level
569 IPHPCompletionProposal[] declarationResults = new IPHPCompletionProposal[0];
570 if (project != null) {
571 DeclarationEngine declarationEngine;
572 ContextType contextType = ContextTypeRegistry.getInstance()
573 .getContextType("php"); //$NON-NLS-1$
574 if (contextType != null) {
575 IdentifierIndexManager indexManager = PHPeclipsePlugin.getDefault()
576 .getIndexManager(project);
577 SortedMap sortedMap = indexManager.getIdentifierMap();
578 declarationEngine = new DeclarationEngine(project, contextType,
579 lastSignificantToken, file);
580 declarationEngine.complete(viewer, offset, sortedMap);
581 declarationResults = declarationEngine.getResults();
584 // built in function names from phpsyntax.xml
585 ArrayList syntaxbuffer = PHPSyntaxRdr.getSyntaxData();
586 IPHPCompletionProposal[] builtinResults = new IPHPCompletionProposal[0];
587 if ((!useClassMembers) && syntaxbuffer != null) {
588 BuiltInEngine builtinEngine;
590 ContextType contextType = ContextTypeRegistry.getInstance()
591 .getContextType("php"); //$NON-NLS-1$
592 if (contextType != null) {
593 builtinEngine = new BuiltInEngine(contextType);
594 builtinEngine.complete(viewer, offset, syntaxbuffer);
595 builtinResults = builtinEngine.getResults();
598 IPHPCompletionProposal[] sqlResults = new IPHPCompletionProposal[0];
599 if (project != null) {
600 // Get The Database bookmark from the Quantum SQL plugin:
601 BookmarkCollection sqlBookMarks = BookmarkCollection.getInstance();
602 if (sqlBookMarks != null) {
603 String bookmarkString = Util.getMiscProjectsPreferenceValue(project,
604 IPreferenceConstants.PHP_BOOKMARK_DEFAULT);
605 if (bookmarkString != null && !bookmarkString.equals("")) {
606 Bookmark bookmark = sqlBookMarks.find(bookmarkString);
607 ArrayList sqlList = new ArrayList();
608 if (bookmark != null && !bookmark.isConnected()) {
609 new ConnectionUtil().connect(bookmark, null);
611 if (bookmark != null && bookmark.isConnected()) {
613 Connection connection = bookmark.getConnection();
614 DatabaseMetaData metaData = connection.getMetaData();
616 if (metaData != null) {
617 int start = context.getStart();
618 int end = context.getEnd();
619 String foundSQLTableName = sqlTable.getTableName();
622 String prefixWithoutDollar = prefix;
623 boolean isDollarPrefix = false;
624 if (prefix.length() > 0 && prefix.charAt(0) == '$') {
625 prefixWithoutDollar = prefix.substring(1);
626 isDollarPrefix = true;
628 IRegion region = new Region(start, end - start);
630 if (!isDollarPrefix) {
631 set = metaData.getTables(null, null, prefixWithoutDollar
634 // String tempSchema = set.getString("TABLE_SCHEM");
635 // tempSchema = (tempSchema == null) ? "" :
636 // tempSchema.trim();
637 tableName = set.getString("TABLE_NAME");
638 tableName = (tableName == null) ? "" : tableName.trim();
639 if (tableName != null && tableName.length() > 0) {
640 sqlList.add(new SQLProposal(tableName, context, region,
641 viewer, PHPUiImages.get(PHPUiImages.IMG_TABLE)));
646 set = metaData.getColumns(null, null, "%",
647 prefixWithoutDollar + "%");
648 SQLProposal sqlProposal;
650 columnName = set.getString("COLUMN_NAME");
651 columnName = (columnName == null) ? "" : columnName.trim();
652 tableName = set.getString("TABLE_NAME");
653 tableName = (tableName == null) ? "" : tableName.trim();
654 if (tableName != null && tableName.length() > 0
655 && columnName != null && columnName.length() > 0) {
656 if (isDollarPrefix) {
657 sqlProposal = new SQLProposal(tableName, "$"
658 + columnName, context, region, viewer, PHPUiImages
659 .get(PHPUiImages.IMG_COLUMN));
661 sqlProposal = new SQLProposal(tableName, columnName,
662 context, region, viewer, PHPUiImages
663 .get(PHPUiImages.IMG_COLUMN));
665 if (tableName.equals(foundSQLTableName)) {
666 sqlProposal.setRelevance(90);
667 } else if (tableName.indexOf(foundSQLTableName) >= 0) {
668 sqlProposal.setRelevance(75);
670 sqlList.add(sqlProposal);
674 sqlResults = new IPHPCompletionProposal[sqlList.size()];
675 for (int i = 0; i < sqlList.size(); i++) {
676 sqlResults[i] = (SQLProposal) sqlList.get(i);
679 } catch (NotConnectedException e) {
680 // ignore this - not mission critical
681 } catch (SQLException e) {
688 // concatenate the result arrays
689 IPHPCompletionProposal[] total;
690 total = new IPHPCompletionProposal[templateResults.length
691 + identifierResults.length + builtinResults.length
692 + declarationResults.length + sqlResults.length];
693 System.arraycopy(templateResults, 0, total, 0, templateResults.length);
694 System.arraycopy(identifierResults, 0, total, templateResults.length,
695 identifierResults.length);
696 System.arraycopy(builtinResults, 0, total, templateResults.length
697 + identifierResults.length, builtinResults.length);
698 System.arraycopy(declarationResults, 0, total, templateResults.length
699 + identifierResults.length + builtinResults.length,
700 declarationResults.length);
701 System.arraycopy(sqlResults, 0, total, templateResults.length
702 + identifierResults.length + builtinResults.length
703 + declarationResults.length, sqlResults.length);
705 fNumberOfComputedResults = (results == null ? 0 : results.length);
707 * Order here and not in result collector to make sure that the order
708 * applies to all proposals and not just those of the compilation unit.
710 return order(results);
712 return new IPHPCompletionProposal[0];
715 private int guessContextInformationPosition(ITextViewer viewer, int offset) {
716 int contextPosition = offset;
717 IDocument document = viewer.getDocument();
720 // PHPCodeReader reader= new PHPCodeReader();
721 // reader.configureBackwardReader(document, offset, true, true);
723 // int nestingLevel= 0;
725 // int curr= reader.read();
726 // while (curr != PHPCodeReader.EOF) {
728 // if (')' == (char) curr)
731 // else if ('(' == (char) curr) {
734 // if (nestingLevel < 0) {
735 // int start= reader.getOffset();
736 // if (looksLikeMethod(reader))
741 // curr= reader.read();
743 // } catch (IOException e) {
745 return contextPosition;
749 * (non-Javadoc) Method declared on IContentAssistProcessor
751 // public IContextInformation[] computeContextInformation(ITextViewer viewer,
752 // int documentOffset) {
753 // IContextInformation[] result = new IContextInformation[5];
754 // for (int i = 0; i < result.length; i++)
756 // ContextInformation(MessageFormat.format(PHPEditorMessages.getString("CompletionProcessor.ContextInfo.display.pattern"),
757 // new Object[] { new Integer(i), new Integer(documentOffset)}),
759 // MessageFormat.format(PHPEditorMessages.getString("CompletionProcessor.ContextInfo.value.pattern"),
760 // new Object[] { new Integer(i), new Integer(documentOffset - 5), new
761 // Integer(documentOffset + 5)})); //$NON-NLS-1$
765 * @see IContentAssistProcessor#computeContextInformation(ITextViewer, int)
767 public IContextInformation[] computeContextInformation(ITextViewer viewer,
769 int contextInformationPosition = guessContextInformationPosition(viewer,
771 List result = addContextInformations(viewer, contextInformationPosition);
772 return (IContextInformation[]) result
773 .toArray(new IContextInformation[result.size()]);
776 private List addContextInformations(ITextViewer viewer, int offset) {
777 ICompletionProposal[] proposals = internalComputeCompletionProposals(
779 List result = new ArrayList();
780 for (int i = 0; i < proposals.length; i++) {
781 IContextInformation contextInformation = proposals[i]
782 .getContextInformation();
783 if (contextInformation != null) {
784 ContextInformationWrapper wrapper = new ContextInformationWrapper(
786 wrapper.setContextInformationPosition(offset);
794 * Order the given proposals.
796 private ICompletionProposal[] order(ICompletionProposal[] proposals) {
797 Arrays.sort(proposals, fComparator);
802 * (non-Javadoc) Method declared on IContentAssistProcessor
804 public char[] getCompletionProposalAutoActivationCharacters() {
805 return fProposalAutoActivationSet;
806 // return null; // new char[] { '$' };
810 * (non-Javadoc) Method declared on IContentAssistProcessor
812 public char[] getContextInformationAutoActivationCharacters() {
813 return new char[] {};
817 * (non-Javadoc) Method declared on IContentAssistProcessor
819 public IContextInformationValidator getContextInformationValidator() {
824 * (non-Javadoc) Method declared on IContentAssistProcessor
826 public String getErrorMessage() {