content: package oscfg.diagram.edit.parts;
  
  import org.eclipse.draw2d.IFigure;
  import org.eclipse.emf.common.notify.Notification;
  import org.eclipse.gef.EditPart;
  import org.eclipse.gef.Request;
  import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
  import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
  import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
  import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
  import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
  import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
  import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
  import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeConnectionRequest;
  import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
  import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
  import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
  import org.eclipse.gmf.runtime.emf.type.core.IElementType;
  import org.eclipse.gmf.runtime.notation.View;
  
  import org.eclipse.gmf.tooling.runtime.edit.policies.reparent.CreationEditPolicyWithCustomReparent;
  import oscfg.diagram.edit.policies.CooperativeGroupCooperativeTasksCanonicalEditPolicy;
  import oscfg.diagram.edit.policies.CooperativeGroupCooperativeTasksItemSemanticEditPolicy;
  import oscfg.diagram.part.Messages;
  import oscfg.diagram.part.OscfgVisualIDRegistry;
  import oscfg.diagram.providers.OscfgElementTypes;
  
  /**
   * @generated
   */
  public class CooperativeGroupCooperativeTasksEditPart extends
  		ShapeCompartmentEditPart {
  
  	/**
  	 * @generated
  	 */
  	public static final int VISUAL_ID = 7005;
  
  	/**
  	 * @generated
  	 */
  	public CooperativeGroupCooperativeTasksEditPart(View view) {
  		super(view);
  	}
  
  	/**
  	 * @generated
  	 */
  	public String getCompartmentName() {
  		return Messages.CooperativeGroupCooperativeTasksEditPart_title;
  	}
  
  	/**
  	 * @generated
  	 */
  	protected void createDefaultEditPolicies() {
  		super.createDefaultEditPolicies();
  		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
  				new CooperativeGroupCooperativeTasksItemSemanticEditPolicy());
  		installEditPolicy(EditPolicyRoles.CREATION_ROLE,
  				new CreationEditPolicyWithCustomReparent(
  						OscfgVisualIDRegistry.TYPED_INSTANCE));
  		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
  				new DragDropEditPolicy());
  		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
  				new CooperativeGroupCooperativeTasksCanonicalEditPolicy());
  	}
  
  	/**
  	 * @generated
  	 */
  	protected void setRatio(Double ratio) {
  		if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
  			super.setRatio(ratio);
  		}
  	}
  
  	/**
  	 * @generated
  	 */
  	public EditPart getTargetEditPart(Request request) {
  		if (request instanceof CreateViewAndElementRequest) {
  			CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request)
  					.getViewAndElementDescriptor()
  					.getCreateElementRequestAdapter();
  			IElementType type = (IElementType) adapter
  					.getAdapter(IElementType.class);
  			if (type == OscfgElementTypes.Task_3020) {
  				return this;
  			}
  			return getParent().getTargetEditPart(request);
  		}
  		if (request instanceof CreateUnspecifiedTypeConnectionRequest) {
  			if (RequestConstants.REQ_CONNECTION_END.equals(request.getType())) {
  				for (Object type : ((CreateUnspecifiedTypeConnectionRequest) request)
  						.getElementTypes()) {
  					if (type instanceof IElementType) {
  						IElementType elementType = (IElementType) type;
  						if (elementType
  								.equals(OscfgElementTypes.SWTimerActivates_4004)
  								|| elementType
  										.equals(OscfgElementTypes.MessageNotifies_4006))
  							return super.getTargetEditPart(request);
  					}
  				}
  			}
  			return getParent().getTargetEditPart(request);
  		}
  		return super.getTargetEditPart(request);
  	}
  
  }
  