/**
 * Copyright (c) 2010 committers of YAKINDU and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * 	committers of YAKINDU - initial API and implementation
 * 
 */
package org.yakindu.sct.ui.editor.editparts;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LayoutAnimator;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
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.ShapeCompartmentFigure;
import org.eclipse.gmf.runtime.notation.View;
import org.yakindu.sct.ui.editor.policies.CompartmentCreationEditPolicy;
import org.yakindu.sct.ui.editor.policies.RegionCompartmentCanonicalEditPolicy;
import org.yakindu.sct.ui.editor.policies.RegionCompartmentXYLayoutEditPolicy;

/**
 * @author muelder
 * @author muehlbrandt
 */
public class RegionCompartmentEditPart extends ShapeCompartmentEditPart {

	private boolean isSupportingViewActions = true;

	public RegionCompartmentEditPart(View view) {
		super(view);
	}
	

	@Override
	protected void createDefaultEditPolicies() {
		super.createDefaultEditPolicies();
		installEditPolicy(EditPolicyRoles.CREATION_ROLE,
				new CompartmentCreationEditPolicy());
		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
				new RegionCompartmentCanonicalEditPolicy());
		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
				new DragDropEditPolicy());
		installEditPolicy(EditPolicy.LAYOUT_ROLE,
				new RegionCompartmentXYLayoutEditPolicy());
	}

	public boolean isSupportingViewActions() {
		return this.isSupportingViewActions;
	}

	public void setIsSupportingViewActions(boolean supportsViewActions) {
		this.isSupportingViewActions = supportsViewActions;
	}

	@Override
	protected IFigure createFigure() {
		ShapeCompartmentFigure figure = new ShapeCompartmentFigure(
				getCompartmentName(), getMapMode());
		figure.getContentPane().setLayoutManager(getLayoutManager());
		figure.getContentPane().addLayoutListener(LayoutAnimator.getDefault());
		figure.setBorder(null);
		//
		figure.setToolTip((String) null);
		return figure;
	}

	@Override
	public boolean isSelectable() {
		return false;
	}

	@Override
	protected void refreshConnections() {
		// Do nothing to prevent super.refreshConnections() from clearing away
		// connections which are now clipped by ViewportAwareClippingStrategy.
	}
}

@@ -548,32 +548,106 @@
 ef.EditPolicy;%0D%0A
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;%0D%0A
 import org.eclip
@@ -705,24 +705,24 @@
 tEditPart;%0D%0A
-
 import org.e
@@ -980,16 +980,68 @@
 .View;%0D%0A
+import org.yakindu.sct.ui.editor.DiagramActivator;%0D%0A
 import o
@@ -1523,11 +1523,8 @@
 %0A%09%7D%0D
-%0A%09%0D
 %0A%0D%0A%09
@@ -1665,30 +1665,25 @@
 EATION_ROLE,
-%0D%0A%09%09%09%09
+ 
 new Compartm
@@ -1756,30 +1756,25 @@
 ONICAL_ROLE,
-%0D%0A%09%09%09%09
+ 
 new RegionCo
@@ -1854,30 +1854,25 @@
 G_DROP_ROLE,
-%0D%0A%09%09%09%09
+ 
 new DragDrop
@@ -1930,22 +1930,17 @@
 UT_ROLE,
-%0D%0A%09%09%09%09
+ 
 new Regi
@@ -1974,32 +1974,158 @@
 licy());%0D%0A%09%7D%0D%0A%0D%0A
+%09@Override%0D%0A%09public PreferencesHint getDiagramPreferencesHint() %7B%0D%0A%09%09return DiagramActivator.DIAGRAM_PREFERENCES_HINT;%0D%0A%09%7D%0D%0A%0D%0A
 %09public boolean 
@@ -2381,16 +2381,16 @@
 re() %7B%0D%0A
+
 %09%09ShapeC
@@ -2446,14 +2446,8 @@
 ure(
-%0D%0A%09%09%09%09
 getC

Add Default diagram preferences for subdiagrams