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/diagram/org.eclipse.papyrus.sysml.diagram.internalblock
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/diagram/org.eclipse.papyrus.sysml.diagram.internalblock')
-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
14 files changed, 567 insertions, 27 deletions
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