diff options
author | Tor Norbye <tnorbye@google.com> | 2012-06-06 12:41:53 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-06-06 12:41:53 -0700 |
commit | 767eb85ab3a32c1a9621eca167863e625b0927cc (patch) | |
tree | 17cd2abeb9614f485fe5854d6cc749684ac13252 /propertysheet/src/org/eclipse | |
parent | bc38c8ea6aff3059860f68fb8a7053c9fdcf707e (diff) | |
download | eclipse-windowbuilder-767eb85ab3a32c1a9621eca167863e625b0927cc.tar.gz |
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
Diffstat (limited to 'propertysheet/src/org/eclipse')
-rw-r--r-- | propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/AbstractTextPropertyEditor.java | 8 |
1 files changed, 8 insertions, 0 deletions
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 @@ public abstract class AbstractTextPropertyEditor extends TextDisplayPropertyEdit 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 @@ public abstract class AbstractTextPropertyEditor extends TextDisplayPropertyEdit super(control, controlContentAdapter, proposalProvider, keyStroke, autoActivationCharacters); m_propertyTable = propertyTable; + m_proposalProvider = proposalProvider; // On focus gain, start completing control.addFocusListener(this); @@ -103,6 +105,12 @@ public abstract class AbstractTextPropertyEditor extends TextDisplayPropertyEdit } 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() { |