[jboss-svn-commits] JBL Code SVN: r14033 - labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Aug 4 15:37:58 EDT 2007
Author: pombredanne
Date: 2007-08-04 15:37:58 -0400 (Sat, 04 Aug 2007)
New Revision: 14033
Modified:
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/AbstractCompletionProcessor.java
Log:
Added a small optimization to avoid filetring completion on empty prefix
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/AbstractCompletionProcessor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/AbstractCompletionProcessor.java 2007-08-04 19:37:13 UTC (rev 14032)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/AbstractCompletionProcessor.java 2007-08-04 19:37:58 UTC (rev 14033)
@@ -14,21 +14,21 @@
import org.eclipse.ui.IEditorPart;
/**
- *
+ *
* @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
*/
public abstract class AbstractCompletionProcessor implements IContentAssistProcessor {
private IEditorPart editor;
-
+
public AbstractCompletionProcessor(IEditorPart editor) {
this.editor = editor;
}
-
+
protected IEditorPart getEditor() {
return editor;
}
-
+
public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentOffset) {
List proposals = getCompletionProposals(viewer, documentOffset);
if (proposals == null) {
@@ -37,10 +37,10 @@
Collections.sort(proposals, new RuleCompletionProposal.RuleCompletionProposalComparator());
return (ICompletionProposal[]) proposals.toArray(new ICompletionProposal[proposals.size()]);
}
-
+
/**
* Returns a list of RuleCompletionProposals.
- *
+ *
* @param viewer
* @param documentOffset
* @return
@@ -51,7 +51,7 @@
* Filter out the proposals whose content does not start with the given prefix.
*/
protected static void filterProposalsOnPrefix(String prefix, List props) {
- if (prefix != null) {
+ if ( prefix != null && prefix.trim().length() > 0 ) {
Iterator iterator = props.iterator();
while ( iterator.hasNext() ) {
ICompletionProposal item = (ICompletionProposal) iterator.next();
@@ -67,7 +67,7 @@
/**
* Read some text from behind the cursor position.
* This provides context to both filter what is shown based
- * on what the user has typed in, and also to provide more information for the
+ * on what the user has typed in, and also to provide more information for the
* list of suggestions based on context.
*/
protected String readBackwards(int documentOffset, IDocument doc) throws BadLocationException {
@@ -76,35 +76,35 @@
return prefix;
}
- /*
+ /*
* @see IContentAssistProcessor
*/
public char[] getCompletionProposalAutoActivationCharacters() {
return null;
}
- /*
+ /*
* @see IContentAssistProcessor
*/
public char[] getContextInformationAutoActivationCharacters() {
return null;
}
- /*
+ /*
* @see IContentAssistProcessor
*/
public IContextInformationValidator getContextInformationValidator() {
return null;
}
- /*
+ /*
* @see IContentAssistProcessor
*/
public IContextInformation[] computeContextInformation(ITextViewer viewer, int documentOffset) {
return null;
}
- /*
+ /*
* @see IContentAssistProcessor
*/
public String getErrorMessage() {
More information about the jboss-svn-commits
mailing list