use of org.eclipse.gef.EditPart in project tdi-studio-se by Talend.
the class MapperGraphicalEditor method makeDefaultSelection.
public void makeDefaultSelection() {
EditPart contents = getGraphicalViewer().getContents();
if (contents instanceof MapperRootEditPart) {
MapperRootEditPart mapdataPart = (MapperRootEditPart) contents;
List children = mapdataPart.getChildren();
InputTablePart firstInputPart = null;
OutputTablePart firstOutputPart = null;
if (children != null) {
for (int i = 0; i < children.size(); i++) {
Object object = children.get(i);
if (object instanceof InputTablePart && firstInputPart == null) {
firstInputPart = (InputTablePart) object;
}
if (object instanceof OutputTablePart && firstOutputPart == null) {
firstOutputPart = (OutputTablePart) object;
}
if (firstInputPart != null && firstOutputPart != null) {
break;
}
}
if (firstInputPart != null) {
getGraphicalViewer().appendSelection(firstInputPart);
}
if (firstOutputPart != null) {
getGraphicalViewer().appendSelection(firstOutputPart);
}
}
}
}
use of org.eclipse.gef.EditPart in project tdi-studio-se by Talend.
the class MapperGraphicalViewer method primDeselectAll.
/*
* if partToAppend is inputTree , don't clean all outputTree in selection list , leave the first one by default . if
* partToAppend is outputTree , do the same for inputTree selections
*/
private void primDeselectAll(EditPart eidtPart) {
EditPart partToAppend = eidtPart;
List list = primGetSelectedEditParts();
if (partToAppend instanceof TableEntityPart) {
partToAppend = MapperUtils.getMapperTablePart((TableEntityPart) partToAppend);
}
EditPart part;
MapperTablePart abstractTreePart = null;
for (int i = 0; i < list.size(); i++) {
part = (EditPart) list.get(i);
if (partToAppend instanceof InputTablePart) {
if (abstractTreePart == null && part instanceof OutputTablePart) {
abstractTreePart = (MapperTablePart) part;
continue;
}
} else if (partToAppend instanceof OutputTablePart) {
if (abstractTreePart == null && part instanceof InputTablePart) {
abstractTreePart = (MapperTablePart) part;
continue;
}
}
part.setSelected(EditPart.SELECTED_NONE);
}
list.clear();
if (abstractTreePart != null) {
list.add(abstractTreePart);
}
}
use of org.eclipse.gef.EditPart in project tdi-studio-se by Talend.
the class MapperGraphicalViewer method findFigureAt.
public IFigure findFigureAt(int x, int y, Collection exclude, final Conditional condition) {
class ConditionalTreeSearch extends ExclusionSearch {
ConditionalTreeSearch(Collection coll) {
super(coll);
}
@Override
public boolean accept(IFigure figure) {
EditPart editpart = null;
while (editpart == null && figure != null) {
editpart = (EditPart) getVisualPartMap().get(figure);
figure = figure.getParent();
}
return editpart != null && (condition == null || condition.evaluate(editpart));
}
}
return getLightweightSystem().getRootFigure().findFigureAt(x, y, new ConditionalTreeSearch(exclude));
}
use of org.eclipse.gef.EditPart in project tdi-studio-se by Talend.
the class MapperSelectEditPartTracker method canAppend.
private boolean canAppend() {
if (getSourceEditPart() instanceof TableEntityPart) {
EditPart lastPart = lastSelectedShiftPart;
List selectedEditParts = getCurrentViewer().getSelectedEditParts();
if (lastPart == null && !selectedEditParts.isEmpty()) {
lastPart = (EditPart) selectedEditParts.get(selectedEditParts.size() - 1);
}
if (lastPart == null) {
return true;
} else if (lastPart instanceof TableEntityPart) {
MapperTablePart lastContaier = MapperUtils.getMapperTablePart((TableEntityPart) lastPart);
MapperTablePart toAppendContaier = MapperUtils.getMapperTablePart((TableEntityPart) getSourceEditPart());
if (lastContaier == toAppendContaier) {
return true;
}
}
}
lastSelectedShiftPart = null;
return false;
}
use of org.eclipse.gef.EditPart in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method selectNode.
/**
* DOC bqian Comment method "selectNode".
*
* @param node
*/
@SuppressWarnings("unchecked")
public void selectNode(String nodeName) {
GraphicalViewer viewer = designerEditor.getViewer();
Object object = viewer.getRootEditPart().getChildren().get(0);
if (object instanceof ProcessPart) {
// ProcessPart < SubjobContainerPart < NodeContainerPart < NodePart
for (EditPart editPart : (List<EditPart>) ((ProcessPart) object).getChildren()) {
if (editPart instanceof SubjobContainerPart) {
SubjobContainerPart subjobPart = (SubjobContainerPart) editPart;
for (EditPart part : (List<EditPart>) subjobPart.getChildren()) {
if (part instanceof NodeContainerPart) {
EditPart nodePart = (EditPart) part.getChildren().get(0);
if (nodePart instanceof NodePart) {
if (((Node) ((NodePart) nodePart).getModel()).getLabel().equals(nodeName)) {
viewer.select(nodePart);
return;
}
}
}
}
}
}
}
}
Aggregations