Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorytanguy2012-03-16 18:05:13 +0000
committerytanguy2012-03-16 18:05:13 +0000
commit438e623c9e40bd66010023ebcc5612fbd5e2791a (patch)
tree2798a84c86f85484c65e77e52a83e89291f2f3e3 /plugins/sysml
parentb0b028c6195c735a44aaaeab9e75a4484d013a87 (diff)
downloadorg.eclipse.papyrus-438e623c9e40bd66010023ebcc5612fbd5e2791a.tar.gz
org.eclipse.papyrus-438e623c9e40bd66010023ebcc5612fbd5e2791a.tar.xz
org.eclipse.papyrus-438e623c9e40bd66010023ebcc5612fbd5e2791a.zip
371381: [SysML Internal Block Diagram] IBD shall support more than one level of modeling
https://bugs.eclipse.org/bugs/show_bug.cgi?id=371381
Diffstat (limited to 'plugins/sysml')
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties9
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java114
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/NestedBlockPropertyCompositeEditPart.java253
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java85
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/NestedBlockPropertyCompositeSemanticEditPolicy.java64
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java4
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyStructureCompartmentEditPart.java5
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/NestedBlockPropertyCompositeClassifierViewFactory.java35
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/NestedBlockPropertyCompositeFigure.java46
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java4
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/build.properties10
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/plugin.xml28
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomEditPartProvider.java4
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomGraphicalTypeRegistry.java20
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomViewProvider.java4
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java41
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/CustomNestedBlockPropertyCompositeSemanticEditPolicy.java94
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/BlockPropertyCompositePreferencePage.java42
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomBlockPropertyCompositePreferencePage.java4
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomNestedBlockPropertyCompositePreferencePage.java268
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomPreferenceInitializer.java4
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomEditPolicyProvider.java9
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/BlockDropHelper.java62
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/PartDropHelper.java4
24 files changed, 1073 insertions, 140 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties
index 8c12d368676..86df25841da 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/build.properties
@@ -1,6 +1,9 @@
-#
-#Mon Sep 12 09:30:14 CEST 2011
-bin.includes=META-INF/,.,icons/,plugin.xml,about.html,plugin.properties
+bin.includes = META-INF/,\
+ .,\
+ icons/,\
+ about.html,\
+ plugin.properties,\
+ plugin.xml
output..=bin/
src.includes = icons/,\
about.html
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java
index 8aa84dc7966..4353185514e 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-gmf/org/eclipse/papyrus/gmf/diagram/common/edit/policy/CommonDiagramDragDropEditPolicy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -27,7 +27,6 @@ import java.util.Set;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartViewer;
@@ -51,21 +50,17 @@ import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescrip
import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.RefreshConnectionsRequest;
import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.commands.wrappers.CommandProxyWithResult;
import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry;
import org.eclipse.papyrus.uml.diagram.common.commands.CommonDeferredCreateConnectionViewCommand;
-import org.eclipse.papyrus.uml.diagram.common.commands.DeferredCreateCommand;
import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter;
import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementBorderEditPart;
import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementLabelEditPart;
-import org.eclipse.papyrus.uml.diagram.common.listeners.DropTargetListener;
-import org.eclipse.swt.dnd.DND;
+import org.eclipse.papyrus.uml.diagram.common.util.CrossReferencerUtil;
/**
* Abstract DND edit policy delegating the choice of the view to create for an EObject to a local
@@ -180,24 +175,7 @@ public abstract class CommonDiagramDragDropEditPolicy extends DiagramDragDropEdi
// Test if a specific drop command should be used
if(getSpecificDropList().contains(droppedNodeType) || getSpecificDropList().contains(droppedEdgeType)) {
- ICommand specificDropCommand = getSpecificDropCommand(dropRequest, droppedObject, droppedNodeType, droppedEdgeType);
- CompositeCommand cc = new CompositeCommand("Drop command");
- cc.compose(specificDropCommand);
- // If ctrl key activate, get the content of element dropped
- if(isCopy(dropRequest)) {
- // Check for ICommandProxy and CompoundCommand the most command type used
- if(specificDropCommand instanceof ICommandProxy) {
- ICommandProxy specificDropCommandProxy = (ICommandProxy)specificDropCommand;
- createDeferredCommandWithCommandResult(droppedObject, cc, specificDropCommandProxy);
- } else if(specificDropCommand instanceof CompoundCommand) {
- CompoundCommand specificDropCompoundCommand = (CompoundCommand)specificDropCommand;
- ICommandProxy cp = getCommandProxyFromCompoundCommand(specificDropCompoundCommand);
- if(cp != null) {
- createDeferredCommandWithCommandResult(droppedObject, cc, cp);
- }
- }
- }
- return cc;
+ return getSpecificDropCommand(dropRequest, droppedObject, droppedNodeType, droppedEdgeType);
}
// Decide unknown type handling
@@ -212,7 +190,7 @@ public abstract class CommonDiagramDragDropEditPolicy extends DiagramDragDropEdi
// - no restriction when dropped on diagram
// - require containment when dropped on any other EObject
if((dropTargetView instanceof Diagram) || (dropTargetElement.eContents().contains(droppedObject))) {
- return getDefaultDropNodeCommand(droppedNodeType, location, droppedObject, dropRequest);
+ return getDefaultDropNodeCommand(droppedNodeType, location, droppedObject);
}
return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
@@ -237,56 +215,7 @@ public abstract class CommonDiagramDragDropEditPolicy extends DiagramDragDropEdi
return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
}
- /**
- * Get a command proxy from the compound command
- *
- * @param cc
- * the compound command
- * @return the command proxy found or null
- */
- protected ICommandProxy getCommandProxyFromCompoundCommand(CompoundCommand cc) {
- if(cc != null && cc.getCommands() != null) {
- for(Object command : cc.getCommands()) {
- if(command instanceof ICommandProxy) {
- return (ICommandProxy)command;
- } else if(command instanceof CompoundCommand) {
- getCommandProxyFromCompoundCommand((CompoundCommand)command);
- }
- }
- }
- return null;
- }
-
- /**
- * Create deferred command for a command proxy
- *
- * @param droppedObject
- * the dropped object
- * @param cc
- * the composite command to add the deferred command
- * @param specificDropCommandProxy
- * the specific drop command to get the result
- */
- protected void createDeferredCommandWithCommandResult(EObject droppedObject, CompositeCommand cc, ICommandProxy specificDropCommandProxy) {
- if(specificDropCommandProxy != null && specificDropCommandProxy.getICommand() != null && specificDropCommandProxy.getICommand().getCommandResult() != null && specificDropCommandProxy.getICommand().getCommandResult().getReturnValue() != null) {
- Object object = specificDropCommandProxy.getICommand().getCommandResult().getReturnValue();
- if(object instanceof Collection<?>) {
- for(Object o : (Collection<?>)object) {
- if(o instanceof CreateViewRequest.ViewDescriptor) {
- CreateViewRequest.ViewDescriptor viewDescritor = (CreateViewRequest.ViewDescriptor)o;
- DeferredCreateCommand createCommand2 = new DeferredCreateCommand(getEditingDomain(), droppedObject, (IAdaptable)viewDescritor, getHost().getViewer());
- cc.compose(createCommand2);
- }
- }
- }
- }
- }
-
protected ICommand getDefaultDropNodeCommand(String droppedObjectGraphicalType, Point absoluteLocation, EObject droppedObject) {
- return getDefaultDropNodeCommand(droppedObjectGraphicalType, absoluteLocation, droppedObject, null);
- }
-
- protected ICommand getDefaultDropNodeCommand(String droppedObjectGraphicalType, Point absoluteLocation, EObject droppedObject, DropObjectsRequest request) {
IAdaptable elementAdapter = new EObjectAdapter(droppedObject);
@@ -296,34 +225,9 @@ public abstract class CommonDiagramDragDropEditPolicy extends DiagramDragDropEdi
// Get view creation command for the dropped object
Command command = getHost().getCommand(createViewRequest);
- if(isCopy(request) && createViewRequest.getNewObject() instanceof List) {
- for(Object object : (List<?>)createViewRequest.getNewObject()) {
- if(object instanceof IAdaptable) {
- DeferredCreateCommand createCommand2 = new DeferredCreateCommand(getEditingDomain(), droppedObject, (IAdaptable)object, getHost().getViewer());
- command.chain(new ICommandProxy(createCommand2));
- }
- }
- }
+
// Use the ViewDescriptor as command result, it then can be used as an adaptable to retrieve the View
return new CommandProxyWithResult(command, descriptor);
-
- }
-
- /**
- * Check if the ctrl key event is activate
- *
- * @param dropRequest
- * the request which contain the event
- * @return true if ctrl key is activate, else return false
- */
- public boolean isCopy(DropObjectsRequest dropRequest) {
- if(dropRequest != null && dropRequest.getExtendedData() != null && dropRequest.getExtendedData().get(DropTargetListener.EVENT_DETAIL) instanceof Integer) {
- int eventDetail = (Integer)dropRequest.getExtendedData().get(DropTargetListener.EVENT_DETAIL);
- if(((eventDetail & DND.DROP_COPY) != 0)) {
- return true;
- }
- }
- return false;
}
protected ICommand getDefaultDropEdgeCommand(EObject droppedObject, EObject source, EObject target, String droppedEdgeType, Point absoluteLocation) {
@@ -450,15 +354,13 @@ public abstract class CommonDiagramDragDropEditPolicy extends DiagramDragDropEdi
View hostDiagram = (hostView instanceof Diagram) ? hostView : hostView.getDiagram();
// Retrieve all views for the eObject
- EReference[] refs = { NotationPackage.eINSTANCE.getView_Element() };
- @SuppressWarnings("unchecked")
- Collection<View> relatedViews = EMFCoreUtil.getReferencers(eObject, refs);
-
+ Collection<View> relatedViews = CrossReferencerUtil.getCrossReferencingViews(eObject, hostDiagram.getType());
+
// Parse and select views from host diagram only
Iterator<View> it = relatedViews.iterator();
while(it.hasNext()) {
View currentView = it.next();
- if(currentView.getDiagram() == hostDiagram) {
+ if(!(currentView instanceof Diagram) && (currentView.getDiagram() == hostDiagram)) {
views.add(currentView);
}
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/NestedBlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/NestedBlockPropertyCompositeEditPart.java
new file mode 100644
index 00000000000..eb491771330
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/NestedBlockPropertyCompositeEditPart.java
@@ -0,0 +1,253 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.figure.SelectableBorderedNodeFigure;
+import org.eclipse.papyrus.sysml.diagram.common.edit.policy.NestedBlockPropertyCompositeSemanticEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.common.figure.NestedBlockPropertyCompositeFigure;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractElementEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PortAffixedNodeEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.part.PropertyNodeLabelEditPart;
+import org.eclipse.papyrus.uml.diagram.common.edit.policy.EncapsulatedClassifierResizableShapeEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.edit.policy.StructuredClassifierCreationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AffixedNodeAlignmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.BorderItemResizableEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.HyperLinkPopupBarEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.NavigationEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideCompartmentEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.editpolicies.ShowHideRelatedContentsEditPolicy;
+import org.eclipse.papyrus.uml.diagram.common.locator.PortPositionLocator;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Edit part for nested Block property shown as composite.
+ */
+public class NestedBlockPropertyCompositeEditPart extends AbstractElementEditPart {
+
+ public NestedBlockPropertyCompositeEditPart(View view) {
+ super(view);
+ }
+
+ @Override
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new NestedBlockPropertyCompositeSemanticEditPolicy());
+ installEditPolicy(ShowHideCompartmentEditPolicy.SHOW_HIDE_COMPARTMENT_POLICY, new ShowHideCompartmentEditPolicy());
+ installEditPolicy(ShowHideRelatedContentsEditPolicy.SHOW_HIDE_RELATED_CONTENTS_POLICY, new ShowHideRelatedContentsEditPolicy());
+ installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy());
+ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy());
+ installEditPolicy(EditPolicyRoles.POPUPBAR_ROLE, new HyperLinkPopupBarEditPolicy());
+ installEditPolicy(NavigationEditPolicy.NAVIGATION_POLICY, new NavigationEditPolicy());
+ installEditPolicy(AffixedNodeAlignmentEditPolicy.AFFIXED_CHILD_ALIGNMENT_ROLE, new AffixedNodeAlignmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new StructuredClassifierCreationEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new EncapsulatedClassifierResizableShapeEditPolicy());
+ }
+
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+ org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if(child instanceof IBorderItemEditPart) {
+ return new BorderItemResizableEditPolicy();
+ }
+
+ EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if(result == null) {
+ result = new NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ }
+
+ protected boolean addFixedChild(EditPart childEditPart) {
+
+ if(childEditPart instanceof PropertyNodeLabelEditPart) {
+ ((PropertyNodeLabelEditPart)childEditPart).setLabel(getPrimaryShape().getNameLabel());
+ return true;
+ }
+
+ if(childEditPart instanceof FlowPortAffixedNodeEditPart) {
+ IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
+ getBorderedFigure().getBorderItemContainer().add(((FlowPortAffixedNodeEditPart)childEditPart).getFigure(), locator);
+ return true;
+ }
+ if(childEditPart instanceof PortAffixedNodeEditPart) {
+ IBorderItemLocator locator = new PortPositionLocator(getMainFigure(), PositionConstants.NONE);
+ getBorderedFigure().getBorderItemContainer().add(((PortAffixedNodeEditPart)childEditPart).getFigure(), locator);
+ return true;
+ }
+
+ return false;
+ }
+
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if(childEditPart instanceof PropertyNodeLabelEditPart) {
+ return true;
+ }
+
+ if(childEditPart instanceof FlowPortAffixedNodeEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((FlowPortAffixedNodeEditPart)childEditPart).getFigure());
+ return true;
+ }
+ if(childEditPart instanceof PortAffixedNodeEditPart) {
+ getBorderedFigure().getBorderItemContainer().remove(((PortAffixedNodeEditPart)childEditPart).getFigure());
+ return true;
+ }
+
+ return false;
+ }
+
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+ if(editPart instanceof IBorderItemEditPart) {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+
+ return getContentPane();
+ }
+
+ // public EditPart getTargetEditPart(Request request) {
+ // if(request instanceof CreateViewAndElementRequest) {
+ // CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest)request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ // IElementType type = (IElementType)adapter.getAdapter(IElementType.class);
+ // if(type == CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_CLN) {
+ // return getChildBySemanticHint(CustomBlockDefinitionDiagramElementTypes.BLOCK_CONSTRAINT_COMPARTMENT_HINT);
+ // }
+ // }
+ // return super.getTargetEditPart(request);
+ // }
+
+ @Override
+ protected NodeFigure createNodeFigure() {
+ return new SelectableBorderedNodeFigure(createMainFigure());
+ }
+
+ @Override
+ protected IFigure createNodeShape() {
+ return primaryShape = new NestedBlockPropertyCompositeFigure();
+ }
+
+ public NestedBlockPropertyCompositeFigure getPrimaryShape() {
+ return (NestedBlockPropertyCompositeFigure)primaryShape;
+ }
+
+ @Override
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID);
+ }
+
+ /**
+ * <pre>
+ *
+ * {@inheritDoc}
+ * </pre>
+ */
+ @Override
+ protected void handleNotificationEvent(Notification event) {
+
+ // A visual refresh may also be needed when the following properties are changing : aggregation, type, or the related association.
+ if(resolveSemanticElement() != null) {
+ EObject element = (EObject)resolveSemanticElement();
+
+ if((element != null) && (element.equals(event.getNotifier())) && (element instanceof Property)) {
+
+ if(UMLPackage.eINSTANCE.getProperty_Aggregation().equals(event.getFeature())) {
+ refreshVisuals();
+ }
+
+ if(UMLPackage.eINSTANCE.getTypedElement_Type().equals(event.getFeature())) {
+ refreshVisuals();
+ }
+
+ if(UMLPackage.eINSTANCE.getProperty_Association().equals(event.getFeature())) {
+ refreshVisuals();
+ }
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * <pre>
+ *
+ * {@inheritDoc}
+ * </pre>
+ */
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+
+ String tag = "property";
+ int lineStyle = Graphics.LINE_SOLID;
+
+ if(resolveSemanticElement() != null) {
+ EObject eObject = (EObject)resolveSemanticElement();
+ if(((ISpecializationType)SysMLElementTypes.PART_PROPERTY).getMatcher().matches(eObject)) {
+ tag = "part";
+
+ } else if(((ISpecializationType)SysMLElementTypes.REFERENCE_PROPERTY).getMatcher().matches(eObject)) {
+ tag = "reference";
+ lineStyle = Graphics.LINE_CUSTOM;
+
+ } else if(((ISpecializationType)SysMLElementTypes.ACTOR_PART_PROPERTY).getMatcher().matches(eObject)) {
+ tag = "actor part";
+
+ } else if(((ISpecializationType)SysMLElementTypes.VALUE_PROPERTY).getMatcher().matches(eObject)) {
+ tag = "value";
+
+ } else {
+ // Consider the element is a Property...
+ }
+ }
+
+ getPrimaryShape().setFigureTag(tag);
+ getPrimaryShape().setLineStyle(lineStyle);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java
new file mode 100644
index 00000000000..a77da72fb10
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/BlockPropertyStructureCompartmentSemanticEditPolicy.java
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.policy;
+
+import java.util.Arrays;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.CompartmentSemanticEditPolicy;
+import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.blocks.Block;
+import org.eclipse.papyrus.sysml.diagram.common.commands.CreateActorPartWithTypeConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.diagram.common.commands.CreatePartWithTypeConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.diagram.common.commands.CreateReferenceWithTypeConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.diagram.common.commands.CreateValueWithTypeConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * Semantic edit policy for {@link Block} structure compartment.
+ */
+public class BlockPropertyStructureCompartmentSemanticEditPolicy extends CompartmentSemanticEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getCreateCommand(CreateElementRequest req) {
+
+ // Property (and variants) creation is allowed if the semantic element is
+ // a Property typed by a Block, the Property is created on this Block.
+ EObject eObject = req.getContainer();
+ if ((eObject != null) && (eObject instanceof Property)) {
+ Type type = ((Property) eObject).getType();
+ if ((type != null) && (((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(type))) {
+
+ if(SysMLElementTypes.PART_PROPERTY == req.getElementType()) {
+ req.setContainer(type);
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreatePartWithTypeConfigureCommandFactory());
+ }
+
+ if(SysMLElementTypes.REFERENCE_PROPERTY == req.getElementType()) {
+ req.setContainer(type);
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateReferenceWithTypeConfigureCommandFactory());
+ }
+
+ if(SysMLElementTypes.ACTOR_PART_PROPERTY == req.getElementType()) {
+ req.setContainer(type);
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateActorPartWithTypeConfigureCommandFactory());
+ }
+
+ if(SysMLElementTypes.VALUE_PROPERTY == req.getElementType()) {
+ req.setContainer(type);
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateValueWithTypeConfigureCommandFactory());
+ }
+
+ if(UMLElementTypes.PROPERTY == req.getElementType()) {
+ req.setContainer(type);
+ }
+
+ } else if ((UMLElementTypes.PROPERTY == req.getElementType()) || (Arrays.asList(req.getElementType().getAllSuperTypes()).contains(UMLElementTypes.PROPERTY))) {
+ // Forbid Property::qualifier creation
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+
+ return super.getCreateCommand(req);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/NestedBlockPropertyCompositeSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/NestedBlockPropertyCompositeSemanticEditPolicy.java
new file mode 100644
index 00000000000..c31619b6d61
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/NestedBlockPropertyCompositeSemanticEditPolicy.java
@@ -0,0 +1,64 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.policy;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.gmf.diagram.common.edit.policy.DefaultSemanticEditPolicy;
+import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.diagram.common.commands.CreateFlowPortWithFlowSpecificationConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * Semantic edit policy for Property owned by a Block (Part or Reference especially).
+ */
+public class NestedBlockPropertyCompositeSemanticEditPolicy extends DefaultSemanticEditPolicy {
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getCreateCommand(CreateElementRequest req) {
+
+ // Port - FlowPort creation is allowed if the semantic element is
+ // a Property typed by a Block, the new Port - FlowPort is created on this Block.
+ EObject eObject = req.getContainer();
+ if ((eObject != null) && (eObject instanceof Property)) {
+ Type type = ((Property) eObject).getType();
+ if ((type != null) && (((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(type))) {
+
+ if((SysMLElementTypes.FLOW_PORT == req.getElementType())
+ || (SysMLElementTypes.FLOW_PORT_IN == req.getElementType())
+ || (SysMLElementTypes.FLOW_PORT_OUT == req.getElementType())
+ || (SysMLElementTypes.FLOW_PORT_IN_OUT == req.getElementType())
+ || (SysMLElementTypes.FLOW_PORT_NA == req.getElementType())
+ || (UMLElementTypes.PORT == req.getElementType())) {
+
+ req.setContainer(type);
+ }
+
+ if(SysMLElementTypes.FLOW_PORT_NA == req.getElementType()) {
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateFlowPortWithFlowSpecificationConfigureCommandFactory());
+ }
+ }
+ }
+
+ return super.getCreateCommand(req);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java
index 91afac46157..642210751b8 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-uml/org/eclipse/papyrus/uml/diagram/common/edit/policy/StructuredClassifierCreationEditPolicy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -69,7 +69,7 @@ public class StructuredClassifierCreationEditPolicy extends CreationEditPolicy {
@Override
protected Command getCreateCommand(CreateViewRequest request) {
- // This overrides getCreatCommand in order to use a specific CreateViewCommand (instead of
+ // This overrides getCreateCommand in order to use a specific CreateViewCommand (instead of
// org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand.
// The original CreateCommand#canExecute() implementation rely on ViewProvider#provides(CreateViewForKindOperation op)
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyStructureCompartmentEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyStructureCompartmentEditPart.java
index 76c89240e1f..009722ab726 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyStructureCompartmentEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyStructureCompartmentEditPart.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -13,7 +13,9 @@
*****************************************************************************/
package org.eclipse.papyrus.sysml.diagram.common.edit.part;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.sysml.diagram.common.edit.policy.BlockPropertyStructureCompartmentSemanticEditPolicy;
import org.eclipse.papyrus.uml.diagram.common.edit.part.AbstractShapeCompartmentEditPart;
public class BlockPropertyStructureCompartmentEditPart extends AbstractShapeCompartmentEditPart {
@@ -28,6 +30,7 @@ public class BlockPropertyStructureCompartmentEditPart extends AbstractShapeComp
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
// Start of user code custom edit policies
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new BlockPropertyStructureCompartmentSemanticEditPolicy());
// End of user code
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/NestedBlockPropertyCompositeClassifierViewFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/NestedBlockPropertyCompositeClassifierViewFactory.java
new file mode 100644
index 00000000000..f82ced16cf9
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/factory/NestedBlockPropertyCompositeClassifierViewFactory.java
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.factory;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.factory.ShapeViewFactory;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+
+public class NestedBlockPropertyCompositeClassifierViewFactory extends ShapeViewFactory {
+
+ /**
+ * Creates nested BlockPropertyComposite view and add Label
+ */
+ @Override
+ protected void decorateView(View containerView, View view, IAdaptable element, String semanticHint, int index, boolean persisted) {
+
+ getViewService().createNode(element, view, UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID, ViewUtil.APPEND, persisted, getPreferencesHint());
+
+ // this action needs to be done after the compartments creation
+ super.decorateView(containerView, view, element, semanticHint, index, persisted);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/NestedBlockPropertyCompositeFigure.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/NestedBlockPropertyCompositeFigure.java
new file mode 100644
index 00000000000..80bda16044c
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/figure/NestedBlockPropertyCompositeFigure.java
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.figure;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.papyrus.uml.diagram.common.figure.node.ClassifierFigure;
+
+public class NestedBlockPropertyCompositeFigure extends ClassifierFigure {
+
+ public NestedBlockPropertyCompositeFigure() {
+ super("undefined"); //$NON-NLS-1$
+ }
+
+ protected void createContentPane(List<String> compartments) {
+ super.createContentPane(getUpdatedListOfCompartments(compartments));
+ }
+
+ /**
+ * Get the list of compartments, updated with specific ones
+ *
+ * @param compartments
+ * the original list of compartments (untouched)
+ * @return the new completed list of compartments
+ */
+ private List<String> getUpdatedListOfCompartments(List<String> compartments) {
+ compartments = new ArrayList<String>(compartments);
+ return compartments;
+ }
+
+ public void setFigureTag(String newTag) {
+ getTaggedLabel().setText(String.valueOf("\u00AB") + newTag + String.valueOf("\u00BB"));
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java
index efdc9a42d9b..97efd897e95 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-gen/org/eclipse/papyrus/sysml/diagram/common/utils/SysMLGraphicalTypes.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -26,6 +26,8 @@ public class SysMLGraphicalTypes {
public static final String SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID = "shape_sysml_blockproperty_as_composite"; //$NON-NLS-1$
+ public static final String SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID = "shape_sysml_nestedblockproperty_as_composite"; //$NON-NLS-1$
+
public static final String SHAPE_SYSML_DIMENSION_AS_CLASSIFIER_ID = "shape_sysml_dimension_as_classifier"; //$NON-NLS-1$
public static final String SHAPE_SYSML_CONSTRAINTBLOCK_AS_CLASSIFIER_ID = "shape_sysml_constraintblock_as_classifier"; //$NON-NLS-1$
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/build.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/build.properties
index d461080a511..fd662a44687 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/build.properties
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/build.properties
@@ -1,14 +1,14 @@
bin.includes = META-INF/,\
.,\
- plugin.xml,\
palettes/,\
about.html,\
plugin.properties,\
icons/,\
- messages.properties
-output..=bin/
+ messages.properties,\
+ plugin.xml
+source..=src/,src-gen/
+bin..=bin/
src.includes = palettes/,\
icons/,\
+ messages.properties,\
about.html
-source..=src/,src-gen/
-bin..=bin/
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/plugin.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/plugin.xml
index 0308084404e..3a186f161e8 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/plugin.xml
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/plugin.xml
@@ -331,8 +331,8 @@
<!-- Custom graphical types view provider -->
<viewProvider class="org.eclipse.papyrus.sysml.diagram.internalblock.provider.CustomViewProvider">
<Priority name="Medium"/>
- <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="SysML::Property, SysML::ActorPartProperty, SysML::ValueProperty, SysML::ReferenceProperty, SysML::FlowPort_In, UML::Port, SysML::FlowPort_Out, SysML::PartProperty, SysML::FlowPort_InOut, SysML::FlowPort, SysML::Block, SysML::FlowPort_NA"/>
- <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="shape_sysml_flowport_as_affixed, shape_sysml_block_as_composite, shape_uml_port_as_affixed, shape_sysml_blockproperty_as_composite"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="UML::Property, SysML::ActorPartProperty, SysML::ValueProperty, SysML::ReferenceProperty, SysML::FlowPort_In, UML::Port, SysML::FlowPort_Out, SysML::PartProperty, SysML::FlowPort_InOut, SysML::FlowPort, SysML::Block, SysML::FlowPort_NA"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="shape_sysml_flowport_as_affixed, shape_sysml_block_as_composite, shape_uml_port_as_affixed, shape_sysml_blockproperty_as_composite, shape_sysml_nestedblockproperty_as_composite"/>
<context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="UML::Dependency, UML::Connector"/>
<context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="link_uml_connector, link_uml_dependency"/>
@@ -432,7 +432,7 @@
<object
class="org.eclipse.gmf.runtime.notation.Node(org.eclipse.gmf.runtime.notation)"
id="org.eclipse.papyrus.sysml.diagram.internalblock.CustomNodeGraphicalTypes">
- <method name="getType()" value="shape_sysml_flowport_as_affixed, shape_sysml_block_as_composite, shape_uml_port_as_affixed, shape_sysml_blockproperty_as_composite"/>
+ <method name="getType()" value="shape_sysml_flowport_as_affixed, shape_sysml_block_as_composite, shape_uml_port_as_affixed, shape_sysml_blockproperty_as_composite, shape_sysml_nestedblockproperty_as_composite"/>
</object>
<object
@@ -553,13 +553,25 @@
id="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.BlockCompositePreferencePage"
name="Block">
</page>
-
+
<page category="org.eclipse.papyrus.sysml.diagram.internalblock.preferences"
- class="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.CustomBlockPropertyCompositePreferencePage"
+ class="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.BlockPropertyCompositePreferencePage"
id="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.BlockPropertyCompositePreferencePage"
name="PartAndReferences">
</page>
+ <page category="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.BlockPropertyCompositePreferencePage"
+ class="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.CustomBlockPropertyCompositePreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.CustomBlockPropertyCompositePreferencePage"
+ name="block property">
+ </page>
+
+ <page category="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.BlockPropertyCompositePreferencePage"
+ class="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.CustomNestedBlockPropertyCompositePreferencePage"
+ id="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.CustomBlockPropertyCompositePreferencePage"
+ name="nested property">
+ </page>
+
<page category="org.eclipse.papyrus.sysml.diagram.internalblock.preferences"
class="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.FlowPortAsBorderItemPreferencePage"
id="org.eclipse.papyrus.sysml.diagram.internalblock.preferences.FlowPortPreferencePage"
@@ -664,7 +676,7 @@
<!-- Diagram specific advices -->
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
- <metamodel nsURI="http://www.eclipse.org/uml2/3.0.0/UML">
+ <metamodel nsURI="http://www.eclipse.org/uml2/4.0.0/UML">
<!-- Property specific advices (remove inconsistent views when a Property type is set) -->
<adviceBinding id="org.eclipse.papyrus.sysml.diagram.internalblock.PropertyHelperAdvice"
@@ -680,14 +692,14 @@
</metamodel>
</extension>
-
+
<!-- UML ElementType bindings to Papyrus shared IClientContext -->
<extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
<!-- Bindings declaration to shared IClientContext -->
<binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
<elementType ref="org.eclipse.papyrus.sysml.diagram.internalblock.PropertyHelperAdvice"/>
- <elementType ref="org.eclipse.papyrus.sysml.diagram.internalblock.DeleteViewDuringMoveHelperAdvice"/>
+ <elementType ref="org.eclipse.papyrus.sysml.diagram.internalblock.DeleteViewDuringMoveHelperAdvice"/>
</binding>
</extension>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomEditPartProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomEditPartProvider.java
index 0cce2942e04..c872dc44bc5 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomEditPartProvider.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomEditPartProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -29,6 +29,7 @@ import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyComposite
import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyStructureCompartmentEditPart;
import org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedLabelNameEditPart;
import org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedNodeEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.NestedBlockPropertyCompositeEditPart;
import org.eclipse.papyrus.sysml.diagram.common.edit.part.StructureCompartmentEditPart;
import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
import org.eclipse.papyrus.uml.diagram.common.edit.part.AppliedStereotypeAffixedLabelEditPart;
@@ -60,6 +61,7 @@ public class CustomEditPartProvider extends CustomAbstractEditPartProvider {
// Nodes
nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, BlockPropertyCompositeEditPart.class);
+ nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID, NestedBlockPropertyCompositeEditPart.class);
nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID, BlockCompositeEditPart.class);
nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID, FlowPortAffixedNodeEditPart.class);
nodeMap.put(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID, PortAffixedNodeEditPart.class);
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomGraphicalTypeRegistry.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomGraphicalTypeRegistry.java
index 1799386bed4..04e563903c4 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomGraphicalTypeRegistry.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomGraphicalTypeRegistry.java
@@ -19,6 +19,7 @@ import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
@@ -30,6 +31,7 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
// Nodes
knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID);
+ knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID);
knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID);
knownNodes.add(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID);
knownNodes.add(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID);
@@ -62,13 +64,13 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
|| ((ISpecializationType)SysMLElementTypes.REFERENCE_PROPERTY).getMatcher().matches(domainElement)
|| ((ISpecializationType)SysMLElementTypes.ACTOR_PART_PROPERTY).getMatcher().matches(domainElement)
|| ((ISpecializationType)SysMLElementTypes.VALUE_PROPERTY).getMatcher().matches(domainElement)
- || (domainElement instanceof Property)) {
+ || ((domainElement instanceof Property) && !(domainElement instanceof Port))) {
if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
}
if(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
- return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ return SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID;
}
return UNDEFINED_TYPE;
@@ -86,6 +88,9 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
if(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) {
return SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID;
}
+ if(SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID;
+ }
return UNDEFINED_TYPE;
}
// End of user code
@@ -124,6 +129,9 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
if(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) {
return UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID;
}
+ if(SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) {
+ return UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID;
+ }
return UNDEFINED_TYPE;
}
return super.getNodeGraphicalType(domainElement, containerType);
@@ -144,7 +152,7 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
}
if(SysMLGraphicalTypes.COMPARTMENT_SYSML_BLOCKPROPERTY_STRUCTURE_ID.equals(containerType)) {
- return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
+ return SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID;
}
return UNDEFINED_TYPE;
@@ -162,6 +170,9 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
if(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) {
return SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID;
}
+ if(SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) {
+ return SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID;
+ }
return UNDEFINED_TYPE;
}
@@ -202,6 +213,9 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
if(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) {
return UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID;
}
+ if(SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID.equals(containerType)) {
+ return UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID;
+ }
return UNDEFINED_TYPE;
}
return super.getNodeGraphicalType(proposedType, containerType);
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomViewProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomViewProvider.java
index f7ade19a846..b5f83fd16ce 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomViewProvider.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomViewProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -26,6 +26,7 @@ import org.eclipse.papyrus.gmf.diagram.common.provider.CustomAbstractViewProvide
import org.eclipse.papyrus.sysml.diagram.common.factory.BlockCompositeClassifierViewFactory;
import org.eclipse.papyrus.sysml.diagram.common.factory.BlockPropertyCompositeClassifierViewFactory;
import org.eclipse.papyrus.sysml.diagram.common.factory.FlowPortAffixedNodeViewFactory;
+import org.eclipse.papyrus.sysml.diagram.common.factory.NestedBlockPropertyCompositeClassifierViewFactory;
import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
import org.eclipse.papyrus.uml.diagram.common.factory.ConnectorLinkViewFactory;
import org.eclipse.papyrus.uml.diagram.common.factory.DependencyLinkViewFactory;
@@ -50,6 +51,7 @@ public class CustomViewProvider extends CustomAbstractViewProvider {
// Custom classifier nodes
nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID, BlockCompositeClassifierViewFactory.class);
nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, BlockPropertyCompositeClassifierViewFactory.class);
+ nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID, NestedBlockPropertyCompositeClassifierViewFactory.class);
// Custom affixed nodes
nodeMap.put(SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID, FlowPortAffixedNodeViewFactory.class);
nodeMap.put(UMLGraphicalTypes.SHAPE_UML_PORT_AS_AFFIXED_ID, PortAffixedNodeViewFactory.class);
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java
index 4fabeb183c2..6983a32126a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -22,7 +22,10 @@ import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
import org.eclipse.papyrus.gmf.diagram.common.commands.SelectAndExecuteCommand;
+import org.eclipse.papyrus.sysml.diagram.internalblock.utils.BlockDropHelper;
import org.eclipse.papyrus.sysml.diagram.internalblock.utils.PartDropHelper;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
import org.eclipse.ui.PlatformUI;
/**
@@ -44,12 +47,14 @@ public class CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy exten
@Override
public Command getDropObjectsCommand(DropObjectsRequest dropRequest) {
+ BlockDropHelper helper = new BlockDropHelper(getEditingDomain());
+
// Single drop management possible drop action list can be proposed
if(dropRequest.getObjects().size() == 1) {
// List of available drop commands
List<Command> commandChoice = new ArrayList<Command>();
-
+
// 1. Build command to drop BlockProperty
PartDropHelper partDropHelper = new PartDropHelper(getEditingDomain());
Command dropPartOnPart = partDropHelper.getDropPartOnPart(dropRequest, (GraphicalEditPart)getHost());
@@ -57,7 +62,37 @@ public class CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy exten
commandChoice.add(dropPartOnPart);
}
- // 2. Build default drop command (show view of the dropped object)
+ // 2. Try to create a Part typed by the dropped object
+ Command dropAsTypedPart = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.PART_PROPERTY);
+ if ((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) {
+ commandChoice.add(dropAsTypedPart);
+ }
+
+ // 3. Try to create a Reference typed by the dropped object
+ Command dropAsTypedReference = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.REFERENCE_PROPERTY);
+ if ((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) {
+ commandChoice.add(dropAsTypedReference);
+ }
+
+ // 4. Try to create an ActorPart typed by the dropped object
+ Command dropAsTypedActorPart = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY);
+ if ((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) {
+ commandChoice.add(dropAsTypedActorPart);
+ }
+
+ // 5. Try to create a Value typed by the dropped object
+ Command dropAsTypedValue = helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.VALUE_PROPERTY);
+ if ((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) {
+ commandChoice.add(dropAsTypedValue);
+ }
+
+ // 6. Try to create a Property typed by the dropped object
+ Command dropAsTypedProperty= helper.getDropAsStructureItemOnPart(dropRequest, (GraphicalEditPart)getHost(), UMLElementTypes.PROPERTY);
+ if ((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) {
+ commandChoice.add(dropAsTypedProperty);
+ }
+
+ // 7. Build default drop command (show view of the dropped object)
Command defaultDropCommand = super.getDropObjectsCommand(dropRequest);
defaultDropCommand.setLabel("Default drop (Show dropped object in diagram)");
if ((defaultDropCommand != null) && (defaultDropCommand.canExecute())) {
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/CustomNestedBlockPropertyCompositeSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/CustomNestedBlockPropertyCompositeSemanticEditPolicy.java
new file mode 100644
index 00000000000..6e2ffd0f6ec
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/CustomNestedBlockPropertyCompositeSemanticEditPolicy.java
@@ -0,0 +1,94 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.internalblock.edit.policy;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.papyrus.gmf.diagram.common.provider.IGraphicalTypeRegistry;
+import org.eclipse.papyrus.sysml.diagram.common.edit.policy.NestedBlockPropertyCompositeSemanticEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.provider.CustomGraphicalTypeRegistry;
+import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes;
+import org.eclipse.papyrus.sysml.diagram.internalblock.provider.GraphicalTypeRegistry;
+import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CommentAnnotatedElementCreateCommand;
+import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CommentAnnotatedElementReorientCommand;
+import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ConstraintConstrainedElementCreateCommand;
+import org.eclipse.papyrus.uml.diagram.composite.edit.commands.ConstraintConstrainedElementReorientCommand;
+import org.eclipse.papyrus.uml.service.types.utils.RequestParameterConstants;
+
+/**
+ * <pre>
+ * Custom semantic edit policy that replace DefaultSemanticEditPolicy
+ * in order to manage Class Diagram specific elements (reference
+ * relationships COMMENT_ANNOTATED_ELEMENT and CONSTRAINT_CONSTRAINED_ELEMENT).
+ * </pre>
+ */
+public class CustomNestedBlockPropertyCompositeSemanticEditPolicy extends NestedBlockPropertyCompositeSemanticEditPolicy {
+
+ /** Local graphical type registry for graphical elements */
+ private IGraphicalTypeRegistry registry = new CustomGraphicalTypeRegistry();
+
+ /** Local graphical type registry for inherited graphical elements */
+ private IGraphicalTypeRegistry inheritedRegistry = new GraphicalTypeRegistry();
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+
+ if(ElementTypes.COMMENT_ANNOTATED_ELEMENT == req.getElementType()) {
+ return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+
+ if(ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT == req.getElementType()) {
+ return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+
+ String newEdgeGraphicalType = registry.getEdgeGraphicalType(req.getElementType());
+
+ if(inheritedRegistry.isKnownEdgeType(newEdgeGraphicalType)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ if(!registry.isKnownEdgeType(newEdgeGraphicalType)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ return super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+
+ View reconnectedView = (View)req.getParameter(RequestParameterConstants.GRAPHICAL_RECONNECTED_EDGE);
+ String reconnectedViewType = (reconnectedView != null) ? reconnectedView.getType() : IGraphicalTypeRegistry.UNDEFINED_TYPE;
+
+ if(ElementTypes.COMMENT_ANNOTATED_ELEMENT.getSemanticHint().equals(reconnectedViewType)) {
+ return getGEFWrapper(new CommentAnnotatedElementReorientCommand(req));
+ }
+
+ if(ElementTypes.CONSTRAINT_CONSTRAINED_ELEMENT.getSemanticHint().equals(reconnectedViewType)) {
+ return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req));
+ }
+
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/BlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/BlockPropertyCompositePreferencePage.java
new file mode 100644
index 00000000000..eaa575a5468
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/BlockPropertyCompositePreferencePage.java
@@ -0,0 +1,42 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.internalblock.preferences;
+
+import org.eclipse.gmf.runtime.common.ui.preferences.AbstractPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+
+public class BlockPropertyCompositePreferencePage extends AbstractPreferencePage {
+
+ /** Constructor */
+ public BlockPropertyCompositePreferencePage() {
+ super();
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ CustomBlockPropertyCompositePreferencePage.initDefaults(store);
+ CustomNestedBlockPropertyCompositePreferencePage.initDefaults(store);
+ }
+
+ @Override
+ protected void addFields(Composite parent) {
+
+ }
+
+ @Override
+ protected void initHelp() {
+
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomBlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomBlockPropertyCompositePreferencePage.java
index f6ef06879b7..fcb2c3653f0 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomBlockPropertyCompositePreferencePage.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomBlockPropertyCompositePreferencePage.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -89,6 +89,8 @@ public class CustomBlockPropertyCompositePreferencePage extends InternalBlockDia
public static void initDefaults(IPreferenceStore store) {
// Start of user code custom default initializations
store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE| DISP_UNDEFINED_TYPE);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.WIDTH), 160);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.HEIGHT), 100);
// End of user code
// Initialize default visibility for compartments in preference page.
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomNestedBlockPropertyCompositePreferencePage.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomNestedBlockPropertyCompositePreferencePage.java
new file mode 100644
index 00000000000..d957e3b8e2e
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomNestedBlockPropertyCompositePreferencePage.java
@@ -0,0 +1,268 @@
+/*****************************************************************************
+ * Copyright (c) 2012 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.internalblock.preferences;
+
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULTVALUE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DEFAULT_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_DERIVE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MODIFIERS;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_MULTIPLICITY;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_NAME;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_UNDEFINED_TYPE;
+import static org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants.DISP_VISIBILITY;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.infra.gmfdiag.preferences.utils.PreferenceConstantHelper;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.ILabelPreferenceConstants;
+import org.eclipse.papyrus.sysml.diagram.common.preferences.LabelPreferenceHelper;
+import org.eclipse.papyrus.sysml.diagram.common.utils.SysMLGraphicalTypes;
+import org.eclipse.papyrus.sysml.diagram.internalblock.provider.ElementTypes;
+import org.eclipse.papyrus.uml.diagram.common.utils.UMLGraphicalTypes;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * Preference page for Part and References.
+ */
+public class CustomNestedBlockPropertyCompositePreferencePage extends InternalBlockDiagramNodePreferencePage {
+
+ /** Constant key to access preferences */
+ public static String prefKey = ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID; //$NON-NLS-1$
+
+ public static String prefLabelKey = prefKey + "-" + UMLGraphicalTypes.LABEL_UML_PROPERTY_LABEL_ID; //$NON-NLS-1$
+
+ /** Constructor */
+ public CustomNestedBlockPropertyCompositePreferencePage() {
+ super();
+ setPreferenceKey(ElementTypes.DIAGRAM_ID + "_" + SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID); //$NON-NLS-1$
+ }
+
+ /** Default preferences initializer */
+ public static void initDefaults(IPreferenceStore store) {
+ // Start of user code custom default initializations
+ store.setDefault(LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE), DISP_NAME | DISP_TYPE| DISP_UNDEFINED_TYPE);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.WIDTH), 160);
+ store.setDefault(PreferenceConstantHelper.getElementConstant(prefKey, PreferenceConstantHelper.HEIGHT), 80);
+ // End of user code
+ }
+
+ /** buttons to select the display mask of the label */
+ protected Button bttnVisibility, bttnDerive, bttnName, bttnType, bttnUndefined_Type, bttnMultiplicity, bttnDefault_Multiplicity, bttnDefaultValue, bttnModifiers;
+
+ private String labelDisplayPreferenceKey = LabelPreferenceHelper.getPreferenceConstant(prefLabelKey, ILabelPreferenceConstants.LABEL_DISPLAY_PREFERENCE);
+
+ /** current property display style */
+ private int propertyValue = getPreferenceStore().getInt(labelDisplayPreferenceKey);
+
+ /**
+ * Creates a button with the {@link SWT#CHECK} style.
+ *
+ * @param parent
+ * the parent of the button
+ * @param label
+ * the label of the button
+ * @param mask
+ * the value controlled by the button
+ * @return the button created
+ */
+ protected Button createCheckButton(Composite parent, String label, int mask) {
+ Button button = new Button(parent, SWT.CHECK);
+ button.setText(label);
+ button.addSelectionListener(new AppearenceSelectionListener(mask));
+ return button;
+ }
+
+ /**
+ * Creates the group and check boxes to choose the kind of display
+ *
+ * @param parent
+ * the parent composite that holds the group
+ */
+ protected void createLabelPreferencesButtons(Composite parent) {
+ // create group that host the buttons
+ Group group = new Group(parent, SWT.SHADOW_NONE);
+ group.setText("Label Display");
+ group.setLayout(new FormLayout());
+
+ FormData data;
+
+ bttnVisibility = createCheckButton(group, "Visibility", DISP_VISIBILITY);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(0, 0);
+ bttnVisibility.setLayoutData(data);
+
+ bttnDerive = createCheckButton(group, "Derive", DISP_DERIVE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnDerive.setLayoutData(data);
+
+ bttnName = createCheckButton(group, "Name", DISP_NAME);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnName.setLayoutData(data);
+
+ bttnType = createCheckButton(group, "Type", DISP_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(0, 0);
+ bttnType.setLayoutData(data);
+
+ bttnUndefined_Type = createCheckButton(group, "Undefined_Type", DISP_UNDEFINED_TYPE);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnUndefined_Type.setLayoutData(data);
+
+ bttnMultiplicity = createCheckButton(group, "Multiplicity", DISP_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnVisibility, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnMultiplicity.setLayoutData(data);
+
+ bttnDefault_Multiplicity = createCheckButton(group, "Default_Multiplicity", DISP_DEFAULT_MULTIPLICITY);
+ data = new FormData();
+ data.left = new FormAttachment(bttnDerive, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnDefault_Multiplicity.setLayoutData(data);
+
+ bttnDefaultValue = createCheckButton(group, "DefaultValue", DISP_DEFAULTVALUE);
+ data = new FormData();
+ data.left = new FormAttachment(bttnName, 85);
+ data.top = new FormAttachment(bttnVisibility, ITabbedPropertyConstants.HSPACE);
+ bttnDefaultValue.setLayoutData(data);
+
+ bttnModifiers = createCheckButton(group, "Modifiers", DISP_MODIFIERS);
+ data = new FormData();
+ data.left = new FormAttachment(0, 0);
+ data.top = new FormAttachment(bttnUndefined_Type, ITabbedPropertyConstants.HSPACE);
+ bttnModifiers.setLayoutData(data);
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void createPageContents(Composite parent) {
+ super.createPageContents(parent);
+
+ // adds the label preferences check boxes
+ createLabelPreferencesButtons(parent);
+
+ refreshButtons();
+ }
+
+ /**
+ * Load the default preferences of the fields contained in this page
+ */
+ protected void loadDefaultPreferences() {
+ propertyValue = getPreferenceStore().getDefaultInt(labelDisplayPreferenceKey);
+ refreshButtons();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void performDefaults() {
+ loadDefaultPreferences();
+ super.performDefaults();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean performOk() {
+ storePreferences();
+ return super.performOk();
+ }
+
+ /**
+ * Refresh the buttons that manages the display.
+ */
+ protected void refreshButtons() {
+
+ bttnVisibility.setSelection((propertyValue & DISP_VISIBILITY) == DISP_VISIBILITY);
+ bttnDerive.setSelection((propertyValue & DISP_DERIVE) == DISP_DERIVE);
+ bttnName.setSelection((propertyValue & DISP_NAME) == DISP_NAME);
+ bttnType.setSelection((propertyValue & DISP_TYPE) == DISP_TYPE);
+ bttnUndefined_Type.setSelection((propertyValue & DISP_UNDEFINED_TYPE) == DISP_UNDEFINED_TYPE);
+ bttnMultiplicity.setSelection((propertyValue & DISP_MULTIPLICITY) == DISP_MULTIPLICITY);
+ bttnDefault_Multiplicity.setSelection((propertyValue & DISP_DEFAULT_MULTIPLICITY) == DISP_DEFAULT_MULTIPLICITY);
+ bttnDefaultValue.setSelection((propertyValue & DISP_DEFAULTVALUE) == DISP_DEFAULTVALUE);
+ bttnModifiers.setSelection((propertyValue & DISP_MODIFIERS) == DISP_MODIFIERS);
+
+ }
+
+ /**
+ * Stores the values of the fields contained in this page into the preference store.
+ */
+ protected void storePreferences() {
+ super.storePreferences();
+ IPreferenceStore store = getPreferenceStore();
+ // checks the stored value and the actual one, so does not refresh diagram if it is not
+ // needed
+ if(propertyValue != store.getInt(labelDisplayPreferenceKey)) {
+ store.setValue(labelDisplayPreferenceKey, propertyValue);
+ }
+ }
+
+ /**
+ * Listeners for the check buttons that select the display.
+ */
+ private class AppearenceSelectionListener implements SelectionListener {
+
+ /** The constant which refers the element to display or not. */
+ final private int style;
+
+ /**
+ * Default Constructor.
+ *
+ * @param style
+ */
+ public AppearenceSelectionListener(int style) {
+ this.style = style;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void widgetSelected(SelectionEvent e) {
+ // add or remove the flag to the display property value (invert the current value)
+ propertyValue = propertyValue ^ style;
+ // refresh buttons to show current values
+ refreshButtons();
+ }
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomPreferenceInitializer.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomPreferenceInitializer.java
index 2af270319f9..05bd69ab49c 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomPreferenceInitializer.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/preferences/CustomPreferenceInitializer.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010-2011 CEA LIST.
+ * Copyright (c) 2010-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -37,7 +37,7 @@ public class CustomPreferenceInitializer extends InternalBlockDiagramPreferenceI
PortAsBorderItemPreferencePage.initDefaults(store);
FlowPortAsBorderItemPreferencePage.initDefaults(store);
- CustomBlockPropertyCompositePreferencePage.initDefaults(store);
+ BlockPropertyCompositePreferencePage.initDefaults(store);
CustomConnectorPreferencePage.initDefaults(store);
// Initialize default positions for labels.
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomEditPolicyProvider.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomEditPolicyProvider.java
index 475102f9ae2..94aaabc59d7 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomEditPolicyProvider.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomEditPolicyProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010-2011 CEA LIST.
+ * Copyright (c) 2010-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -26,6 +26,7 @@ import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockCompositeEditPart
import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyCompositeEditPart;
import org.eclipse.papyrus.sysml.diagram.common.edit.part.BlockPropertyStructureCompartmentEditPart;
import org.eclipse.papyrus.sysml.diagram.common.edit.part.FlowPortAffixedNodeEditPart;
+import org.eclipse.papyrus.sysml.diagram.common.edit.part.NestedBlockPropertyCompositeEditPart;
import org.eclipse.papyrus.sysml.diagram.common.edit.part.StructureCompartmentEditPart;
import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomBlockCompositeSemanticEditPolicy;
import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomBlockPropertyCompositeDropEditPolicy;
@@ -33,6 +34,7 @@ import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomBlockPr
import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy;
import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDefaultSemanticEditPolicy;
import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomDragDropEditPolicy;
+import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.CustomNestedBlockPropertyCompositeSemanticEditPolicy;
import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.EncapsulatedClassifierDropEditPolicy;
import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.StructureClassifierDropEditPolicy;
import org.eclipse.papyrus.sysml.diagram.internalblock.edit.policy.TypedElementDropEditPolicy;
@@ -120,6 +122,11 @@ public class CustomEditPolicyProvider extends InternalBlockDiagramEditPolicyProv
editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomBlockPropertyCompositeSemanticEditPolicy());
}
+ if(editPart instanceof NestedBlockPropertyCompositeEditPart) {
+ editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyCompositeDropEditPolicy());
+ editPart.installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomNestedBlockPropertyCompositeSemanticEditPolicy());
+ }
+
if(editPart instanceof BlockPropertyStructureCompartmentEditPart) {
editPart.installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomBlockPropertyStructureCompartmentEditPartDropEditPolicy());
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/BlockDropHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/BlockDropHelper.java
index 9292cc4c138..d261efba84e 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/BlockDropHelper.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/BlockDropHelper.java
@@ -44,6 +44,7 @@ import org.eclipse.uml2.uml.Actor;
import org.eclipse.uml2.uml.Association;
import org.eclipse.uml2.uml.DataType;
import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.TypedElement;
import org.eclipse.uml2.uml.UMLPackage;
/**
@@ -55,6 +56,67 @@ public class BlockDropHelper extends ElementHelper {
this.editDomain = editDomain;
}
+ public Command getDropAsStructureItemOnPart(DropObjectsRequest request, GraphicalEditPart host, IElementType elementType) {
+ String label = "";
+ if (elementType == SysMLElementTypes.PART_PROPERTY) {
+ label = "Create a new Part";
+ }
+ if (elementType == SysMLElementTypes.REFERENCE_PROPERTY) {
+ label = "Create a new Reference";
+ }
+ if (elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) {
+ label = "Create a new ActorPart";
+ }
+ if (elementType == SysMLElementTypes.VALUE_PROPERTY) {
+ label = "Create a new Value";
+ }
+ if (elementType == UMLElementTypes.PROPERTY) {
+ label = "Create a new Property";
+ }
+ CompoundCommand cc = new CompoundCommand(label);
+
+ Object droppedEObject = request.getObjects().get(0);
+ if (! isValidStructureItemType(droppedEObject, elementType)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // Verify target nature
+ EObject target = getHostEObject(host);
+ if ((! (target instanceof TypedElement)) || (((TypedElement) target).getType() == null)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // The target type has to be a Block (will hold the created Port)
+ Type targetType = ((TypedElement) target).getType();
+ if (! ((ISpecializationType)SysMLElementTypes.BLOCK).getMatcher().matches(targetType)) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ // Prepare a command for the element creation and the drop in diagram
+
+ // 1. Prepare creation command
+ ICommand createElementCommand = null;
+ CreateElementRequest createElementRequest = new CreateElementRequest(getEditingDomain(), targetType, elementType);
+ createElementRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new ConfigureFeatureCommandFactory(UMLPackage.eINSTANCE.getTypedElement_Type(), request.getObjects().get(0)));
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetType);
+ if(provider != null) {
+ createElementCommand = provider.getEditCommand(createElementRequest);
+ }
+ IAdaptable createElementRequestAdapter = new CreateElementRequestAdapter(createElementRequest);
+
+ // 2. Prepare the drop command
+ ViewDescriptor descriptor = new ViewDescriptor(createElementRequestAdapter, Node.class, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, ViewUtil.APPEND, true, host.getDiagramPreferencesHint());
+ CreateViewRequest createViewRequest = new CreateViewRequest(descriptor);
+ createViewRequest.setLocation(request.getLocation().getCopy());
+ Command viewCreateCommand = host.getCommand(createViewRequest);
+
+ // 3. Create the compound command
+ cc.add(new ICommandProxy(createElementCommand));
+ cc.add(viewCreateCommand);
+
+ return cc;
+ }
+
public Command getDropAsStructureItem(DropObjectsRequest request, GraphicalEditPart host, IElementType elementType) {
String label = "";
if (elementType == SysMLElementTypes.PART_PROPERTY) {
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/PartDropHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/PartDropHelper.java
index 979990e671f..b3867c3c673 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/PartDropHelper.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/PartDropHelper.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
+ * Copyright (c) 2011-2012 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -49,7 +49,7 @@ public class PartDropHelper extends ElementHelper {
}
// Prepare the view creation command
- ViewDescriptor descriptor = new ViewDescriptor(new SemanticAdapter((EObject)droppedEObject, null), Node.class, SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID, ViewUtil.APPEND, true, host.getDiagramPreferencesHint());
+ ViewDescriptor descriptor = new ViewDescriptor(new SemanticAdapter((EObject)droppedEObject, null), Node.class, SysMLGraphicalTypes.SHAPE_SYSML_NESTEDBLOCKPROPERTY_AS_COMPOSITE_ID, ViewUtil.APPEND, true, host.getDiagramPreferencesHint());
CreateViewRequest createViewRequest = new CreateViewRequest(descriptor);
createViewRequest.setLocation(request.getLocation().getCopy());
Command viewCreateCommand = host.getCommand(createViewRequest);

Back to the top