use of org.eclipse.titan.common.parsers.AddedParseTree in project titan.EclipsePlug-ins by eclipse.
the class TestportParameterTransfer method nativeToJava.
@Override
protected TestportParameter[] nativeToJava(final TransferData transferData) {
byte[] bytes = (byte[]) super.nativeToJava(transferData);
DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
try {
int n = in.readInt();
TestportParameter[] items = new TestportParameter[n];
String componentName;
String testportName;
String parameterName;
String hiddenBefore1;
String hiddenBefore2;
String value;
for (int i = 0; i < n; i++) {
TestportParameter item = new TestportParameterSectionHandler.TestportParameter();
final ParseTree root = new ParserRuleContext();
item.setRoot(root);
// component name part
hiddenBefore1 = in.readUTF();
componentName = in.readUTF();
hiddenBefore2 = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBefore1));
item.setComponentName(new AddedParseTree(componentName));
ConfigTreeNodeUtilities.addChild(root, item.getComponentName());
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBefore2));
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("".equals(componentName) ? "" : "."));
// testport name part
hiddenBefore1 = in.readUTF();
testportName = in.readUTF();
hiddenBefore2 = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBefore2));
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("".equals(testportName) ? "" : "."));
// parameter name part
hiddenBefore1 = in.readUTF();
parameterName = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBefore1));
item.setParameterName(new AddedParseTree(parameterName));
ConfigTreeNodeUtilities.addChild(root, item.getParameterName());
// the := sign and the hidden stuff before it
hiddenBefore1 = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBefore1));
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(":="));
// the value part
value = in.readUTF();
item.setValue(new AddedParseTree(value));
ConfigTreeNodeUtilities.addChild(root, item.getValue());
items[i] = item;
}
return items;
} catch (IOException e) {
ErrorReporter.logExceptionStackTrace(e);
return new TestportParameter[] {};
}
}
use of org.eclipse.titan.common.parsers.AddedParseTree in project titan.EclipsePlug-ins by eclipse.
the class TestportParametersSectionPage method createNewTestportParameterSection.
private void createNewTestportParameterSection() {
if (testportParametersHandler == null) {
return;
}
ParserRuleContext sectionRoot = new ParserRuleContext();
testportParametersHandler.setLastSectionRoot(sectionRoot);
ParseTree header = new AddedParseTree("\n[TESTPORT_PARAMETERS]");
ConfigTreeNodeUtilities.addChild(sectionRoot, header);
ParserRuleContext root = editor.getParseTreeRoot();
if (root != null) {
root.addChild(sectionRoot);
}
}
use of org.eclipse.titan.common.parsers.AddedParseTree in project titan.EclipsePlug-ins by eclipse.
the class ExternalCommandsSubPage method createExternalCommandsSection.
// creates the maincontroller section if needed
private void createExternalCommandsSection() {
if (executeCommandSectionHandler == null || executeCommandSectionHandler.getLastSectionRoot() != null) {
return;
}
ParserRuleContext sectionRoot = new ParserRuleContext();
executeCommandSectionHandler.setLastSectionRoot(sectionRoot);
ParseTree header = new AddedParseTree("\n[EXTERNAL_COMMANDS]");
ConfigTreeNodeUtilities.addChild(sectionRoot, header);
ParserRuleContext root = editor.getParseTreeRoot();
if (root != null) {
root.addChild(sectionRoot);
}
}
use of org.eclipse.titan.common.parsers.AddedParseTree in project titan.EclipsePlug-ins by eclipse.
the class DefineItemTransfer method nativeToJava.
@Override
protected Definition[] nativeToJava(final TransferData transferData) {
byte[] bytes = (byte[]) super.nativeToJava(transferData);
DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
try {
int n = in.readInt();
Definition[] items = new Definition[n];
String name;
String value;
String hiddenBefore;
for (int i = 0; i < n; i++) {
items[i] = new DefineSectionHandler.Definition();
final ParseTree root = new ParserRuleContext();
items[i].setRoot(root);
hiddenBefore = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, ConfigTreeNodeUtilities.createHiddenTokenNode(hiddenBefore));
name = in.readUTF();
final ParseTree nameNode = new AddedParseTree(name);
items[i].setDefinitionName(nameNode);
ConfigTreeNodeUtilities.addChild(root, nameNode);
hiddenBefore = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, ConfigTreeNodeUtilities.createHiddenTokenNode(hiddenBefore));
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(":="));
hiddenBefore = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, ConfigTreeNodeUtilities.createHiddenTokenNode(hiddenBefore));
value = in.readUTF();
final ParseTree valueNode = new AddedParseTree(value);
items[i].setDefinitionValue(valueNode);
ConfigTreeNodeUtilities.addChild(root, valueNode);
}
return items;
} catch (IOException e) {
ErrorReporter.logExceptionStackTrace(e);
return new Definition[] {};
}
}
use of org.eclipse.titan.common.parsers.AddedParseTree in project titan.EclipsePlug-ins by eclipse.
the class DefineSubPage method createNewDefineSection.
private void createNewDefineSection() {
if (defineSectionHandler == null) {
return;
}
ParserRuleContext sectionRoot = new ParserRuleContext();
defineSectionHandler.setLastSectionRoot(sectionRoot);
ParseTree header = new AddedParseTree("\n[DEFINE]");
ConfigTreeNodeUtilities.addChild(sectionRoot, header);
ParserRuleContext root = editor.getParseTreeRoot();
if (root != null) {
root.addChild(sectionRoot);
}
}
Aggregations