Search in sources :

Example 21 with HL7TreeNode

use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.

the class DeleteHL7NodeAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
    if (node == null) {
        return;
    }
    HL7TreeNode parent = node.getParent();
    if (parent == null) {
        return;
    }
    if (node instanceof Element) {
        disconnectSubTree(node);
    }
    parent.removeChild(node);
    xmlViewer.refresh(parent);
}
Also used : Element(org.talend.designer.hl7.ui.data.Element) HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Example 22 with HL7TreeNode

use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.

the class HL7DisconnectAction method init.

public void init() {
    HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
    this.setEnabled(node != null && node.hasLink());
}
Also used : HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Example 23 with HL7TreeNode

use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.

the class HL7DisconnectAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
    if (node == null) {
        return;
    }
    node.setColumn(null);
    node.setColumnName(null);
    xmlViewer.refresh(node);
    xmlViewer.expandAll();
    if (hl7ui != null) {
        hl7ui.redrawLinkers();
    } else if (form != null) {
        form.refreshLinks();
    }
}
Also used : HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Example 24 with HL7TreeNode

use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.

the class HL7FixValueAction method init.

public void init() {
    this.setEnabled(false);
    HL7TreeNode node = (HL7TreeNode) this.getStructuredSelection().getFirstElement();
    if (node == null) {
        this.setEnabled(false);
        return;
    }
    if (node.getParent() == null) {
        this.setEnabled(false);
        return;
    }
    if (node.getChildren() != null && node.getChildren().size() > 0) {
        this.setEnabled(false);
        return;
    }
    if (node.getColumn() == null) {
        this.setEnabled(false);
    }
    this.setEnabled(true);
}
Also used : HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Example 25 with HL7TreeNode

use of org.talend.designer.hl7.ui.data.HL7TreeNode in project tdi-studio-se by Talend.

the class HL7PublicUtil method tableLoader.

public void tableLoader(Element element, String parentPath, List<HL7FileNode> table, String defaultValue, Map<String, Integer> orderMap) {
    HL7FileNode hl7FileNode = ConnectionFactory.eINSTANCE.createHL7FileNode();
    String currentPath = parentPath + "/" + element.getLabel();
    hl7FileNode.setFilePath(currentPath);
    hl7FileNode.setRelatedColumn(element.getColumnLabel());
    hl7FileNode.setAttribute(element.isMain() ? "main" : "branch");
    hl7FileNode.setDefaultValue(defaultValue);
    // xmlFileNode.setType(element.getDataType());
    hl7FileNode.setOrder(getNodeOrder(element, orderMap));
    hl7FileNode.setRepeatable(element.isRepetable());
    table.add(hl7FileNode);
    for (HL7TreeNode att : element.getAttributeChildren()) {
        hl7FileNode = ConnectionFactory.eINSTANCE.createHL7FileNode();
        hl7FileNode.setFilePath(att.getLabel());
        hl7FileNode.setRelatedColumn(att.getColumnLabel());
        hl7FileNode.setAttribute("attri");
        hl7FileNode.setDefaultValue(att.getDefaultValue());
        // xmlFileNode.setType(att.getDataType());
        hl7FileNode.setOrder(getNodeOrder(att, orderMap));
        hl7FileNode.setRepeatable(att.isRepetable());
        table.add(hl7FileNode);
    }
    for (HL7TreeNode att : element.getNameSpaceChildren()) {
        hl7FileNode = ConnectionFactory.eINSTANCE.createHL7FileNode();
        hl7FileNode.setFilePath(att.getLabel());
        hl7FileNode.setRelatedColumn(att.getColumnLabel());
        hl7FileNode.setAttribute("ns");
        hl7FileNode.setDefaultValue(att.getDefaultValue());
        // xmlFileNode.setType(att.getDataType());
        hl7FileNode.setOrder(getNodeOrder(att, orderMap));
        hl7FileNode.setRepeatable(att.isRepetable());
        table.add(hl7FileNode);
    }
    List<HL7TreeNode> children = element.getElementChildren();
    for (HL7TreeNode child : children) {
        // if (!child.isGroup() && !child.isLoop()) {
        tableLoader((Element) child, currentPath, table, child.getDefaultValue(), orderMap);
    // }
    }
}
Also used : HL7FileNode(org.talend.core.model.metadata.builder.connection.HL7FileNode) HL7TreeNode(org.talend.designer.hl7.ui.data.HL7TreeNode)

Aggregations

HL7TreeNode (org.talend.designer.hl7.ui.data.HL7TreeNode)41 Element (org.talend.designer.hl7.ui.data.Element)13 ArrayList (java.util.ArrayList)10 HashMap (java.util.HashMap)6 List (java.util.List)4 Map (java.util.Map)4 TreeItem (org.eclipse.swt.widgets.TreeItem)4 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)3 HL7FileNode (org.talend.core.model.metadata.builder.connection.HL7FileNode)3 HL7OutputManager (org.talend.designer.hl7.managers.HL7OutputManager)3 Group (ca.uhn.hl7v2.model.Group)2 Message (ca.uhn.hl7v2.model.Message)2 TableItem (org.eclipse.swt.widgets.TableItem)2 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)2 IConnection (org.talend.core.model.process.IConnection)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 EList (org.eclipse.emf.common.util.EList)1 Command (org.eclipse.gef.commands.Command)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1