use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class SetForJSONLoopAction method selectionChanged.
@Override
public void selectionChanged(IStructuredSelection selection) {
FOXTreeNode node = (FOXTreeNode) this.getStructuredSelection().getFirstElement();
if (node == null) {
this.setEnabled(false);
return;
}
// fix for TDI-18802
this.setEnabled(TreeUtil.canSetAsLoop(node));
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class SetJSONGroupAction method selectionChanged.
@Override
public void selectionChanged(IStructuredSelection selection) {
FOXTreeNode node = (FOXTreeNode) this.getStructuredSelection().getFirstElement();
if (node == null) {
this.setEnabled(false);
return;
}
if (((node instanceof Attribute) || node.hasLink())) {
this.setEnabled(TreeUtil.checkTreeGoupNode(node));
return;
}
if (node instanceof NameSpaceNode) {
this.setEnabled(false);
return;
}
this.setEnabled(TreeUtil.checkTreeGoupNode(node));
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class CreateJSONElementAction method createChildNode.
private boolean createChildNode(FOXTreeNode node) {
if (node.getColumn() != null) {
if (!MessageDialog.openConfirm(jsonViewer.getControl().getShell(), "Warning", "Do you want to disconnect the existing linker and then add an sub element for the selected element " + node.getLabel() + " \"?")) {
return false;
}
node.setColumn(null);
}
String label = "";
while (!JSONUtil.validateLabelForJSON(label)) {
InputDialog dialog = new InputDialog(null, "Input element's label", "Input the new element's valid label", "", null);
int status = dialog.open();
if (status == InputDialog.OK) {
label = dialog.getValue().trim();
}
if (status == InputDialog.CANCEL) {
return false;
}
}
FOXTreeNode child = new Element(label);
// child.setRow(node.getRow());
node.addChild(child);
// fix for TDI-18802
if (node.getParent() == null && node.isLoop()) {
node.setLoop(false);
}
this.jsonViewer.refresh();
this.jsonViewer.expandAll();
return true;
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class CreateJSONNameSpaceAction method createChildNode.
private void createChildNode(FOXTreeNode node) {
String label = null;
String defaultValue = null;
while (!JSONUtil.validateLabelForNameSpace(label) || !JSONUtil.validateLabelForFixedValue(defaultValue)) {
NameSpaceDialog nsDialog = new NameSpaceDialog(null);
int status = nsDialog.open();
if (status == nsDialog.OK) {
defaultValue = nsDialog.getNSValue();
if (defaultValue != null) {
defaultValue = defaultValue.trim();
}
label = nsDialog.getPrefix().trim();
}
if (status == nsDialog.CANCEL) {
return;
}
}
FOXTreeNode child = new NameSpaceNode(label);
child.setDefaultValue(defaultValue);
// add by wzhang. set the row name
child.setRow(node.getRow());
node.addChild(child);
this.jsonViewer.refresh();
jsonViewer.expandAll();
form.redrawLinkers();
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class JSONFileOutputStep2Form method updateConnection.
public void updateConnection() {
ConnectionHelper.getTables(getConnection());
EList root = getConnection().getRoot();
EList loop = getConnection().getLoop();
EList group = getConnection().getGroup();
root.clear();
loop.clear();
group.clear();
List<FOXTreeNode> node = (List<FOXTreeNode>) JSONViewer.getInput();
FOXTreeNode foxTreeNode = node.get(0);
if (foxTreeNode != null) {
initNodeOrder(foxTreeNode);
if (!foxTreeNode.isLoop()) {
tableLoader((Element) foxTreeNode, "", root, foxTreeNode.getDefaultValue());
}
Element loopNode = (Element) TreeUtil.getLoopNode(foxTreeNode);
if (loopNode != null) {
String path = TreeUtil.getPath(loopNode);
tableLoader(loopNode, path.substring(0, path.lastIndexOf("/")), loop, loopNode.getDefaultValue());
}
Element groupNode = (Element) TreeUtil.getGroupNode(foxTreeNode);
if (groupNode != null) {
String path = TreeUtil.getPath(groupNode);
tableLoader(groupNode, path.substring(0, path.lastIndexOf("/")), group, groupNode.getDefaultValue());
}
}
}
Aggregations