diff options
author | Ansgar Radermacher | 2014-05-11 20:38:55 +0000 |
---|---|---|
committer | Ansgar Radermacher | 2014-05-12 05:20:43 +0000 |
commit | f3a48a855391bb1b348c8689f45eae640bba5573 (patch) | |
tree | 86c2e0cff8a932b6b30b25b0c675125bf43afe44 /plugins/uml/xtext | |
parent | e39e50efd845db6b228ec79e197cf0780506fce7 (diff) | |
download | org.eclipse.papyrus-f3a48a855391bb1b348c8689f45eae640bba5573.tar.gz org.eclipse.papyrus-f3a48a855391bb1b348c8689f45eae640bba5573.tar.xz org.eclipse.papyrus-f3a48a855391bb1b348c8689f45eae640bba5573.zip |
433855: [OCL in Papyrus] Pressing delete during constraint writing makes Papyrus think you want to delete the entire element
Diffstat (limited to 'plugins/uml/xtext')
-rw-r--r-- | plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/StyledTextCellEditor.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/StyledTextCellEditor.java b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/StyledTextCellEditor.java index 2a05f5cb7e8..a03ca212d36 100644 --- a/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/StyledTextCellEditor.java +++ b/plugins/uml/xtext/org.eclipse.papyrus.uml.xtext.integration.ui/src/org/eclipse/papyrus/uml/xtext/integration/StyledTextCellEditor.java @@ -19,6 +19,7 @@ import org.eclipse.jface.viewers.CellEditor; import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.custom.VerifyKeyListener;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.KeyAdapter;
@@ -31,6 +32,7 @@ import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
+import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
@@ -161,6 +163,20 @@ public class StyledTextCellEditor extends CellEditor { text.setBackground(parent.getBackground());
text.setText("");//$NON-NLS-1$
text.addModifyListener(getModifyListener());
+
+ // fix for bug 433855: delete at end of input deletes whole constraint
+ text.addVerifyKeyListener(new VerifyKeyListener() {
+
+ public void verifyKey(VerifyEvent event) {
+ event.doit = true;
+ // Allow delete only, if enabled
+ if (event.character == '\u007F') {
+ if (!isDeleteEnabled()) {
+ event.doit = false;
+ }
+ }
+ }
+ });
return text;
}
|