content: package oscfg.diagram.edit.parts;
  
  import org.eclipse.draw2d.IFigure;
  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.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.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.OSOSModulesCanonicalEditPolicy;
  import oscfg.diagram.edit.policies.OSOSModulesItemSemanticEditPolicy;
  import oscfg.diagram.part.Messages;
  import oscfg.diagram.part.OscfgVisualIDRegistry;
  import oscfg.diagram.providers.OscfgElementTypes;
  
  /**
   * @generated
   */
  public class OSOSModulesEditPart extends ShapeCompartmentEditPart {
  
  	/**
  	 * @generated
  	 */
  	public static final int VISUAL_ID = 7001;
  
  	/**
  	 * @generated
  	 */
  	public OSOSModulesEditPart(View view) {
  		super(view);
  	}
  
  	/**
  	 * @generated
  	 */
  	public String getCompartmentName() {
  		return Messages.OSOSModulesEditPart_title;
  	}
  
  	/**
  	 * @generated
  	 */
  	public IFigure createFigure() {
  		ResizableCompartmentFigure result = (ResizableCompartmentFigure) super
  				.createFigure();
  		result.setTitleVisibility(false);
  		return result;
  	}
  
  	/**
  	 * @generated
  	 */
  	protected void createDefaultEditPolicies() {
  		super.createDefaultEditPolicies();
  		installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
  				new OSOSModulesItemSemanticEditPolicy());
  		installEditPolicy(EditPolicyRoles.CREATION_ROLE,
  				new CreationEditPolicyWithCustomReparent(
  						OscfgVisualIDRegistry.TYPED_INSTANCE));
  		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
  				new DragDropEditPolicy());
  		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
  				new OSOSModulesCanonicalEditPolicy());
  	}
  
  	/**
  	 * @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.Module_3009) {
  				return this;
  			}
  			return getParent().getTargetEditPart(request);
  		}
  		if (request instanceof CreateUnspecifiedTypeConnectionRequest) {
  			return getParent().getTargetEditPart(request);
  		}
  		return super.getTargetEditPart(request);
  	}
  
  }
  