Search in sources :

Example 26 with VarNode

use of org.talend.designer.xmlmap.model.emf.xmlmap.VarNode in project tdi-studio-se by Talend.

the class VarToolBarFigure method addVar.

@Override
protected void addVar() {
    CommandStack commandStack = getTableManager().getGraphicalViewer().getEditDomain().getCommandStack();
    commandStack.execute(new Command() {

        @Override
        public void execute() {
            VarNode newNode = XmlmapFactory.eINSTANCE.createVarNode();
            newNode.setType(XmlMapUtil.DEFAULT_DATA_TYPE);
            newNode.setName(XmlMapUtil.findUniqueVarColumnName("Var", parentTable));
            parentTable.getNodes().add(newNode);
            parentTable.setMinimized(false);
            EditPart toSelect = null;
            int index = parentTable.getNodes().indexOf(newNode);
            if (index < tablePart.getChildren().size()) {
                toSelect = (EditPart) tablePart.getChildren().get(index);
                tablePart.getViewer().select(toSelect);
            }
            if (!remove.isEnabled()) {
                remove.setEnabled(true);
            }
        }
    });
}
Also used : VarNode(org.talend.designer.xmlmap.model.emf.xmlmap.VarNode) CommandStack(org.eclipse.gef.commands.CommandStack) Command(org.eclipse.gef.commands.Command) VarNodeEditPart(org.talend.designer.xmlmap.parts.VarNodeEditPart) EditPart(org.eclipse.gef.EditPart)

Example 27 with VarNode

use of org.talend.designer.xmlmap.model.emf.xmlmap.VarNode in project tdi-studio-se by Talend.

the class SearchZoneMapper method moveScrollBarZoneAtSelectedTableItem.

public void moveScrollBarZoneAtSelectedTableItem(Figure entry) {
    if (entry != null) {
        Rectangle bounds = entry.getBounds();
        int selection = bounds.y - 100;
        if (entry instanceof XmlmapTreeNodeFigure) {
            XmlmapTreeNodeFigure xmlMapTreeNodeFigure = (XmlmapTreeNodeFigure) entry;
            TreeNode treeNode = xmlMapTreeNodeFigure.getTreeNode();
            if (treeNode != null) {
                for (Adapter adapter : treeNode.eAdapters()) {
                    TreeNodeEditPart part = (TreeNodeEditPart) adapter;
                    XmlMapDataEditPart xmlMapDataEditPart = part.getMapDataEditPart();
                    if (adapter instanceof OutputTreeNodeEditPart) {
                        Viewport viewport = xmlMapDataEditPart.getOutputScroll().getViewport();
                        viewport.setViewLocation(viewport.getViewLocation().translate(bounds.x, selection));
                    } else if (adapter instanceof TreeNodeEditPart) {
                        Viewport viewport = xmlMapDataEditPart.getInputScroll().getViewport();
                        viewport.setViewLocation(viewport.getViewLocation().translate(bounds.x, selection));
                    }
                }
            }
        } else if (entry instanceof VarNodeFigure) {
            VarNodeFigure varNodeFigure = (VarNodeFigure) entry;
            VarNode varNode = varNodeFigure.getVarNode();
            if (varNode != null) {
                for (Adapter adapter : varNode.eAdapters()) {
                    VarNodeEditPart part = (VarNodeEditPart) adapter;
                    XmlMapDataEditPart xmlMapDataEditPart = part.getMapDataEditPart();
                    Viewport viewport = xmlMapDataEditPart.getVarScroll().getViewport();
                    viewport.setViewLocation(viewport.getViewLocation().translate(bounds.x, selection));
                }
            }
        }
    }
}
Also used : VarNode(org.talend.designer.xmlmap.model.emf.xmlmap.VarNode) VarNodeEditPart(org.talend.designer.xmlmap.parts.VarNodeEditPart) VarNodeFigure(org.talend.designer.xmlmap.figures.varnode.VarNodeFigure) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Viewport(org.eclipse.draw2d.Viewport) Adapter(org.eclipse.emf.common.notify.Adapter) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure) OutputTreeNodeEditPart(org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart) XmlMapDataEditPart(org.talend.designer.xmlmap.parts.XmlMapDataEditPart) TreeNodeEditPart(org.talend.designer.xmlmap.parts.TreeNodeEditPart) OutputTreeNodeEditPart(org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart)

Example 28 with VarNode

use of org.talend.designer.xmlmap.model.emf.xmlmap.VarNode in project tdi-studio-se by Talend.

the class VarNodeEditPart method setModel.

@Override
public void setModel(Object model) {
    super.setModel(model);
    manager = new VarEntityManager((VarNode) model, this);
}
Also used : VarNode(org.talend.designer.xmlmap.model.emf.xmlmap.VarNode) VarEntityManager(org.talend.designer.xmlmap.figures.varnode.VarEntityManager)

Aggregations

VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)28 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)19 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)17 VarTable (org.talend.designer.xmlmap.model.emf.xmlmap.VarTable)13 InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)12 OutputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)12 VarNodeEditPart (org.talend.designer.xmlmap.parts.VarNodeEditPart)11 AbstractNode (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode)9 XmlMapData (org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)8 ArrayList (java.util.ArrayList)7 List (java.util.List)7 TransferedObject (org.talend.designer.gefabstractmap.dnd.TransferedObject)7 TreeNodeEditPart (org.talend.designer.xmlmap.parts.TreeNodeEditPart)7 EList (org.eclipse.emf.common.util.EList)6 AbstractInOutTree (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)6 FilterConnection (org.talend.designer.xmlmap.model.emf.xmlmap.FilterConnection)6 EditPart (org.eclipse.gef.EditPart)4 Command (org.eclipse.gef.commands.Command)4 CommandStack (org.eclipse.gef.commands.CommandStack)4 Connection (org.talend.designer.xmlmap.model.emf.xmlmap.Connection)4