use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class InputBusinessItemNameEditPart 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 TalendConnectionCreationTool method selectAddedObject.
protected void selectAddedObject(EditPartViewer viewer, Collection objects) {
final List editparts = new ArrayList();
final EditPart[] primaryEP = new EditPart[1];
for (Iterator i = objects.iterator(); i.hasNext(); ) {
Object object = i.next();
if (object instanceof IAdaptable) {
Object editPart = viewer.getEditPartRegistry().get(((IAdaptable) object).getAdapter(View.class));
if (editPart instanceof GraphicalEditPart) {
editparts.add(editPart);
}
}
}
if (!editparts.isEmpty()) {
viewer.setSelection(new StructuredSelection(editparts));
// automatically put the first shape into edit-mode
Display.getCurrent().asyncExec(new Runnable() {
@Override
public void run() {
if (primaryEP[0] == null) {
primaryEP[0] = (EditPart) editparts.get(0);
}
// code is being executed. (see RATLC00527114)
if (primaryEP[0].isActive()) {
primaryEP[0].performRequest(new Request("direct edit"));
}
}
});
}
}
use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class NodeLabelEditPart method refreshVisuals.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
protected void refreshVisuals() {
Node node = ((NodeLabel) getModel()).getNode();
// Node node = ((NodeContainer) ((NodeContainerPart) getParent()).getModel()).getNode();
String text = ((NodeLabel) getModel()).getLabelText();
SimpleHtmlFigure htmlFig = (SimpleHtmlFigure) this.getFigure();
htmlFig.setText(text);
Point loc = node.getLocation().getCopy();
Point offset = ((NodeLabel) getModel()).getOffset();
Point textOffset = new Point();
Dimension size = htmlFig.getPreferredSize();
textOffset.y = node.getSize().height;
textOffset.x = (node.getSize().width - size.width) / 2;
((NodeLabel) getModel()).setTextOffset(textOffset);
loc.translate(textOffset.x + offset.x, textOffset.y + offset.y);
Rectangle rectangle = new Rectangle(loc, size);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), rectangle);
}
use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class NodeErrorEditPart method refreshVisuals.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
protected void refreshVisuals() {
Node node = ((NodeContainer) ((NodeContainerPart) getParent()).getModel()).getNode();
NodeLabel nodeLabel = node.getNodeLabel();
NodeErrorFigure errorFig = (NodeErrorFigure) this.getFigure();
Point loc = node.getLocation().getCopy();
Dimension size = errorFig.getSize();
loc.x = loc.x + (node.getSize().width - size.width) / 2;
loc.y = loc.y + node.getSize().height + (nodeLabel.getLabelSize().height);
Rectangle rectangle = new Rectangle(loc, size);
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), rectangle);
}
use of org.eclipse.gef.GraphicalEditPart in project tdi-studio-se by Talend.
the class NodePart method refreshVisuals.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
@Override
@SuppressWarnings("unchecked")
protected void refreshVisuals() {
Node node = (Node) this.getModel();
Point loc = node.getLocation();
Rectangle rectangle = new Rectangle(loc, node.getSize());
((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), rectangle);
}
Aggregations