use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class MapperRootEditPart method addChildVisual.
@Override
protected void addChildVisual(EditPart childEditPart, int index) {
IFigure child = ((GraphicalEditPart) childEditPart).getFigure();
if (childEditPart instanceof InputTablePart) {
/* get first figure to put all input tables figures in */
Object model = childEditPart.getModel();
index = getRootModelManager().getInputTables().indexOf(model);
if (index != -1) {
leftFigure.add(child, index);
} else {
leftFigure.add(child);
}
}
if (childEditPart instanceof OutputTablePart) {
/* get third figure to put all output tables figures in */
Object model = childEditPart.getModel();
index = getRootModelManager().getOutputTables().indexOf(model);
if (index != -1) {
rightFigure.add(child, index);
} else {
rightFigure.add(child);
}
}
if (childEditPart instanceof VarTablePart) {
Object model = childEditPart.getModel();
index = getRootModelManager().getVarTables().indexOf(model);
if (index != -1) {
// had added search figure when inited the center figure.
if (centerFigure.getChildren() != null && centerFigure.getChildren().size() != 0) {
centerFigure.add(child, index + centerFigure.getChildren().size());
} else {
centerFigure.add(child, index);
}
} else {
centerFigure.add(child);
}
}
}
use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class DocumentBusinessItemNameEditPart method createDefaultEditPolicies.
/**
* @generated
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
protected List createSelectionHandles() {
List handles = new ArrayList();
NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
return handles;
}
public Command getCommand(Request request) {
return null;
}
public boolean understandsRequest(Request request) {
return false;
}
});
}
use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class GearBusinessItemNameEditPart method createDefaultEditPolicies.
/**
* @generated
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
protected List createSelectionHandles() {
List handles = new ArrayList();
NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
return handles;
}
public Command getCommand(Request request) {
return null;
}
public boolean understandsRequest(Request request) {
return false;
}
});
}
use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class EllipseBusinessItemNameEditPart method createDefaultEditPolicies.
/**
* @generated
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
protected List createSelectionHandles() {
List handles = new ArrayList();
NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
return handles;
}
public Command getCommand(Request request) {
return null;
}
public boolean understandsRequest(Request request) {
return false;
}
});
}
use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class BusinessExtNodeLabelEditPart method refreshBounds.
/**
* @generated
*/
public void refreshBounds() {
IFigure refFigure = ((GraphicalEditPart) getParent()).getFigure();
int dx = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue();
int dy = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue();
Point offset = new Point(dx, dy);
getFigure().getParent().setConstraint(getFigure(), new LabelLocator(refFigure, offset, getKeyPoint()) {
public void relocate(IFigure target) {
Point location = getReferencePoint().getTranslated(getOffset());
location.translate(-target.getBounds().width / 2, 0);
target.setLocation(location);
target.setSize(new Dimension(target.getPreferredSize().width, target.getPreferredSize().height));
}
protected Point getReferencePoint() {
return getLabelLocation(parent);
}
});
}
Aggregations