summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorKevin Sawicki2011-05-04 15:38:53 (EDT)
committer Kevin Sawicki2011-05-04 15:38:53 (EDT)
commitd8b0596e5524fddb94f6f80886dfa4b3d083050c (patch)
treee31c224d8ef7ec94f5d65373207eb9d4d4b7f5ed
parenta467c56b9e1c6e704b1084eb6b31db42e6e3b94d (diff)
downloadegit-d8b0596e5524fddb94f6f80886dfa4b3d083050c.zip
egit-d8b0596e5524fddb94f6f80886dfa4b3d083050c.tar.gz
egit-d8b0596e5524fddb94f6f80886dfa4b3d083050c.tar.bz2
Lookup index of current text when no selection index.refs/changes/33/3333/2
On Linux GTK the CommitCombo does not work properly because the content proposal popup sets the text of the box but getSelectionIndex still returns -1. getSelectionIndex now looks up the index of the current text if the selection index of the combo returns -1. Change-Id: I06b5d38bee999a68be55f657e84df18c1533e9cb Signed-off-by: Kevin Sawicki <kevin@github.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java
index a40cb42..85fd0fd 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java
@@ -183,14 +183,17 @@ public class CommitCombo extends Composite {
* @return index of selected element
*/
public int getSelectedIndex() {
- return combo.getSelectionIndex();
+ int selectionIndex = combo.getSelectionIndex();
+ if (selectionIndex == -1)
+ selectionIndex = combo.indexOf(combo.getText());
+ return selectionIndex;
}
/**
* @return SHA-1 of selected commit
*/
public ObjectId getValue() {
- int selectionIndex = combo.getSelectionIndex();
+ int selectionIndex = getSelectedIndex();
return -1 != selectionIndex ? getItem(selectionIndex) : null;
}