Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorytanguy2012-02-22 14:54:21 +0000
committerytanguy2012-02-22 14:54:21 +0000
commit910d1b5f16013e34747288fc58294505ce73fd8d (patch)
tree09eacdec1eb4c81aa3567dc93f9f45cab284ffcc /plugins/sysml
parent8ec82ea54ac6d92566f651c1f38162d61217a2b3 (diff)
downloadorg.eclipse.papyrus-910d1b5f16013e34747288fc58294505ce73fd8d.tar.gz
org.eclipse.papyrus-910d1b5f16013e34747288fc58294505ce73fd8d.tar.xz
org.eclipse.papyrus-910d1b5f16013e34747288fc58294505ce73fd8d.zip
372234: [SysML Internal Block Diagram] Support for ActorPart
https://bugs.eclipse.org/bugs/show_bug.cgi?id=372234 372235: [SysML Block Definition Diagram] Support for ActorPart https://bugs.eclipse.org/bugs/show_bug.cgi?id=372235 372236: [SysML Internal Block Diagram] Support for simple Property https://bugs.eclipse.org/bugs/show_bug.cgi?id=372236
Diffstat (limited to 'plugins/sysml')
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/palettes/blockdefinition.palette.modelelements.xml3
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/plugin.xml15
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/factory/DiagramPaletteFactory.java4
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/provider/CustomGraphicalTypeRegistry.java14
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/helper/advice/DeleteViewDuringPartEditHelperAdvice.java13
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/helper/advice/DeleteViewDuringReferenceEditHelperAdvice.java13
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java89
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java119
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompositeEditPart.java10
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java6
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java14
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java24
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties15
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/palettes/internalblock.palette.xml11
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/plugin.xml37
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/factory/DiagramPaletteFactory.java9
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/provider/CustomGraphicalTypeRegistry.java15
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/StructureClassifierDropEditPolicy.java31
-rw-r--r--plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/BlockDropHelper.java36
-rw-r--r--plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/plugin.xml10
-rw-r--r--plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src-gen/org/eclipse/papyrus/sysml/modelexplorer/filter/CommandFilter.java3
-rw-r--r--plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src-gen/org/eclipse/papyrus/sysml/modelexplorer/handler/ActorPartPropertyHandler.java72
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/plugin.xml11
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src-gen/org/eclipse/papyrus/sysml/service/types/element/SysMLElementTypes.java7
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ActorPartPropertyEditHelperAdvice.java88
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/AssociationEditHelperAdvice.java13
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java105
-rw-r--r--plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/matcher/ActorPartPropertyMatcher.java50
28 files changed, 795 insertions, 42 deletions
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/palettes/blockdefinition.palette.modelelements.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/palettes/blockdefinition.palette.modelelements.xml
index aaac3251e52..daf4f537d96 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/palettes/blockdefinition.palette.modelelements.xml
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/palettes/blockdefinition.palette.modelelements.xml
@@ -32,6 +32,9 @@
<aspectTool description="Create a new Reference" id="blockdefinition_modelelements.tool.reference"
name="Reference" refToolId="blockdefinition.tool.reference">
</aspectTool>
+ <aspectTool description="Create a new ActorPart" id="blockdefinition_modelelements.tool.actorpart"
+ name="ActorPart" refToolId="blockdefinition.tool.actorpart">
+ </aspectTool>
<aspectTool description="Create a new Value" id="blockdefinition_modelelements.tool.value"
name="Value" refToolId="blockdefinition.tool.value">
</aspectTool>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/plugin.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/plugin.xml
index 37b92455ff2..e06341f4fd6 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/plugin.xml
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/plugin.xml
@@ -407,7 +407,18 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif"
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Comment.gif">
</entry>
-
+
+ <!-- internalblock.tool.actorpart -->
+ <entry
+ defineOnly="true"
+ description="Create an ActorPart"
+ id="blockdefinition.tool.actorpart"
+ kind="tool"
+ label="ActorPart"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
+ </entry>
+
<!-- End of user code -->
@@ -564,7 +575,7 @@
<!-- Custom graphical types view provider -->
<viewProvider class="org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.CustomViewProvider">
<Priority name="Medium"/>
- <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="SysML::ReferenceProperty, UML::EnumerationLiteral, SysML::ConstraintBlock, UML::Signal, UML::Operation, SysML::FlowProperty, UML::PrimitiveType, UML::Port, SysML::ConstraintProperty, SysML::ValueProperty, UML::Reception, UML::Interface, UML::Constraint, UML::DataType, SysML::Unit, UML::Enumeration, SysML::ValueType, UML::Actor, UML::Property, SysML::Dimension, SysML::FlowSpecification, SysML::PartProperty, SysML::Block, SysML::FlowPort"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="SysML::ActorPartProperty, SysML::ReferenceProperty, UML::EnumerationLiteral, SysML::ConstraintBlock, UML::Signal, UML::Operation, SysML::FlowProperty, UML::PrimitiveType, UML::Port, SysML::ConstraintProperty, SysML::ValueProperty, UML::Reception, UML::Interface, UML::Constraint, UML::DataType, SysML::Unit, UML::Enumeration, SysML::ValueType, UML::Actor, UML::Property, SysML::Dimension, SysML::FlowSpecification, SysML::PartProperty, SysML::Block, SysML::FlowPort"/>
<context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="shape_sysml_block_as_classifier, shape_sysml_part_as_label, shape_uml_reception_as_label, shape_uml_port_as_label, shape_sysml_valuetype_as_classifier, shape_uml_enumerationliteral_as_label, shape_sysml_constraintproperty_as_label, shape_sysml_dimension_as_classifier, shape_sysml_flowspecification_as_classifier, shape_uml_operation_as_label, shape_sysml_reference_as_label, shape_sysml_unit_as_classifier, shape_sysml_flowport_as_affixed, shape_uml_port_as_affixed, shape_uml_property_as_label, shape_uml_signal_as_classifier, shape_uml_enumeration_as_classifier, shape_uml_primitivetype_as_classifier, shape_uml_datatype_as_classifier, shape_uml_interface_as_classifier, shape_sysml_flowproperty_as_label, shape_sysml_constraintblock_as_classifier, shape_sysml_value_as_label, shape_sysml_flowport_as_label, shape_uml_actor_as_classifier, shape_uml_constraint_as_label"/>
<context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="SysML::AssociationNone, UML::Dependency, SysML::Association, UML::InterfaceRealization, UML::Generalization, SysML::AssociationSharedDirected, SysML::AssociationCompositeDirected, SysML::AssociationComposite, UML::Usage, SysML::AssociationNoneDirected, SysML::AssociationShared"/>
<context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="link_uml_dependency, link_uml_usage, link_uml_interfacerealization, link_sysml_association, link_uml_generalization"/>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/factory/DiagramPaletteFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/factory/DiagramPaletteFactory.java
index bd9d4d645c4..7eb8b914727 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/factory/DiagramPaletteFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/factory/DiagramPaletteFactory.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
@@ -67,6 +67,8 @@ public class DiagramPaletteFactory extends PaletteFactory.Adapter {
put("blockdefinition.tool.slot", new IElementType[]{ UMLElementTypes.SLOT });
put("blockdefinition.tool.comment", new IElementType[]{ UMLElementTypes.COMMENT });
+ put("blockdefinition.tool.actorpart", new IElementType[]{ SysMLElementTypes.ACTOR_PART_PROPERTY });
+
//End of user code
}
};
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/provider/CustomGraphicalTypeRegistry.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/provider/CustomGraphicalTypeRegistry.java
index a07d90e7473..a82c829a4f7 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/provider/CustomGraphicalTypeRegistry.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src-gen/org/eclipse/papyrus/sysml/diagram/blockdefinition/provider/CustomGraphicalTypeRegistry.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
@@ -204,6 +204,12 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
}
return UNDEFINED_TYPE;
}
+ if(((ISpecializationType)SysMLElementTypes.ACTOR_PART_PROPERTY).getMatcher().matches(domainElement)) {
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_PROPERTY_AS_LIST_ID.equals(containerType)) {
+ return UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_LABEL_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
if(UMLElementTypes.PROPERTY.getEClass().isInstance(domainElement)) {
if(UMLGraphicalTypes.COMPARTMENT_UML_PROPERTY_AS_LIST_ID.equals(containerType)) {
return UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_LABEL_ID;
@@ -532,6 +538,12 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
}
return UNDEFINED_TYPE;
}
+ if(SysMLElementTypes.ACTOR_PART_PROPERTY.getSemanticHint().equals(proposedType)) {
+ if(SysMLGraphicalTypes.COMPARTMENT_SYSML_PROPERTY_AS_LIST_ID.equals(containerType)) {
+ return UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_LABEL_ID;
+ }
+ return UNDEFINED_TYPE;
+ }
if(UMLElementTypes.PROPERTY.getSemanticHint().equals(proposedType)) {
if(UMLGraphicalTypes.COMPARTMENT_UML_PROPERTY_AS_LIST_ID.equals(containerType)) {
return UMLGraphicalTypes.SHAPE_UML_PROPERTY_AS_LABEL_ID;
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/helper/advice/DeleteViewDuringPartEditHelperAdvice.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/helper/advice/DeleteViewDuringPartEditHelperAdvice.java
index 6b4bbabcd7c..02d624debf7 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/helper/advice/DeleteViewDuringPartEditHelperAdvice.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/helper/advice/DeleteViewDuringPartEditHelperAdvice.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
@@ -21,15 +21,18 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes;
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.util.CrossReferencerUtil;
import org.eclipse.uml2.uml.AggregationKind;
import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
import org.eclipse.uml2.uml.UMLPackage;
/**
@@ -56,6 +59,14 @@ public class DeleteViewDuringPartEditHelperAdvice extends AbstractEditHelperAdvi
viewsToDestroy.addAll(getViewsToDestroy(modifiedObject));
}
+ if ((modifiedObject != null) && (modifiedObject instanceof Property)
+ && (request.getFeature() == UMLPackage.eINSTANCE.getTypedElement_Type())
+ && (request.getValue() instanceof Type)
+ && !((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches((Type) request.getValue())) {
+
+ viewsToDestroy.addAll(getViewsToDestroy(modifiedObject));
+ }
+
if(!viewsToDestroy.isEmpty()) {
DestroyDependentsRequest ddr = new DestroyDependentsRequest(request.getEditingDomain(), request.getElementToEdit(), false);
ICommand destroyViewsCommand = ddr.getDestroyDependentsCommand(viewsToDestroy);
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/helper/advice/DeleteViewDuringReferenceEditHelperAdvice.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/helper/advice/DeleteViewDuringReferenceEditHelperAdvice.java
index 96245a30d15..59d1c06613f 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/helper/advice/DeleteViewDuringReferenceEditHelperAdvice.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.blockdefinition/src/org/eclipse/papyrus/sysml/diagram/blockdefinition/helper/advice/DeleteViewDuringReferenceEditHelperAdvice.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
@@ -21,15 +21,18 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyDependentsRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.sysml.diagram.blockdefinition.provider.ElementTypes;
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.util.CrossReferencerUtil;
import org.eclipse.uml2.uml.AggregationKind;
import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
import org.eclipse.uml2.uml.UMLPackage;
/**
@@ -56,6 +59,14 @@ public class DeleteViewDuringReferenceEditHelperAdvice extends AbstractEditHelpe
viewsToDestroy.addAll(getViewsToDestroy(modifiedObject));
}
+ if ((modifiedObject != null) && (modifiedObject instanceof Property)
+ && (request.getFeature() == UMLPackage.eINSTANCE.getTypedElement_Type())
+ && (request.getValue() instanceof Type)
+ && !((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches((Type) request.getValue())) {
+
+ viewsToDestroy.addAll(getViewsToDestroy(modifiedObject));
+ }
+
if(!viewsToDestroy.isEmpty()) {
DestroyDependentsRequest ddr = new DestroyDependentsRequest(request.getEditingDomain(), request.getElementToEdit(), false);
ICommand destroyViewsCommand = ddr.getDestroyDependentsCommand(viewsToDestroy);
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java
new file mode 100644
index 00000000000..886612c7d74
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/commands/CreateActorPartWithTypeConfigureCommandFactory.java
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ * 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.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.papyrus.infra.services.edit.commands.AbstractConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.utils.GMFCommandUtils;
+import org.eclipse.papyrus.sysml.diagram.common.dialogs.CreateOrSelectActorPartTypeDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.Package;
+import org.eclipse.uml2.uml.Property;
+import org.eclipse.uml2.uml.Type;
+
+/**
+ * This command factory provides a command that enable ActorPart type to be selected or created during creation.
+ */
+public class CreateActorPartWithTypeConfigureCommandFactory extends AbstractConfigureCommandFactory {
+
+ /**
+ * {@inheritDoc}
+ */
+ public ICommand create(ConfigureRequest request) {
+
+ ICommand configureCommand = null;
+
+ Shell shell = Display.getDefault().getActiveShell();
+ // Start dialog to identify the new part type
+ Property part = (Property)request.getElementToConfigure();
+ Package partPkg = part.getNearestPackage();
+
+ CreateOrSelectActorPartTypeDialog dialog = new CreateOrSelectActorPartTypeDialog(shell, partPkg);
+ dialog.open();
+ if(dialog.getReturnCode() == CreateOrSelectActorPartTypeDialog.OK) {
+
+ final ICommand typeCreationCommand = dialog.getNewTypeCreateCommand();
+ final Type actorPartType = (Type)dialog.getExistingType();
+
+ // Abort if type creation command exists but is not executable
+ if((typeCreationCommand != null) && (!typeCreationCommand.canExecute())) {
+ return cancelCommand(request);
+ } else {
+ configureCommand = CompositeCommand.compose(configureCommand, typeCreationCommand);
+ }
+
+ // Create the configure command that will set the ActorPart type
+ ICommand setTypeCommand = new ConfigureElementCommand(request) {
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+
+ Property actorPart = (Property)getElementToEdit();
+ if(actorPartType != null) {
+ actorPart.setType(actorPartType);
+ } else {
+ Type newType = (Type)GMFCommandUtils.getCommandEObjectResult(typeCreationCommand);
+ actorPart.setType(newType);
+ }
+
+ return CommandResult.newOKCommandResult(actorPart);
+ }
+
+ };
+
+ configureCommand = CompositeCommand.compose(configureCommand, setTypeCommand);
+ return configureCommand;
+ }
+
+ return cancelCommand(request);
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java
new file mode 100644
index 00000000000..18ea1e49a8c
--- /dev/null
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/dialogs/CreateOrSelectActorPartTypeDialog.java
@@ -0,0 +1,119 @@
+/*****************************************************************************
+ * 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.dialogs;
+
+import org.eclipse.papyrus.sysml.diagram.common.messages.Messages;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.uml2.uml.NamedElement;
+import org.eclipse.uml2.uml.UMLPackage;
+
+/**
+ * Dialog for initialization of ActorPart (Property) type (the type is either selected or created).
+ */
+public class CreateOrSelectActorPartTypeDialog extends CreateOrSelectTypeDialog {
+
+ /** Constructor */
+ public CreateOrSelectActorPartTypeDialog(Shell shell, NamedElement owner) {
+ super(shell, owner, UMLElementTypes.ACTOR, UMLPackage.eINSTANCE.getTypedElement_Type(), UMLPackage.eINSTANCE.getActor(), UMLElementTypes.PACKAGE, UMLPackage.eINSTANCE.getPackage_PackagedElement(), null);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getDialogTitle() {
+ return Messages.CreateOrSelectActorPartTypeDialog_DialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionTitle() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectionSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getSelectionSectionRadioLabel() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionTitle() {
+ return Messages.CreateOrSelectActorPartTypeDialog_CreationSectionTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getCreationSectionRadioLabel() {
+ return Messages.CreateOrSelectActorPartTypeDialog_CreationSectionRadioLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeNameLabel() {
+ return Messages.CreateOrSelectActorPartTypeDialog_NewTypeNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerNameLabel() {
+ return Messages.CreateOrSelectActorPartTypeDialog_NewTypeContainerNameLabel;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogTitle() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getNewTypeContainerDialogMessage() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogMessage;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogTitle() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectTypeDialogTitle;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String getTypeDialogMessage() {
+ return Messages.CreateOrSelectActorPartTypeDialog_SelectTypeDialogMessage;
+ }
+}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompositeEditPart.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompositeEditPart.java
index be102c67268..4aaa828235a 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompositeEditPart.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/part/BlockPropertyCompositeEditPart.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
@@ -250,9 +250,11 @@ public class BlockPropertyCompositeEditPart extends AbstractElementEditPart {
tag = "reference";
lineStyle = Graphics.LINE_CUSTOM;
- // } else if (UMLElementTypes.ACTOR.getEClass().isInstance(eObject.eGet(UMLPackage.eINSTANCE.getTypedElement_Type()))) {
- // tag = "actor";
- // lineStyle = Graphics.LINE_SOLID;
+ } 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...
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java
index ea4db9d5fec..160904c3fa7 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/PropertyCompartmentSemanticEditPolicy.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
@@ -18,6 +18,7 @@ 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.CreateFlowPortWithFlowSpecificationConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreatePartWithTypeConfigureCommandFactory;
import org.eclipse.papyrus.sysml.diagram.common.commands.CreateReferenceWithTypeConfigureCommandFactory;
@@ -41,6 +42,9 @@ public class PropertyCompartmentSemanticEditPolicy extends CompartmentSemanticEd
if(SysMLElementTypes.REFERENCE_PROPERTY == req.getElementType()) {
req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateReferenceWithTypeConfigureCommandFactory());
}
+ if(SysMLElementTypes.ACTOR_PART_PROPERTY == req.getElementType()) {
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateActorPartWithTypeConfigureCommandFactory());
+ }
if(SysMLElementTypes.VALUE_PROPERTY == req.getElementType()) {
req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateValueWithTypeConfigureCommandFactory());
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java
index 6664b1a0dd0..c659f109f3d 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/edit/policy/StructureCompartmentSemanticEditPolicy.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
@@ -18,8 +18,10 @@ 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;
/**
@@ -40,7 +42,15 @@ public class StructureCompartmentSemanticEditPolicy extends CompartmentSemanticE
if(SysMLElementTypes.REFERENCE_PROPERTY == req.getElementType()) {
req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateReferenceWithTypeConfigureCommandFactory());
}
-
+
+ if(SysMLElementTypes.ACTOR_PART_PROPERTY == req.getElementType()) {
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateActorPartWithTypeConfigureCommandFactory());
+ }
+
+ if(SysMLElementTypes.VALUE_PROPERTY == req.getElementType()) {
+ req.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateValueWithTypeConfigureCommandFactory());
+ }
+
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/messages/Messages.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java
index 582931ad218..5be5e2b7217 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/Messages.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
@@ -61,6 +61,28 @@ public class Messages extends NLS {
public static String CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogMessage;
+ public static String CreateOrSelectActorPartTypeDialog_DialogTitle;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectionSectionTitle;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel;
+
+ public static String CreateOrSelectActorPartTypeDialog_CreationSectionTitle;
+
+ public static String CreateOrSelectActorPartTypeDialog_CreationSectionRadioLabel;
+
+ public static String CreateOrSelectActorPartTypeDialog_NewTypeNameLabel;
+
+ public static String CreateOrSelectActorPartTypeDialog_NewTypeContainerNameLabel;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectTypeDialogTitle;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectTypeDialogMessage;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogTitle;
+
+ public static String CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogMessage;
+
public static String CreateOrSelectValuePropertyTypeDialog_DialogTitle;
public static String CreateOrSelectValuePropertyTypeDialog_SelectionSectionTitle;
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties
index c6c83df544d..cece3d4efbc 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.common/src-common-sysml/org/eclipse/papyrus/sysml/diagram/common/messages/messages.properties
@@ -29,6 +29,21 @@ CreateOrSelectBlockPropertyTypeDialog_SelectTypeDialogMessage=Select a Block to
CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogTitle=Type container selection
CreateOrSelectBlockPropertyTypeDialog_SelectNewTypeContainerDialogMessage=Select the container for the new Block
+CreateOrSelectActorPartTypeDialog_DialogTitle=ActorPart type initialization
+CreateOrSelectActorPartTypeDialog_SelectionSectionTitle=Select an existing type (Actor)
+CreateOrSelectActorPartTypeDialog_SelectionSectionRadioLabel=Actor (type) selection mode
+
+CreateOrSelectActorPartTypeDialog_CreationSectionTitle=Create a new type (Actor)
+CreateOrSelectActorPartTypeDialog_CreationSectionRadioLabel=Actor (type) creation mode
+CreateOrSelectActorPartTypeDialog_NewTypeNameLabel=Select new Actor name
+CreateOrSelectActorPartTypeDialog_NewTypeContainerNameLabel=Select new Actor container
+
+CreateOrSelectActorPartTypeDialog_SelectTypeDialogTitle=Type selection
+CreateOrSelectActorPartTypeDialog_SelectTypeDialogMessage=Select a Actor to use as new element type
+
+CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogTitle=Type container selection
+CreateOrSelectActorPartTypeDialog_SelectNewTypeContainerDialogMessage=Select the container for the new Actor
+
CreateOrSelectValuePropertyTypeDialog_DialogTitle=Value type initialization
CreateOrSelectValuePropertyTypeDialog_SelectionSectionTitle=Select an existing type (ValueType or DataType)
CreateOrSelectValuePropertyTypeDialog_SelectionSectionRadioLabel=Type selection mode
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/palettes/internalblock.palette.xml b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/palettes/internalblock.palette.xml
index f9fc11be25d..a9fff2e2596 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/palettes/internalblock.palette.xml
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/palettes/internalblock.palette.xml
@@ -18,13 +18,22 @@
</aspectTool>
<aspectTool description="Create a new FlowPort (Non Atomic)" id="internalblock_main.tool.flowport_na"
name="FlowPort (Non Atomic)" refToolId="internalblock.tool.flowport_na">
- </aspectTool>
+ </aspectTool>
+ <aspectTool description="Create a new Property" id="internalblock_main.tool.property"
+ name="Property" refToolId="internalblock.tool.property">
+ </aspectTool>
<aspectTool description="Create a new Part" id="internalblock_main.tool.part"
name="Part" refToolId="internalblock.tool.part">
</aspectTool>
<aspectTool description="Create a new Reference" id="internalblock_main.tool.reference"
name="Reference" refToolId="internalblock.tool.reference">
</aspectTool>
+ <aspectTool description="Create a new ActorPart" id="internalblock_main.tool.actorpart"
+ name="ActorPart" refToolId="internalblock.tool.actorpart">
+ </aspectTool>
+ <aspectTool description="Create a new Value" id="internalblock_main.tool.value"
+ name="Value" refToolId="internalblock.tool.value">
+ </aspectTool>
<aspectTool name="Comment" id="internalblock_main.tool.comment" refToolId="internalblock.tool.comment" description="Create a new Comment" />
<aspectTool name="Constraint" id="internalblock_main.tool.constraint" refToolId="internalblock.tool.constraint" description="Create a new Constraint" />
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 ab30e232b62..0308084404e 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
@@ -134,7 +134,18 @@
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Port.gif">
</entry>
<!-- Start of user code Custom node button entry -->
-
+
+ <!-- internalblock.tool.property -->
+ <entry
+ defineOnly="true"
+ description="Create a Property"
+ id="internalblock.tool.property"
+ kind="tool"
+ label="Property"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
+ </entry>
+
<!-- internalblock.tool.part -->
<entry
defineOnly="true"
@@ -156,7 +167,29 @@
large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
</entry>
+
+ <!-- internalblock.tool.actorpart -->
+ <entry
+ defineOnly="true"
+ description="Create an ActorPart"
+ id="internalblock.tool.actorpart"
+ kind="tool"
+ label="ActorPart"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
+ </entry>
+ <!-- internalblock.tool.value -->
+ <entry
+ defineOnly="true"
+ description="Create a Value"
+ id="internalblock.tool.value"
+ kind="tool"
+ label="Value"
+ large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
+ small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif">
+ </entry>
+
<!-- internalblock.tool.flowport (IN) -->
<entry
defineOnly="true"
@@ -298,7 +331,7 @@
<!-- 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::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="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.Edge" semanticHints="UML::Dependency, UML::Connector"/>
<context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="link_uml_connector, link_uml_dependency"/>
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/factory/DiagramPaletteFactory.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/factory/DiagramPaletteFactory.java
index 575a699ed27..6e5cd1bd330 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/factory/DiagramPaletteFactory.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src-gen/org/eclipse/papyrus/sysml/diagram/internalblock/factory/DiagramPaletteFactory.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
@@ -32,13 +32,16 @@ public class DiagramPaletteFactory extends PaletteFactory.Adapter {
{
put("internalblock.tool.block", new IElementType[]{ SysMLElementTypes.BLOCK });
- put("internalblock.tool.blockpropertycomposite", new IElementType[]{ SysMLElementTypes.PART_PROPERTY, SysMLElementTypes.REFERENCE_PROPERTY });
+ put("internalblock.tool.blockpropertycomposite", new IElementType[]{ SysMLElementTypes.PART_PROPERTY, SysMLElementTypes.REFERENCE_PROPERTY, SysMLElementTypes.ACTOR_PART_PROPERTY, SysMLElementTypes.VALUE_PROPERTY, UMLElementTypes.PROPERTY });
put("internalblock.tool.flowport", new IElementType[]{ SysMLElementTypes.FLOW_PORT });
put("internalblock.tool.port", new IElementType[]{ UMLElementTypes.PORT });
//Start of user code Custom nodes
put("internalblock.tool.part", new IElementType[]{ SysMLElementTypes.PART_PROPERTY });
put("internalblock.tool.reference", new IElementType[]{ SysMLElementTypes.REFERENCE_PROPERTY });
-
+ put("internalblock.tool.actorpart", new IElementType[]{ SysMLElementTypes.ACTOR_PART_PROPERTY });
+ put("internalblock.tool.value", new IElementType[]{ SysMLElementTypes.VALUE_PROPERTY });
+ put("internalblock.tool.property", new IElementType[]{ UMLElementTypes.PROPERTY });
+
put("internalblock.tool.flowport_na", new IElementType[]{ SysMLElementTypes.FLOW_PORT_NA });
put("internalblock.tool.flowport_in", new IElementType[]{ SysMLElementTypes.FLOW_PORT_IN });
put("internalblock.tool.flowport_out", new IElementType[]{ SysMLElementTypes.FLOW_PORT_OUT });
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 5df76b11800..1799386bed4 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
@@ -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
@@ -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.Property;
public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
@@ -58,7 +59,10 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
public String getNodeGraphicalType(EObject domainElement, String containerType) {
// Start of user code getNodeGraphicalType(EObject domainElement, String containerType)
if(((ISpecializationType)SysMLElementTypes.PART_PROPERTY).getMatcher().matches(domainElement)
- || ((ISpecializationType)SysMLElementTypes.REFERENCE_PROPERTY).getMatcher().matches(domainElement)) {
+ || ((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)) {
if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
@@ -131,7 +135,10 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
public String getNodeGraphicalType(String proposedType, String containerType) {
// Start of user code getNodeGraphicalType(String proposedType, String containerType)
if(SysMLElementTypes.PART_PROPERTY.getSemanticHint().equals(proposedType)
- || SysMLElementTypes.REFERENCE_PROPERTY.getSemanticHint().equals(proposedType)) {
+ || SysMLElementTypes.REFERENCE_PROPERTY.getSemanticHint().equals(proposedType)
+ || SysMLElementTypes.ACTOR_PART_PROPERTY.getSemanticHint().equals(proposedType)
+ || SysMLElementTypes.VALUE_PROPERTY.getSemanticHint().equals(proposedType)
+ || UMLElementTypes.PROPERTY.getSemanticHint().equals(proposedType)) {
if(SysMLGraphicalTypes.COMPARTMENT_SYSML_STRUCTURE_ID.equals(containerType)) {
return SysMLGraphicalTypes.SHAPE_SYSML_BLOCKPROPERTY_AS_COMPOSITE_ID;
@@ -148,7 +155,7 @@ public class CustomGraphicalTypeRegistry extends GraphicalTypeRegistry {
|| SysMLElementTypes.FLOW_PORT_OUT.getSemanticHint().equals(proposedType)
|| SysMLElementTypes.FLOW_PORT_IN_OUT.getSemanticHint().matches(proposedType)
|| SysMLElementTypes.FLOW_PORT_NA.getSemanticHint().matches(proposedType)) {
-
+
if(SysMLGraphicalTypes.SHAPE_SYSML_BLOCK_AS_COMPOSITE_ID.equals(containerType)) {
return SysMLGraphicalTypes.SHAPE_SYSML_FLOWPORT_AS_AFFIXED_ID;
}
diff --git a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/StructureClassifierDropEditPolicy.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/StructureClassifierDropEditPolicy.java
index a38b9040e5a..da108295735 100644
--- a/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/StructureClassifierDropEditPolicy.java
+++ b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/edit/policy/StructureClassifierDropEditPolicy.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
@@ -24,12 +24,13 @@ 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.service.types.element.SysMLElementTypes;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
import org.eclipse.ui.PlatformUI;
/**
* <pre>
* Customization of the DND edit policy for the StructureClassifier compartments, that enables the direct
- * creation of typed Part or Reference by dragging Block in a Block structure compartment.
+ * creation of typed Part, Reference, Value, ActorPart or Property by dragging types in a Block structure compartment.
* </pre>
*/
public class StructureClassifierDropEditPolicy extends CustomDragDropEditPolicy {
@@ -52,20 +53,38 @@ public class StructureClassifierDropEditPolicy extends CustomDragDropEditPolicy
// List of available drop commands
List<Command> commandChoice = new ArrayList<Command>();
-
+
// 1. Try to create a Part typed by the dropped object
Command dropAsTypedPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.PART_PROPERTY);
if ((dropAsTypedPart != null) && (dropAsTypedPart.canExecute())) {
commandChoice.add(dropAsTypedPart);
}
-
+
// 2. Try to create a Reference typed by the dropped object
Command dropAsTypedReference = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.REFERENCE_PROPERTY);
if ((dropAsTypedReference != null) && (dropAsTypedReference.canExecute())) {
commandChoice.add(dropAsTypedReference);
}
-
- // 3. Build default drop command (show view of the dropped object)
+
+ // 3. Try to create an ActorPart typed by the dropped object
+ Command dropAsTypedActorPart = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.ACTOR_PART_PROPERTY);
+ if ((dropAsTypedActorPart != null) && (dropAsTypedActorPart.canExecute())) {
+ commandChoice.add(dropAsTypedActorPart);
+ }
+
+ // 4. Try to create a Value typed by the dropped object
+ Command dropAsTypedValue = helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), SysMLElementTypes.VALUE_PROPERTY);
+ if ((dropAsTypedValue != null) && (dropAsTypedValue.canExecute())) {
+ commandChoice.add(dropAsTypedValue);
+ }
+
+ // 5. Try to create a Property typed by the dropped object
+ Command dropAsTypedProperty= helper.getDropAsStructureItem(dropRequest, (GraphicalEditPart)getHost(), UMLElementTypes.PROPERTY);
+ if ((dropAsTypedProperty != null) && (dropAsTypedProperty.canExecute())) {
+ commandChoice.add(dropAsTypedProperty);
+ }
+
+ // 6. 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/utils/BlockDropHelper.java b/plugins/sysml/diagram/org.eclipse.papyrus.sysml.diagram.internalblock/src/org/eclipse/papyrus/sysml/diagram/internalblock/utils/BlockDropHelper.java
index c120c88410e..9292cc4c138 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
@@ -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
@@ -39,6 +39,10 @@ import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
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.helper.ElementHelper;
+import org.eclipse.papyrus.uml.service.types.element.UMLElementTypes;
+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.UMLPackage;
@@ -59,6 +63,15 @@ public class BlockDropHelper extends ElementHelper {
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);
@@ -94,7 +107,7 @@ public class BlockDropHelper extends ElementHelper {
private boolean isValidStructureItemType(Object object, IElementType elementType) {
boolean isValid = false;
- if ((object != null) && (object instanceof Type)) {
+ if ((object != null) && (object instanceof Type) && !(object instanceof Association)) {
Type type = (Type) object;
if ((elementType == SysMLElementTypes.PART_PROPERTY) || (elementType == SysMLElementTypes.REFERENCE_PROPERTY)) {
@@ -102,7 +115,24 @@ public class BlockDropHelper extends ElementHelper {
isValid = true;
}
}
-
+ if (elementType == SysMLElementTypes.ACTOR_PART_PROPERTY) {
+ if(type instanceof Actor) {
+ isValid = true;
+ }
+ }
+ if (elementType == SysMLElementTypes.VALUE_PROPERTY) {
+ if(((ISpecializationType) SysMLElementTypes.VALUE_TYPE).getMatcher().matches(type) || (type instanceof DataType)) {
+ isValid = true;
+ }
+ }
+ if (elementType == UMLElementTypes.PROPERTY) {
+ if (!((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(type)
+ && !(type instanceof Actor)
+ && !(type instanceof DataType)
+ && !((ISpecializationType) SysMLElementTypes.VALUE_TYPE).getMatcher().matches(type)) {
+ isValid = true;
+ }
+ }
}
return isValid;
diff --git a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/plugin.xml b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/plugin.xml
index 03bddd008d4..4f9484bef7e 100644
--- a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/plugin.xml
+++ b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/plugin.xml
@@ -23,6 +23,11 @@
<!-- Creation command declarations -->
<extension point="org.eclipse.ui.commands">
+
+ <!-- Creation command for ActorPart -->
+ <command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.sysml.modelexplorer.handler.ActorPartPropertyHandler" description="Create a new ActorPart" id="org.eclipse.papyrus.sysml.modelexplorer.ActorPartCreateCommand" name="Create a new ActorPart">
+ </command>
+
<!-- Creation command for Allocate -->
<command categoryId="org.eclipse.papyrus.editor.category" defaultHandler="org.eclipse.papyrus.sysml.modelexplorer.handler.AllocateHandler" description="Create a new Allocate" id="org.eclipse.papyrus.sysml.modelexplorer.AllocateCreateCommand" name="Create a new Allocate">
</command>
@@ -191,6 +196,11 @@
<!-- Create SysML element menu content -->
<menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.createsysmlchild" allPopups="false">
+ <!-- Creation menu action for ActorPart -->
+ <command commandId="org.eclipse.papyrus.sysml.modelexplorer.ActorPartCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif" label="Create a new ActorPart" style="push" tooltip="Create a new ActorPart">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
<!-- Creation menu action for Allocate -->
<command commandId="org.eclipse.papyrus.sysml.modelexplorer.AllocateCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" label="Create a new Allocate" style="push" tooltip="Create a new Allocate">
<visibleWhen checkEnabled="true"/>
diff --git a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src-gen/org/eclipse/papyrus/sysml/modelexplorer/filter/CommandFilter.java b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src-gen/org/eclipse/papyrus/sysml/modelexplorer/filter/CommandFilter.java
index b0e2f285a91..c1d402c9997 100644
--- a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src-gen/org/eclipse/papyrus/sysml/modelexplorer/filter/CommandFilter.java
+++ b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src-gen/org/eclipse/papyrus/sysml/modelexplorer/filter/CommandFilter.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 @@ public class CommandFilter implements ICommandFilter {
if(visibleCommands == null) {
visibleCommands = new ArrayList<IElementType>();
+ visibleCommands.add(SysMLElementTypes.ACTOR_PART_PROPERTY);
// visibleCommands.add(SysMLElementTypes.ALLOCATE);
// visibleCommands.add(SysMLElementTypes.ASSOCIATION);
// visibleCommands.add(SysMLElementTypes.ASSOCIATION_COMPOSITE);
diff --git a/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src-gen/org/eclipse/papyrus/sysml/modelexplorer/handler/ActorPartPropertyHandler.java b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src-gen/org/eclipse/papyrus/sysml/modelexplorer/handler/ActorPartPropertyHandler.java
new file mode 100644
index 00000000000..462cef8544c
--- /dev/null
+++ b/plugins/sysml/modelexplorer/org.eclipse.papyrus.sysml.modelexplorer/src-gen/org/eclipse/papyrus/sysml/modelexplorer/handler/ActorPartPropertyHandler.java
@@ -0,0 +1,72 @@
+package org.eclipse.papyrus.sysml.modelexplorer.handler;
+
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.papyrus.infra.services.edit.commands.IConfigureCommandFactory;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+import org.eclipse.papyrus.sysml.diagram.common.commands.CreateActorPartWithTypeConfigureCommandFactory;
+import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
+
+/**
+ * <pre>
+ * Command handler for ActorPart (Property) creation
+ *
+ * </pre>
+ *
+ * @generated
+ */
+public class ActorPartPropertyHandler extends CreateCommandHandler implements IHandler {
+
+ /**
+ * <pre>
+ * @see org.eclipse.papyrus.uml.service.creation.handler.CreateHandler#getElementTypeToCreate()
+ *
+ * @return the IElementType this handler is supposed to create
+ *
+ * </pre>
+ *
+ * @generated
+ */
+ protected IElementType getElementTypeToCreate() {
+ return SysMLElementTypes.ACTOR_PART_PROPERTY;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Command buildCommand() {
+
+ if(getCommandContext() == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ EObject container = getCommandContext().getContainer();
+ EReference reference = getCommandContext().getReference();
+
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(container);
+ if(provider == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ CreateElementRequest createRequest = null;
+ if(reference == null) {
+ createRequest = new CreateElementRequest(container, getElementTypeToCreate());
+ } else {
+ createRequest = new CreateElementRequest(container, getElementTypeToCreate(), reference);
+ }
+ createRequest.setParameter(IConfigureCommandFactory.CONFIGURE_COMMAND_FACTORY_ID, new CreateActorPartWithTypeConfigureCommandFactory());
+
+ // Retrieve create command from the Element Edit service
+ ICommand createGMFCommand = provider.getEditCommand(createRequest);
+ Command emfCommand = new org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper(createGMFCommand);
+ return emfCommand;
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/plugin.xml b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/plugin.xml
index d6d44afa039..ac0029d5535 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/plugin.xml
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/plugin.xml
@@ -9,6 +9,16 @@
<!-- Declaration of IElementTypes -->
+ <!-- ISpecializationType ActorPartProperty of UML::Property -->
+ <specializationType id="org.eclipse.papyrus.sysml.ActorPartProperty" name="SysML::ActorPartProperty"
+ edithelperadvice="org.eclipse.papyrus.sysml.service.types.helper.ActorPartPropertyEditHelperAdvice"
+ icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Property.gif"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType" >
+ <param name="semanticHint" value="SysML::ActorPartProperty"/>
+ <specializes id="org.eclipse.papyrus.uml.Property" />
+ <matcher class ="org.eclipse.papyrus.sysml.service.types.matcher.ActorPartPropertyMatcher" />
+ </specializationType>
+
<!-- ISpecializationType Allocate of UML::Abstraction -->
<specializationType id="org.eclipse.papyrus.sysml.Allocate" name="SysML::Allocate"
edithelperadvice="org.eclipse.papyrus.sysml.service.types.helper.AllocateEditHelperAdvice"
@@ -406,6 +416,7 @@
<!-- Bindings declaration -->
<binding context="org.eclipse.papyrus.infra.services.edit.TypeContext">
+ <elementType ref="org.eclipse.papyrus.sysml.ActorPartProperty" />
<elementType ref="org.eclipse.papyrus.sysml.Allocate" />
<elementType ref="org.eclipse.papyrus.sysml.Association" />
<elementType ref="org.eclipse.papyrus.sysml.AssociationComposite" />
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src-gen/org/eclipse/papyrus/sysml/service/types/element/SysMLElementTypes.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src-gen/org/eclipse/papyrus/sysml/service/types/element/SysMLElementTypes.java
index 73f2de864e5..80e501882ce 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src-gen/org/eclipse/papyrus/sysml/service/types/element/SysMLElementTypes.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src-gen/org/eclipse/papyrus/sysml/service/types/element/SysMLElementTypes.java
@@ -8,10 +8,13 @@ public class SysMLElementTypes extends AbstractElementTypeEnumerator {
/** Constant for SysML nature */
public static final String SYSML_NATURE = "SysML_Nature";
-
+
+ /** IElementType for SysML ActorPartProperty */
+ public static final IHintedType ACTOR_PART_PROPERTY = (IHintedType)getElementType("org.eclipse.papyrus.sysml.ActorPartProperty"); //$NON-NLS-1$
+
/** IElementType for SysML Allocate */
public static final IHintedType ALLOCATE = (IHintedType)getElementType("org.eclipse.papyrus.sysml.Allocate"); //$NON-NLS-1$
-
+
/** IElementType for SysML Association (Association with SysML nature) */
public static final IHintedType ASSOCIATION = (IHintedType)getElementType("org.eclipse.papyrus.sysml.Association"); //$NON-NLS-1$
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ActorPartPropertyEditHelperAdvice.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ActorPartPropertyEditHelperAdvice.java
new file mode 100644
index 00000000000..752cf7fd5c4
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/ActorPartPropertyEditHelperAdvice.java
@@ -0,0 +1,88 @@
+/*****************************************************************************
+ * 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.service.types.helper;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.IElementMatcher;
+import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.papyrus.sysml.blocks.Block;
+import org.eclipse.papyrus.sysml.service.types.matcher.BlockMatcher;
+import org.eclipse.papyrus.uml.service.types.utils.NamedElementHelper;
+import org.eclipse.uml2.uml.AggregationKind;
+import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.Property;
+
+/** SysML Property ActorPart edit helper advice */
+public class ActorPartPropertyEditHelperAdvice extends AbstractEditHelperAdvice {
+
+ /**
+ * Check if the creation context is a {@link Block}.
+ *
+ * @see org.eclipse.papyrus.sysml.service.types.helper.AbstractStereotypedElementEditHelperAdvice#approveRequest(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest)
+ *
+ * @param request
+ * @return true if the request is approved
+ */
+ @Override
+ public boolean approveRequest(IEditCommandRequest request) {
+ boolean isApproved = super.approveRequest(request);
+
+ if((request != null) && (request instanceof GetEditContextRequest)) {
+
+ // Retrieve the edit context from request
+ GetEditContextRequest editContextRequest = (GetEditContextRequest)request;
+
+ // Test if the edit context is a Block
+ if(editContextRequest.getEditContext() instanceof Element) {
+ Element contextElement = (Element)editContextRequest.getEditContext();
+
+ IElementMatcher matcher = new BlockMatcher();
+ if(!matcher.matches(contextElement)) {
+ isApproved = false;
+ }
+ }
+ }
+
+ return isApproved;
+ }
+
+ /** Complete creation process by setting name and default aggregation */
+ @Override
+ protected ICommand getBeforeConfigureCommand(final ConfigureRequest request) {
+
+ return new ConfigureElementCommand(request) {
+
+ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
+ Property element = (Property)request.getElementToConfigure();
+ if(element != null) {
+
+ // Set default name
+ String initializedName = NamedElementHelper.getDefaultNameWithIncrementFromBase("actorPart", element.eContainer().eContents()); //$NON-NLS-1$
+ element.setName(initializedName);
+ // Initialize the aggregation to composite.
+ element.setAggregation(AggregationKind.COMPOSITE_LITERAL);
+ }
+ return CommandResult.newOKCommandResult(element);
+ }
+ };
+ }
+}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/AssociationEditHelperAdvice.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/AssociationEditHelperAdvice.java
index 4142f1e9a3b..6566a294bec 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/AssociationEditHelperAdvice.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/AssociationEditHelperAdvice.java
@@ -1,12 +1,15 @@
/*****************************************************************************
- * 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
* 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.service.types.helper.advice;
@@ -119,9 +122,13 @@ public class AssociationEditHelperAdvice extends AbstractEditHelperAdvice {
protected ICommand getBeforeDestroyDependentsCommand(DestroyDependentsRequest req) {
List<EObject> dependentsToDestroy = new ArrayList<EObject>();
+ List<EObject> dependentsToKeep = (req.getParameter(RequestParameterConstants.DEPENDENTS_TO_KEEP) != null) ? (List<EObject>)req.getParameter(RequestParameterConstants.DEPENDENTS_TO_KEEP) : new ArrayList<EObject>();
+
Association association = (Association)req.getElementToDestroy();
for(Property end : association.getMemberEnds()) {
- dependentsToDestroy.add(end);
+ if (!dependentsToKeep.contains(end)) {
+ dependentsToDestroy.add(end);
+ }
}
// Return command to destroy dependents ends
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java
index 65411e2a1e1..82d6f92fa9e 100644
--- a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/helper/advice/PropertyEditHelperAdvice.java
@@ -1,35 +1,47 @@
/*****************************************************************************
- * 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
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ *
+ * CEA LIST - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.sysml.service.types.helper.advice;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.AbstractCommand;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.emf.type.core.ISpecializationType;
import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
import org.eclipse.papyrus.sysml.service.types.element.SysMLElementTypes;
import org.eclipse.papyrus.uml.service.types.utils.ElementUtil;
+import org.eclipse.papyrus.uml.service.types.utils.NamedElementHelper;
import org.eclipse.papyrus.uml.service.types.utils.RequestParameterConstants;
import org.eclipse.uml2.uml.Association;
import org.eclipse.uml2.uml.Port;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.UMLPackage;
/**
@@ -62,6 +74,24 @@ public class PropertyEditHelperAdvice extends AbstractEditHelperAdvice {
// The edited property has to be related to a SysML association
if((relatedAssociation == null) || !(ElementUtil.hasNature(relatedAssociation, SysMLElementTypes.SYSML_NATURE))) {
+
+ // If no association exist and the new type is a Block, add the association
+ if ((relatedAssociation == null)
+ && ((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches((Type) request.getValue())
+ && ((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches(propertyToEdit.eContainer())) {
+
+ ICommand addAssociationCommand = getCreatePartAssociationCommand((org.eclipse.uml2.uml.Class)propertyToEdit.eContainer(), propertyToEdit, (org.eclipse.uml2.uml.Class)request.getValue());
+ gmfCommand = CompositeCommand.compose(gmfCommand, addAssociationCommand);
+ }
+
+ return gmfCommand;
+ }
+
+ // If the new type is not a block, destroy related association
+ if (!((ISpecializationType) SysMLElementTypes.BLOCK).getMatcher().matches((Type) request.getValue())) {
+ ICommand destroyCommand = getDestroyPartAssociationCommand(relatedAssociation, propertyToEdit);
+ gmfCommand = CompositeCommand.compose(gmfCommand, destroyCommand);
+
return gmfCommand;
}
@@ -120,4 +150,73 @@ public class PropertyEditHelperAdvice extends AbstractEditHelperAdvice {
return null;
}
+
+ /**
+ * Create a part association creation command.
+ *
+ * @return the part association creation command
+ */
+ private ICommand getCreatePartAssociationCommand(final org.eclipse.uml2.uml.Class sourceBlock, final Property sourceProperty, final org.eclipse.uml2.uml.Class targetBlock) {
+
+ return new AbstractCommand("Create part association") {
+
+ @Override
+ protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException {
+ Association association = UMLFactory.eINSTANCE.createAssociation();
+
+ // Add the association in the model
+ org.eclipse.uml2.uml.Package container = (org.eclipse.uml2.uml.Package)EMFCoreUtil.getLeastCommonContainer(Arrays.asList(new EObject[]{sourceBlock, targetBlock}), UMLPackage.eINSTANCE.getPackage());
+ container.getPackagedElements().add(association);
+
+ // Use existing Property as source...
+ association.getMemberEnds().add(sourceProperty);
+ // ... and create the opposite (unnamed) Property
+ Property targetProperty = UMLFactory.eINSTANCE.createProperty();
+ association.getOwnedEnds().add(targetProperty);
+
+ // Set Association name
+ // Initialize the element name based on the created IElementType
+ String initializedName = NamedElementHelper.getDefaultNameWithIncrementFromBase(UMLPackage.eINSTANCE.getAssociation().getName(), association.eContainer().eContents());
+ association.setName(initializedName);
+
+ // Add SysML Nature on the new Association
+ ElementUtil.addNature(association, SysMLElementTypes.SYSML_NATURE);
+
+ return CommandResult.newOKCommandResult(association) ;
+ }
+ };
+
+ }
+
+ /**
+ * Create a part association destroy command.
+ *
+ * @return the part association destroy command
+ */
+ private ICommand getDestroyPartAssociationCommand(Association partAssociation, Property propertyToEdit) {
+
+ DestroyElementRequest request = new DestroyElementRequest(partAssociation, false);
+ List<EObject> dependentsToKeep = Arrays.asList(new EObject[] { propertyToEdit });
+ request.getParameters().put(RequestParameterConstants.DEPENDENTS_TO_KEEP, dependentsToKeep);
+
+ IElementEditService provider = ElementEditServiceUtils.getCommandProvider(partAssociation.eContainer());
+ if(provider == null) {
+ return null;
+ }
+ ICommand destroyCommand = provider.getEditCommand(request);
+
+ return destroyCommand;
+ }
}
diff --git a/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/matcher/ActorPartPropertyMatcher.java b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/matcher/ActorPartPropertyMatcher.java
new file mode 100644
index 00000000000..ac1d3a030af
--- /dev/null
+++ b/plugins/sysml/org.eclipse.papyrus.sysml.service.types/src/org/eclipse/papyrus/sysml/service/types/matcher/ActorPartPropertyMatcher.java
@@ -0,0 +1,50 @@
+/*****************************************************************************
+ * 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.service.types.matcher;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.type.core.IElementMatcher;
+import org.eclipse.uml2.uml.Actor;
+import org.eclipse.uml2.uml.AggregationKind;
+import org.eclipse.uml2.uml.Port;
+import org.eclipse.uml2.uml.Property;
+
+/**
+ * Test if current {@link Property} is a {@link Actor} Part
+ */
+public class ActorPartPropertyMatcher implements IElementMatcher {
+
+ /**
+ * {@inheritDoc}
+ */
+ public boolean matches(EObject eObject) {
+
+ boolean isMatch = false;
+ if((eObject instanceof Property) && !(eObject instanceof Port)) {
+
+ Property element = (Property)eObject;
+
+ // The property is necessary a composition and has a type
+ if ((element.getType() != null) && (element.getAggregation() == AggregationKind.COMPOSITE_LITERAL)) {
+
+ // Moreover its type has to be a Actor
+ if(element.getType() instanceof Actor) {
+ isMatch = true;
+ }
+ }
+ }
+ return isMatch;
+ }
+
+}

Back to the top