/** @generated */ @Override protected Command getDestroyElementCommand(DestroyElementRequest req) { CompoundCommand cc = getDestroyEdgesCommand(); addDestroyShortcutsCommand(cc); cc.add(getGEFWrapper(new DestroyElementCommand(req))); return cc.unwrap(); }
/** * Return the command to create the view * * @param container the container for the element * @param semanticElement * @return The command to create the view */ protected Command getCreateViewCommand(View container, EObject semanticElement, Point location) { // creation of the node ViewDescriptor viewDescriptor = new ViewDescriptor( new EObjectAdapter(semanticElement), Node.class, null, ViewUtil.APPEND, true, ((IGraphicalEditPart) this.getHost()).getDiagramPreferencesHint()); CompoundCommand compositeCmd = new CompoundCommand("Create View"); // $NON-NLS-1$ CreateCommand cmd = new CreateCommand(getEditingDomain(), viewDescriptor, container); if (cmd.canExecute()) { compositeCmd.add(new ICommandProxy(cmd)); } // set the location if (location != null) { SetBoundsCommand setBoundsCommand = new SetBoundsCommand( getEditingDomain(), "move", (IAdaptable) cmd.getCommandResult().getReturnValue(), location); //$NON-NLS-1$ if (setBoundsCommand.canExecute()) { compositeCmd.add(new ICommandProxy(setBoundsCommand)); } } return compositeCmd; }
public void run() { CompoundCommand command = new CompoundCommand(); WorkflowModelEditor editor = (WorkflowModelEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor(); final DiagramEditorPage diagramEditorPage = (DiagramEditorPage) editor.getCurrentPage(); if (actualMode.equals(DiagramModeType.MODE_450_LITERAL)) { // move children if children have negative positions PoolSymbol poolSymbol = DiagramUtil.getDefaultPool(diagram); if (poolSymbol != null && !poolSymbol.getNodes().isEmpty()) { int[] checkNegative = new int[] {0, 0}; PoolLaneUtils.checkForNegativePositions(poolSymbol, checkNegative); if (checkNegative[0] < 0 || checkNegative[1] < 0) { checkNegative[0] = -checkNegative[0]; checkNegative[1] = -checkNegative[1]; EditPart editPart = diagramEditorPage.findEditPart(diagram); command.add(PoolLaneUtils.moveAllChildren(editPart, checkNegative)); } } } Command cmd = new SetValueCmd(diagram, CWM_PKG.getDiagramType_Mode(), actualMode) { public void redo() { super.redo(); updatePalette(getValue()); } public void undo() { super.undo(); updatePalette(getUndoValue()); } public void updatePalette(Object value) { WorkflowModelEditorPaletteFactory.setDiagramModeType((DiagramModeType) value); WorkflowModelEditorPaletteFactory.updatePalette(diagramEditorPage); WorkflowModelEditorPaletteFactory.setDiagramModeType(null); } }; command.add(cmd); command.add( new DelegatingCommand() { public Command createDelegate() { CompoundCommand cmd = new CompoundCommand(); PoolSymbol poolSymbol = DiagramUtil.getDefaultPool(diagram); EditPart editPart = diagramEditorPage.findEditPart(diagram); Rectangle newSize = PoolLaneUtils.checkPoolSize((DiagramEditPart) editPart); if (newSize != null) { cmd.add( new SetValueCmd( poolSymbol, CWM_PKG.getINodeSymbol_Width(), new Integer(newSize.width))); cmd.add( new SetValueCmd( poolSymbol, CWM_PKG.getINodeSymbol_Height(), new Integer(newSize.height))); return cmd; } return null; } }); domain.getCommandStack().execute(command); }
protected Command createNodeChangeBoundCommands(final List<ShapeEditPart> sortedNodes) { final CompoundCommand result = new CompoundCommand(); final Iterator<ShapeEditPart> iterEditParts = sortedNodes.iterator(); while (iterEditParts.hasNext()) { final ShapeEditPart shapeEditPart = iterEditParts.next(); final ChangeBoundsRequest request = new ChangeBoundsRequest(org.eclipse.gef.RequestConstants.REQ_MOVE); request.setEditParts(shapeEditPart); final Point ptLocation = new Point(0, 0); // the zoom. double scale = 1.0; if (shapeEditPart.getRoot() instanceof DiagramRootEditPart) { final ZoomManager zoomManager = ((DiagramRootEditPart) shapeEditPart.getRoot()).getZoomManager(); scale = zoomManager.getZoom(); } // Compute request data. final Point ptOldLocation = shapeEditPart.getFigure().getBounds().getLocation(); final Dimension delta = ptLocation.getDifference(ptOldLocation); request.setMoveDelta(new PrecisionPoint(delta.width * scale, delta.height * scale)); request.setLocation(new PrecisionPoint(ptLocation.x * scale, ptLocation.y * scale)); final Command cmd = this.buildCommandWrapper(request, shapeEditPart); result.add(cmd); } return result; }
private void addNewChild(XamlNode parent, XamlNode child) { if (child instanceof XamlAttribute && !parent.getAttributes().contains(child)) { commandList.add(new AddNewChildCommand(parent, child)); } else if (child instanceof XamlElement && !parent.getChildNodes().contains(child)) { commandList.add(new AddNewChildCommand(parent, child)); } }
/** * Gets a command from each child in the group. * * @param request * @return the compound command */ private Command getCommandFromChildren(Request request) { CompoundCommand cc = new CompoundCommand(); for (Iterator iter = getHost().getChildren().iterator(); iter.hasNext(); ) { EditPart childEP = (EditPart) iter.next(); cc.add(childEP.getCommand(request)); } cc.unwrap(); return cc; }
/** * Overridden so that if a child shape is moved or resized such that the group's location (i.e. * top left corner) changes, the group's location as well as all the children's relative locations * are updated. */ protected Command getResizeChildrenCommand(ChangeBoundsRequest request) { CompoundCommand resize = new CompoundCommand(); resize.add(super.getResizeChildrenCommand(request)); resize.add( new ICommandProxy( new UpdateGroupLocationCommand( ((IGraphicalEditPart) getHost()).getEditingDomain(), (View) getHost().getModel()))); return resize; }
protected Command computeCommand() { MUIElement selectedPart = model; if (selectedPart instanceof MPart) { MGenericStack<MUIElement> partStack = findParentStack(); if (partStack != null) { selectedPart = partStack; } } MElementContainer<MUIElement> parent = partStack.getParent(); List<MUIElement> children = parent.getChildren(); int index = children.indexOf(partStack); if (parent instanceof MGenericTile<?>) { MGenericTile<?> genericTile = (MGenericTile<?>) parent; int modelIndex = children.indexOf(selectedPart); if (modelIndex == 0 && index == 1 && children.size() == 2 && genericTile.isHorizontal()) { return UnexecutableCommand.INSTANCE; } } CompoundCommand result = new CompoundCommand(); MPartSashContainer newSash = MBasicFactory.INSTANCE.createPartSashContainer(); String preferData = partStack.getContainerData(); newSash.setContainerData(preferData); newSash.setHorizontal(true); if (selectedPart instanceof MPartStack) { if (selectedPart.getParent() == null) { selectedPart.setContainerData(preferData); result.add(CommandFactory.createAddChildCommand(newSash, selectedPart, 0)); } else { result.add(new ChangeParentCommand(newSash, selectedPart, 0)); if (!preferData.equals(selectedPart.getContainerData())) { result.add( new ApplyAttributeSettingCommand( (EObject) selectedPart, "containerData", preferData)); } } } else if (selectedPart instanceof MPart) { MPart part = (MPart) selectedPart; MPartStack createPartStack = MBasicFactory.INSTANCE.createPartStack(); createPartStack.setContainerData(preferData); if (part.getParent() != null) { result.add(new ChangeParentCommand(createPartStack, part, 0)); } else { result.add(CommandFactory.createAddChildCommand(createPartStack, part, 0)); } result.add(CommandFactory.createAddChildCommand(newSash, createPartStack, 0)); } result.add(new ChangeParentCommand(newSash, partStack, 1)); result.add(CommandFactory.createAddChildCommand(parent, newSash, index)); return result.unwrap(); }
private CompoundCommand clone(CompoundCommand commands) { CompoundCommand ret = new CompoundCommand(); if (dependantCommands != null) { for (Iterator iter = commands.getCommands().iterator(); iter.hasNext(); ) { RetargetParentPasteCommand command = (RetargetParentPasteCommand) iter.next(); ret.add(command.clone()); } } return ret; }
/** @generated */ protected Command getDestroyElementCommand(DestroyElementRequest req) { CompoundCommand cc = getDestroyEdgesCommand(); addDestroyShortcutsCommand(cc); View view = (View) getHost().getModel(); if (view.getEAnnotation("Shortcut") != null) { // $NON-NLS-1$ req.setElementToDestroy(view); } cc.add(getGEFWrapper(new DestroyElementCommand(req))); return cc.unwrap(); }
@Override protected boolean handleKeyDown(KeyEvent event) { int dx = 0; int dy = 0; if (event.keyCode == SWT.SHIFT) { shift = true; } if (event.keyCode == SWT.ARROW_DOWN) { dy = 1; } else if (event.keyCode == SWT.ARROW_LEFT) { dx = -1; } else if (event.keyCode == SWT.ARROW_RIGHT) { dx = 1; } else if (event.keyCode == SWT.ARROW_UP) { dy = -1; } ERDiagram diagram = (ERDiagram) this.getCurrentViewer().getContents().getModel(); List selectedObject = this.getCurrentViewer().getSelectedEditParts(); if (!selectedObject.isEmpty()) { CompoundCommand command = new CompoundCommand(); for (Object object : selectedObject) { if (object instanceof ERTableEditPart || object instanceof NoteEditPart) { NodeElementEditPart editPart = (NodeElementEditPart) object; NodeElement nodeElement = (NodeElement) editPart.getModel(); MoveElementCommand moveElementCommand = new MoveElementCommand( diagram, editPart.getFigure().getBounds(), nodeElement.getX() + dx, nodeElement.getY() + dy, nodeElement.getWidth(), nodeElement.getHeight(), nodeElement); command.add(moveElementCommand); } } this.executeCommand(command.unwrap()); } return super.handleKeyDown(event); }
@Override protected Command getAddCommand(Request req) { ChangeBoundsRequest request = (ChangeBoundsRequest) req; List editParts = request.getEditParts(); CompoundCommand command = new CompoundCommand(); for (int i = 0; i < editParts.size(); i++) { EditPart child = (EditPart) editParts.get(i); command.add(createAddCommand(child)); } return command.unwrap(); }
/** * @see * org.eclipse.gef.editpolicies.ContainerEditPolicy#getAddCommand(org.eclipse.gef.requests.GroupRequest) */ protected Command getAddCommand(GroupRequest request) { CompoundCommand cmd = new CompoundCommand(); for (int i = 0; i < request.getEditParts().size(); i++) { AddAndAssignSourceCommand add = new AddAndAssignSourceCommand(); add.setParent((StructuredActivity) getHost().getParent().getModel()); add.setSource((Activity) getHost().getModel()); add.setChild(((Activity) ((EditPart) request.getEditParts().get(i)).getModel())); cmd.add(add); } return cmd; }
/** * Creates commands to destroy all host incoming and outgoing links. * * @generated */ protected CompoundCommand getDestroyEdgesCommand() { CompoundCommand cmd = new CompoundCommand(); View view = (View) getHost().getModel(); for (Iterator it = view.getSourceEdges().iterator(); it.hasNext(); ) { cmd.add(getDestroyElementCommand((Edge) it.next())); } for (Iterator it = view.getTargetEdges().iterator(); it.hasNext(); ) { cmd.add(getDestroyElementCommand((Edge) it.next())); } return cmd; }
private Command getDeleteComponentCommand() { CompoundCommand commands = new CompoundCommand(); if (getSourceConnections().size() > 0) commands.add(getConnectionsDeleteCommand(getSourceConnections())); if (getTargetConnections().size() > 0) commands.add(getConnectionsDeleteCommand(getTargetConnections())); if (getParent() != null) commands.add( new DeleteVisualComponentCommand( (ComponentDiagram) getParent().getModel(), (NodeVisualModel) getModel())); return commands; }
/** * Execute the command : create the model element, then the corresponding views * * @see org.eclipse.gef.commands.Command#execute() */ @Override public void execute() { Object constraint = null; if (elementCreationCommand != null) { elementCreationCommand.execute(); constraint = elementCreationCommand.getICommand().getCommandResult().getReturnValue(); } if (constraint instanceof Constraint && compartment != null && type != null) { // construct the complete command for views creation and execute it. viewsCreationCommand = new CompoundCommand(); // creation of the node by the compartment ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor( new EObjectAdapter((EObject) constraint), Node.class, type.getSemanticHint(), compartment.getDiagramPreferencesHint()); CreateViewRequest request = new CreateViewRequest(descriptor); Command nodeCreationCommand = compartment.getCommand(request); viewsCreationCommand.add(nodeCreationCommand); // try and recover the created edit part, then create the link if (linkedActionEditPart != null && getLinkType() != null) { IAdaptable targetAdapter = extractResult(nodeCreationCommand); if (targetAdapter != null) { IAdaptable sourceAdapter = new SemanticAdapter(null, linkedActionEditPart.getModel()); // descriptor of the link CreateConnectionViewRequest.ConnectionViewDescriptor linkdescriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor( getLinkType(), getLinkType().getSemanticHint(), compartment.getDiagramPreferencesHint()); CommonDeferredCreateConnectionViewCommand aLinkCommand = new CommonDeferredCreateConnectionViewCommand( EditorUtils.getTransactionalEditingDomain(), getLinkType().getSemanticHint(), sourceAdapter, targetAdapter, compartment.getViewer(), compartment.getDiagramPreferencesHint(), linkdescriptor, null); aLinkCommand.setElement((EObject) constraint); viewsCreationCommand.add(new ICommandProxy(aLinkCommand)); } } viewsCreationCommand.execute(); } }
private Command createCommandChain() { CompoundCommand chain = new CompoundCommand(); sort(_editParts); double startPosition = calculateStartPosition(); double spacing = calculateSpacing(); for (int i = 1; i < _editParts.size() - 1; i++) { AbstractWidgetModel widget = _editParts.get(i).getWidgetModel(); int newPosition = calculateNewPosition(startPosition, spacing, i); chain.add(new SetPropertyCommand(widget, _positionProperty, newPosition)); } return chain; }
private void updateDependantCommands(NodeVisualModel parentVisualModel) { if (dependantCommands != null) { for (Iterator iter = dependantCommands.getCommands().iterator(); iter.hasNext(); ) { RetargetParentPasteCommand command = (RetargetParentPasteCommand) iter.next(); command.setParent(parentVisualModel); } } }
/** * Undo model and views creation * * @see org.eclipse.gef.commands.Command#undo() */ @Override public void undo() { if (viewsCreationCommand != null) { viewsCreationCommand.undo(); } if (elementCreationCommand != null) { elementCreationCommand.undo(); } }
/** * Adds a "Set as default" behavior to a list of commands * * @param commands * @return */ protected List<Command> convertToDefault(List<Command> commands) { List<Command> result = new ArrayList<Command>(commands.size()); for (Command command : commands) { final Command commandToExecute = command; CompoundCommand compound = new CompoundCommand(commandToExecute.getLabel()); compound.add(commandToExecute); compound.add( new Command("Set default drop behavior") { @Override public void execute() { defaultHandler.defaultActionSelected(commandToExecute); } }); result.add(compound); } return result; }
private Command createCommand(List<?> selection, RGB newColor) { CompoundCommand result = new CompoundCommand(Messages.FillColorAction_1); for (Object object : selection) { if (object instanceof EditPart) { Object model = ((EditPart) object).getModel(); if (shouldEnable(model)) { Command cmd = new FillColorCommand( (IDiagramModelObject) model, ColorFactory.convertRGBToString(newColor)); if (cmd.canExecute()) { result.add(cmd); } } } } return result.unwrap(); }
/** @generated */ protected void addDestroyChildNodesCommand(CompoundCommand cmd) { View view = (View) getHost().getModel(); EAnnotation annotation = view.getEAnnotation("Shortcut"); // $NON-NLS-1$ if (annotation != null) { return; } for (Iterator it = view.getChildren().iterator(); it.hasNext(); ) { Node node = (Node) it.next(); switch (hub.top.adaptiveSystem.diagram.part.AdaptiveSystemVisualIDRegistry.getVisualID( node)) { case hub.top.adaptiveSystem.diagram.edit.parts.PreNetEditPart.VISUAL_ID: cmd.add(getDestroyElementCommand(node)); break; case hub.top.adaptiveSystem.diagram.edit.parts.DoNetEditPart.VISUAL_ID: cmd.add(getDestroyElementCommand(node)); break; } } }
/** Clear links */ @SuppressWarnings({"rawtypes", "unchecked"}) private static void clearLinks() { Collection values = getDiagramEditor().getDiagramGraphicalViewer().getEditPartRegistry().values(); Iterator iterator = values.iterator(); CompoundCommand ccModel = new CompoundCommand(); org.eclipse.gef.commands.CompoundCommand ccView = new org.eclipse.gef.commands.CompoundCommand(); while (iterator.hasNext()) { Object editPart = iterator.next(); if (editPart instanceof EsbLinkEditPart) { EsbLinkEditPart linkEditPart = (EsbLinkEditPart) editPart; /* * We shouldn't remove EsbLinkEditParts if the target of the link is a AbstractEndpointInputConnectorEditPart. * Because these kind of links will not be get regenerated again according to the current implementation. */ if (linkEditPart.getTarget() instanceof AbstractEndpointInputConnectorEditPart) { continue; } Collection linkCollection = new ArrayList(); linkCollection.add(((ConnectorImpl) linkEditPart.getModel()).getElement()); org.eclipse.emf.edit.command.DeleteCommand modelDeleteCommand = new org.eclipse.emf.edit.command.DeleteCommand( getDiagramEditor().getEditingDomain(), linkCollection); if (modelDeleteCommand.canExecute()) { ccModel.append(modelDeleteCommand); } DeleteCommand viewDeleteCommand = new DeleteCommand(linkEditPart.getNotationView()); if (viewDeleteCommand.canExecute()) { ccView.add(new ICommandProxy(viewDeleteCommand)); } } } if (ccModel.canExecute()) { getDiagramEditor().getEditingDomain().getCommandStack().execute(ccModel); } if (ccView.canExecute()) { getDiagramEditor().getDiagramEditDomain().getDiagramCommandStack().execute(ccView); } }
public void execute() { visualModel = EditormodelFactory.eINSTANCE.createNodeVisualModel(copyVisualModel); visualModel.setSemanticModel( CoremodelFactory.eINSTANCE.createComponentModel( (ComponentModel) copyVisualModel.getSemanticModel())); updateBounds(); updateDependantCommands(visualModel); dependantCommands.execute(); super.redo(); }
/** {@inheritDoc} */ @Override protected Command createDeleteViewCommand(GroupRequest deleteRequest) { CompoundCommand deleteViewsCommand = new CompoundCommand(); /* apex added start */ // Activation의 source connections들을 parent인 lifeline으로 이동하여 연결 if (getHost() instanceof ShapeNodeEditPart) { LifelineEditPart lifelineEP = SequenceUtil.getParentLifelinePart(getHost()); IFigure figure = lifelineEP.getNodeFigure(); Rectangle newBounds = figure.getBounds().getCopy(); figure.translateToAbsolute(newBounds); List connections = ((ShapeNodeEditPart) getHost()).getSourceConnections(); for (Iterator iter = connections.iterator(); iter.hasNext(); ) { ConnectionNodeEditPart connection = (ConnectionNodeEditPart) iter.next(); Point location = SequenceUtil.getAbsoluteEdgeExtremity(connection, true); ReconnectRequest reconnReq = new ReconnectRequest(); reconnReq.setConnectionEditPart(connection); reconnReq.setLocation(location); reconnReq.setTargetEditPart(lifelineEP); reconnReq.setType(RequestConstants.REQ_RECONNECT_SOURCE); reconnReq.getExtendedData().put(SequenceRequestConstant.DO_NOT_MOVE_EDIT_PARTS, true); deleteViewsCommand.add(lifelineEP.getCommand(reconnReq)); } } /* apex added end */ Command deleteViewCommand = super.createDeleteViewCommand(deleteRequest); deleteViewsCommand.add(deleteViewCommand); if (getHost() instanceof ShapeNodeEditPart) { TransactionalEditingDomain editingDomain = ((ShapeNodeEditPart) getHost()).getEditingDomain(); SequenceDeleteHelper.completeDeleteExecutionSpecificationViewCommand( deleteViewsCommand, editingDomain, getHost()); } return deleteViewsCommand; }
/** * Gets the command to handle objects dropped into the Mapping diagram. * * @param dropRequest The drop request. * @return The executable command. */ public Command getDropObjectsCommand(DropObjectsRequest dropRequest) { ModelRelEditPart modelRelEditPart = (ModelRelEditPart) getHost(); CompoundCommand command = new CompoundCommand("Add model element references"); IElementType elementType = MIDElementTypes.getElementType(ModelElementReferenceEditPart.VISUAL_ID); EReference containment = RelationshipPackage.Literals.MODEL_ENDPOINT_REFERENCE__MODEL_ELEM_REFS; Iterator<?> it = dropRequest.getObjects().iterator(); while (it.hasNext()) { RelationshipDiagramOutlineDropObject dropObj = (RelationshipDiagramOutlineDropObject) it.next(); ModelEndpointReference modelEndpointRef = dropObj.getModelEndpointReference(); CreateElementRequest createReq = new CreateElementRequest( modelRelEditPart.getEditingDomain(), modelEndpointRef, elementType, containment); command.add( new ICommandProxy( // convert GMF command to GEF command new ModelElementReferenceDropCommand(createReq, dropObj))); } return command; }
/** creates the command to move the shapes left or right. */ protected Command getCommand() { if (_container == null) { return null; } CompoundCommand command = new CompoundCommand("Multiple Shape Move"); TransactionalEditingDomain editingDomain = _container.getEditingDomain(); Point moveDelta = ((ChangeBoundsRequest) getSourceRequest()).getMoveDelta().getCopy(); Dimension spSizeDelta = new Dimension(moveDelta.x, moveDelta.y); ZoomManager zoomManager = ((DiagramRootEditPart) getCurrentViewer().getRootEditPart()).getZoomManager(); spSizeDelta.scale(1 / zoomManager.getZoom()); command.add(_container.getCommand(getSourceRequest())); for (IGraphicalEditPart sp : _subProcesses) { Dimension spDim = sp.getFigure().getBounds().getSize().getCopy(); spDim.expand(spSizeDelta); SetBoundsCommand setBounds = new SetBoundsCommand(editingDomain, "MultipleShape Move", sp, spDim); command.add(new ICommandProxy(setBounds)); } return command; }
/** * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) * @param action */ public void run(IAction action) { // 1 this is a associationEnd? CompoundCommand command = new CompoundCommand(); if (selectedElement instanceof AssociationEndSourceEditPart || selectedElement instanceof AssociationEndTargetEditPart || selectedElement instanceof AssociationClassRoleSourceEditPart || selectedElement instanceof AssociationClassRoleTargetEditPart) { // 2. look for the future owner of the property, run only for binary association Property property = (Property) ((GraphicalEditPart) selectedElement).resolveSemanticElement(); if (property.getAssociation() != null) { // add property in association EStructuralFeature feature = UMLPackage.eINSTANCE.getAssociation_NavigableOwnedEnd(); List<Property> attributeList = new ArrayList<Property>(); attributeList.addAll(property.getAssociation().getNavigableOwnedEnds()); attributeList.remove(property); SetRequest setRequest = new SetRequest(property.getAssociation(), feature, attributeList); SetValueCommand setValueCommand = new SetValueCommand(setRequest); command.add(new ICommandProxy(setValueCommand)); selectedElement.getDiagramEditDomain().getDiagramCommandStack().execute(command); } } }
/** @generated */ protected void addDestroyShortcutsCommand(CompoundCommand command) { View view = (View) getHost().getModel(); if (view.getEAnnotation("Shortcut") != null) { // $NON-NLS-1$ return; } for (Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext(); ) { View nextView = (View) it.next(); if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { // $NON-NLS-1$ continue; } command.add(getDestroyElementCommand(nextView)); } }
@Override protected void executeCurrentCommand() { FiguresHelper.AVOID_OVERLAP_ENABLE = false; super.executeCurrentCommand(); FiguresHelper.AVOID_OVERLAP_ENABLE = true; CompoundCommand cc = new CompoundCommand("Check Overlap"); for (IGraphicalEditPart ep : _movingShapes) { Location loc = (Location) ((Node) ep.getNotationView()).getLayoutConstraint(); Point oldLoc = new Point(loc.getX(), loc.getY()); Point newLoc = FiguresHelper.handleCompartmentMargin( ep, loc.getX(), loc.getY(), (ep.resolveSemanticElement() instanceof SubProcessEvent)); if ((newLoc.x != 0 && newLoc.y != 0) && !newLoc.equals(oldLoc)) { cc.add( new ICommandProxy( new SetBoundsCommand( _container.getEditingDomain(), "Check Overlap", new EObjectAdapter(ep.getNotationView()), newLoc))); } } executeCommand(cc); }