Revision aae0ca06
Added by Katja Luther about 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/combo/VocabularyComboElement.java | ||
---|---|---|
8 | 8 |
import java.util.Comparator; |
9 | 9 |
import java.util.List; |
10 | 10 |
|
11 |
import org.eclipse.jface.fieldassist.ComboContentAdapter; |
|
12 |
import org.eclipse.jface.fieldassist.ContentProposalAdapter; |
|
13 |
import org.eclipse.jface.fieldassist.IContentProposal; |
|
14 |
import org.eclipse.jface.fieldassist.IContentProposalListener; |
|
15 | 11 |
import org.eclipse.jface.util.PropertyChangeEvent; |
16 | 12 |
import org.eclipse.swt.SWT; |
17 | 13 |
import org.eclipse.swt.events.SelectionEvent; |
... | ... | |
58 | 54 |
|
59 | 55 |
combo.addSelectionListener(this); |
60 | 56 |
combo.addDisposeListener(this); |
61 |
ContentProposalAdapter adapter; |
|
62 |
|
|
63 |
adapter = new ContentProposalAdapter(combo, new ComboContentAdapter(), getProposalProvider(), null, null); |
|
64 |
adapter.setPropagateKeys(true); |
|
65 |
adapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE); |
|
66 |
adapter.addContentProposalListener(new IContentProposalListener() { |
|
67 |
|
|
68 |
@Override |
|
69 |
public void proposalAccepted(IContentProposal proposal) { |
|
70 |
setSelection((VOC)combo.getData(proposal.getContent())); |
|
71 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(getComboElement(), null)); |
|
72 |
} |
|
73 |
}); |
|
57 |
addContentProposalAdapter(); |
|
74 | 58 |
|
75 | 59 |
PreferencesUtil.getPreferenceStore().addPropertyChangeListener(this); |
76 | 60 |
|
... | ... | |
79 | 63 |
} |
80 | 64 |
} |
81 | 65 |
|
82 |
/** |
|
66 |
|
|
67 |
|
|
68 |
/** |
|
83 | 69 |
* <p>Sets the selection of the combo to the given T object.</p> |
84 | 70 |
* <p>Passing <code>null</code> to this method will set the selection to |
85 | 71 |
* the empty element and effectively clear the selection</p> |
... | ... | |
252 | 238 |
combo.remove(EMPTY_ELEMENT_LABEL); |
253 | 239 |
} |
254 | 240 |
|
255 |
private VocabularyComboElement<TERM, VOC> getComboElement(){ |
|
256 |
return this; |
|
257 |
} |
|
258 |
|
|
259 | 241 |
} |
Also available in: Unified diff
fix #8749: move proposal adapter creation to method in abstractComboDetailElement