import org.eclipse.jface.layout.GridDataFactory;\r
import org.eclipse.jface.layout.GridLayoutFactory;\r
import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.custom.StyledText;\r
+import org.eclipse.swt.custom.VerifyKeyListener;\r
import org.eclipse.swt.events.FocusEvent;\r
import org.eclipse.swt.events.FocusListener;\r
import org.eclipse.swt.events.ModifyEvent;\r
import org.eclipse.swt.events.ModifyListener;\r
import org.eclipse.swt.events.MouseEvent;\r
import org.eclipse.swt.events.MouseListener;\r
+import org.eclipse.swt.events.VerifyEvent;\r
import org.eclipse.swt.graphics.Point;\r
import org.eclipse.swt.widgets.Composite;\r
import org.eclipse.swt.widgets.Label;\r
}\r
});\r
\r
+ expressionWidget.addVerifyKeyListener(new VerifyKeyListener() {\r
+ \r
+ @Override\r
+ public void verifyKey(VerifyEvent event) {\r
+ if(event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) {\r
+ if((event.stateMask & SWT.SHIFT) == 0) {\r
+ event.doit = false;\r
+ ((StyledText)event.widget).getParent().forceFocus();\r
+ expressionWidget.save();\r
+ }\r
+ }\r
+ }\r
+ });\r
+ \r
focusLostListener = new org.eclipse.ui.IPartListener2()\r
{\r
public void partInputChanged(IWorkbenchPartReference partRef) {}\r
\r
import org.eclipse.jface.viewers.ISelection;\r
import org.eclipse.jface.viewers.IStructuredSelection;\r
+import org.eclipse.swt.custom.VerifyKeyListener;\r
import org.eclipse.swt.events.FocusListener;\r
import org.eclipse.swt.events.ModifyListener;\r
import org.eclipse.swt.widgets.Composite;\r
private ModifyListener modifyListener;\r
private FocusListener focusListener;\r
private Table variableTable;\r
+ private VerifyKeyListener verifyKeyListener;\r
\r
\r
public ExpressionWidget(Composite parent, WidgetSupport support, int style) {\r
exp.readData(variable, data);\r
\r
exp.createExpressionFields(parent, data);\r
+ if(modifyListener != null)\r
exp.addModifyListener(modifyListener);\r
if(focusListener != null)\r
exp.addFocusListener(focusListener);\r
+ if(verifyKeyListener != null)\r
+ exp.addVerifyKeyListener(verifyKeyListener);\r
this.expression = exp;\r
this.parent.layout();\r
validateFields();\r
this.modifyListener = listener;\r
}\r
\r
+ public void addVerifyKeyListener(VerifyKeyListener listener) {\r
+ this.verifyKeyListener = listener;\r
+ }\r
+ \r
public void addFocusListener(FocusListener listener) {\r
this.focusListener = listener;\r
}\r
import org.eclipse.jface.text.BadLocationException;\r
import org.eclipse.jface.text.IDocument;\r
import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.custom.VerifyKeyListener;\r
import org.eclipse.swt.events.FocusListener;\r
import org.eclipse.swt.events.KeyListener;\r
import org.eclipse.swt.events.ModifyListener;\r
public void addFocusListener(FocusListener listener) {\r
this.expression.getSourceViewer().getTextWidget().addFocusListener(listener);\r
}\r
+\r
+ @Override\r
+ public void addVerifyKeyListener(VerifyKeyListener listener) {\r
+ this.expression.getSourceViewer().getTextWidget().addVerifyKeyListener(listener);\r
+ }\r
}\r
import java.util.List;\r
import java.util.Map;\r
\r
+import org.eclipse.swt.custom.VerifyKeyListener;\r
import org.eclipse.swt.events.FocusListener;\r
import org.eclipse.swt.events.KeyListener;\r
import org.eclipse.swt.events.ModifyListener;\r
\r
}\r
\r
+ @Override\r
+ public void addVerifyKeyListener(VerifyKeyListener listener) {\r
+ // TODO Auto-generated method stub\r
+ \r
+ }\r
+\r
}\r
import java.util.List;\r
import java.util.Map;\r
\r
+import org.eclipse.swt.custom.VerifyKeyListener;\r
import org.eclipse.swt.events.FocusListener;\r
import org.eclipse.swt.events.KeyListener;\r
import org.eclipse.swt.events.ModifyListener;\r
\r
}\r
\r
+ @Override\r
+ public void addVerifyKeyListener(VerifyKeyListener listener) {\r
+ // TODO Auto-generated method stub\r
+ \r
+ }\r
+\r
}\r
import java.util.List;\r
import java.util.Map;\r
\r
+import org.eclipse.swt.custom.VerifyKeyListener;\r
import org.eclipse.swt.events.FocusListener;\r
import org.eclipse.swt.events.KeyListener;\r
import org.eclipse.swt.events.ModifyListener;\r
public void addModifyListener(ModifyListener listener);\r
\r
public void addKeyListener(KeyListener listener);\r
+ \r
+ public void addVerifyKeyListener(VerifyKeyListener listener);\r
\r
public void addFocusListener(FocusListener listener);\r
}\r
import java.util.List;\r
import java.util.Map;\r
\r
+import org.eclipse.swt.custom.VerifyKeyListener;\r
import org.eclipse.swt.events.FocusListener;\r
import org.eclipse.swt.events.KeyListener;\r
import org.eclipse.swt.events.ModifyListener;\r
\r
}\r
\r
+ @Override\r
+ public void addVerifyKeyListener(VerifyKeyListener listener) {\r
+ // TODO Auto-generated method stub\r
+ \r
+ }\r
+\r
}\r
import org.eclipse.jface.text.BadLocationException;\r
import org.eclipse.jface.text.IDocument;\r
import org.eclipse.swt.SWT;\r
+import org.eclipse.swt.custom.VerifyKeyListener;\r
import org.eclipse.swt.events.FocusListener;\r
import org.eclipse.swt.events.KeyListener;\r
import org.eclipse.swt.events.ModifyListener;\r
public void addFocusListener(FocusListener listener) {\r
this.expression.getSourceViewer().getTextWidget().addFocusListener(listener);\r
}\r
+ \r
+ @Override\r
+ public void addVerifyKeyListener(VerifyKeyListener listener) {\r
+ this.expression.getSourceViewer().getTextWidget().addVerifyKeyListener(listener);\r
+ }\r
\r
}\r
import org.eclipse.jface.text.IDocument;\r
import org.eclipse.swt.SWT;\r
import org.eclipse.swt.awt.SWT_AWT;\r
+import org.eclipse.swt.custom.VerifyKeyListener;\r
import org.eclipse.swt.events.FocusAdapter;\r
import org.eclipse.swt.events.FocusEvent;\r
import org.eclipse.swt.events.FocusListener;\r
this.expression.getSourceViewer().getTextWidget().addKeyListener(listener);\r
this.lookup.getSourceViewer().getTextWidget().addKeyListener(listener);\r
}\r
+ \r
+ @Override\r
+ public void addVerifyKeyListener(VerifyKeyListener listener) {\r
+ this.expression.getSourceViewer().getTextWidget().addVerifyKeyListener(listener);\r
+ this.lookup.getSourceViewer().getTextWidget().addVerifyKeyListener(listener);\r
+ }\r
\r
@Override\r
public void addModifyListener(ModifyListener listener) {\r