001: package newprocess.diagram.edit.parts;
002:
003: import newprocess.diagram.cust.layouter.ConditionStackLayout;
004: import newprocess.diagram.edit.policies.EventEventPostconditionCompartmentCanonicalEditPolicy;
005: import newprocess.diagram.edit.policies.EventEventPostconditionCompartmentItemSemanticEditPolicy;
006:
007: import org.eclipse.draw2d.IFigure;
008: import org.eclipse.draw2d.MarginBorder;
009: import org.eclipse.draw2d.ScrollPane;
010: import org.eclipse.emf.common.notify.Notification;
011: import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
012: import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
013: import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
014: import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
015: import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
016: import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
017: import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
018: import org.eclipse.gmf.runtime.notation.View;
019:
020: /**
021: * @generated
022: */
023: public class EventEventPostconditionCompartmentEditPart extends
024: ListCompartmentEditPart {
025:
026: /**
027: * @generated
028: */
029: public static final int VISUAL_ID = 7013;
030:
031: /**
032: * @generated
033: */
034: public EventEventPostconditionCompartmentEditPart(View view) {
035: super (view);
036: }
037:
038: /**
039: * @generated
040: */
041: protected boolean hasModelChildrenChanged(Notification evt) {
042: return false;
043: }
044:
045: /**
046: * @generated
047: */
048: public String getCompartmentName() {
049: return "EventPostconditionCompartment";
050: }
051:
052: /**
053: * @generated NOT
054: * @author sh
055: */
056: public IFigure createFigure() {
057: ResizableCompartmentFigure result = (ResizableCompartmentFigure) super
058: .createFigure();
059:
060: // remove the spacing of the left and right side between compartment and condition
061: result.getScrollPane().getContents().setBorder(
062: new MarginBorder(0, 0, 0, 0));
063:
064: result.setTitleVisibility(false);
065: result.setBorder(null);
066:
067: // set a custom layout
068: ConditionStackLayout layout = new ConditionStackLayout();
069: result.setLayoutManager(layout);
070:
071: // disable scrollpane
072: result.getScrollPane().setEnabled(false);
073: result.getScrollPane().setScrollBarVisibility(ScrollPane.NEVER);
074: result.getScrollPane().setVerticalScrollBarVisibility(
075: ScrollPane.NEVER);
076: result.getScrollPane().getViewport().setContentsTracksHeight(
077: true);
078:
079: result.getContentPane().setLayoutManager(layout);
080: return result;
081: }
082:
083: /**
084: * @generated
085: */
086: protected void createDefaultEditPolicies() {
087: super .createDefaultEditPolicies();
088: installEditPolicy(
089: EditPolicyRoles.SEMANTIC_ROLE,
090: new EventEventPostconditionCompartmentItemSemanticEditPolicy());
091: installEditPolicy(EditPolicyRoles.CREATION_ROLE,
092: new CreationEditPolicy());
093: installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
094: new DragDropEditPolicy());
095: installEditPolicy(
096: EditPolicyRoles.CANONICAL_ROLE,
097: new EventEventPostconditionCompartmentCanonicalEditPolicy());
098: }
099:
100: /**
101: * @generated
102: */
103: protected void setRatio(Double ratio) {
104: if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
105: super.setRatio(ratio);
106: }
107: }
108: }
|