Bug 436965 Password recording fixed and enabled for text fields with
echo character set.
diff --git a/core/org.eclipse.rcptt.tesla.recording.core.ecl/src/org/eclipse/rcptt/tesla/recording/core/ecl/parser/TeslaParser.java b/core/org.eclipse.rcptt.tesla.recording.core.ecl/src/org/eclipse/rcptt/tesla/recording/core/ecl/parser/TeslaParser.java
index b72f5e8..167a7f3 100644
--- a/core/org.eclipse.rcptt.tesla.recording.core.ecl/src/org/eclipse/rcptt/tesla/recording/core/ecl/parser/TeslaParser.java
+++ b/core/org.eclipse.rcptt.tesla.recording.core.ecl/src/org/eclipse/rcptt/tesla/recording/core/ecl/parser/TeslaParser.java
@@ -30,7 +30,6 @@
import org.eclipse.rcptt.ecl.core.Sequence;
import org.eclipse.rcptt.ecl.core.util.EclRefactoring;
import org.eclipse.swt.dnd.DND;
-
import org.eclipse.rcptt.util.Base64;
import org.eclipse.rcptt.util.swt.KeysAndButtons;
import org.eclipse.rcptt.tesla.core.protocol.ActivateCellEditor;
@@ -97,6 +96,7 @@
import org.eclipse.rcptt.tesla.ecl.TeslaEclUtils;
import org.eclipse.rcptt.tesla.ecl.TeslaScriptletFactory;
import org.eclipse.rcptt.tesla.ecl.model.Button;
+import org.eclipse.rcptt.tesla.ecl.model.Decrypt;
import org.eclipse.rcptt.tesla.ecl.model.ExecWithOptions;
import org.eclipse.rcptt.tesla.ecl.model.FromRawKey;
import org.eclipse.rcptt.tesla.ecl.model.GetProperty;
@@ -296,16 +296,29 @@
}
@TeslaCommand(packageUri = ProtocolPackage.eNS_URI, classifier = "SetText")
- protected Command setText(SetText c) {
- if (c.getElement().getKind().equals(ElementKind.DateTime.name())
- || c.getElement().getKind().equals(ElementKind.Slider.name())) {
- return TeslaScriptletFactory.makePipe(selectorOf(c.getElement()),
- TeslaScriptletFactory.makeSetValue(c.getValue()));
+ protected Command setText(SetText c) {
+ if (c.getElement().getKind().equals(ElementKind.DateTime.name())
+ || c.getElement().getKind().equals(ElementKind.Slider.name())) {
+ return TeslaScriptletFactory.makePipe(selectorOf(c.getElement()),
+ TeslaScriptletFactory.makeSetValue(c.getValue()));
+ }
+
+ org.eclipse.rcptt.tesla.ecl.model.SetText cmd = TeslaFactory.eINSTANCE.createSetText();
+ if (c.isHidden()) {
+ bind(cmd, TeslaPackage.eINSTANCE.getSetText_Text(), decrypt(c.getValue()));
+ } else {
+ cmd.setText(c.getValue());
}
- return TeslaScriptletFactory.makePipe(selectorOf(c.getElement()),
- TeslaScriptletFactory.makeSetText(c.getValue()));
+ return TeslaScriptletFactory.makePipe(selectorOf(c.getElement()),
+ cmd);
}
-
+
+ protected Command decrypt(String rawdata) {
+ Decrypt cmd = TeslaFactory.eINSTANCE.createDecrypt();
+ cmd.setValue(rawdata);
+ return cmd;
+ }
+
@TeslaCommand(packageUri = ProtocolPackage.eNS_URI, classifier = "SetTextSelection")
protected Command setTextSelection(SetTextSelection c) {
if (c.getEndline() != null && c.getEndoffset() != null) {
diff --git a/runtime/tesla/org.eclipse.rcptt.tesla.recording.swt/src/org/eclipse/rcptt/tesla/recording/core/swt/SWTEventRecorder.java b/runtime/tesla/org.eclipse.rcptt.tesla.recording.swt/src/org/eclipse/rcptt/tesla/recording/core/swt/SWTEventRecorder.java
index 23c1869..bec6b61 100644
--- a/runtime/tesla/org.eclipse.rcptt.tesla.recording.swt/src/org/eclipse/rcptt/tesla/recording/core/swt/SWTEventRecorder.java
+++ b/runtime/tesla/org.eclipse.rcptt.tesla.recording.swt/src/org/eclipse/rcptt/tesla/recording/core/swt/SWTEventRecorder.java
@@ -1550,7 +1550,7 @@
|| !beforeTextState.equals(currentText)) {
if (widget != JFaceRecordingProcessor.lastCellEditorControl) {
if (!(widget instanceof Combo)) {
- e.setText(currentText, false, (widget.getStyle() & SWT.PASSWORD) != 0);
+ e.setText(currentText, false, isPasswordField(widget));
} else {
processComboSelection(e,
((Combo) widget).getItems(), currentText);
@@ -1581,6 +1581,15 @@
}
}
+ private static boolean isPasswordField(Widget widget) {
+ if ((widget.getStyle() & SWT.PASSWORD) != 0)
+ return true;
+ if (widget instanceof Text) {
+ return ((Text) widget).getEchoChar() != '\0';
+ }
+ return false;
+ }
+
private void processMenuShow(Widget widget, RecordedEvent toRecording) {
Object menuSource = null;