use of org.antlr.v4.runtime.tree.ParseTree in project titan.EclipsePlug-ins by eclipse.
the class LoggingBitsSubPage method pluginRenamed.
public void pluginRenamed() {
if (selectedLogEntry.getConsoleMaskRoot() != null) {
ParseTree child = selectedLogEntry.getConsoleMask().getChild(0);
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getConsoleMaskRoot());
createConsoleMaskRootNode(loggingPage.getSelectedTreeElement(), selectedLogEntry);
if (child != null) {
ConfigTreeNodeUtilities.addChild(selectedLogEntry.getConsoleMask(), child, 0);
}
}
if (selectedLogEntry.getFileMaskRoot() != null) {
ParseTree child = selectedLogEntry.getFileMask().getChild(0);
ConfigTreeNodeUtilities.removeChild(loggingSectionHandler.getLastSectionRoot(), selectedLogEntry.getFileMaskRoot());
createFileMaskRootNode(loggingPage.getSelectedTreeElement(), selectedLogEntry);
if (child != null) {
ConfigTreeNodeUtilities.addChild(selectedLogEntry.getFileMask(), child, 0);
}
}
}
use of org.antlr.v4.runtime.tree.ParseTree in project titan.EclipsePlug-ins by eclipse.
the class ModuleParameterTransfer method nativeToJava.
@Override
protected ModuleParameter[] nativeToJava(final TransferData transferData) {
byte[] bytes = (byte[]) super.nativeToJava(transferData);
DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
try {
int n = in.readInt();
ModuleParameter[] items = new ModuleParameter[n];
for (int i = 0; i < n; i++) {
ModuleParameter newModuleParameter = new ModuleParameterSectionHandler.ModuleParameter();
final ParseTree root = new ParserRuleContext();
newModuleParameter.setRoot(root);
// module name part
final String hiddenBeforeModuleName = in.readUTF();
final String moduleName = in.readUTF();
final String hiddenBeforeSeparator = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree("\n"));
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBeforeModuleName));
newModuleParameter.setModuleName(new AddedParseTree(moduleName));
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBeforeSeparator));
ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getModuleName());
final boolean isModuleNameEmpty = moduleName == null || moduleName.isEmpty();
newModuleParameter.setSeparator(new AddedParseTree(isModuleNameEmpty ? "" : "."));
ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getSeparator());
// parameter name part
final String hiddenBeforeParameterName = in.readUTF();
final String parameterName = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBeforeParameterName));
newModuleParameter.setParameterName(new AddedParseTree(parameterName));
ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getParameterName());
// the := sign and the hidden stuff before it
final String hiddenBeforeOperator = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBeforeOperator));
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(" := "));
// the value part
final String hiddenBeforeValue = in.readUTF();
final String value = in.readUTF();
ConfigTreeNodeUtilities.addChild(root, new AddedParseTree(hiddenBeforeValue));
newModuleParameter.setValue(new AddedParseTree(value));
ConfigTreeNodeUtilities.addChild(root, newModuleParameter.getValue());
// put it under the root node
items[i] = newModuleParameter;
}
return items;
} catch (IOException e) {
ErrorReporter.logExceptionStackTrace(e);
return new ModuleParameter[] {};
}
}
use of org.antlr.v4.runtime.tree.ParseTree 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.antlr.v4.runtime.tree.ParseTree 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.antlr.v4.runtime.tree.ParseTree in project titan.EclipsePlug-ins by eclipse.
the class ExecuteSectionDropTargetListener method drop.
@Override
public void drop(final DropTargetEvent event) {
if (ExecuteItemTransfer.getInstance().isSupportedType(event.currentDataType)) {
if (event.item != null && viewer.getInput() != null) {
ExecuteSectionHandler executeSectionHandler = (ExecuteSectionHandler) viewer.getInput();
ExecuteItem element = (ExecuteItem) event.item.getData();
ExecuteItem[] items = (ExecuteItem[]) event.data;
int baseindex = executeSectionHandler.getExecuteitems().indexOf(element);
final ParseTree parent = executeSectionHandler.getLastSectionRoot();
ConfigTreeNodeUtilities.removeChild(parent, element.getRoot());
ConfigTreeNodeUtilities.addChild(parent, element.getRoot(), baseindex);
if (items.length > 0) {
for (int i = 0; i < items.length - 1; i++) {
executeSectionHandler.getExecuteitems().add(++baseindex, items[i]);
}
executeSectionHandler.getExecuteitems().add(++baseindex, items[items.length - 1]);
}
viewer.refresh(true);
editor.setDirty();
}
}
}
Aggregations