use of org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart in project tdi-studio-se by Talend.
the class BusinessGraphicalNodeEditPolicy method getConnectionWithReorientedViewCompleteCommand.
/**
* @generated
*/
protected Command getConnectionWithReorientedViewCompleteCommand(CreateConnectionRequest request) {
ICommandProxy c = (ICommandProxy) super.getConnectionCompleteCommand(request);
CompositeCommand cc = (CompositeCommand) c.getICommand();
TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
BusinessReorientConnectionViewCommand rcvCommand = new BusinessReorientConnectionViewCommand(editingDomain, null);
rcvCommand.setEdgeAdaptor(getViewAdapter());
cc.compose(rcvCommand);
return c;
}
use of org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart in project tdi-studio-se by Talend.
the class BusinessModelingAssistantProvider method getRelTypesOnSource.
public List getRelTypesOnSource(IAdaptable source) {
IGraphicalEditPart editPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
if (editPart instanceof BusinessItemShapeEditPart) {
List types = new ArrayList();
types.add(BusinessElementTypes.BusinessItemRelationship_3001);
types.add(BusinessElementTypes.DirectionalBusinessItemRelationship_3002);
types.add(BusinessElementTypes.BidirectionalBusinessItemRelationship_3003);
return types;
}
return Collections.EMPTY_LIST;
}
use of org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart in project statecharts by Yakindu.
the class UpdateAnnotationsOnMoveCommand method doExecuteWithResult.
@Override
protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
final View parentView = TreeLayoutUtil.getTreeNodeParentView(editPart.getNotationView());
if (parentView != null) {
final IGraphicalEditPart parentEditPart = (IGraphicalEditPart) editPart.findEditPart(editPart.getParent(), parentView.getElement());
if (parentEditPart != null) {
final List<IGraphicalEditPart> treeChildren = new ArrayList<IGraphicalEditPart>(TreeLayoutUtil.getOrderedTreeChildren(parentEditPart));
if (!treeChildren.isEmpty()) {
final int oldPos = treeChildren.indexOf(editPart);
final int newPos = layoutConstraint.getTreeInnerRankIndex();
if (newPos != -1) {
if (oldPos != newPos) {
final IGraphicalEditPart element = treeChildren.get(oldPos);
treeChildren.remove(oldPos);
treeChildren.add(newPos, element);
TreeLayoutUtil.setTreeNodesPositionAnnotation(TreeLayoutUtil.getViews(treeChildren));
}
}
return CommandResult.newOKCommandResult();
}
}
}
return CommandResult.newErrorCommandResult("Parent view or parent edit part not found!");
}
use of org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart in project statecharts by Yakindu.
the class TreeLayoutEditPolicy method showLayoutTargetFeedback.
@Override
protected void showLayoutTargetFeedback(Request request) {
if (request instanceof ChangeBoundsRequest) {
final ChangeBoundsRequest changeBoundsRequest = (ChangeBoundsRequest) request;
if (!changeBoundsRequest.getEditParts().isEmpty() && !(changeBoundsRequest.getEditParts().get(0) instanceof LabelEditPart)) {
final IGraphicalEditPart editPart = (IGraphicalEditPart) changeBoundsRequest.getEditParts().get(0);
final List<IGraphicalEditPart> siblingList = TreeLayoutUtil.getSiblings(editPart);
if (!siblingList.isEmpty()) {
final int newTreePosition = TreeLayoutUtil.getNewTreeNodePosition(changeBoundsRequest.getLocation(), TreeLayoutUtil.getSiblings(editPart));
Point point;
if (newTreePosition == 0) {
// top end
point = getFeedBackFigurePoint(editPart.getFigure(), siblingList, 0, 0);
} else if (newTreePosition == siblingList.size()) {
// Bottom end
point = getFeedBackFigurePoint(editPart.getFigure(), siblingList, siblingList.size(), siblingList.size());
} else {
// Between siblings
point = getFeedBackFigurePoint(editPart.getFigure(), siblingList, newTreePosition - 1, newTreePosition);
}
final Rectangle bounds = getFeedbackFigureBounds();
siblingList.get(0).getFigure().translateToAbsolute(bounds);
bounds.setLocation(point);
getFeedbackFigure().setBounds(bounds);
getFeedbackFigure().translateToRelative(getFeedbackFigure().getBounds());
getFeedbackLayer().add(getFeedbackFigure());
getFeedbackLayer().repaint();
}
}
}
}
use of org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart in project statecharts by Yakindu.
the class AdjustIdentityAnchorCommand method adjustAnchors.
@SuppressWarnings("unchecked")
protected void adjustAnchors(IGraphicalEditPart editPart) {
if (editPart instanceof IGraphicalEditPart) {
View view = ((IGraphicalEditPart) editPart).getNotationView();
List<Edge> targetEdges = view.getTargetEdges();
for (Edge edge : targetEdges) {
handleEdge(edge, editPart, false);
}
List<Edge> sourceEdges = view.getSourceEdges();
for (Edge edge : sourceEdges) {
handleEdge(edge, editPart, true);
}
}
}
Aggregations