Source:
protected Command getGraphicalCommand(Request request, EditPart targetEditPart) { DropObjectsRequest dropRequest = getDropObjectsRequest(request); if (dropRequest == null) { return null; } List<CreateViewRequest.ViewDescriptor> viewDescriptors = new LinkedList<CreateViewRequest.ViewDescriptor>(); for (EObject eObject : getSourceEObjects(dropRequest)) { if (eObject instanceof org.eclipse.uml2.uml.UseCase) { viewDescriptors.add(new CreateViewRequest.ViewDescriptor(new EObjectAdapter(eObject), Node.class, Integer.toString(NestedClassForClassEditPart.VISUAL_ID), ((IGraphicalEditPart) targetEditPart).getDiagramPreferencesHint())); } } if (viewDescriptors.isEmpty()) { return null; } CreateViewRequest createViewRequest = new CreateViewRequest(viewDescriptors); createViewRequest.setLocation(dropRequest.getLocation()); targetEditPart = getTargetEditPart(targetEditPart); Command createCommand = targetEditPart.getCommand(createViewRequest); if (createCommand != null) { List<?> result = (List<?>) createViewRequest.getNewObject(); dropRequest.setResult(result); RefreshConnectionsRequest refreshRequest = new RefreshConnectionsRequest(result); Command refreshCommand = targetEditPart.getCommand(refreshRequest); ArrangeRequest arrangeRequest = new ArrangeRequest(RequestConstants.REQ_ARRANGE_DEFERRED); arrangeRequest.setViewAdaptersToArrange(result); Command arrangeCommand = targetEditPart.getCommand(arrangeRequest); CompoundCommand cc = new CompoundCommand(createCommand.getLabel()); cc.add(createCommand.chain(refreshCommand)); cc.add(arrangeCommand); for (Object object : dropRequest.getObjects()) { if (object instanceof EditPart) { EditPart editPart = (EditPart) object; ShowHideElementsRequest destroyViewRequest = new ShowHideElementsRequest(editPart); Command destroyViewCommand = editPart.getCommand(destroyViewRequest); if (destroyViewCommand != null) { cc.add(destroyViewCommand); } } } return cc; } return null; }

Target:
protected Command getGraphicalCommand(Request request, EditPart targetEditPart) { DropObjectsRequest dropRequest = getDropObjectsRequest(request); if (dropRequest == null) { return null; } List<CreateViewRequest.ViewDescriptor> viewDescriptors = new LinkedList<CreateViewRequest.ViewDescriptor>(); for (EObject eObject : getSourceEObjects(dropRequest)) { if (eObject instanceof org.eclipse.uml2.uml.Class) { viewDescriptors.add(new CreateViewRequest.ViewDescriptor(new EObjectAdapter(eObject), Node.class, Integer.toString(NestedClassForClassEditPart.VISUAL_ID), ((IGraphicalEditPart) targetEditPart).getDiagramPreferencesHint())); } } if (viewDescriptors.isEmpty()) { return null; } CreateViewRequest createViewRequest = new CreateViewRequest(viewDescriptors); createViewRequest.setLocation(dropRequest.getLocation()); targetEditPart = getTargetEditPart(targetEditPart); Command createCommand = targetEditPart.getCommand(createViewRequest); if (createCommand != null) { List<?> result = (List<?>) createViewRequest.getNewObject(); dropRequest.setResult(result); RefreshConnectionsRequest refreshRequest = new RefreshConnectionsRequest(result); Command refreshCommand = targetEditPart.getCommand(refreshRequest); ArrangeRequest arrangeRequest = new ArrangeRequest(RequestConstants.REQ_ARRANGE_DEFERRED); arrangeRequest.setViewAdaptersToArrange(result); Command arrangeCommand = targetEditPart.getCommand(arrangeRequest); CompoundCommand cc = new CompoundCommand(createCommand.getLabel()); cc.add(createCommand.chain(refreshCommand)); cc.add(arrangeCommand); for (Object object : dropRequest.getObjects()) { if (object instanceof EditPart) { EditPart editPart = (EditPart) object; ShowHideElementsRequest destroyViewRequest = new ShowHideElementsRequest(editPart); Command destroyViewCommand = editPart.getCommand(destroyViewRequest); if (destroyViewCommand != null) { cc.add(destroyViewCommand); } } } return cc; } return null; }