use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class DisconnectAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
FOXTreeNode node = (FOXTreeNode) this.getStructuredSelection().getFirstElement();
if (node == null) {
return;
}
node.setColumn(null);
xmlViewer.refresh(node);
xmlViewer.expandToLevel(node, 1);
foxui.redrawLinkers();
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class FixValueAction method run.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
FOXTreeNode node = (FOXTreeNode) this.getStructuredSelection().getFirstElement();
setFixValue(node);
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class ImportTreeFromXMLAction method treeNodeAdapt.
private List<FOXTreeNode> treeNodeAdapt(String file) {
List<FOXTreeNode> list = new ArrayList<FOXTreeNode>();
try {
ATreeNode treeNode = SchemaPopulationUtil.getSchemaTree(file, true, 0);
String schemaName = getSelectedSchema();
String rootName = "";
if (treeNode.getValue() instanceof String) {
rootName += "/" + treeNode.getValue();
}
FOXTreeNode root = cloneATreeNode(treeNode, schemaName, rootName);
Element rootElement = (Element) root;
if (rootElement.getElementChildren() != null && rootElement.getElementChildren().size() > 0) {
for (FOXTreeNode foxTreeNode : rootElement.getElementChildren()) {
foxTreeNode.setParent(null);
list.add(foxTreeNode);
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
return list;
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class ImportTreeFromXMLAction method selectionChanged.
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
*/
@Override
public void selectionChanged(IStructuredSelection selection) {
this.setEnabled(true);
FOXTreeNode node = (FOXTreeNode) this.getStructuredSelection().getFirstElement();
if (node != null) {
foxui.setSelectedText(node.getLabel());
}
}
use of org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode in project tdi-studio-se by Talend.
the class ImportTreeFromXMLAction method cloneATreeNode.
private FOXTreeNode cloneATreeNode(ATreeNode treeNode, String schemaName, String currentPath) throws Exception {
FOXTreeNode node = null;
if (treeNode.getType() == ATreeNode.ATTRIBUTE_TYPE) {
node = new Attribute();
} else {
node = new Element();
}
// zli fixed for bug 7414
if (treeNode.getType() == ATreeNode.NAMESPACE_TYPE) {
node = new NameSpaceNode();
//$NON-NLS-1$
node.setLabel("");
node.setDefaultValue((String) treeNode.getValue());
} else {
node.setLabel((String) treeNode.getValue());
}
Object[] children = treeNode.getChildren();
if (children != null) {
for (Object element : children) {
if (element instanceof ATreeNode) {
ATreeNode child = (ATreeNode) element;
String newPath = currentPath + "/";
if (child.getValue() instanceof String) {
String elementName = (String) child.getValue();
if (currentPath.contains("/" + elementName + "/")) {
ExceptionHandler.process(new Exception("XSD ERROR: loop found. Item: " + elementName + " is already in the currentPath (" + currentPath + ")."));
continue;
}
newPath += elementName;
} else {
newPath += "unknownElement";
}
FOXTreeNode foxChild = cloneATreeNode(child, schemaName, newPath);
foxChild.setRow(schemaName);
node.addChild(foxChild);
}
}
}
return node;
}
Aggregations