/**
 * 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.gef.EditPolicy;
import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IDiagramPreferenceSupport;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.yakindu.sct.ui.editor.policies.CompositeElementCanonicalEditPolicy;

import de.itemis.gmf.runtime.commons.editparts.FixedXYLayoutEditPolicy;

/**
 * 
 * @author andreas muelder - Initial contribution and API
 * 
 */
public class StatechartDiagramEditPart extends DiagramEditPart implements
		IDiagramPreferenceSupport {

	private PreferencesHint preferenceHint;

	public StatechartDiagramEditPart(View diagramView) {
		super(diagramView);
	}

	@Override
	protected void createDefaultEditPolicies() {
		installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
				new CompositeElementCanonicalEditPolicy());
		super.createDefaultEditPolicies();
		installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
				new DragDropEditPolicy());
		// TODO: This is a workaround for GMF bug #349042
		installEditPolicy(EditPolicy.LAYOUT_ROLE, new FixedXYLayoutEditPolicy());
		removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
	}

	public void setPreferencesHint(PreferencesHint preferenceHint) {
		this.preferenceHint = preferenceHint;
	}

	public PreferencesHint getPreferencesHint() {
		return preferenceHint;
	}

}

@@ -897,16 +897,68 @@
 .View;%0D%0A
+import org.yakindu.sct.ui.editor.DiagramActivator;%0D%0A
 import o
@@ -1258,20 +1258,17 @@
 plements
-%0D%0A%09%09
+ 
 IDiagram
@@ -1524,30 +1524,25 @@
 ONICAL_ROLE,
-%0D%0A%09%09%09%09
+ 
 new Composit
@@ -1667,14 +1667,9 @@
 OLE,
-%0D%0A%09%09%09%09
+ 
 new 
@@ -2074,11 +2074,137 @@
 %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
 %7D%0D%0A

Use DiagramActivator Preferences when canonically create preview diagram elements