use of org.talend.designer.gefabstractmap.part.TableEntityPart in project tdi-studio-se by Talend.
the class RowSelectionEditPolicy method getLocatorFigure.
private IFigure getLocatorFigure(GraphicalEditPart owner) {
IFigure figure = owner.getFigure();
if (owner instanceof TableEntityPart) {
TableEntityFigure treeNodeFigure = (TableEntityFigure) figure;
// table figure to restrict the width
MapperTablePart abstractInOutTreePart = MapperUtils.getMapperTablePart((TableEntityPart) owner);
IFigure parentFigure = ((GraphicalEditPart) abstractInOutTreePart).getFigure();
Rectangle treeBounds = parentFigure.getBounds();
Rectangle rowBounds = treeNodeFigure.getElement().getBounds();
Rectangle treeNodeBounds = figure.getBounds();
figure = new Figure();
if (treeBounds.x + 1 != treeNodeBounds.x || treeNodeBounds.width > treeBounds.width) {
figure.setBounds(new Rectangle(treeBounds.x + 1, treeNodeBounds.y, treeBounds.width - 2, rowBounds.height));
return figure;
} else {
figure.setBounds(owner.getFigure().getBounds().getCopy());
figure.getBounds().height = rowBounds.height;
return figure;
}
} else if (figure instanceof VarEntityFigure) {
Rectangle copy = figure.getBounds().getCopy();
figure = new Figure();
figure.setBounds(copy);
return figure;
}
return owner.getFigure();
}
use of org.talend.designer.gefabstractmap.part.TableEntityPart in project tdi-studio-se by Talend.
the class TreeExpandSupportEditPolicy method activate.
@Override
public void activate() {
super.activate();
TableEntityPart host = (TableEntityPart) getHost();
if (host.getFigure() instanceof TableEntityFigure) {
TableTreeEntityFigure treeNodeFigure = (TableTreeEntityFigure) host.getFigure();
if (treeNodeFigure.getTreeBranch() != null) {
ExpandCollapseFigure ecFigure = treeNodeFigure.getTreeBranch().getExpandCollapseFigure();
if (ecFigure != null) {
ecFigure.addMouseListener(l);
}
}
}
}
use of org.talend.designer.gefabstractmap.part.TableEntityPart in project tdi-studio-se by Talend.
the class TreeExpandSupportEditPolicy method deactivate.
@Override
public void deactivate() {
TableEntityPart host = (TableEntityPart) getHost();
if (host.getFigure() instanceof TableTreeEntityFigure) {
TableTreeEntityFigure treeNodeFigure = (TableTreeEntityFigure) host.getFigure();
if (treeNodeFigure.getTreeBranch() != null) {
ExpandCollapseFigure ecFigure = treeNodeFigure.getTreeBranch().getExpandCollapseFigure();
if (ecFigure != null) {
ecFigure.removeMouseListener(l);
}
}
}
super.deactivate();
}
use of org.talend.designer.gefabstractmap.part.TableEntityPart in project tdi-studio-se by Talend.
the class MapperSelectEditPartTracker method getShiftAffactedEditPart.
private void getShiftAffactedEditPart(List toSelect, List deSelect) {
if (lastSelectedShiftPart == null || lastSelectedShiftPart == getSourceEditPart()) {
toSelect.add(getSourceEditPart());
return;
}
List<TableEntityPart> partList = new ArrayList<TableEntityPart>();
if (lastSelectedShiftPart instanceof TableEntityPart) {
MapperTablePart treePart = MapperUtils.getMapperTablePart((TableEntityPart) lastSelectedShiftPart);
if (treePart != null) {
partList = MapperUtils.getFlatChildrenPartList(treePart);
}
}
int index = partList.indexOf(lastSelectedShiftPart);
int index2 = partList.indexOf(getSourceEditPart());
if (index2 != -1) {
for (int i = Math.min(index, index2); i < Math.max(index, index2) + 1; i++) {
if (!toSelect.contains(partList.get(i))) {
toSelect.add(partList.get(i));
}
}
List selectedEditParts = getCurrentViewer().getSelectedEditParts();
for (int i = 0; i < selectedEditParts.size(); i++) {
if (partList.contains(selectedEditParts.get(i)) && !toSelect.contains(selectedEditParts.get(i))) {
deSelect.add(selectedEditParts.get(i));
}
}
}
}
use of org.talend.designer.gefabstractmap.part.TableEntityPart in project tdi-studio-se by Talend.
the class MapperSelectEditPartTracker method performSelection.
@Override
protected void performSelection() {
if (hasSelectionOccurred()) {
return;
}
setFlag(FLAG_SELECTION_PERFORMED, true);
EditPartViewer viewer = getCurrentViewer();
List selectedObjects = viewer.getSelectedEditParts();
if (getCurrentInput().isModKeyDown(SWT.MOD1)) {
lastSelectedShiftPart = null;
if (selectedObjects.contains(getSourceEditPart())) {
viewer.deselect(getSourceEditPart());
} else if (canAppend()) {
viewer.appendSelection(getSourceEditPart());
} else {
viewer.select(getSourceEditPart());
}
} else if (getCurrentInput().isShiftKeyDown()) {
if (lastSelectedShiftPart == null) {
if (!selectedObjects.isEmpty()) {
Object object = selectedObjects.get(selectedObjects.size() - 1);
if (object instanceof TableEntityPart) {
lastSelectedShiftPart = (EditPart) object;
}
} else {
lastSelectedShiftPart = getSourceEditPart();
}
}
if (canAppend()) {
List<EditPart> toselect = new ArrayList<EditPart>();
List<EditPart> deSelect = new ArrayList<EditPart>();
getShiftAffactedEditPart(toselect, deSelect);
for (EditPart part : deSelect) {
viewer.deselect(part);
}
for (EditPart part : toselect) {
if (!viewer.getSelectedEditParts().contains(part)) {
viewer.appendSelection(part);
}
}
} else {
viewer.select(getSourceEditPart());
}
} else {
lastSelectedShiftPart = null;
viewer.select(getSourceEditPart());
}
}
Aggregations