Skip to content

Commit 32609a8

Browse files
committed
Fix conversion of OPI script and command actions to BOB format
Currently these cannot be parsed and so the actions get removed in the conveerted BOB.
1 parent 7d8db27 commit 32609a8

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

app/display/actions/src/main/java/org/csstudio/display/actions/ExecuteCommandAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void writeToXML(ModelWriter modelWriter, XMLStreamWriter writer) throws E
9393
@Override
9494
public boolean matchesAction(String actionId) {
9595
return actionId.equalsIgnoreCase(EXECUTE_COMMAND) ||
96-
"EXECUTE_CMD".equalsIgnoreCase(type);
96+
actionId.equalsIgnoreCase("EXECUTE_CMD");
9797
}
9898

9999
public String getCommand() {

app/display/actions/src/main/java/org/csstudio/display/actions/ExecuteScriptAction.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public Image getImage() {
5858

5959
@Override
6060
public void readFromXML(ModelReader modelReader, Element actionXml) throws Exception {
61+
String type = actionXml.getAttribute(XMLTags.TYPE);
6162
if (type.equalsIgnoreCase(EXECUTE_SCRIPT)) {
6263
// <script file="EmbeddedPy">
6364
// <text> the embedded text </text>
@@ -105,10 +106,10 @@ public void writeToXML(ModelWriter modelWriter, XMLStreamWriter writer) throws E
105106
writer.writeAttribute(XMLTags.TYPE, EXECUTE_SCRIPT);
106107
writeDescriptionToXML(writer, description);
107108
writer.writeStartElement(XMLTags.SCRIPT);
108-
writer.writeAttribute(XMLTags.FILE, path);
109+
writer.writeAttribute(XMLTags.FILE, scriptInfo.getPath());
109110
// The controller updates the text and path not the scriptInfo
110-
if (this.path.equals(ScriptInfo.EMBEDDED_PYTHON) ||
111-
this.path.equals(ScriptInfo.EMBEDDED_JAVASCRIPT)) {
111+
if (scriptInfo.getPath().equals(ScriptInfo.EMBEDDED_PYTHON) ||
112+
scriptInfo.getPath().equals(ScriptInfo.EMBEDDED_JAVASCRIPT)) {
112113
final String text = this.text;
113114
if (text != null) {
114115
writer.writeStartElement(XMLTags.TEXT);
@@ -119,6 +120,13 @@ public void writeToXML(ModelWriter modelWriter, XMLStreamWriter writer) throws E
119120
writer.writeEndElement();
120121
}
121122

123+
@Override
124+
public boolean matchesAction(String actionId) {
125+
return actionId.equalsIgnoreCase(EXECUTE_SCRIPT) ||
126+
actionId.equalsIgnoreCase(EXECUTE_PYTHONSCRIPT) ||
127+
actionId.equalsIgnoreCase(EXECUTE_JAVASCRIPT);
128+
}
129+
122130
public ScriptInfo getScriptInfo() {
123131
return scriptInfo;
124132
}

0 commit comments

Comments
 (0)