use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class CreateJSONElementAction method selectionChanged.
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.ISelection)
*/
@Override
public void selectionChanged(IStructuredSelection selection) {
FOXTreeNode node = (FOXTreeNode) this.getStructuredSelection().getFirstElement();
if (node == null) {
this.setEnabled(false);
return;
}
if (node instanceof Attribute) {
this.setEnabled(false);
return;
}
if (node instanceof NameSpaceNode) {
this.setEnabled(false);
return;
}
this.setEnabled(true);
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class CreateJSONElementAction method run.
@Override
public void run() {
FOXTreeNode node = (FOXTreeNode) this.getStructuredSelection().getFirstElement();
if (createChildNode(node)) {
form.redrawLinkers();
}
form.updateConnection();
form.updateStatus();
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class CreateJSONNameSpaceAction method run.
@Override
public void run() {
FOXTreeNode node = (FOXTreeNode) this.getStructuredSelection().getFirstElement();
if (node != null) {
createChildNode(node);
}
form.updateConnection();
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class JSONFileOutputStep2Form method initLinker.
private void initLinker(TreeItem node, TableItem[] tableItems) {
FOXTreeNode treeNode = (FOXTreeNode) node.getData();
IMetadataColumn column = treeNode.getColumn();
Properties prop = System.getProperties();
String os = prop.getProperty("os.name");
boolean isLastOne = false;
if (column != null) {
for (int i = 0; i < tableItems.length; i++) {
MetadataColumn metadataColumn = (MetadataColumn) tableItems[i].getData();
if (metadataColumn.getLabel().equals(column.getLabel())) {
// "isLastOne" directly to false
if (os.startsWith("Linux")) {
isLastOne = true;
}
linker.addLoopLink(tableItems[i], tableItems[i].getData(), JSONViewer.getTree(), treeNode, isLastOne);
break;
}
}
}
TreeItem[] children = node.getItems();
for (int i = 0; i < children.length; i++) {
initLinker(children[i], tableItems);
}
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class JSONFileOutputStep1Form method updateConnection.
private void updateConnection(String text) {
if (text == null || "".equals(text)) {
return;
}
List<FOXTreeNode> rootFoxTreeNodes = null;
if (JSONFileOutputStep1Form.this.tempPath == null) {
JSONFileOutputStep1Form.this.tempPath = JSONUtil.changeJsonToXml(text);
}
if (treeNode == null) {
rootFoxTreeNodes = TreeUtil.getFoxTreeNodes(JSONFileOutputStep1Form.this.tempPath);
} else {
rootFoxTreeNodes = getCorrespondingFoxTreeNodes(treeNode, true);
}
if (rootFoxTreeNodes.size() == 0) {
return;
}
if (ConnectionHelper.getTables(getConnection()).isEmpty()) {
MetadataTable table = ConnectionFactory.eINSTANCE.createMetadataTable();
RecordFile record = (RecordFile) ConnectionHelper.getPackage(getConnection().getName(), getConnection(), RecordFile.class);
if (record != null) {
// hywang
PackageHelper.addMetadataTable(table, record);
} else {
RecordFile newrecord = RecordFactory.eINSTANCE.createRecordFile();
newrecord.setName(connection.getName());
ConnectionHelper.addPackage(newrecord, connection);
PackageHelper.addMetadataTable(table, newrecord);
}
}
EList schemaMetadataColumn = ConnectionHelper.getTables(getConnection()).toArray(new MetadataTable[0])[0].getColumns();
schemaMetadataColumn.clear();
initMetadataTable(rootFoxTreeNodes, schemaMetadataColumn);
updateConnectionProperties(rootFoxTreeNodes.get(0));
}
Aggregations