[autocomplete] 89/143: Minor parameterized completion refactoring.

Benjamin Mesing ben at alioth.debian.org
Sat Oct 19 12:53:23 UTC 2013


This is an automated email from the git hooks/post-receive script.

ben pushed a commit to branch master
in repository autocomplete.

commit e191ed834e877374a55992ad68fdec7cdad9586a
Author: bobbylight <robert at fifesoft.com>
Date:   Tue Jun 19 02:36:53 2012 +0000

    Minor parameterized completion refactoring.
---
 .../ui/autocomplete/AutoCompleteDescWindow.java    |    4 +--
 .../ui/autocomplete/CompletionCellRenderer.java    |    2 +-
 .../ParameterizedCompletionChoicesWindow.java      |    6 ++--
 .../ParameterizedCompletionContext.java            |   29 ++++++++++----------
 4 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/src/org/fife/ui/autocomplete/AutoCompleteDescWindow.java b/src/org/fife/ui/autocomplete/AutoCompleteDescWindow.java
index 0fac65e..8f2c471 100644
--- a/src/org/fife/ui/autocomplete/AutoCompleteDescWindow.java
+++ b/src/org/fife/ui/autocomplete/AutoCompleteDescWindow.java
@@ -530,7 +530,7 @@ class AutoCompleteDescWindow extends JWindow implements HyperlinkListener,
 													get(--historyPos);
 				descArea.setText(pair.summary);
 				if (pair.anchor!=null) {
-					System.out.println("Scrolling to: " + pair.anchor);
+					//System.out.println("Scrolling to: " + pair.anchor);
 					descArea.scrollToReference(pair.anchor);
 				}
 				else {
@@ -562,7 +562,7 @@ class AutoCompleteDescWindow extends JWindow implements HyperlinkListener,
 											get(++historyPos);
 				descArea.setText(pair.summary);
 				if (pair.anchor!=null) {
-					System.out.println("Scrolling to: " + pair.anchor);
+					//System.out.println("Scrolling to: " + pair.anchor);
 					descArea.scrollToReference(pair.anchor);
 				}
 				else {
diff --git a/src/org/fife/ui/autocomplete/CompletionCellRenderer.java b/src/org/fife/ui/autocomplete/CompletionCellRenderer.java
index 2d0ba17..309b90d 100644
--- a/src/org/fife/ui/autocomplete/CompletionCellRenderer.java
+++ b/src/org/fife/ui/autocomplete/CompletionCellRenderer.java
@@ -195,7 +195,7 @@ this.realBG = altBG!=null && (index&1)==0 ? altBG : list.getBackground();
 			else {
 				int textX = paintTextR.x;
 				int textY = paintTextR.y;// + g.getFontMetrics().getAscent();
-				System.out.println(g.getFontMetrics().getAscent());
+				//System.out.println(g.getFontMetrics().getAscent());
 				g.drawString(text, textX, textY);
 			}
 		}
diff --git a/src/org/fife/ui/autocomplete/ParameterizedCompletionChoicesWindow.java b/src/org/fife/ui/autocomplete/ParameterizedCompletionChoicesWindow.java
index 76f0f39..897eb5a 100644
--- a/src/org/fife/ui/autocomplete/ParameterizedCompletionChoicesWindow.java
+++ b/src/org/fife/ui/autocomplete/ParameterizedCompletionChoicesWindow.java
@@ -137,7 +137,7 @@ public class ParameterizedCompletionChoicesWindow extends JWindow {
 	public void incSelection(int amount) {
 		int selection = list.getSelectedIndex();
 		selection += amount;
-		if (selection<=0) {
+		if (selection<0) {
 			// Account for nothing selected yet
 			selection = model.getSize()-1;//+= model.getSize();
 		}
@@ -213,7 +213,7 @@ public class ParameterizedCompletionChoicesWindow extends JWindow {
 
 	/**
 	 * Displays the choices for the specified parameter matching the given
-	 * text.
+	 * text.  This will display or hide this popup window as necessary.
 	 *
 	 * @param param The index of the parameter the caret is currently in.
 	 *        This may be <code>-1</code> if not in a parameter (i.e., on
@@ -295,7 +295,7 @@ public class ParameterizedCompletionChoicesWindow extends JWindow {
 	public void setVisible(boolean visible) {
 		if (visible!=isVisible()) {
 			// i.e. if no possibilities matched what's been typed
-			if (visible && list.getVisibleRowCount()==0) {
+			if (visible && model.size()==0) {//list.getVisibleRowCount()==0) {
 				return;
 			}
 			super.setVisible(visible);
diff --git a/src/org/fife/ui/autocomplete/ParameterizedCompletionContext.java b/src/org/fife/ui/autocomplete/ParameterizedCompletionContext.java
index 37c9013..49ecdfc 100644
--- a/src/org/fife/ui/autocomplete/ParameterizedCompletionContext.java
+++ b/src/org/fife/ui/autocomplete/ParameterizedCompletionContext.java
@@ -693,27 +693,28 @@ class ParameterizedCompletionContext {
 
 			JTextComponent tc = ac.getTextComponent();
 
-			try {
-				int dot = tc.getCaretPosition();
-				Rectangle r = tc.modelToView(dot);
-				Point p = new Point(r.x, r.y);
-				SwingUtilities.convertPointToScreen(p, tc);
-				r.x = p.x;
-				r.y = p.y;
-				tip.setLocationRelativeTo(r);
-				tip.setVisible(true);
-			} catch (BadLocationException ble) { // Should never happen
-				UIManager.getLookAndFeel().provideErrorFeedback(tc);
-				ble.printStackTrace();
-			}
-
 			if (visible) {
+
+				try {
+					int dot = tc.getCaretPosition();
+					Rectangle r = tc.modelToView(dot);
+					Point p = new Point(r.x, r.y);
+					SwingUtilities.convertPointToScreen(p, tc);
+					r.x = p.x;
+					r.y = p.y;
+					tip.setLocationRelativeTo(r);
+				} catch (BadLocationException ble) { // Should never happen
+					UIManager.getLookAndFeel().provideErrorFeedback(tc);
+					ble.printStackTrace();
+				}
+
 				listener.install(tc, addParamListStart);
 				// First time through, we'll need to create this window.
 				if (paramChoicesWindow==null) {
 					paramChoicesWindow = createParamChoicesWindow();
 				}
 				prepareParamChoicesWindow();
+
 			}
 			else {
 				listener.uninstall();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/autocomplete.git



More information about the pkg-java-commits mailing list