Prevent beeps in property editor
Clicking focus into a property editor which both has
proposal support as well as has a current value which
is not a proposal match (for example, a TextView's text
property can have a hardcoded string which is not a
match for the proposals which are for @-resources) would
cause an audible beep. This CL prevents that.
Change-Id: I0a006f594266cce248b91d065f4d438659b1743b
diff --git a/propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/AbstractTextPropertyEditor.java b/propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/AbstractTextPropertyEditor.java
index 1ee9237..dd651af 100644
--- a/propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/AbstractTextPropertyEditor.java
+++ b/propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/AbstractTextPropertyEditor.java
@@ -57,6 +57,7 @@
private class ImmediateProposalAdapter extends ContentProposalAdapter
implements FocusListener, IContentProposalListener, IContentProposalListener2 {
private final PropertyTable m_propertyTable;
+ private final IContentProposalProvider m_proposalProvider;
public ImmediateProposalAdapter(
Text control,
IControlContentAdapter controlContentAdapter,
@@ -67,6 +68,7 @@
super(control, controlContentAdapter, proposalProvider, keyStroke,
autoActivationCharacters);
m_propertyTable = propertyTable;
+ m_proposalProvider = proposalProvider;
// On focus gain, start completing
control.addFocusListener(this);
@@ -103,6 +105,12 @@
}
private void openIfNecessary() {
+ if (m_textControl == null || m_textControl.isDisposed() ||
+ m_proposalProvider.getProposals(m_textControl.getText(),
+ m_textControl.getCaretPosition()).length == 0) {
+ return;
+ }
+
getControl().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {