This is an automated email from the git hooks/post-receive script. ben pushed a commit to branch master in repository autocomplete.
commit f12db2ee87fd72200b82cd93f1dd1a46ef41b3ed Author: bobbylight <[email protected]> Date: Sat Jan 3 23:18:02 2009 +0000 Description for function parameters added to ProceduralLanguageCompletionProvider. Started "LanguageAwareCompletionProvider", which uses RSTA's syntax highlighting to provide more intelligent completion choices. Adding getReplacementText() hook to AutoCompletion. --- src/org/fife/ui/autocomplete/AutoCompletion.java | 36 ++++++++++++++++---- .../LanguageAwareCompletionProvider.java | 1 - 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/org/fife/ui/autocomplete/AutoCompletion.java b/src/org/fife/ui/autocomplete/AutoCompletion.java index 91fe502..a1eae7d 100644 --- a/src/org/fife/ui/autocomplete/AutoCompletion.java +++ b/src/org/fife/ui/autocomplete/AutoCompletion.java @@ -187,6 +187,25 @@ public class AutoCompletion implements HierarchyListener { /** + * Returns the text to replace with in the document. This is a + * "last-chance" hook for subclasses to make special modifications to the + * completion text inserted. The default implementation simply returns + * <tt>c.getReplacementText()</tt>. You usually will not need to modify + * this method. + * + * @param c The completion being inserted. + * @param doc The document being modified. + * @param start The start of the text being replaced. + * @param len The length of the text being replaced. + * @return The text to replace with. + */ + protected String getReplacementText(Completion c, Document doc, int start, + int len) { + return c.getReplacementText(); + } + + + /** * Returns whether the "description window" should be shown alongside * the completion window. * @@ -272,20 +291,23 @@ public class AutoCompletion implements HierarchyListener { Caret caret = textComp.getCaret(); int dot = caret.getDot(); - caret.setDot(dot - alreadyEntered.length()); + int len = alreadyEntered.length(); + int start = dot-len; + String replacement = getReplacementText(c, textComp.getDocument(), + start, len); + + caret.setDot(start); caret.moveDot(dot); - textComp.replaceSelection(c.getReplacementText()); + textComp.replaceSelection(replacement); /* Document doc = textComp.getDocument(); - int end = caret.getDot(); - int start = end - alreadyEntered.length(); try { if (doc instanceof AbstractDocument) { - ((AbstractDocument)doc).replace(start, end-start, c.getReplacementText(), null); + ((AbstractDocument)doc).replace(start, len, replacement, null); } else { - doc.remove(start, end-start); - doc.insertString(start, c.getReplacementText(), null); + doc.remove(start, len); + doc.insertString(start, replacement, null); } } catch (javax.swing.text.BadLocationException ble) { ble.printStackTrace(); } */ diff --git a/src/org/fife/ui/autocomplete/LanguageAwareCompletionProvider.java b/src/org/fife/ui/autocomplete/LanguageAwareCompletionProvider.java index 5aca9b8..f1ec8ba 100644 --- a/src/org/fife/ui/autocomplete/LanguageAwareCompletionProvider.java +++ b/src/org/fife/ui/autocomplete/LanguageAwareCompletionProvider.java @@ -24,7 +24,6 @@ package org.fife.ui.autocomplete; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import javax.swing.text.JTextComponent; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/autocomplete.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

