001: package newprocess.diagram.edit.parts;
002:
003: import newprocess.diagram.cust.layouter.ConditionStackLayout;
004: import newprocess.diagram.edit.policies.AsyncActivityAsyncActivityPreconditionCompartmentCanonicalEditPolicy;
005: import newprocess.diagram.edit.policies.AsyncActivityAsyncActivityPreconditionCompartmentItemSemanticEditPolicy;
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 AsyncActivityAsyncActivityPreconditionCompartmentEditPart
024: extends ListCompartmentEditPart {
025:
026: /**
027: * @generated
028: */
029: public static final int VISUAL_ID = 7007;
030:
031: /**
032: * @generated
033: */
034: public AsyncActivityAsyncActivityPreconditionCompartmentEditPart(
035: View view) {
036: super (view);
037: }
038:
039: /**
040: * @generated
041: */
042: protected boolean hasModelChildrenChanged(Notification evt) {
043: return false;
044: }
045:
046: /**
047: * @generated
048: */
049: public String getCompartmentName() {
050: return "AsyncActivityPreconditionCompartment";
051: }
052:
053: /**
054: * @generated NOT
055: * @author sh
056: */
057: public IFigure createFigure() {
058: ResizableCompartmentFigure result = (ResizableCompartmentFigure) super
059: .createFigure();
060:
061: // remove the spacing of the left and right side between compartment and condition
062: result.getScrollPane().getContents().setBorder(
063: new MarginBorder(0, 0, 0, 0));
064:
065: result.setTitleVisibility(false);
066: result.setBorder(null);
067:
068: // set a custom layout
069: ConditionStackLayout layout = new ConditionStackLayout();
070: result.setLayoutManager(layout);
071:
072: // disable scrollpane
073: result.getScrollPane().setEnabled(false);
074: result.getScrollPane().setScrollBarVisibility(ScrollPane.NEVER);
075: result.getScrollPane().setVerticalScrollBarVisibility(
076: ScrollPane.NEVER);
077: result.getScrollPane().getViewport().setContentsTracksHeight(
078: true);
079:
080: result.getContentPane().setLayoutManager(layout);
081: return result;
082: }
083:
084: /**
085: * @generated
086: */
087: protected void createDefaultEditPolicies() {
088: super .createDefaultEditPolicies();
089: installEditPolicy(
090: EditPolicyRoles.SEMANTIC_ROLE,
091: new AsyncActivityAsyncActivityPreconditionCompartmentItemSemanticEditPolicy());
092: installEditPolicy(EditPolicyRoles.CREATION_ROLE,
093: new CreationEditPolicy());
094: installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE,
095: new DragDropEditPolicy());
096: installEditPolicy(
097: EditPolicyRoles.CANONICAL_ROLE,
098: new AsyncActivityAsyncActivityPreconditionCompartmentCanonicalEditPolicy());
099: }
100:
101: /**
102: * @generated
103: */
104: protected void setRatio(Double ratio) {
105: if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) {
106: super.setRatio(ratio);
107: }
108: }
109: }
|