Search in sources :

Example 1 with VarNodeFigure

use of org.talend.designer.xmlmap.figures.varnode.VarNodeFigure 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)

Aggregations

Viewport (org.eclipse.draw2d.Viewport)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1 Adapter (org.eclipse.emf.common.notify.Adapter)1 XmlmapTreeNodeFigure (org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure)1 VarNodeFigure (org.talend.designer.xmlmap.figures.varnode.VarNodeFigure)1 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)1 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)1 VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)1 OutputTreeNodeEditPart (org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart)1 TreeNodeEditPart (org.talend.designer.xmlmap.parts.TreeNodeEditPart)1 VarNodeEditPart (org.talend.designer.xmlmap.parts.VarNodeEditPart)1 XmlMapDataEditPart (org.talend.designer.xmlmap.parts.XmlMapDataEditPart)1