diff options
Diffstat (limited to 'plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit')
12 files changed, 0 insertions, 811 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java deleted file mode 100644 index deb65fa55c1..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomConnectionPointReferenceNameEditPart.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.edit.part; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.diagram.statemachine.custom.figures.ConnectionPointReferenceFigure; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceEditPart; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.ConnectionPointReferenceNameEditPart; -import org.eclipse.uml2.uml.ConnectionPointReference; -import org.eclipse.uml2.uml.Pseudostate; - - -public class CustomConnectionPointReferenceNameEditPart extends ConnectionPointReferenceNameEditPart { - - public CustomConnectionPointReferenceNameEditPart(View view) { - super(view); - } - - @Override - protected void handleNotificationEvent(Notification event) { - // TODO Auto-generated method stub - super.handleNotificationEvent(event); - - refreshVisuals(); - } - - public String getLinks(ConnectionPointReference ref) { - String label = ""; - if(!ref.getEntries().isEmpty()) { - boolean first = true; - for(Pseudostate p : ref.getEntries()) { - if(!first) { - label += ", "; - } else { - first = false; - } - label += p.getName(); - } - } else if(!ref.getExits().isEmpty()) { - boolean first = true; - for(Pseudostate p : ref.getExits()) { - if(!first) { - label += ", "; - } else { - first = false; - } - label += p.getName(); - } - } - return label; - } - - @Override - protected void refreshVisuals() { - // TODO Auto-generated method stub - super.refreshVisuals(); - - ConnectionPointReferenceFigure connPtRefFigure = ((ConnectionPointReferenceEditPart)getParent()).getPrimaryShape(); - ConnectionPointReference connPtRef = (ConnectionPointReference)((View)getModel()).getElement(); - - if(connPtRef.getEntries().isEmpty() && connPtRef.getExits().isEmpty()) - connPtRefFigure.setKind(0); - else { - setLabelText(getLinks(connPtRef)); - if(!connPtRef.getEntries().isEmpty()) { - connPtRefFigure.setKind(1); - - } else if(!connPtRef.getExits().isEmpty()) { - connPtRefFigure.setKind(2); - } - } - - } - -} diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomFinalStateEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomFinalStateEditPart.java deleted file mode 100644 index e835bead979..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomFinalStateEditPart.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.FinalStateEditPart; - - -public class CustomFinalStateEditPart extends FinalStateEditPart { - - - public CustomFinalStateEditPart(View view) { - super(view); - // TODO Auto-generated constructor stub - } - - @Override - protected void createDefaultEditPolicies() { - // TODO Auto-generated method stub - super.createDefaultEditPolicies(); - removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE); - removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); - - } -} diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomPackageEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomPackageEditPart.java deleted file mode 100644 index 11f4cde2a68..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomPackageEditPart.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.PackageEditPart; - -public class CustomPackageEditPart extends PackageEditPart { - - public CustomPackageEditPart(View view) { - super(view); - // TODO Auto-generated constructor stub - } - - @Override - protected void createDefaultEditPolicies() { - // TODO Auto-generated method stub - super.createDefaultEditPolicies(); - removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE); - removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); - - } - -} diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java deleted file mode 100644 index 78f3b8ec742..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionCompartmentEditPart.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.edit.part; - -import org.eclipse.draw2d.IFigure; -import org.eclipse.gef.DragTracker; -import org.eclipse.gef.Request; -import org.eclipse.gef.requests.SelectionRequest; -import org.eclipse.gef.tools.DeselectAllTracker; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.internal.tools.RubberbandDragTracker; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.diagram.statemachine.custom.figures.CustomShapeCompartmentFigure; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionCompartmentEditPart; -import org.eclipse.uml2.uml.Region; - -public class CustomRegionCompartmentEditPart extends RegionCompartmentEditPart { - - public CustomRegionCompartmentEditPart(View view) { - super(view); - // TODO Auto-generated constructor stub - } - - @Override - protected void createDefaultEditPolicies() { - // TODO Auto-generated method stub - super.createDefaultEditPolicies(); - removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE); - removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); - - } - - public IFigure createFigure() { - CustomShapeCompartmentFigure result = new CustomShapeCompartmentFigure(getCompartmentName(), getMapMode()); - result.setBorder(null); - return result; - } - - @Override - public DragTracker getDragTracker(Request req) { - if(!supportsDragSelection()) - return super.getDragTracker(req); - - if(req instanceof SelectionRequest && ((SelectionRequest)req).getLastButtonPressed() == 3) - return new DeselectAllTracker(this) { - - protected boolean handleButtonDown(int button) { - getCurrentViewer().select(getParent()); - return true; - } - }; - return new RubberbandDragTracker() { - - protected void handleFinished() { - if(getViewer().getSelectedEditParts().isEmpty()) - getViewer().select(getParent()); - } - }; - } - - @Override - protected void refreshVisuals() { - // TODO Auto-generated method stub - super.refreshVisuals(); - - View regionView = (View)((View)getModel()).eContainer(); - Region region = (Region)regionView.getElement(); - - ((CustomShapeCompartmentFigure)getFigure()).setToolTip(region.getName()); - - } -} diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionEditPart.java deleted file mode 100644 index 46952a7346d..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomRegionEditPart.java +++ /dev/null @@ -1,96 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.edit.part; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gef.DragTracker; -import org.eclipse.gef.EditPolicy; -import org.eclipse.gef.Request; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.diagram.statemachine.custom.figures.RegionFigure; -import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone; -import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionDragTracker; -import org.eclipse.papyrus.diagram.statemachine.custom.policies.CustomRegionResizableEditPolicy; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.RegionEditPart; - -public class CustomRegionEditPart extends RegionEditPart { - - /** The DragTracker associated to the EditPart. */ - private DragTracker tracker = null; - - public CustomRegionEditPart(View view) { - super(view); - // TODO Auto-generated constructor stub - } - - @Override - protected void createDefaultEditPolicies() { - // TODO Auto-generated method stub - super.createDefaultEditPolicies(); - removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE); - removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); - - } - - /** - * This method is overridden to store the DragTracker locally. - * - * @param request - * the associated Request - * - * @return the DragTracker created by the superclass - */ - @Override - public DragTracker getDragTracker(Request request) { - tracker = new CustomRegionDragTracker(this); - return tracker; - } - - /** - * This method provides access to the RegionDragTracker if any or returns - * null. - * - * @return the RegionDragTracker - */ - public CustomRegionDragTracker getRegionDragTracker() { - if((tracker != null) && (tracker instanceof CustomRegionDragTracker)) - return (CustomRegionDragTracker)tracker; - return null; - } - - @Override - protected void handleNotificationEvent(Notification notification) { - super.handleNotificationEvent(notification); - if(getParent() != null) - refreshVisuals(); - } - - @Override - protected void refreshVisuals() { - // TODO Auto-generated method stub - super.refreshVisuals(); - - View view = (View)getModel(); - RegionFigure f = getPrimaryShape(); - - // check the region zone - String zone = Zone.getZone(view); - // check the neighbours if any and change the corresponding flags in the - // figure - if(Zone.hasRightNeighbours(zone)) - f.setDisplayRightBorder(true); - else - f.setDisplayRightBorder(false); - if(Zone.hasBottomNeighbours(zone)) - f.setDisplayBottomBorder(true); - else - f.setDisplayBottomBorder(false); - - CustomRegionResizableEditPolicy policy = (CustomRegionResizableEditPolicy)getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); - // test for allowed directions - int dirs = Zone.getAllowedResizeDirections(zone); - // constrain the edit policy with these directions - if(policy != null) - policy.setResizeDirections(dirs); - - } -} diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java deleted file mode 100644 index b154c83aea5..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateCompartmentEditPart.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.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.notation.View; -import org.eclipse.papyrus.diagram.statemachine.custom.figures.CustomShapeCompartmentFigure; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateCompartmentEditPart; -import org.eclipse.uml2.uml.State; - -public class CustomStateCompartmentEditPart extends StateCompartmentEditPart { - - public CustomStateCompartmentEditPart(View view) { - super(view); - // TODO Auto-generated constructor stub - } - - @Override - protected void createDefaultEditPolicies() { - // TODO Auto-generated method stub - super.createDefaultEditPolicies(); - removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE); - removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); - - } - - public IFigure createFigure() { - CustomShapeCompartmentFigure result = new CustomShapeCompartmentFigure(getCompartmentName(), getMapMode()); - return result; - } - - @Override - protected void handleNotificationEvent(Notification notification) { - // TODO Auto-generated method stub - super.handleNotificationEvent(notification); - refreshVisuals(); - } - - @Override - protected void refreshVisuals() { - // TODO Auto-generated method stub - super.refreshVisuals(); - - View stateView = (View)((View)getModel()).eContainer(); - State state = (State)stateView.getElement(); - - ((CustomShapeCompartmentFigure)getFigure()).setToolTip(state.getName()); - - } - -} diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateEditPart.java deleted file mode 100644 index 52599bf8e92..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateEditPart.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.edit.part;
-
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart;
-
-public class CustomStateEditPart extends StateEditPart {
-
- public CustomStateEditPart(View view) {
- super(view);
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- // TODO Auto-generated method stub
- super.createDefaultEditPolicies();
- removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE);
- removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE);
-
- }
-
-}
diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java deleted file mode 100644 index eb0f046acf9..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineCompartmentEditPart.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.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.notation.View; -import org.eclipse.papyrus.diagram.statemachine.custom.figures.CustomShapeCompartmentFigure; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineCompartmentEditPart; -import org.eclipse.uml2.uml.StateMachine; - -public class CustomStateMachineCompartmentEditPart extends StateMachineCompartmentEditPart { - - public CustomStateMachineCompartmentEditPart(View view) { - super(view); - // TODO Auto-generated constructor stub - } - - @Override - protected void createDefaultEditPolicies() { - // TODO Auto-generated method stub - super.createDefaultEditPolicies(); - removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE); - removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); - - } - - public IFigure createFigure() { - CustomShapeCompartmentFigure result = new CustomShapeCompartmentFigure(getCompartmentName(), getMapMode()); - return result; - } - - @Override - protected void handleNotificationEvent(Notification notification) { - // TODO Auto-generated method stub - super.handleNotificationEvent(notification); - refreshVisuals(); - } - - @Override - protected void refreshVisuals() { - // TODO Auto-generated method stub - super.refreshVisuals(); - - View smView = (View)((View)getModel()).eContainer(); - StateMachine sm = (StateMachine)smView.getElement(); - - ((CustomShapeCompartmentFigure)getFigure()).setToolTip(sm.getName()); - - } - -} diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineEditPart.java deleted file mode 100644 index f68268c7c58..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineEditPart.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.edit.part; - -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineEditPart; - -public class CustomStateMachineEditPart extends StateMachineEditPart { - - public CustomStateMachineEditPart(View view) { - super(view); - // TODO Auto-generated constructor stub - } - - @Override - protected void createDefaultEditPolicies() { - // TODO Auto-generated method stub - super.createDefaultEditPolicies(); - removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE); - removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); - - } - -} diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java deleted file mode 100644 index a4df5c43277..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateMachineNameEditPart.java +++ /dev/null @@ -1,98 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.edit.part; - -import java.util.Collections; -import java.util.Iterator; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.transaction.Transaction; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter; -import org.eclipse.papyrus.diagram.common.figure.node.StereotypePropertiesCompartment; -import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomStateMachineResizeCommand; -import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateMachineNameEditPart; - -public class CustomStateMachineNameEditPart extends StateMachineNameEditPart { - - public CustomStateMachineNameEditPart(View view) { - super(view); - // TODO Auto-generated constructor stub - } - - @Override - protected void createDefaultEditPolicies() { - // TODO Auto-generated method stub - super.createDefaultEditPolicies(); - removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE); - removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); - - } - - @Override - protected void handleNotificationEvent(Notification notification) { - // TODO Auto-generated method stub - super.handleNotificationEvent(notification); - - refreshVisuals(); - } - - @Override - protected void refreshVisuals() { - // TODO Auto-generated method stub - super.refreshVisuals(); - int height = 0; - int width = 0; - Iterator<IFigure> it = (Iterator<IFigure>)getFigure().getParent().getChildren().iterator(); - while(it.hasNext()) { - IFigure current = it.next(); - if((current instanceof Label) || (current instanceof WrappingLabel) || (current instanceof StereotypePropertiesCompartment)) { - Dimension d = current.getPreferredSize().getCopy(); - height += d.height; - width = Math.max(width, d.width); - } - } - - View stateMachineLabelView = (View)getModel(); - View stateMachineView = (View)stateMachineLabelView.eContainer(); - View stateMachineCompartView = (View)stateMachineView.getChildren().get(1); - - int stateMachineHeight = Zone.getHeight(stateMachineView); - int stateMachineWidth = Zone.getWidth(stateMachineView); - - int stateMachineCompartHeight = Zone.getHeight(stateMachineCompartView); - - int dx = width - stateMachineWidth; - int dy = stateMachineCompartHeight + height - stateMachineHeight; - int x = Zone.getX(stateMachineView); - int y = Zone.getY(stateMachineView); - - if((stateMachineHeight != -1) && (width != 0) && (dy != 0)) { - dx = (dx > 0) ? dx : 0; - // a resize request, which we route to the specific ResizeCommand - IAdaptable adaptableForStateMachine = new SemanticAdapter(null, stateMachineView); - ChangeBoundsRequest internalResizeRequest = new ChangeBoundsRequest(); - internalResizeRequest.setResizeDirection(PositionConstants.EAST); - internalResizeRequest.setSizeDelta(new Dimension(dx, dy)); - Rectangle rect = new Rectangle(x, y, stateMachineWidth + dx, stateMachineHeight + dy); - - CustomStateMachineResizeCommand internalResizeCommand = new CustomStateMachineResizeCommand(adaptableForStateMachine, getDiagramPreferencesHint(), getEditingDomain(), DiagramUIMessages.CreateCommand_Label, internalResizeRequest, rect, true); - internalResizeCommand.setOptions(Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE)); - try { - internalResizeCommand.execute(null, null); - } catch (ExecutionException e) { - } - - } - } -} diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java deleted file mode 100644 index 166cc734dff..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomStateNameEditPart.java +++ /dev/null @@ -1,164 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.edit.part; - -import java.util.Collections; -import java.util.Iterator; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.draw2d.IFigure; -import org.eclipse.draw2d.Label; -import org.eclipse.draw2d.PositionConstants; -import org.eclipse.draw2d.geometry.Dimension; -import org.eclipse.draw2d.geometry.Rectangle; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.transaction.Transaction; -import org.eclipse.gef.requests.ChangeBoundsRequest; -import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; -import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.diagram.common.commands.SemanticAdapter; -import org.eclipse.papyrus.diagram.common.figure.node.StereotypePropertiesCompartment; -import org.eclipse.papyrus.diagram.statemachine.custom.commands.CustomStateResizeCommand; -import org.eclipse.papyrus.diagram.statemachine.custom.figures.StateFigure; -import org.eclipse.papyrus.diagram.statemachine.custom.helpers.Zone; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateEditPart; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.StateNameEditPart; -import org.eclipse.uml2.uml.Activity; -import org.eclipse.uml2.uml.Behavior; -import org.eclipse.uml2.uml.OpaqueBehavior; -import org.eclipse.uml2.uml.State; -import org.eclipse.uml2.uml.StateMachine; - -public class CustomStateNameEditPart extends StateNameEditPart { - - public CustomStateNameEditPart(View view) { - super(view); - // TODO Auto-generated constructor stub - } - - private String behaviorKindAsString(Behavior b) { - if(b instanceof Activity) - return "Activity"; - if(b instanceof StateMachine) - return "StateMachine"; - if(b instanceof OpaqueBehavior) - return "OpaqueBehavior"; - return ""; - } - - @Override - protected void createDefaultEditPolicies() { - // TODO Auto-generated method stub - super.createDefaultEditPolicies(); - removeEditPolicy(EditPolicyRoles.CONNECTION_HANDLES_ROLE); - removeEditPolicy(EditPolicyRoles.POPUPBAR_ROLE); - - } - - public String getInformationFromState(State state) { - String textToEdit = ""; - - // entryActivity - if(state.getEntry() != null) { - String kind = behaviorKindAsString(state.getEntry()); - textToEdit = "/entry " + kind + " " + state.getEntry().getName(); - } - - // doActivity - if(state.getDoActivity() != null) { - String kind = behaviorKindAsString(state.getDoActivity()); - textToEdit = textToEdit + "\n/do " + kind + " " + state.getDoActivity().getName(); - } - - // exitActivity - if(state.getExit() != null) { - String kind = behaviorKindAsString(state.getExit()); - textToEdit = textToEdit + "\n/exit " + kind + " " + state.getExit().getName(); - } - - textToEdit += "\n"; - return textToEdit; - } - - @Override - protected void handleNotificationEvent(Notification notification) { - // TODO Auto-generated method stub - super.handleNotificationEvent(notification); - - refreshVisuals(); - } - - @Override - protected void refreshVisuals() { - // TODO Auto-generated method stub - super.refreshVisuals(); - - StateFigure stateFigure = ((StateEditPart)getParent()).getPrimaryShape(); - State state = (State)((View)getModel()).getElement(); - - View stateLabelView = (View)getModel(); - View stateView = (View)stateLabelView.eContainer(); - View stateCompartView = (View)stateView.getChildren().get(1); - - if(stateCompartView.getChildren().isEmpty()) - stateFigure.getStateCompartmentFigure().setVisible(false); - else - stateFigure.getStateCompartmentFigure().setVisible(true); - - stateFigure.fillInformation(getInformationFromState(state)); - - if(state.isSubmachineState()) { - stateFigure.setSubmachineStateName(state.getName() + " : " + state.getSubmachine().getQualifiedName()); - stateFigure.setIsSubmachineState(true); - } else - stateFigure.setIsSubmachineState(false); - - - int height = 0; - int width = 0; - Iterator<IFigure> it = (Iterator<IFigure>)getFigure().getParent().getChildren().iterator(); - while(it.hasNext()) { - IFigure current = it.next(); - if((current instanceof Label) || (current instanceof WrappingLabel) || (current instanceof StereotypePropertiesCompartment)) { - Dimension d = current.getPreferredSize().getCopy(); - height += d.height; - width = Math.max(width, d.width); - } - } - - width += 10; - - int stateHeight = Zone.getHeight(stateView); - int stateWidth = Zone.getWidth(stateView); - - int stateCompartHeight = Zone.getHeight(stateCompartView); - - int dx = width - stateWidth; - int dy = stateCompartHeight + height - stateHeight; - int x = Zone.getX(stateView); - int y = Zone.getY(stateView); - - - if((stateHeight != -1) && (width != 0) && (dy != 0)) { - dx = (dx > 0) ? dx : 0; - // a resize request, which we route to the specific ResizeCommand - IAdaptable adaptableForState = new SemanticAdapter(null, stateView); - ChangeBoundsRequest internalResizeRequest = new ChangeBoundsRequest(); - internalResizeRequest.setResizeDirection(PositionConstants.EAST); - internalResizeRequest.setSizeDelta(new Dimension(dx, dy)); - Rectangle rect = new Rectangle(x, y, stateWidth + dx, stateHeight + dy); - - CustomStateResizeCommand internalResizeCommand = new CustomStateResizeCommand(adaptableForState, getDiagramPreferencesHint(), getEditingDomain(), DiagramUIMessages.CreateCommand_Label, internalResizeRequest, rect, true); - internalResizeCommand.setOptions(Collections.singletonMap(Transaction.OPTION_UNPROTECTED, Boolean.TRUE)); - - try { - internalResizeCommand.execute(null, null); - } catch (ExecutionException e) { - } - - } - - - } -} diff --git a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomTransitionGuardEditPart.java b/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomTransitionGuardEditPart.java deleted file mode 100644 index 2202366dab5..00000000000 --- a/plugins/uml/org.eclipse.papyrus.diagram.statemachine/custom-src/org/eclipse/papyrus/diagram/statemachine/custom/edit/part/CustomTransitionGuardEditPart.java +++ /dev/null @@ -1,115 +0,0 @@ -package org.eclipse.papyrus.diagram.statemachine.custom.edit.part; - -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; -import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.diagram.statemachine.edit.parts.TransitionGuardEditPart; -import org.eclipse.uml2.uml.Activity; -import org.eclipse.uml2.uml.CallEvent; -import org.eclipse.uml2.uml.ChangeEvent; -import org.eclipse.uml2.uml.Event; -import org.eclipse.uml2.uml.OpaqueBehavior; -import org.eclipse.uml2.uml.OpaqueExpression; -import org.eclipse.uml2.uml.SignalEvent; -import org.eclipse.uml2.uml.StateMachine; -import org.eclipse.uml2.uml.TimeEvent; -import org.eclipse.uml2.uml.Transition; -import org.eclipse.uml2.uml.Trigger; - - -public class CustomTransitionGuardEditPart extends TransitionGuardEditPart { - - public CustomTransitionGuardEditPart(View view) { - super(view); - // TODO Auto-generated constructor stub - } - - public String getInformationFromTransition(Transition transition) { - String textToEdit = ""; - - // Triggers - if(!transition.getTriggers().isEmpty()) { - boolean isFirstTrigger = true; - for(Trigger t : transition.getTriggers()) { - if(!isFirstTrigger) - textToEdit = textToEdit + ", "; - else - isFirstTrigger = false; - Event e = t.getEvent(); - if(e instanceof CallEvent) { - if(((CallEvent)e).getOperation() != null) - textToEdit = textToEdit + ((CallEvent)e).getOperation().getName(); - else - textToEdit = textToEdit + ((CallEvent)e).getName(); - - } else if(e instanceof SignalEvent) { - if(((SignalEvent)e).getSignal() != null) - textToEdit = textToEdit + ((SignalEvent)e).getSignal().getName(); - else - textToEdit = textToEdit + ((SignalEvent)e).getName(); - } else if(e instanceof ChangeEvent) { - - textToEdit = textToEdit + "when " + "\"" + retrieveBody((OpaqueExpression)((ChangeEvent)e).getChangeExpression(), "Natural language") + "\""; - } else if(e instanceof TimeEvent) { - String absRelPrefix = "" + (((TimeEvent)e).isRelative() ? "after " : "at "); - textToEdit = textToEdit + absRelPrefix + "\"" + retrieveBody((OpaqueExpression)((TimeEvent)e).getWhen().getExpr(), "Natural language") + "\""; - } else { // any receive event - textToEdit = textToEdit + "all"; - } - } - } - - // Guard - if(transition.getGuard() != null && transition.getGuard().getSpecification() != null) { - textToEdit = textToEdit + " [" + "\"" + retrieveBody((OpaqueExpression)transition.getGuard().getSpecification(), "Natural language") + "\"" + "]"; - } - - if(transition.getEffect() != null) { - textToEdit = textToEdit + " / "; - String behaviorKind = ""; - behaviorKind = behaviorKind + ((behaviorKind.equals("") && (transition.getEffect() instanceof Activity)) ? "Activity " : ""); - behaviorKind = behaviorKind + ((behaviorKind.equals("") && (transition.getEffect() instanceof StateMachine)) ? "StateMachine " : ""); - behaviorKind = behaviorKind + ((behaviorKind.equals("") && (transition.getEffect() instanceof OpaqueBehavior)) ? "OpaqueBehavior " : ""); - textToEdit = textToEdit + behaviorKind + " " + transition.getEffect().getName(); - } - - return textToEdit; - } - - @Override - protected void handleNotificationEvent(Notification notification) { - // TODO Auto-generated method stub - super.handleNotificationEvent(notification); - - - refreshVisuals(); - } - - @Override - protected void refreshVisuals() { - // TODO Auto-generated method stub - super.refreshVisuals(); - - WrappingLabel transitionGuardLabel = (WrappingLabel)getFigure(); - Transition transition = (Transition)((View)getModel()).getElement(); - transitionGuardLabel.setText(getInformationFromTransition(transition)); - } - - private String retrieveBody(OpaqueExpression exp, String languageName) { - String body = ""; - if(exp == null) - return body; - int index = 0; - for(String _languageName : exp.getLanguages()) { - if(_languageName.equals(languageName)) { - if(index < exp.getBodies().size()) - return exp.getBodies().get(index); - else - return ""; - } - index++; - } - return body; - } - -} |