diff options
author | Kevin Sawicki | 2011-05-04 19:38:53 +0000 |
---|---|---|
committer | Kevin Sawicki | 2011-05-04 19:38:53 +0000 |
commit | d8b0596e5524fddb94f6f80886dfa4b3d083050c (patch) | |
tree | e31c224d8ef7ec94f5d65373207eb9d4d4b7f5ed /org.eclipse.egit.ui | |
parent | a467c56b9e1c6e704b1084eb6b31db42e6e3b94d (diff) | |
download | egit-d8b0596e5524fddb94f6f80886dfa4b3d083050c.tar.gz egit-d8b0596e5524fddb94f6f80886dfa4b3d083050c.tar.xz egit-d8b0596e5524fddb94f6f80886dfa4b3d083050c.zip |
Lookup index of current text when no selection index.
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>
Diffstat (limited to 'org.eclipse.egit.ui')
-rw-r--r-- | org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/CommitCombo.java | 7 |
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 a40cb42ed4..85fd0fded1 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; } |