Revision 960c17a3
Added by Katja Luther almost 3 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/AbstractComboElement.java | ||
---|---|---|
9 | 9 |
package eu.etaxonomy.taxeditor.ui.combo; |
10 | 10 |
|
11 | 11 |
import java.util.ArrayList; |
12 |
import java.util.Collections; |
|
12 | 13 |
|
13 | 14 |
import org.eclipse.equinox.internal.p2.ui.misc.StringMatcher; |
14 | 15 |
import org.eclipse.jface.fieldassist.ComboContentAdapter; |
... | ... | |
161 | 162 |
if (contents.length() == 0 || items.length == 0) { |
162 | 163 |
return new IContentProposal[0]; |
163 | 164 |
} |
164 |
StringMatcher matcher = new StringMatcher(contents + "*", true, false); //$NON-NLS-1$ //$NON-NLS-2$ |
|
165 |
StringMatcher matcher = new StringMatcher("*" + contents + "*", true, false); //$NON-NLS-1$ //$NON-NLS-2$
|
|
165 | 166 |
ArrayList<String> matches = new ArrayList<>(); |
166 | 167 |
for (int i = 0; i < items.length; i++) { |
167 | 168 |
if (matcher.match(items[i])) { |
... | ... | |
169 | 170 |
} |
170 | 171 |
} |
171 | 172 |
|
173 |
Collections.sort(matches); |
|
174 |
|
|
172 | 175 |
// We don't want to autoactivate if the only proposal exactly matches |
173 | 176 |
// what is in the combo. This prevents the popup from |
174 | 177 |
// opening when the user is merely scrolling through the combo values or |
Also available in: Unified diff
some more enable/disable elements issues