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);
}
}
});
}
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));
}
}
}
}
}
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);
}
Aggregations