use of org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart in project statecharts by Yakindu.
the class GroupStatesIntoCompositeRefactoring method setContextStates.
protected void setContextStates() {
contextStates = Lists.newArrayList();
List<GraphicalEditPart> contextObjects = getContextObjects();
for (GraphicalEditPart editPart : contextObjects) {
EObject element = editPart.resolveSemanticElement();
contextStates.add((State) element);
}
}
use of org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart in project statecharts by Yakindu.
the class GroupStatesIntoCompositeRefactoring method moveSelectedStateNodesTo.
protected void moveSelectedStateNodesTo(View containerView, Bounds compositeBounds) {
for (GraphicalEditPart editPart : getContextObjects()) {
Node stateNode = (Node) editPart.getNotationView();
ViewUtil.insertChildView(containerView, stateNode, ViewUtil.APPEND, true);
Bounds newBounds = NotationFactory.eINSTANCE.createBounds();
Bounds oldBounds = (Bounds) stateNode.getLayoutConstraint();
// FIXME use bounds of region view
newBounds.setX(oldBounds.getX() - compositeBounds.getX() - 7);
// FIXME use bounds of region view
newBounds.setY(oldBounds.getY() - compositeBounds.getY() - 34);
((Node) editPart.getNotationView()).setLayoutConstraint(newBounds);
}
}
use of org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart in project statecharts by Yakindu.
the class TransitionPriorityDecorationProvider method createDecorators.
@Override
public void createDecorators(IDecoratorTarget decoratorTarget) {
EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
EditDomain ed = editPart.getViewer().getEditDomain();
if (!(ed instanceof DiagramEditDomain)) {
return;
}
if (shouldInstall(((DiagramEditDomain) ed).getEditorPart()) && editPart instanceof TransitionEditPart) {
IDecorator decorator = createStatusDecorator(decoratorTarget);
decorators.add(decorator);
decoratorTarget.installDecorator(getDecoratorKey(), decorator);
}
}
}
use of org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart in project statecharts by Yakindu.
the class RegionPriorityDecorationProvider method createDecorators.
@Override
public void createDecorators(IDecoratorTarget decoratorTarget) {
EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
EditDomain ed = editPart.getViewer().getEditDomain();
if (!(ed instanceof DiagramEditDomain)) {
return;
}
if (shouldInstall(((DiagramEditDomain) ed).getEditorPart()) && editPart instanceof RegionEditPart) {
IDecorator decorator = createStatusDecorator(decoratorTarget);
decorators.add(decorator);
decoratorTarget.installDecorator(getDecoratorKey(), decorator);
}
}
}
use of org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart in project statecharts by Yakindu.
the class GroupStatesIntoCompositeRefactoring method setCompositeStateLayoutConstraint.
/**
* Iterates through all {@link StateEditPart}s of the current selection and
* computes layout constraints for the composite node.
*
* @param compositeStateNode
* node of the composite state
*/
protected void setCompositeStateLayoutConstraint(Node compositeStateNode) {
Rectangle newbounds = null;
for (GraphicalEditPart editPart : getContextObjects()) {
Rectangle childBounds = editPart.getFigure().getBounds();
if (newbounds == null)
newbounds = childBounds.getCopy();
newbounds.union(childBounds);
}
newbounds.expand(new Insets(PADDING, PADDING, PADDING, PADDING));
Bounds bounds = NotationFactory.eINSTANCE.createBounds();
bounds.setX(newbounds.x);
bounds.setY(newbounds.y);
bounds.setWidth(newbounds.width);
bounds.setHeight(newbounds.height);
compositeStateNode.setLayoutConstraint(bounds);
}
Aggregations