blob: 8e1d6e670726bfd4335831cbe24b044d3eac077d [file] [log] [blame]
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
*
* 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:
*
* CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.common.edit.part;
import org.eclipse.draw2d.IFigure;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ResizeableListCompartmentEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCompartmentSemanticEditPolicy;
import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultCreationEditPolicy;
public class BlockConstraintCompartmentEditPart extends ResizeableListCompartmentEditPart {
public final static String COMPARTMENT_NAME = "constraints";
public BlockConstraintCompartmentEditPart(View view) {
super(view);
}
@Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultCompartmentSemanticEditPolicy());
installEditPolicy(EditPolicyRoles.CREATION_ROLE, new DefaultCreationEditPolicy());
// Start of user code custom edit policies
// End of user code
}
@Override
public String getCompartmentName() {
return COMPARTMENT_NAME;
}
@Override
protected boolean hasModelChildrenChanged(Notification evt) {
return false;
}
@Override
public IFigure createFigure() {
ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
result.setTitleVisibility(false);
return result;
}
@Override
protected void setRatio(Double ratio) {
if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
super.setRatio(ratio);
}
}
}