Java Code Examples for org.eclipse.gef.requests.ChangeBoundsRequest#getLocation()

The following examples show how to use org.eclipse.gef.requests.ChangeBoundsRequest#getLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomDragDropEditPolicy.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private boolean isTargetaCollapseSubprocess(final ChangeBoundsRequest request) {
    if(request.getLocation() == null){
        return false ;
    }
    final EditPart ep = getHost().getParent().getViewer().findObjectAt(request.getLocation()) ;
    return ep instanceof IGraphicalEditPart && ((IGraphicalEditPart) ep).resolveSemanticElement() instanceof SubProcessEvent && isCollapsed(ep);
}
 
Example 2
Source File: CustomCreationEditPolicy.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Command getReparentCommand(final ChangeBoundsRequest request) {
	final CompoundCommand cc = new CompoundCommand();
	if(getHost() instanceof ITextAwareEditPart){
		return UnexecutableCommand.INSTANCE;
	}
	if(request.getExtendedData().get("DELETE_FROM_LANE") != null){
		return super.getReparentCommand(request);
	}
	if(getHost() instanceof CustomPoolCompartmentEditPart
			&& request.getEditParts().get(0) != null
			&& ((EditPart) request.getEditParts().get(0)).getParent() instanceof CustomLaneCompartmentEditPart){
		return UnexecutableCommand.INSTANCE;
	}

	if(getHost() instanceof CustomSubprocessEventCompartmentEditPart
			&& request.getEditParts().get(0) != null){
		for(final Object child : request.getEditParts()){
			if(child instanceof IGraphicalEditPart){
				if(!((IGraphicalEditPart) child).getTargetConnections().isEmpty() ||
						!((IGraphicalEditPart) child).getSourceConnections().isEmpty()){
					return  UnexecutableCommand.INSTANCE;
				} else {
					if (child instanceof StartTimerEvent2EditPart
							&& !(((IGraphicalEditPart) child).getParent() instanceof CustomSubprocessEventCompartmentEditPart)
							&& !((IGraphicalEditPart)child).getParent().equals(getHost())){
						final Command editCommand = editTimerEventValue((IGraphicalEditPart)child);
						if (editCommand.canExecute()){
							cc.add(editCommand);
						}
					}
				}
			}
	}
	}
	if(getHost() instanceof CustomSubProcessEvent2EditPart){
		return  UnexecutableCommand.INSTANCE;
	}

	if(getHost() instanceof CustomLaneEditPart){
		if( request.getLocation() != null){
			return   UnexecutableCommand.INSTANCE;
		}

	}
	cc.add(super.getReparentCommand(request));
	return cc;
}