summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Kriese2011-05-26 07:08:24 (EDT)
committerSteffen Kriese2011-05-26 07:08:24 (EDT)
commit6e4ad9201a9f0dbaa54a38a16e49dc8c4f1f6ff1 (patch)
treec1079efb9a609c8a6e140e5de83bd7495f023cae
parentacf32b544748b84f91ec5da5c6cf8a6629ffd617 (diff)
downloadorg.eclipse.riena-6e4ad9201a9f0dbaa54a38a16e49dc8c4f1f6ff1.zip
org.eclipse.riena-6e4ad9201a9f0dbaa54a38a16e49dc8c4f1f6ff1.tar.gz
org.eclipse.riena-6e4ad9201a9f0dbaa54a38a16e49dc8c4f1f6ff1.tar.bz2
Fixed Bug 347292 prevent CompletionCombo from deleting the selection when in AutocompleteMode.first_letter_match
-rw-r--r--org.eclipse.riena.ui.swt/src/org/eclipse/riena/ui/swt/CompletionCombo.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/org.eclipse.riena.ui.swt/src/org/eclipse/riena/ui/swt/CompletionCombo.java b/org.eclipse.riena.ui.swt/src/org/eclipse/riena/ui/swt/CompletionCombo.java
index 352828a..9f76e7a 100644
--- a/org.eclipse.riena.ui.swt/src/org/eclipse/riena/ui/swt/CompletionCombo.java
+++ b/org.eclipse.riena.ui.swt/src/org/eclipse/riena/ui/swt/CompletionCombo.java
@@ -138,6 +138,8 @@ public abstract class CompletionCombo extends Composite {
* rejected.
*/
private IFlashDelegate flashDelegate;
+ private Menu systemContextMenu;
+ private Menu emptyContextMenu;
/**
* This enumeration is used to configure the the way the autocompletion
@@ -226,6 +228,9 @@ public abstract class CompletionCombo extends Composite {
label = createLabel(this);
text = new Text(this, textStyle);
text.setBackground(getBackground());
+ systemContextMenu = text.getMenu();
+ emptyContextMenu = new Menu(text);
+
int arrowStyle = SWT.ARROW | SWT.DOWN;
if ((style & SWT.FLAT) != 0) {
arrowStyle |= SWT.FLAT;
@@ -320,7 +325,7 @@ public abstract class CompletionCombo extends Composite {
}
createPopup(null, null, -1);
- autoCompletionMode = AutoCompletionMode.NO_MISSMATCH;
+ setAutoCompletionMode(AutoCompletionMode.NO_MISSMATCH);
}
/**
@@ -1696,6 +1701,14 @@ public abstract class CompletionCombo extends Composite {
public void setAutoCompletionMode(final AutoCompletionMode autoCompletionMode) {
Assert.isNotNull(autoCompletionMode);
this.autoCompletionMode = autoCompletionMode;
+
+ // hide system context menu so the user can not modify the text
+ // by using the cut or paste action
+ if (this.autoCompletionMode == AutoCompletionMode.ALLOW_MISSMATCH) {
+ text.setMenu(systemContextMenu);
+ } else {
+ text.setMenu(emptyContextMenu);
+ }
}
/**
@@ -2488,13 +2501,6 @@ public abstract class CompletionCombo extends Composite {
// ALT + CONTROL + x will not go in here and will be handled
// by isInputChar(x) instead.
event.doit = handleClipboardOperations(event);
- } else if (event.character == SWT.DEL || event.character == SWT.BS) {
- clearImage();
- text.setText(""); //$NON-NLS-1$
- if (getSelectionIndex() > -1) {
- deselectAll(list);
- sendSelectionEvent();
- }
} else if (isControlChar(event)) {
// System.out.println("isControlChar: " + event.character);
event.doit = true;