Search in sources :

Example 6 with OutputXmlTreeEditPart

use of org.talend.designer.xmlmap.parts.OutputXmlTreeEditPart in project tdi-studio-se by Talend.

the class XmlMapOutputZoneToolBar method moveUp.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.xmlmap.figures.treetools.zone.ZoneToolBar#moveUp()
     */
@Override
public void moveUp() {
    List<OutputXmlTree> outputTrees = externalData.getOutputTrees();
    OutputXmlTreeEditPart currentSelectedOutputXmlTree = graphicViewer.getFiguresManager().getCurrentSelectedOutputTable();
    if (currentSelectedOutputXmlTree != null) {
        OutputXmlTree selectedTree = (OutputXmlTree) currentSelectedOutputXmlTree.getModel();
        int index = outputTrees.indexOf(selectedTree);
        if (index != -1 && index - 1 >= 0) {
            outputTrees.remove(selectedTree);
            outputTrees.add(index - 1, selectedTree);
            // index of modelchildren is different from index of tree
            int indexOf = externalPart.getModelChildren().indexOf(selectedTree);
            if (indexOf != -1) {
                graphicViewer.appendSelection((EditPart) externalPart.getChildren().get(indexOf));
            }
        }
    }
}
Also used : OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) OutputXmlTreeEditPart(org.talend.designer.xmlmap.parts.OutputXmlTreeEditPart)

Example 7 with OutputXmlTreeEditPart

use of org.talend.designer.xmlmap.parts.OutputXmlTreeEditPart in project tdi-studio-se by Talend.

the class XmlMapOutputZoneToolBar method moveDown.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.xmlmap.figures.treetools.zone.ZoneToolBar#moveDown()
     */
@Override
public void moveDown() {
    List<OutputXmlTree> outputTrees = externalData.getOutputTrees();
    OutputXmlTreeEditPart currentSelectedOutputXmlTree = graphicViewer.getFiguresManager().getCurrentSelectedOutputTable();
    if (currentSelectedOutputXmlTree != null) {
        OutputXmlTree selectedTree = (OutputXmlTree) currentSelectedOutputXmlTree.getModel();
        int index = outputTrees.indexOf(selectedTree);
        if (index != -1 && index + 1 < outputTrees.size()) {
            outputTrees.remove(selectedTree);
            outputTrees.add(index + 1, selectedTree);
            // index of modelchildren is different from index of tree
            int indexOf = externalPart.getModelChildren().indexOf(selectedTree);
            if (indexOf != -1) {
                graphicViewer.appendSelection((EditPart) externalPart.getChildren().get(indexOf));
            }
        }
    }
}
Also used : OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) OutputXmlTreeEditPart(org.talend.designer.xmlmap.parts.OutputXmlTreeEditPart)

Aggregations

OutputXmlTreeEditPart (org.talend.designer.xmlmap.parts.OutputXmlTreeEditPart)7 OutputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)6 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)5 InputXmlTreeEditPart (org.talend.designer.xmlmap.parts.InputXmlTreeEditPart)4 InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)3 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)3 Figure (org.eclipse.draw2d.Figure)2 AbstractNode (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode)2 VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)2 VarTable (org.talend.designer.xmlmap.model.emf.xmlmap.VarTable)2 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 IFigure (org.eclipse.draw2d.IFigure)1 Adapter (org.eclipse.emf.common.notify.Adapter)1 EditPart (org.eclipse.gef.EditPart)1 Command (org.eclipse.gef.commands.Command)1 CommandStack (org.eclipse.gef.commands.CommandStack)1 CellEditor (org.eclipse.jface.viewers.CellEditor)1 ComboBoxCellEditor (org.eclipse.jface.viewers.ComboBoxCellEditor)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1