diff options
Diffstat (limited to 'plugins/uml')
173 files changed, 12869 insertions, 13404 deletions
diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/.classpath b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/.classpath new file mode 100644 index 00000000000..eca7bdba8f0 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/.project b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/.project new file mode 100644 index 00000000000..4d88371ed29 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.uml.architecture</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..0c68a61dca8 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/META-INF/MANIFEST.MF b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..12c4de3c043 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/META-INF/MANIFEST.MF @@ -0,0 +1,37 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.papyrus.uml.architecture;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.constraints;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.emf;bundle-version="[2.2.0,3.0.0)", + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.nattable;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.nattable.common;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.nattable.views.config;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.services.controlmode;bundle-version="[1.5.0,2.0.0)", + org.eclipse.papyrus.infra.services.edit;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.infra.types.rulebased;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.uml.diagram.activity;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.diagram.clazz;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.diagram.communication;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.diagram.component;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.uml.diagram.composite;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.diagram.deployment;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.diagram.interactionoverview;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.diagram.profile;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.diagram.sequence;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.diagram.statemachine;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.diagram.stereotype.edition;bundle-version="[2.0.0,3.0.0)", + org.eclipse.papyrus.uml.diagram.timing;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.uml.diagram.usecase;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.nattable.generic.config;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.uml.service.types;bundle-version="[3.0.0,4.0.0)", + org.eclipse.papyrus.uml.service.types.ui;bundle-version="[2.0.0,3.0.0)" +Export-Package: org.eclipse.papyrus.uml.architecture +Bundle-Vendor: %providerName diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/about.html b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/about.html new file mode 100644 index 00000000000..bbf2bd6aac7 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>January 30, 2017</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/build.properties b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/build.properties new file mode 100644 index 00000000000..0dc34f7833b --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/icons/profile.gif b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/icons/profile.gif Binary files differnew file mode 100644 index 00000000000..deadaaa3634 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/icons/profile.gif diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/icons/uml.gif b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/icons/uml.gif Binary files differnew file mode 100644 index 00000000000..0626e1f8fa4 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/icons/uml.gif diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/model/uml.architecture b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/model/uml.architecture new file mode 100644 index 00000000000..37fe77aebb1 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/model/uml.architecture @@ -0,0 +1,429 @@ +<?xml version="1.0" encoding="UTF-8"?> +<architecture:ArchitectureDomain xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmlns:gmfdiagrepresentation="http://www.eclipse.org/papyrus/infra/gmfdiag/representation" xmlns:nattablerepresentation="http://www.eclipse.org/papyrus/infra/nattable/representation" xmi:id="_HQhf4MSYEeaKZJ_pGfaSiA" name="Software Engineering" desciption="The domain of developing software systems"> + <stakeholders xmi:id="_HQhf4cSYEeaKZJ_pGfaSiA" name="Software Engineer" desciption="An engineer interested in software development" concerns="_HQhf4sSYEeaKZJ_pGfaSiA _HQhf48SYEeaKZJ_pGfaSiA _HQhf5MSYEeaKZJ_pGfaSiA"/> + <stakeholders xmi:id="_IigrMMSjEeaCPPhpB0_9OQ" name="Domain Architect" concerns="_NxfRgMSjEeaCPPhpB0_9OQ"/> + <concerns xmi:id="_NxfRgMSjEeaCPPhpB0_9OQ" name="Profiles" desciption="The concern of defining the domain profiles"/> + <concerns xmi:id="_HQhf4sSYEeaKZJ_pGfaSiA" name="Use Cases" desciption="The concern of defining the system's use cases"/> + <concerns xmi:id="_HQhf48SYEeaKZJ_pGfaSiA" name="Structure" desciption="The concern of developing the system's structure"/> + <concerns xmi:id="_HQhf5MSYEeaKZJ_pGfaSiA" name="Behavior" desciption="The concern of developing the system's behavior"/> + <contexts xsi:type="architecture:ArchitectureDescriptionLanguage" xmi:id="_HQhf5cSYEeaKZJ_pGfaSiA" name="UML" desciption="The Unified Modeling Language" id="org.eclipse.papyrus.infra.services.edit.TypeContext" icon="platform:/plugin/org.eclipse.papyrus.uml.architecture/icons/uml.gif" creationCommandClass="org.eclipse.papyrus.uml.diagram.common.commands.CreateUMLModelCommand"> + <viewpoints xmi:id="_HQhf5sSYEeaKZJ_pGfaSiA" name="Software Analysis" desciption="A viewpoint allowing software analysis with UML" representationKinds="_yeY0sHDvEeWh-MssWmCB_A _zzf4gHDtEeWh-MssWmCB_A _zzf4cXDtEeWh-MssWmCB_A _Uz8agHDuEeWh-MssWmCB_A _WC1q0P4UEeSRsNBVzfUrzA _wXztQHDwEeWh-MssWmCB_A _P3J1cEr7EeSVGbM3cmVSqQ _P3J1cEr7EeSVGbM3cmVSqQ _P3J1cEr7EeRVGbM3cmVSqQ" id="org.eclipse.papyrus.uml.analysis"/> + <viewpoints xmi:id="_OOrIUMSZEeaKZJ_pGfaSiA" name="Software Design" desciption="A viewpoint allowing software design with UML" representationKinds="_UzcgsHDtEeWh-MssWmCB_A _zzf4gHDtEeWh-MssWmCB_A _jRtroHDuEeWh-MssWmCB_A _fa4kAHDuEeWh-MssWmCB_A _fa4kBHDuEeWh-MssWmCB_A _bKiwMHDuEeWh-MssWmCB_A _bKiwNHDuEeWh-MssWmCB_A _ARGokHDuEeWh-MssWmCB_A _zzf4YHDtEeWh-MssWmCB_A _FuMjYHDuEeWh-MssWmCB_A _zzf4cXDtEeWh-MssWmCB_A _TR15IHDvEeWh-MssWmCB_A _PwD0cHDvEeWh-MssWmCB_A _LzyMIHDvEeWh-MssWmCB_A _P3J1cEr7EeSVGbM3cmVSqQ _Uz8agHDuEeWh-MssWmCB_A _P3J1cEr7EeRVGbM3cmVSqQ _wXztQHDwEeWh-MssWmCB_A _WC1q0P4UEeSRsNBVzfUrzA _P3J1cEr7EeSVGbM3cmVSqQ _P3J1cEr7EeSVGbM3cmVSqQ" id="org.eclipse.papyrus.uml.design"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.emf/model/infra-emf.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/model/notation.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/model/gmfdiag-common.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.nattable/model/nattable-tablecontents.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.nattable/model/nattable-tablecontext.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.nattable.common/model/nattable-common.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.services.controlmode/model/controlmode.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.services.edit/model/marker.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.types.rulebased/model/rulebased.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.elementtypesconfigurations#_x8G0YGaNEeSyJIsxLao1Pw"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram-uml.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.elementtypesconfigurations#_tL86sLazEeSbnofizoRSMQ"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.interactionoverview/model/interactionOverviewDiagram.elementtypesconfigurations#_x8G0YGaNEeSyJIsxLao1Pw"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.sequence/model/sequencediagram-uml.elementtypesconfigurations#_BJMa0PyeEeWbo9Y7g2MLdw"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.elementtypesconfigurations#_wYwtMMeDEeSwP_9Vn5UnWg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.stereotype.edition/model/stereotype-edit.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram-uml.elementtypesconfigurations#_BJMa0PyeEeWbo9Y7g2MLdw"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/uml-containments.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/StandardProfile.elementtypesconfigurations#_jfoLkGT_EeSEqNuV3JpFCA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/umldi.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types.ui/model/uml-advice.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_UzcgsHDtEeWh-MssWmCB_A" name="Activity Diagram" concerns="_HQhf5MSYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.activity/icons/obj16/Diagram_Activity.gif" implementationID="PapyrusUMLActivityDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.activity.CreateActivityDiagramCommand"> + <modelRules xmi:id="_UzcgsXDtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Activity"/> + </modelRules> + <owningRules xmi:id="_UzcgsnDtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Activity"/> + </owningRules> + <owningRules xmi:id="_Uzcgs3DtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> + <newModelPath xmi:id="_UzcgtHDtEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_UzcgtXDtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> + <newModelPath xmi:id="_UzcgtnDtEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_Uzcgt3DtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + <newModelPath xmi:id="_UzcguHDtEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/> + </newModelPath> + </owningRules> + <childRules xmi:id="_UzcguXDtEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_zzf4gHDtEeWh-MssWmCB_A" name="Class Diagram" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.clazz/icons/obj16/Diagram_Class.gif" implementationID="PapyrusUMLClassDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand"> + <modelRules xmi:id="_zzf4gXDtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </modelRules> + <owningRules xmi:id="_zzf4gnDtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <childRules xmi:id="_zzf4g3DtEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_zzf4YHDtEeWh-MssWmCB_A" name="Inner Class Diagram" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.clazz/icons/obj16/Diagram_Class.gif" implementationID="PapyrusUMLClassDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand"> + <modelRules xmi:id="_zzf4YXDtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/> + </modelRules> + <owningRules xmi:id="_zzf4YnDtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/> + </owningRules> + <owningRules xmi:id="_zzf4Y3DtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <childRules xmi:id="_zzf4ZHDtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> + <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/> + <insertionPath xmi:id="_zzf4ZXDtEeWh-MssWmCB_A"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Class/nestedClassifier"/> + </insertionPath> + </childRules> + <childRules xmi:id="_zzf4ZnDtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Comment"/> + <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/> + <insertionPath xmi:id="_zzf4Z3DtEeWh-MssWmCB_A"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Element/ownedComment"/> + </insertionPath> + </childRules> + <paletteRules xmi:id="_zzf4aHDtEeWh-MssWmCB_A" element="clazz.tool.class"/> + <paletteRules xmi:id="_zzf4aXDtEeWh-MssWmCB_A" element="clazz.tool.comment"/> + <paletteRules xmi:id="_zzf4anDtEeWh-MssWmCB_A" element="clazz.tool.interface"/> + <paletteRules xmi:id="_zzf4a3DtEeWh-MssWmCB_A" element="clazz.tool.abstraction"/> + <paletteRules xmi:id="_zzf4bHDtEeWh-MssWmCB_A" element="clazz.tool.association"/> + <paletteRules xmi:id="_zzf4bXDtEeWh-MssWmCB_A" element="clazz.tool.generalization"/> + <paletteRules xmi:id="_zzf4bnDtEeWh-MssWmCB_A" element="clazz.tool.generalizationset"/> + <paletteRules xmi:id="_zzf4b3DtEeWh-MssWmCB_A" permit="false" element="clazz.tool.*"/> + <paletteRules xmi:id="_zzf4cHDtEeWh-MssWmCB_A" element=""/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_zzf4cXDtEeWh-MssWmCB_A" name="Package Diagram" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/icons/Diagram_Package.gif" implementationID="PapyrusUMLClassDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand"> + <modelRules xmi:id="_zzf4cnDtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </modelRules> + <owningRules xmi:id="_zzf4c3DtEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <childRules xmi:id="_zzf4dHDtEeWh-MssWmCB_A"/> + <paletteRules xmi:id="_zzf4dXDtEeWh-MssWmCB_A" element="clazz.tool.comment"/> + <paletteRules xmi:id="_zzf4dnDtEeWh-MssWmCB_A" element="clazz.tool.constraint"/> + <paletteRules xmi:id="_zzf4d3DtEeWh-MssWmCB_A" element="clazz.tool.model"/> + <paletteRules xmi:id="_zzf4eHDtEeWh-MssWmCB_A" element="clazz.tool.package"/> + <paletteRules xmi:id="_zzf4eXDtEeWh-MssWmCB_A" element="clazz.tool.abstraction"/> + <paletteRules xmi:id="_zzf4enDtEeWh-MssWmCB_A" element="clazz.tool.dependency"/> + <paletteRules xmi:id="_zzf4e3DtEeWh-MssWmCB_A" element="clazz.tool.packageimport"/> + <paletteRules xmi:id="_zzf4fHDtEeWh-MssWmCB_A" element="clazz.tool.link"/> + <paletteRules xmi:id="_zzf4fXDtEeWh-MssWmCB_A" element="clazz.tool.containmentlink"/> + <paletteRules xmi:id="_zzf4fnDtEeWh-MssWmCB_A" permit="false" element="clazz.tool.*"/> + <paletteRules xmi:id="_zzf4f3DtEeWh-MssWmCB_A" element=""/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_jRtroHDuEeWh-MssWmCB_A" name="Communication Diagram" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.communication/icons/obj16/Diagram_Communication.gif" implementationID="PapyrusUMLCommunicationDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.communication.CreateCommunicationDiagramCommand"> + <modelRules xmi:id="_jRtroXDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interaction"/> + </modelRules> + <owningRules xmi:id="_jRtronDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interaction"/> + </owningRules> + <owningRules xmi:id="_jRtro3DuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> + <newModelPath xmi:id="_jRtrpHDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_jRtrpXDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> + <newModelPath xmi:id="_jRtrpnDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_jRtrp3DuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + <newModelPath xmi:id="_jRtrqHDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/> + </newModelPath> + </owningRules> + <childRules xmi:id="_jRtrqXDuEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_fa4kAHDuEeWh-MssWmCB_A" name="Component Diagram" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.component/icons/obj16/ComponentDiagram.gif" implementationID="PapyrusUMLComponentDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.component.CreateComponentDiagramCommand"> + <modelRules xmi:id="_fa4kAXDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </modelRules> + <owningRules xmi:id="_fa4kAnDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <childRules xmi:id="_fa4kA3DuEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_fa4kBHDuEeWh-MssWmCB_A" name="Component Diagram" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.component/icons/obj16/ComponentDiagram.gif" implementationID="PapyrusUMLComponentDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.component.CreateComponentDiagramCommand"> + <modelRules xmi:id="_fa4kBXDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/> + </modelRules> + <owningRules xmi:id="_fa4kBnDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/> + </owningRules> + <owningRules xmi:id="_fa4kB3DuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <childRules xmi:id="_fa4kCHDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/> + <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/> + <insertionPath xmi:id="_fa4kCXDuEeWh-MssWmCB_A"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Class/nestedClassifier"/> + </insertionPath> + </childRules> + <childRules xmi:id="_fa4kCnDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Comment"/> + <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/> + <insertionPath xmi:id="_fa4kC3DuEeWh-MssWmCB_A"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Element/ownedComment"/> + </insertionPath> + </childRules> + <childRules xmi:id="_fa4kDHDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Constraint"/> + <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/> + <insertionPath xmi:id="_fa4kDXDuEeWh-MssWmCB_A"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Namespace/ownedRule"/> + </insertionPath> + </childRules> + <childRules xmi:id="_fa4kDnDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Port"/> + <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/> + <insertionPath xmi:id="_fa4kD3DuEeWh-MssWmCB_A"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//EncapsulatedClassifier/ownedPort"/> + </insertionPath> + </childRules> + <paletteRules xmi:id="_fa4kEHDuEeWh-MssWmCB_A" permit="false" element="component.tool.model"/> + <paletteRules xmi:id="_fa4kEXDuEeWh-MssWmCB_A" permit="false" element="component.tool.package"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_bKiwMHDuEeWh-MssWmCB_A" name="Composite Structure Diagram" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.composite/icons/obj16/Diagram_CompositeStructure.gif" implementationID="CompositeStructure" creationCommandClass="org.eclipse.papyrus.uml.diagram.composite.CreateCompositeDiagramCommand"> + <modelRules xmi:id="_bKiwMXDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </modelRules> + <owningRules xmi:id="_bKiwMnDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <childRules xmi:id="_bKiwM3DuEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_bKiwNHDuEeWh-MssWmCB_A" name="Composite Structure Diagram" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.composite/icons/obj16/Diagram_CompositeStructure.gif" implementationID="CompositeStructure" creationCommandClass="org.eclipse.papyrus.uml.diagram.composite.CreateCompositeDiagramCommand"> + <modelRules xmi:id="_bKiwNXDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//StructuredClassifier"/> + </modelRules> + <owningRules xmi:id="_bKiwNnDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//StructuredClassifier"/> + </owningRules> + <owningRules xmi:id="_bKiwN3DuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <childRules xmi:id="_bKiwOHDuEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_ARGokHDuEeWh-MssWmCB_A" name="Deployment Diagram" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.deployment/icons/obj16/DeploymentDiagram.gif" implementationID="PapyrusUMLDeploymentDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.deployment.CreateDeploymentDiagramCommand"> + <modelRules xmi:id="_ARGokXDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </modelRules> + <owningRules xmi:id="_ARGoknDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <childRules xmi:id="_ARGok3DuEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_FuMjYHDuEeWh-MssWmCB_A" name="Interaction Overview Diagram" concerns="_HQhf5MSYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.interactionoverview/icons/obj16/interactionOverviewDiagram.gif" implementationID="PapyrusUMLInteractionOverviewDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramCreateCommand"> + <modelRules xmi:id="_FuMjYXDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Activity"/> + </modelRules> + <owningRules xmi:id="_FuMjYnDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Activity"/> + </owningRules> + <owningRules xmi:id="_FuMjY3DuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> + <newModelPath xmi:id="_FuMjZHDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_FuMjZXDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> + <newModelPath xmi:id="_FuMjZnDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_FuMjZ3DuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + <newModelPath xmi:id="_FuMjaHDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/> + </newModelPath> + </owningRules> + <childRules xmi:id="_FuMjaXDuEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_UekVgHDwEeWh-MssWmCB_A" name="Profile Diagram" concerns="_NxfRgMSjEeaCPPhpB0_9OQ" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.profile/icons/obj16/Diagram_Profile.gif" implementationID="PapyrusUMLProfileDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.profile.CreateProfileDiagramCommand"> + <modelRules xmi:id="_UekVgXDwEeWh-MssWmCB_A"> + <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_UekVgnDwEeWh-MssWmCB_A" name="IsContainedByProfile"> + <constraintType href="platform:/plugin/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi#//@constraintTypes.4"/> + <properties xsi:type="constraints:ValueProperty" xmi:id="_UekVg3DwEeWh-MssWmCB_A" name="className" value="org.eclipse.papyrus.infra.viewpoints.policy.query.IsContainedByProfileQuery"/> + </constraints> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </modelRules> + <owningRules xmi:id="_UekVhHDwEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <owningRules xmi:id="_UekVhXDwEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Profile"/> + </owningRules> + <childRules xmi:id="_UekVhnDwEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_TR15IHDvEeWh-MssWmCB_A" name="Sequence Diagram" concerns="_HQhf5MSYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.sequence/icons/obj16/Diagram_Sequence.gif" implementationID="PapyrusUMLSequenceDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.sequence.CreateSequenceDiagramCommand"> + <modelRules xmi:id="_TR15IXDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interaction"/> + </modelRules> + <owningRules xmi:id="_TR15InDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interaction"/> + </owningRules> + <owningRules xmi:id="_TR15I3DvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> + <newModelPath xmi:id="_TR15JHDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_TR15JXDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> + <newModelPath xmi:id="_TR15JnDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_TR15J3DvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + <newModelPath xmi:id="_TR15KHDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_TR15KXDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//UseCase"/> + <newModelPath xmi:id="_TR15KnDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/> + </newModelPath> + </owningRules> + <childRules xmi:id="_TR15K3DvEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_PwD0cHDvEeWh-MssWmCB_A" name="State Machine Diagram" concerns="_HQhf5MSYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.statemachine/icons/obj16/Diagram_StateMachine.gif" implementationID="PapyrusUMLStateMachineDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.statemachine.CreateStateMachineDiagramCommand"> + <modelRules xmi:id="_PwD0cXDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//StateMachine"/> + </modelRules> + <modelRules xmi:id="_H-oCgB0UEea_bcpknMJ7-w"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//State"/> + </modelRules> + <owningRules xmi:id="_PwD0cnDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//StateMachine"/> + </owningRules> + <owningRules xmi:id="_PwD0c3DvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> + <newModelPath xmi:id="_PwD0dHDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.StateMachine"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_PwD0dXDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> + <newModelPath xmi:id="_PwD0dnDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.StateMachine"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_PwD0d3DvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + <newModelPath xmi:id="_PwD0eHDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.StateMachine"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_PwD0eXDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interface"/> + <newModelPath xmi:id="_PwD0enDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.ProtocolStateMachine"> + <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Interface/protocol"/> + </newModelPath> + </owningRules> + <owningRules xmi:id="_5kmMcB0UEea_bcpknMJ7-w"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//State"/> + </owningRules> + <childRules xmi:id="_PwD0e3DvEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_LzyMIHDvEeWh-MssWmCB_A" name="Timing Diagram" concerns="_HQhf5MSYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.timing/icons/obj16/Diagram_Timing.gif" implementationID="PapyrusUMLTimingDiagram" creationCommandClass="org.eclipse.papyrus.uml.diagram.timing.custom.CreateTimingDiagramCommand"> + <modelRules xmi:id="_LzyMIXDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </modelRules> + <owningRules xmi:id="_LzyMInDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <childRules xmi:id="_LzyMI3DvEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="gmfdiagrepresentation:PapyrusDiagram" xmi:id="_yeY0sHDvEeWh-MssWmCB_A" name="Use Case Diagram" concerns="_HQhf4sSYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.usecase/icons/obj16/Diagram_UseCase.gif" implementationID="UseCase" customStyle="platform:/plugin/org.eclipse.papyrus.uml.diagram.usecase/models/usecase.css" creationCommandClass="org.eclipse.papyrus.uml.diagram.usecase.CreateUseCaseDiagramCommand"> + <modelRules xmi:id="_yeY0sXDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </modelRules> + <modelRules xmi:id="_yeY0snDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/> + </modelRules> + <owningRules xmi:id="_yeY0s3DvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <owningRules xmi:id="_yeY0tHDvEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/> + </owningRules> + <childRules xmi:id="_yeY0tXDvEeWh-MssWmCB_A"/> + </representationKinds> + <representationKinds xsi:type="nattablerepresentation:PapyrusSyncTable" xmi:id="_P3J1cEr7EeSVGbM3cmVSqQ" name="Generic Tree Table" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.nattable/icons/uml_generic_table.png" implementationID="PapyrusUMLGenericTreeTable"> + <modelRules xmi:id="_vZwgkEr7EeSVGbM3cmVSqQ"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> + </modelRules> + <owningRules xmi:id="_vZwgkUr7EeSVGbM3cmVSqQ"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> + </owningRules> + </representationKinds> + <representationKinds xsi:type="nattablerepresentation:PapyrusSyncTable" xmi:id="_P3J1cEr7EeRVGbM3cmVSqQ" name="Class Tree Table" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/icons/uml_generic_table.png" implementationID="PapyrusClassTreeTable"> + <modelRules xmi:id="_vZwgkEr7EeSVGbM3cmVSqQ"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </modelRules> + <owningRules xmi:id="_vZwgkUr7EeSVGbM3cmVSqQ"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + </representationKinds> + <representationKinds xsi:type="nattablerepresentation:PapyrusSyncTable" xmi:id="_Uz8agHDuEeWh-MssWmCB_A" name="Generic Table" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/icons/uml_generic_table.png" implementationID="PapyrusGenericTable"> + <modelRules xmi:id="_Uz8agXDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> + </modelRules> + <owningRules xmi:id="_Uz8agnDuEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> + </owningRules> + </representationKinds> + <representationKinds xsi:type="nattablerepresentation:PapyrusSyncTable" xmi:id="_WC1q0P4UEeSRsNBVzfUrzA" name="Stereotype Display Tree Table" concerns="_NxfRgMSjEeaCPPhpB0_9OQ" icon="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/icons/uml_generic_table.png" implementationID="PapyrusStereotypeDisplayTreeTable"> + <modelRules xmi:id="_7k79wP4VEeSRsNBVzfUrzA"> + <element href="http://www.eclipse.org/gmf/runtime/1.0.2/notation#//View"/> + </modelRules> + <owningRules xmi:id="_AJmbwP4WEeSRsNBVzfUrzA"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> + </owningRules> + </representationKinds> + <representationKinds xsi:type="nattablerepresentation:PapyrusSyncTable" xmi:id="_wXztQHDwEeWh-MssWmCB_A" name="View Table" concerns="_HQhf48SYEeaKZJ_pGfaSiA" icon="platform:/plugin/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.png" implementationID="PapyrusViewsTable"> + <modelRules xmi:id="_wXztQXDwEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> + </modelRules> + <owningRules xmi:id="_wXztQnDwEeWh-MssWmCB_A"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/> + </owningRules> + </representationKinds> + <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/> + </contexts> + <contexts xsi:type="architecture:ArchitectureFramework" xmi:id="__ZqwAMSlEeaCPPhpB0_9OQ" name="Profile" desciption="The Profile Definition Framework" id="org.eclipse.papyrus.uml.architecture.Profile" icon="platform:/plugin/org.eclipse.papyrus.uml.architecture/icons/profile.gif" extensionPrefix="profile" creationCommandClass="org.eclipse.papyrus.uml.diagram.profile.CreateProfileModelCommand"> + <viewpoints xmi:id="_hoXx0MSiEeaKZJ_pGfaSiA" name="Profile Definition" desciption="A viewpoint allowing profile definition with UML" representationKinds="_UekVgHDwEeWh-MssWmCB_A _zzf4gHDtEeWh-MssWmCB_A" id="org.eclipse.papyrus.uml.profile.definition"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.emf/model/infra-emf.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/model/notation.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.gmfdiag.common/model/gmfdiag-common.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.services.controlmode/model/controlmode.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.services.edit/model/marker.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.infra.types.rulebased/model/rulebased.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.elementtypesconfigurations#_rWI4YHPzEeSnGJwaJWHCSg"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.diagram.stereotype.edition/model/stereotype-edit.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/uml.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/uml-containments.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/StandardProfile.elementtypesconfigurations#_jfoLkGT_EeSEqNuV3JpFCA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types/model/umldi.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + <elementTypes href="platform:/plugin/org.eclipse.papyrus.uml.service.types.ui/model/uml-advice.elementtypesconfigurations#_ScP1oFYCEeS0WsAAtVmToA"/> + </contexts> +</architecture:ArchitectureDomain> diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/plugin.properties b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/plugin.properties new file mode 100644 index 00000000000..ac94a7f7681 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/plugin.properties @@ -0,0 +1,14 @@ +# Copyright (c) 2017 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: +# Maged Elaasar - Initial API and implementation +# +# + +pluginName = UML Architecture +providerName=Eclipse Modeling Project diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/plugin.xml b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/plugin.xml new file mode 100644 index 00000000000..1be64e8b3e9 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/plugin.xml @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + + <extension + point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings"> + <clientContext + id="org.eclipse.papyrus.uml.architecture.Profile"> + <matcher + class="org.eclipse.papyrus.uml.architecture.internal.NoContextEnablementMatcher"> + </matcher> + </clientContext> + <binding context="org.eclipse.papyrus.uml.architecture.Profile"> + <!-- ElementType that deals with View deletion when their related model element is deleted --> + <elementType ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/> + <elementType ref="org.eclipse.gmf.runtime.diagram.core.advice.removeBookmarks"/> + <!-- Check for attempts to edit read-only objects that cannot reasonably be made writeable. --> + <advice ref="org.eclipse.papyrus.infra.emf.readOnlyAdvice" /> + <!-- Delete markers attached to objects being deleted. --> + </binding> + </extension> + + <extension point="org.eclipse.papyrus.infra.architecture.models"> + <model path="model/uml.architecture"/> + </extension> + + <extension + point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> + <diagramReconciler + diagramType="PapyrusUMLActivityDiagram" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="PapyrusUMLClassDiagram" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="PapyrusUMLCommunicationDiagram" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="PapyrusUMLComponentDiagram" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="CompositeStructure" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="PapyrusUMLDeploymentDiagram" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="PapyrusUMLInteractionOverviewDiagram" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="PapyrusUMLProfileDiagram" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="PapyrusUMLSequenceDiagram" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="PapyrusUMLStateMachineDiagram" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="PapyrusUMLTimingDiagram" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="UseCase" + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLDiagramReconciler_1_3_0" + source="1.2.0" + target="1.3.0"> + </diagramReconciler> + </extension> + + <extension + point="org.eclipse.papyrus.infra.nattable.common.tableReconciler"> + <tableReconciler + reconcilerClass="org.eclipse.papyrus.uml.architecture.migration.UMLTableReconciler_1_3_0" + source="1.0.0" + target="1.3.0"> + </tableReconciler> + </extension> + +</plugin> + diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/pom.xml b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/pom.xml new file mode 100644 index 00000000000..b0958eef33b --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/pom.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.eclipse.papyrus</groupId> + <artifactId>org.eclipse.papyrus.uml-architecture</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <artifactId>org.eclipse.papyrus.uml.architecture</artifactId> + <version>1.0.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project>
\ No newline at end of file diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/UMLArchitectureContextIds.java b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/UMLArchitectureContextIds.java new file mode 100644 index 00000000000..1483f541d9f --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/UMLArchitectureContextIds.java @@ -0,0 +1,31 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * 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: + * Maged Elaasar - Initial API and Implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.architecture; + +/** + * The ids of UML-related architecture contexts + * + * @since 1.0 + */ +public class UMLArchitectureContextIds { + + /** + * The id of the UML architecture context + */ + public static final String UML = "org.eclipse.papyrus.infra.services.edit.TypeContext"; //$NON-NLS-1$ + + /** + * The id of the Profile architecture context + */ + public static final String Profile = "org.eclipse.papyrus.uml.architecture.Profile"; //$NON-NLS-1$ +} diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/internal/NoContextEnablementMatcher.java b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/internal/NoContextEnablementMatcher.java new file mode 100644 index 00000000000..0125bb33134 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/internal/NoContextEnablementMatcher.java @@ -0,0 +1,29 @@ +/***************************************************************************** + * Copyright (c) 2017 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: + * + * Maged Elaasar - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.architecture.internal; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.emf.type.core.IElementMatcher; + +/** + * A no context matcher used to register element type bindings in the extension points + */ +public class NoContextEnablementMatcher implements IElementMatcher { + + @Override + public boolean matches(EObject eObject) { + return false; + } +} diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/migration/UMLDiagramReconciler_1_3_0.java b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/migration/UMLDiagramReconciler_1_3_0.java new file mode 100644 index 00000000000..a893e60d2d4 --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/migration/UMLDiagramReconciler_1_3_0.java @@ -0,0 +1,101 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * 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: + * Maged Elaasar - Initial API and Implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.architecture.migration; + +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.core.architecture.RepresentationKind; +import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureDescriptionLanguage; +import org.eclipse.papyrus.infra.architecture.ArchitectureDomainManager; +import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler_1_3_0; +import org.eclipse.papyrus.infra.gmfdiag.representation.PapyrusDiagram; +import org.eclipse.papyrus.infra.viewpoints.style.PapyrusViewStyle; +import org.eclipse.papyrus.uml.architecture.UMLArchitectureContextIds; + +/** + * UML Diagram Reconciler from 1.2.0 to 1.3.0 that switches the old PapyrusViewStyle by + * the new PapyrusDiagramStyle + */ +public class UMLDiagramReconciler_1_3_0 extends DiagramReconciler_1_3_0 { + + private static final String ACTIVITY_DIAGRAM = "PapyrusUMLActivityDiagram"; + private static final String CLASS_DIAGRAM = "PapyrusUMLClassDiagram"; + private static final String COMMUNICATION_DIAGRAM = "PapyrusUMLCommunicationDiagram"; + private static final String COMPONENT_DIAGRAM = "PapyrusUMLComponentDiagram"; + private static final String COMPOSITE_STRUCTURE_DIAGRAM = "CompositeStructure"; + private static final String DEPLOYMENT_DIAGRAM = "PapyrusUMLDeploymentDiagram"; + private static final String INTERACTION_OVERVIEW_DIAGRAM = "PapyrusUMLInteractionOverviewDiagram"; + private static final String PROFILE_DIAGRAM = "PapyrusUMLProfileDiagram"; + private static final String SEQUENCE_DIAGRAM = "PapyrusUMLSequenceDiagram"; + private static final String STATE_MACHINE_DIAGRAM = "PapyrusUMLStateMachineDiagram"; + private static final String TIMING_DIAGRAM = "PapyrusUMLTimingDiagram"; + private static final String USE_CASE_DIAGRAM = "UseCase"; + + /** + * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler_1_3_0#getPapyrusDiagram(org.eclipse.papyrus.infra.viewpoints.style.PapyrusViewStyle) + * + * @param oldStyle + * @return + */ + @Override + protected PapyrusDiagram getDiagramKind(Diagram diagram, PapyrusViewStyle oldStyle) { + if (oldStyle != null) { + org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusDiagram oldDiagramKind = + (org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusDiagram) oldStyle.getConfiguration(); + if (oldDiagramKind != null) + return getDiagramKind(oldDiagramKind.getName(), diagram); + } + if (ACTIVITY_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Activity Diagram", diagram); + } else if (CLASS_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Class Diagram", diagram); + } else if (COMMUNICATION_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Communication Diagram", diagram); + } else if (COMPONENT_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Component Diagram", diagram); + } else if (COMPOSITE_STRUCTURE_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Composite Structure Diagram", diagram); + } else if (DEPLOYMENT_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Deployment Diagram", diagram); + } else if (INTERACTION_OVERVIEW_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Interaction Overview Diagram", diagram); + } else if (PROFILE_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Profile Diagram", diagram); + } else if (SEQUENCE_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Sequence Diagram", diagram); + } else if (STATE_MACHINE_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("State Machine Diagram", diagram); + } else if (TIMING_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Timing Diagram", diagram); + } else if (USE_CASE_DIAGRAM.equals(diagram.getType())) { + return getDiagramKind("Use Case Diagram", diagram); + } + return null; + } + + /** + * Gets the diagram kind that matches given name and that supports the given diagram + */ + protected PapyrusDiagram getDiagramKind(String name, Diagram diagram) { + ArchitectureDomainManager manager = ArchitectureDomainManager.getInstance(); + MergedArchitectureDescriptionLanguage context = (MergedArchitectureDescriptionLanguage) manager.getArchitectureContextById(UMLArchitectureContextIds.UML); + for(RepresentationKind pKind : context.getRepresentationKinds()) { + if (pKind.getName().equals(name)) { + PapyrusDiagram dKind = (PapyrusDiagram) pKind; + if (dKind.getModelRules().get(0).getElement().isInstance(diagram.getElement())) { + return dKind; + } + } + } + return null; + } +} diff --git a/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/migration/UMLTableReconciler_1_3_0.java b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/migration/UMLTableReconciler_1_3_0.java new file mode 100644 index 00000000000..591b999edbd --- /dev/null +++ b/plugins/uml/architecture/org.eclipse.papyrus.uml.architecture/src/org/eclipse/papyrus/uml/architecture/migration/UMLTableReconciler_1_3_0.java @@ -0,0 +1,127 @@ +/***************************************************************************** + * Copyright (c) 2017 CEA LIST and others. + * + * 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: + * Maged Elaasar - Initial API and Implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.architecture.migration; + +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.AbstractCommand; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.papyrus.infra.core.architecture.RepresentationKind; +import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureDescriptionLanguage; +import org.eclipse.papyrus.infra.nattable.representation.PapyrusSyncTable; +import org.eclipse.papyrus.infra.architecture.ArchitectureDomainManager; +import org.eclipse.papyrus.infra.nattable.common.reconciler.TableReconciler; +import org.eclipse.papyrus.infra.nattable.model.nattable.Table; +import org.eclipse.papyrus.uml.architecture.UMLArchitectureContextIds; + +/** + * UML Table Reconciler from 1.0.0 to 1.3.0 that replaces the old prototype value for tables + * with ones based on table kinds + */ +public class UMLTableReconciler_1_3_0 extends TableReconciler { + + private static final String VIEW_TABLE = "View Table"; + private static final String GENERIC_TREE_TABLE = "Generic Tree Table"; + private static final String CLASS_TREE_TABLE = "ClassTreeTable"; + private static final String GENERIC_TABLE = "Generic Table"; + private static final String STEREO_DISPLAY_TREE_TABLE = "StereotypeDisplayTreeTable"; + + @Override + public ICommand getReconcileCommand(Table table) { + if (table.getPrototype() instanceof org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusView) { + org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusView oldTableKind = + (org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusView) table.getPrototype(); + + RepresentationKind newTableKind = null; + if (oldTableKind != null) { + if (VIEW_TABLE.equals(oldTableKind.getName())) { + newTableKind = getSyncTableKind(oldTableKind.getName(), table); + } else if (GENERIC_TREE_TABLE.equals(oldTableKind.getName())) { + newTableKind = getSyncTableKind(oldTableKind.getName(), table); + } else if (CLASS_TREE_TABLE.equals(oldTableKind.getName())) { + newTableKind = getSyncTableKind("Class Tree Table", table); + } else if (GENERIC_TABLE.equals(oldTableKind.getName())) { + newTableKind = getSyncTableKind(oldTableKind.getName(), table); + } else if (STEREO_DISPLAY_TREE_TABLE.equals(oldTableKind.getName())) { + newTableKind = getSyncTableKind("Stereotype Display Tree Table", table); + } else if (oldTableKind.getName() == null) { + newTableKind = getSyncTableKind(GENERIC_TABLE, table); + } + }; + + if (newTableKind != null) + return new ReplaceTablePrototypeCommand(table, newTableKind); + } + return null; + } + + /** + * Get a sync table that matches the given name and that supports the given table + */ + protected PapyrusSyncTable getSyncTableKind(String name, Table table) { + ArchitectureDomainManager manager = ArchitectureDomainManager.getInstance(); + MergedArchitectureDescriptionLanguage context = (MergedArchitectureDescriptionLanguage) manager.getArchitectureContextById(UMLArchitectureContextIds.UML); + for(RepresentationKind pKind : context.getRepresentationKinds()) { + if (pKind.getName().equals(name)) { + PapyrusSyncTable tKind = (PapyrusSyncTable) pKind; + if (tKind.getModelRules().get(0).getElement().isInstance(table.getContext())) { + return tKind; + } + } + } + return null; + } + + /** + * A command to replace the old table prototype with the new representation kinds + */ + protected class ReplaceTablePrototypeCommand extends AbstractCommand { + + private Table table; + private RepresentationKind newKind; + + public ReplaceTablePrototypeCommand(Table table, RepresentationKind newKind) { + super("Replace the papyrus view style from 1.0.0 to 1.3.0"); + this.table = table; + this.newKind = newKind; + } + + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + table.setPrototype(newKind); + return CommandResult.newOKCommandResult(); + } + + @Override + public boolean canUndo() { + return false; + } + + @Override + public boolean canRedo() { + return false; + } + + @Override + protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + throw new ExecutionException("Should not be called, canRedo false"); //$NON-NLS-1$ + } + + @Override + protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { + throw new ExecutionException("Should not be called, canUndo false"); //$NON-NLS-1$ + } + } +} diff --git a/plugins/uml/architecture/pom.xml b/plugins/uml/architecture/pom.xml new file mode 100644 index 00000000000..24cea77f8cc --- /dev/null +++ b/plugins/uml/architecture/pom.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<project> + <modelVersion>4.0.0</modelVersion> + <artifactId>org.eclipse.papyrus.uml-architecture</artifactId> + <packaging>pom</packaging> + <parent> + <groupId>org.eclipse.papyrus</groupId> + <artifactId>org.eclipse.papyrus.uml</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + <name>Papyrus UML Architecture</name> + <description>Papyrus UML architecture contexts.</description> + + <modules> + <module>org.eclipse.papyrus.uml.architecture</module> + </modules> +</project> diff --git a/plugins/uml/assistants/org.eclipse.papyrus.uml.profile.types.generator.ui/src/org/eclipse/papyrus/uml/profile/types/generator/ui/internal/wizards/BaseElementTypeSetBlock.java b/plugins/uml/assistants/org.eclipse.papyrus.uml.profile.types.generator.ui/src/org/eclipse/papyrus/uml/profile/types/generator/ui/internal/wizards/BaseElementTypeSetBlock.java index c2258bf4ae6..2205febf5cb 100644 --- a/plugins/uml/assistants/org.eclipse.papyrus.uml.profile.types.generator.ui/src/org/eclipse/papyrus/uml/profile/types/generator/ui/internal/wizards/BaseElementTypeSetBlock.java +++ b/plugins/uml/assistants/org.eclipse.papyrus.uml.profile.types.generator.ui/src/org/eclipse/papyrus/uml/profile/types/generator/ui/internal/wizards/BaseElementTypeSetBlock.java @@ -28,6 +28,8 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StyledString; import org.eclipse.osgi.util.NLS; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.services.edit.context.TypeContext; import org.eclipse.papyrus.infra.types.ElementTypeSetConfiguration; import org.eclipse.papyrus.infra.types.core.registries.ElementTypeSetConfigurationRegistry; import org.eclipse.papyrus.uml.profile.types.generator.ui.internal.Activator; @@ -59,8 +61,6 @@ class BaseElementTypeSetBlock { private static final String UML_ELEMENT_TYPE_SET = "org.eclipse.papyrus.uml.service.types.UMLElementTypeSet"; //$NON-NLS-1$ - private static final String CONTEXT_ID = "org.eclipse.papyrus.infra.services.edit.TypeContext"; - private final GeneratorWizardModel model; private final BiMap<String, ElementTypeSetConfiguration> elementTypeSets; @@ -69,7 +69,14 @@ class BaseElementTypeSetBlock { super(); this.model = model; - this.elementTypeSets = HashBiMap.create(ElementTypeSetConfigurationRegistry.getInstance().getElementTypeSetConfigurations().get(CONTEXT_ID)); + + String clientContextId = ""; + try { + clientContextId = TypeContext.getDefaultContext().getId(); + } catch (ServiceException e) { + Activator.log.error(e); + } + this.elementTypeSets = HashBiMap.create(ElementTypeSetConfigurationRegistry.getInstance().getElementTypeSetConfigurations().get(clientContextId)); } public void createControl(Composite parent) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/build.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/build.properties index 2e3d8ccd1c8..2043598e7aa 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/build.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/build.properties @@ -11,7 +11,6 @@ bin.includes = .,\ about.html,\ custom-messages.properties,\ model/activityDiagram.elementtypesconfigurations,\ - model/activityDiagram.configuration,\ css/ jars.compile.order=. src.includes = about.html diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/migration/ActivityReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/migration/ActivityReconcilerForCompartment_1_2_0.java index dc44870c50f..b4e68d60a2e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/migration/ActivityReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/migration/ActivityReconcilerForCompartment_1_2_0.java @@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Class Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class ActivityReconcilerForCompartment extends ReconcilerForCompartment { +public class ActivityReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String ActivityActivityParametersCompartmentEditPart_VISUAL_ID = "7001"; private static final String ActivityActivityPreConditionsCompartmentEditPart_VISUAL_ID = "7002"; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/migration/ActivityReconciler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/migration/ActivityReconciler_1_1_0.java index af620dd4054..751629b38fe 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/migration/ActivityReconciler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/custom-src/org/eclipse/papyrus/uml/diagram/activity/migration/ActivityReconciler_1_1_0.java @@ -1,166 +1,166 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2015 CEA LIST and others.
- *
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.migration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand;
-import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler;
-
-/**
- * Activity Diagram Reconciler from 1.0.0 to 1.1.0
- */
-public class ActivityReconciler extends DiagramReconciler {
-
- private final static String AcceptEventActionEditPart_VISUAL_ID = "3063";
- private final static String AcceptEventActionFloatingNameEditPart_VISUAL_ID = "6040";
- private final static String ActivityFinalNodeEditPart_VISUAL_ID = "3005";
- private final static String ActivityFinalNodeFloatingNameEditPart_VISUAL_ID = "5081";
- private final static String ActivityPartitionEditPart_VISUAL_ID = "3067";
- private final static String ActivityPartitionFloatingNameEditPart_VISUAL_ID = "6016";
- private final static String AddStructuralFeatureValueActionEditPart_VISUAL_ID = "3091";
- private final static String AddStructuralFeatureValueActionFloatingNameEditPart_VISUAL_ID = "6019";
- private final static String AddVariableValueActionEditPart_VISUAL_ID = "3099";
- private final static String AddVariableValueActionFloatingNameEditPart_VISUAL_ID = "6018";
- private final static String BroadcastSignalActionEditPart_VISUAL_ID = "3102";
- private final static String BroadcastSignalActionFloatingNameEditPart_VISUAL_ID = "6017";
- private final static String CallBehaviorActionEditPart_VISUAL_ID = "3008";
- private final static String CallBehaviorActionFloatingNameEditPart_VISUAL_ID = "6029";
- private final static String CallOperationActionEditPart_VISUAL_ID = "3010";
- private final static String CallOperationActionFloatingNameEditPart_VISUAL_ID = "6020";
- private final static String CentralBufferNodeEditPart_VISUAL_ID = "3104";
- private final static String CentralBufferNodeFloatingNameEditPart_VISUAL_ID = "6030";
- private final static String ClearAssociationActionEditPart_VISUAL_ID = "3119";
- private final static String ClearAssociationActionFloatingNameEditPart_VISUAL_ID = "5400";
- private final static String ClearStructuralFeatureActionEditPart_VISUAL_ID = "3115";
- private final static String ClearStructuralFeatureActionFloatingNameEditPart_VISUAL_ID = "5396";
- private final static String CreateLinkActionEditPart_VISUAL_ID = "3117";
- private final static String CreateLinkActionFloatingNameEditPart_VISUAL_ID = "5397";
- private final static String CreateLinkObjectActionEditPart_VISUAL_ID = "3198";
- private final static String CreateLinkObjectActionFloatingNameEditPart_VISUAL_ID = "5407";
- private final static String CreateObjectActionEditPart_VISUAL_ID = "3086";
- private final static String CreateObjectActionFloatingNameEditPart_VISUAL_ID = "6024";
- private final static String DataStoreNodeEditPart_VISUAL_ID = "3078";
- private final static String DataStoreNodeFloatingNameEditPart_VISUAL_ID = "6031";
- private final static String DecisionNodeEditPart_VISUAL_ID = "3038";
- private final static String DecisionNodeFloatingNameEditPart_VISUAL_ID = "6036";
- private final static String DestroyLinkActionEditPart_VISUAL_ID = "3118";
- private final static String DestroyLinkActionFloatingNameEditPart_VISUAL_ID = "5399";
- private final static String DestroyObjectActionEditPart_VISUAL_ID = "3095";
- private final static String DestroyObjectActionFloatingNameEditPart_VISUAL_ID = "6022";
- private final static String FlowFinalNodeEditPart_VISUAL_ID = "3006";
- private final static String FlowFinalNodeFloatingNameEditPart_VISUAL_ID = "6035";
- private final static String ForkNodeEditPart_VISUAL_ID = "3040";
- private final static String ForkNodeFloatingNameEditPart_VISUAL_ID = "6038";
- private final static String InitialNodeEditPart_VISUAL_ID = "3004";
- private final static String InitialNodeFloatingNameEditPart_VISUAL_ID = "6034";
- private final static String JoinNodeEditPart_VISUAL_ID = "3041";
- private final static String JoinNodeFloatingNameEditPart_VISUAL_ID = "6039";
- private final static String MergeNodeEditPart_VISUAL_ID = "3039";
- private final static String MergeNodeFloatingNameEditPart_VISUAL_ID = "6037";
- private final static String OpaqueActionEditPart_VISUAL_ID = "3007";
- private final static String OpaqueActionFloatingNameEditPart_VISUAL_ID = "6028";
- private final static String ReadExtentActionEditPart_VISUAL_ID = "3120";
- private final static String ReadExtentActionFloatingNameEditPart_VISUAL_ID = "5402";
- private final static String ReadIsClassifiedObjectActionEditPart_VISUAL_ID = "3122";
- private final static String ReadIsClassifiedObjectActionFloatingNameEditPart_VISUAL_ID = "5403";
- private final static String ReadLinkActionEditPart_VISUAL_ID = "3116";
- private final static String ReadLinkActionFloatingNameEditPart_VISUAL_ID = "5398";
- private final static String ReadSelfActionEditPart_VISUAL_ID = "3081";
- private final static String ReadSelfActionFloatingNameEditPart_VISUAL_ID = "6025";
- private final static String ReadStructuralFeatureActionEditPart_VISUAL_ID = "3088";
- private final static String ReadStructuralFeatureActionFloatingNameEditPart_VISUAL_ID = "6023";
- private final static String ReadVariableActionEditPart_VISUAL_ID = "3097";
- private final static String ReadVariableActionFloatingNameEditPart_VISUAL_ID = "6021";
- private final static String ReclassifyObjectActionEditPart_VISUAL_ID = "3221";
- private final static String ReclassifyObjectActionFloatingNameEditPart_VISUAL_ID = "5401";
- private final static String ReduceActionEditPart_VISUAL_ID = "3123";
- private final static String ReduceActionFloatingNameEditPart_VISUAL_ID = "5404";
- private final static String SendObjectActionEditPart_VISUAL_ID = "3042";
- private final static String SendObjectActionFloatingNameEditPart_VISUAL_ID = "6027";
- private final static String SendSignalActionEditPart_VISUAL_ID = "3052";
- private final static String SendSignalActionFloatingNameEditPart_VISUAL_ID = "6032";
- private final static String StartClassifierBehaviorActionEditPart_VISUAL_ID = "3124";
- private final static String StartClassifierBehaviorActionFloatingNameEditPart_VISUAL_ID = "5405";
- private final static String StartObjectBehavoiurActionEditPart_VISUAL_ID = "3113";
- private final static String StartObjectBehaviorActionFloatingNameEditPart_VISUAL_ID = "5394";
- private final static String TestIdentityActionEditPart_VISUAL_ID = "3114";
- private final static String TestIdentityActionFloatingNameEditPart_VISUAL_ID = "5395";
- private final static String ValueSpecificationActionEditPart_VISUAL_ID = "3076";
- private final static String ValueSpecificationActionFloatingNameEditPart_VISUAL_ID = "6026";
-
- /**
- * Gets the reconcile command.
- *
- * @param diagram
- * the diagram
- * @return the reconcile command
- * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram)
- */
- @Override
- public ICommand getReconcileCommand(Diagram diagram) {
- return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap());
- }
-
- /**
- * Gets the floating label map to add.
- *
- * @return the floating label map
- */
- private Map<String, String> getFloatingLabelMap() {
- Map<String, String> map = new HashMap<String, String>();
- map.put(AcceptEventActionEditPart_VISUAL_ID, AcceptEventActionFloatingNameEditPart_VISUAL_ID);
- map.put(ActivityFinalNodeEditPart_VISUAL_ID, ActivityFinalNodeFloatingNameEditPart_VISUAL_ID);
- map.put(ActivityPartitionEditPart_VISUAL_ID, ActivityPartitionFloatingNameEditPart_VISUAL_ID);
- map.put(AddStructuralFeatureValueActionEditPart_VISUAL_ID, AddStructuralFeatureValueActionFloatingNameEditPart_VISUAL_ID);
- map.put(AddVariableValueActionEditPart_VISUAL_ID, AddVariableValueActionFloatingNameEditPart_VISUAL_ID);
- map.put(BroadcastSignalActionEditPart_VISUAL_ID, BroadcastSignalActionFloatingNameEditPart_VISUAL_ID);
- map.put(CallBehaviorActionEditPart_VISUAL_ID, CallBehaviorActionFloatingNameEditPart_VISUAL_ID);
- map.put(CallOperationActionEditPart_VISUAL_ID, CallOperationActionFloatingNameEditPart_VISUAL_ID);
- map.put(CentralBufferNodeEditPart_VISUAL_ID, CentralBufferNodeFloatingNameEditPart_VISUAL_ID);
- map.put(ClearAssociationActionEditPart_VISUAL_ID, ClearAssociationActionFloatingNameEditPart_VISUAL_ID);
- map.put(ClearStructuralFeatureActionEditPart_VISUAL_ID, ClearStructuralFeatureActionFloatingNameEditPart_VISUAL_ID);
- map.put(CreateLinkActionEditPart_VISUAL_ID, CreateLinkActionFloatingNameEditPart_VISUAL_ID);
- map.put(CreateLinkObjectActionEditPart_VISUAL_ID, CreateLinkObjectActionFloatingNameEditPart_VISUAL_ID);
- map.put(CreateObjectActionEditPart_VISUAL_ID, CreateObjectActionFloatingNameEditPart_VISUAL_ID);
- map.put(DataStoreNodeEditPart_VISUAL_ID, DataStoreNodeFloatingNameEditPart_VISUAL_ID);
- map.put(DecisionNodeEditPart_VISUAL_ID, DecisionNodeFloatingNameEditPart_VISUAL_ID);
- map.put(DestroyLinkActionEditPart_VISUAL_ID, DestroyLinkActionFloatingNameEditPart_VISUAL_ID);
- map.put(DestroyObjectActionEditPart_VISUAL_ID, DestroyObjectActionFloatingNameEditPart_VISUAL_ID);
- map.put(FlowFinalNodeEditPart_VISUAL_ID, FlowFinalNodeFloatingNameEditPart_VISUAL_ID);
- map.put(ForkNodeEditPart_VISUAL_ID, ForkNodeFloatingNameEditPart_VISUAL_ID);
- map.put(InitialNodeEditPart_VISUAL_ID, InitialNodeFloatingNameEditPart_VISUAL_ID);
- map.put(JoinNodeEditPart_VISUAL_ID, JoinNodeFloatingNameEditPart_VISUAL_ID);
- map.put(MergeNodeEditPart_VISUAL_ID, MergeNodeFloatingNameEditPart_VISUAL_ID);
- map.put(OpaqueActionEditPart_VISUAL_ID, OpaqueActionFloatingNameEditPart_VISUAL_ID);
- map.put(ReadExtentActionEditPart_VISUAL_ID, ReadExtentActionFloatingNameEditPart_VISUAL_ID);
- map.put(ReadIsClassifiedObjectActionEditPart_VISUAL_ID, ReadIsClassifiedObjectActionFloatingNameEditPart_VISUAL_ID);
- map.put(ReadLinkActionEditPart_VISUAL_ID, ReadLinkActionFloatingNameEditPart_VISUAL_ID);
- map.put(ReadSelfActionEditPart_VISUAL_ID, ReadSelfActionFloatingNameEditPart_VISUAL_ID);
- map.put(ReadStructuralFeatureActionEditPart_VISUAL_ID, ReadStructuralFeatureActionFloatingNameEditPart_VISUAL_ID);
- map.put(ReadVariableActionEditPart_VISUAL_ID, ReadVariableActionFloatingNameEditPart_VISUAL_ID);
- map.put(ReclassifyObjectActionEditPart_VISUAL_ID, ReclassifyObjectActionFloatingNameEditPart_VISUAL_ID);
- map.put(ReduceActionEditPart_VISUAL_ID, ReduceActionFloatingNameEditPart_VISUAL_ID);
- map.put(SendObjectActionEditPart_VISUAL_ID, SendObjectActionFloatingNameEditPart_VISUAL_ID);
- map.put(SendSignalActionEditPart_VISUAL_ID, SendSignalActionFloatingNameEditPart_VISUAL_ID);
- map.put(StartClassifierBehaviorActionEditPart_VISUAL_ID, StartClassifierBehaviorActionFloatingNameEditPart_VISUAL_ID);
- map.put(StartObjectBehavoiurActionEditPart_VISUAL_ID, StartObjectBehaviorActionFloatingNameEditPart_VISUAL_ID);
- map.put(TestIdentityActionEditPart_VISUAL_ID, TestIdentityActionFloatingNameEditPart_VISUAL_ID);
- map.put(ValueSpecificationActionEditPart_VISUAL_ID, ValueSpecificationActionFloatingNameEditPart_VISUAL_ID);
-
- return map;
- }
-}
+/***************************************************************************** + * Copyright (c) 2010, 2015 CEA LIST and others. + * + * 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: + * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.migration; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand; +import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler; + +/** + * Activity Diagram Reconciler from 1.0.0 to 1.1.0 + */ +public class ActivityReconciler_1_1_0 extends DiagramReconciler { + + private final static String AcceptEventActionEditPart_VISUAL_ID = "3063"; + private final static String AcceptEventActionFloatingNameEditPart_VISUAL_ID = "6040"; + private final static String ActivityFinalNodeEditPart_VISUAL_ID = "3005"; + private final static String ActivityFinalNodeFloatingNameEditPart_VISUAL_ID = "5081"; + private final static String ActivityPartitionEditPart_VISUAL_ID = "3067"; + private final static String ActivityPartitionFloatingNameEditPart_VISUAL_ID = "6016"; + private final static String AddStructuralFeatureValueActionEditPart_VISUAL_ID = "3091"; + private final static String AddStructuralFeatureValueActionFloatingNameEditPart_VISUAL_ID = "6019"; + private final static String AddVariableValueActionEditPart_VISUAL_ID = "3099"; + private final static String AddVariableValueActionFloatingNameEditPart_VISUAL_ID = "6018"; + private final static String BroadcastSignalActionEditPart_VISUAL_ID = "3102"; + private final static String BroadcastSignalActionFloatingNameEditPart_VISUAL_ID = "6017"; + private final static String CallBehaviorActionEditPart_VISUAL_ID = "3008"; + private final static String CallBehaviorActionFloatingNameEditPart_VISUAL_ID = "6029"; + private final static String CallOperationActionEditPart_VISUAL_ID = "3010"; + private final static String CallOperationActionFloatingNameEditPart_VISUAL_ID = "6020"; + private final static String CentralBufferNodeEditPart_VISUAL_ID = "3104"; + private final static String CentralBufferNodeFloatingNameEditPart_VISUAL_ID = "6030"; + private final static String ClearAssociationActionEditPart_VISUAL_ID = "3119"; + private final static String ClearAssociationActionFloatingNameEditPart_VISUAL_ID = "5400"; + private final static String ClearStructuralFeatureActionEditPart_VISUAL_ID = "3115"; + private final static String ClearStructuralFeatureActionFloatingNameEditPart_VISUAL_ID = "5396"; + private final static String CreateLinkActionEditPart_VISUAL_ID = "3117"; + private final static String CreateLinkActionFloatingNameEditPart_VISUAL_ID = "5397"; + private final static String CreateLinkObjectActionEditPart_VISUAL_ID = "3198"; + private final static String CreateLinkObjectActionFloatingNameEditPart_VISUAL_ID = "5407"; + private final static String CreateObjectActionEditPart_VISUAL_ID = "3086"; + private final static String CreateObjectActionFloatingNameEditPart_VISUAL_ID = "6024"; + private final static String DataStoreNodeEditPart_VISUAL_ID = "3078"; + private final static String DataStoreNodeFloatingNameEditPart_VISUAL_ID = "6031"; + private final static String DecisionNodeEditPart_VISUAL_ID = "3038"; + private final static String DecisionNodeFloatingNameEditPart_VISUAL_ID = "6036"; + private final static String DestroyLinkActionEditPart_VISUAL_ID = "3118"; + private final static String DestroyLinkActionFloatingNameEditPart_VISUAL_ID = "5399"; + private final static String DestroyObjectActionEditPart_VISUAL_ID = "3095"; + private final static String DestroyObjectActionFloatingNameEditPart_VISUAL_ID = "6022"; + private final static String FlowFinalNodeEditPart_VISUAL_ID = "3006"; + private final static String FlowFinalNodeFloatingNameEditPart_VISUAL_ID = "6035"; + private final static String ForkNodeEditPart_VISUAL_ID = "3040"; + private final static String ForkNodeFloatingNameEditPart_VISUAL_ID = "6038"; + private final static String InitialNodeEditPart_VISUAL_ID = "3004"; + private final static String InitialNodeFloatingNameEditPart_VISUAL_ID = "6034"; + private final static String JoinNodeEditPart_VISUAL_ID = "3041"; + private final static String JoinNodeFloatingNameEditPart_VISUAL_ID = "6039"; + private final static String MergeNodeEditPart_VISUAL_ID = "3039"; + private final static String MergeNodeFloatingNameEditPart_VISUAL_ID = "6037"; + private final static String OpaqueActionEditPart_VISUAL_ID = "3007"; + private final static String OpaqueActionFloatingNameEditPart_VISUAL_ID = "6028"; + private final static String ReadExtentActionEditPart_VISUAL_ID = "3120"; + private final static String ReadExtentActionFloatingNameEditPart_VISUAL_ID = "5402"; + private final static String ReadIsClassifiedObjectActionEditPart_VISUAL_ID = "3122"; + private final static String ReadIsClassifiedObjectActionFloatingNameEditPart_VISUAL_ID = "5403"; + private final static String ReadLinkActionEditPart_VISUAL_ID = "3116"; + private final static String ReadLinkActionFloatingNameEditPart_VISUAL_ID = "5398"; + private final static String ReadSelfActionEditPart_VISUAL_ID = "3081"; + private final static String ReadSelfActionFloatingNameEditPart_VISUAL_ID = "6025"; + private final static String ReadStructuralFeatureActionEditPart_VISUAL_ID = "3088"; + private final static String ReadStructuralFeatureActionFloatingNameEditPart_VISUAL_ID = "6023"; + private final static String ReadVariableActionEditPart_VISUAL_ID = "3097"; + private final static String ReadVariableActionFloatingNameEditPart_VISUAL_ID = "6021"; + private final static String ReclassifyObjectActionEditPart_VISUAL_ID = "3221"; + private final static String ReclassifyObjectActionFloatingNameEditPart_VISUAL_ID = "5401"; + private final static String ReduceActionEditPart_VISUAL_ID = "3123"; + private final static String ReduceActionFloatingNameEditPart_VISUAL_ID = "5404"; + private final static String SendObjectActionEditPart_VISUAL_ID = "3042"; + private final static String SendObjectActionFloatingNameEditPart_VISUAL_ID = "6027"; + private final static String SendSignalActionEditPart_VISUAL_ID = "3052"; + private final static String SendSignalActionFloatingNameEditPart_VISUAL_ID = "6032"; + private final static String StartClassifierBehaviorActionEditPart_VISUAL_ID = "3124"; + private final static String StartClassifierBehaviorActionFloatingNameEditPart_VISUAL_ID = "5405"; + private final static String StartObjectBehavoiurActionEditPart_VISUAL_ID = "3113"; + private final static String StartObjectBehaviorActionFloatingNameEditPart_VISUAL_ID = "5394"; + private final static String TestIdentityActionEditPart_VISUAL_ID = "3114"; + private final static String TestIdentityActionFloatingNameEditPart_VISUAL_ID = "5395"; + private final static String ValueSpecificationActionEditPart_VISUAL_ID = "3076"; + private final static String ValueSpecificationActionFloatingNameEditPart_VISUAL_ID = "6026"; + + /** + * Gets the reconcile command. + * + * @param diagram + * the diagram + * @return the reconcile command + * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram) + */ + @Override + public ICommand getReconcileCommand(Diagram diagram) { + return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap()); + } + + /** + * Gets the floating label map to add. + * + * @return the floating label map + */ + private Map<String, String> getFloatingLabelMap() { + Map<String, String> map = new HashMap<String, String>(); + map.put(AcceptEventActionEditPart_VISUAL_ID, AcceptEventActionFloatingNameEditPart_VISUAL_ID); + map.put(ActivityFinalNodeEditPart_VISUAL_ID, ActivityFinalNodeFloatingNameEditPart_VISUAL_ID); + map.put(ActivityPartitionEditPart_VISUAL_ID, ActivityPartitionFloatingNameEditPart_VISUAL_ID); + map.put(AddStructuralFeatureValueActionEditPart_VISUAL_ID, AddStructuralFeatureValueActionFloatingNameEditPart_VISUAL_ID); + map.put(AddVariableValueActionEditPart_VISUAL_ID, AddVariableValueActionFloatingNameEditPart_VISUAL_ID); + map.put(BroadcastSignalActionEditPart_VISUAL_ID, BroadcastSignalActionFloatingNameEditPart_VISUAL_ID); + map.put(CallBehaviorActionEditPart_VISUAL_ID, CallBehaviorActionFloatingNameEditPart_VISUAL_ID); + map.put(CallOperationActionEditPart_VISUAL_ID, CallOperationActionFloatingNameEditPart_VISUAL_ID); + map.put(CentralBufferNodeEditPart_VISUAL_ID, CentralBufferNodeFloatingNameEditPart_VISUAL_ID); + map.put(ClearAssociationActionEditPart_VISUAL_ID, ClearAssociationActionFloatingNameEditPart_VISUAL_ID); + map.put(ClearStructuralFeatureActionEditPart_VISUAL_ID, ClearStructuralFeatureActionFloatingNameEditPart_VISUAL_ID); + map.put(CreateLinkActionEditPart_VISUAL_ID, CreateLinkActionFloatingNameEditPart_VISUAL_ID); + map.put(CreateLinkObjectActionEditPart_VISUAL_ID, CreateLinkObjectActionFloatingNameEditPart_VISUAL_ID); + map.put(CreateObjectActionEditPart_VISUAL_ID, CreateObjectActionFloatingNameEditPart_VISUAL_ID); + map.put(DataStoreNodeEditPart_VISUAL_ID, DataStoreNodeFloatingNameEditPart_VISUAL_ID); + map.put(DecisionNodeEditPart_VISUAL_ID, DecisionNodeFloatingNameEditPart_VISUAL_ID); + map.put(DestroyLinkActionEditPart_VISUAL_ID, DestroyLinkActionFloatingNameEditPart_VISUAL_ID); + map.put(DestroyObjectActionEditPart_VISUAL_ID, DestroyObjectActionFloatingNameEditPart_VISUAL_ID); + map.put(FlowFinalNodeEditPart_VISUAL_ID, FlowFinalNodeFloatingNameEditPart_VISUAL_ID); + map.put(ForkNodeEditPart_VISUAL_ID, ForkNodeFloatingNameEditPart_VISUAL_ID); + map.put(InitialNodeEditPart_VISUAL_ID, InitialNodeFloatingNameEditPart_VISUAL_ID); + map.put(JoinNodeEditPart_VISUAL_ID, JoinNodeFloatingNameEditPart_VISUAL_ID); + map.put(MergeNodeEditPart_VISUAL_ID, MergeNodeFloatingNameEditPart_VISUAL_ID); + map.put(OpaqueActionEditPart_VISUAL_ID, OpaqueActionFloatingNameEditPart_VISUAL_ID); + map.put(ReadExtentActionEditPart_VISUAL_ID, ReadExtentActionFloatingNameEditPart_VISUAL_ID); + map.put(ReadIsClassifiedObjectActionEditPart_VISUAL_ID, ReadIsClassifiedObjectActionFloatingNameEditPart_VISUAL_ID); + map.put(ReadLinkActionEditPart_VISUAL_ID, ReadLinkActionFloatingNameEditPart_VISUAL_ID); + map.put(ReadSelfActionEditPart_VISUAL_ID, ReadSelfActionFloatingNameEditPart_VISUAL_ID); + map.put(ReadStructuralFeatureActionEditPart_VISUAL_ID, ReadStructuralFeatureActionFloatingNameEditPart_VISUAL_ID); + map.put(ReadVariableActionEditPart_VISUAL_ID, ReadVariableActionFloatingNameEditPart_VISUAL_ID); + map.put(ReclassifyObjectActionEditPart_VISUAL_ID, ReclassifyObjectActionFloatingNameEditPart_VISUAL_ID); + map.put(ReduceActionEditPart_VISUAL_ID, ReduceActionFloatingNameEditPart_VISUAL_ID); + map.put(SendObjectActionEditPart_VISUAL_ID, SendObjectActionFloatingNameEditPart_VISUAL_ID); + map.put(SendSignalActionEditPart_VISUAL_ID, SendSignalActionFloatingNameEditPart_VISUAL_ID); + map.put(StartClassifierBehaviorActionEditPart_VISUAL_ID, StartClassifierBehaviorActionFloatingNameEditPart_VISUAL_ID); + map.put(StartObjectBehavoiurActionEditPart_VISUAL_ID, StartObjectBehaviorActionFloatingNameEditPart_VISUAL_ID); + map.put(TestIdentityActionEditPart_VISUAL_ID, TestIdentityActionFloatingNameEditPart_VISUAL_ID); + map.put(ValueSpecificationActionEditPart_VISUAL_ID, ValueSpecificationActionFloatingNameEditPart_VISUAL_ID); + + return map; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.configuration deleted file mode 100644 index e2468a0ce24..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.configuration +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_UzcgsHDtEeWh-MssWmCB_A" implementationID="PapyrusUMLActivityDiagram">
- <modelRules xmi:id="_UzcgsXDtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Activity"/>
- </modelRules>
- <owningRules xmi:id="_UzcgsnDtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Activity"/>
- </owningRules>
- <owningRules xmi:id="_Uzcgs3DtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/>
- <newModelPath xmi:id="_UzcgtHDtEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_UzcgtXDtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/>
- <newModelPath xmi:id="_UzcgtnDtEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_Uzcgt3DtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- <newModelPath xmi:id="_UzcguHDtEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/>
- </newModelPath>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_UzcguXDtEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml index ee9945c59d1..ca04d139eae 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml @@ -15,14 +15,6 @@ --> <plugin> - <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/activityDiagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - <extension point="org.eclipse.ui.contexts" id="ui-context"> <?gmfgen generated="true"?> <context @@ -3284,33 +3276,26 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]> </mapping> </diagramMappings> </extension> -<extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/activityDiagram.elementtypesconfigurations"> - </elementTypeSet> -</extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="PapyrusUMLActivityDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.activity.migration.ActivityReconciler" - source="undefined" - target="1.1.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.activity.migration.ActivityReconciler_1_1_0" + source="1.0.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLActivityDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.activity.migration.ActivityReconcilerForCompartment" - source="undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.activity.migration.ActivityReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLActivityDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.activity.migration.ActivityReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/policies/UMLBaseItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/policies/UMLBaseItemSemanticEditPolicy.java index 5d9d13744e7..99f1dbde08e 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/policies/UMLBaseItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src-gen/org/eclipse/papyrus/uml/diagram/activity/edit/policies/UMLBaseItemSemanticEditPolicy.java @@ -1,894 +1,894 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.activity.edit.policies;
-
-import java.util.Iterator;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gef.requests.ReconnectRequest;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand;
-import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
-import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.activity.helper.CustomObjectFlowEditHelper;
-import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin;
-import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry;
-import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Action;
-import org.eclipse.uml2.uml.Activity;
-import org.eclipse.uml2.uml.ActivityEdge;
-import org.eclipse.uml2.uml.ActivityNode;
-import org.eclipse.uml2.uml.ActivityParameterNode;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.ControlFlow;
-import org.eclipse.uml2.uml.DecisionNode;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.ExceptionHandler;
-import org.eclipse.uml2.uml.ExecutableNode;
-import org.eclipse.uml2.uml.FinalNode;
-import org.eclipse.uml2.uml.ForkNode;
-import org.eclipse.uml2.uml.InitialNode;
-import org.eclipse.uml2.uml.InputPin;
-import org.eclipse.uml2.uml.JoinNode;
-import org.eclipse.uml2.uml.MergeNode;
-import org.eclipse.uml2.uml.ObjectFlow;
-import org.eclipse.uml2.uml.ObjectNode;
-import org.eclipse.uml2.uml.OutputPin;
-import org.eclipse.uml2.uml.StructuredActivityNode;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy {
-
- /**
- * Extended request data key to hold editpart visual id.
- *
- * @generated
- */
- public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
-
- /**
- * Extended request data key to hold the edge view during a reconnect request.
- *
- * @generated
- */
- public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- private final IElementType myElementType;
-
- /**
- * @generated
- */
- protected UMLBaseItemSemanticEditPolicy(IElementType elementType) {
- myElementType = elementType;
- }
-
- /**
- * Extended request data key to hold editpart visual id.
- * Add visual id of edited editpart to extended data of the request
- * so command switch can decide what kind of diagram element is being edited.
- * It is done in those cases when it's not possible to deduce diagram
- * element kind from domain element.
- *
- * @generated
- */
- @Override
- @SuppressWarnings("unchecked")
- public Command getCommand(Request request) {
- if (request instanceof ReconnectRequest) {
- Object view = ((ReconnectRequest) request).getConnectionEditPart().getModel();
- if (view instanceof View) {
- String id = UMLVisualIDRegistry.getVisualID((View) view);
- request.getExtendedData().put(VISUAL_ID_KEY, id);
- request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view);
- }
- }
- return super.getCommand(request);
- }
-
- /**
- * Returns visual id from request parameters.
- *
- * @generated
- */
- protected String getVisualID(IEditCommandRequest request) {
- return (String) request.getParameter(VISUAL_ID_KEY);
- }
-
- /**
- * @generated
- */
- @Override
- protected Command getSemanticCommand(IEditCommandRequest request) {
- IEditCommandRequest completedRequest = completeRequest(request);
- Command semanticCommand = getSemanticCommandSwitch(completedRequest);
- semanticCommand = getEditHelperCommand(completedRequest, semanticCommand);
- if (completedRequest instanceof DestroyRequest) {
- DestroyRequest destroyRequest = (DestroyRequest) completedRequest;
- return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null;
- }
- return semanticCommand;
- }
-
- /**
- * @generated
- */
- protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) {
- Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View) getHost().getModel()));
- return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand);
- }
-
- /**
- * @generated NOT adding the possibility to globally disabling a request
- */
- private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) {
- // disable the request if necessary
- if (requestIsDisabled(request)) {
- return null;
- }
- // return command for reorient, as this has already been computed through the edit helpers
- if (request instanceof ReorientRelationshipRequest) {
- return editPolicyCommand;
- }
- // generated code
- if (editPolicyCommand != null) {
- ICommand command = editPolicyCommand instanceof ICommandProxy
- ? ((ICommandProxy) editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
- request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command);
- }
- IElementType requestContextElementType = getContextElementType(request);
- if (requestContextElementType != null) {
- request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, requestContextElementType);
- ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
- request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null);
- if (command != null) {
- if (!(command instanceof CompositeTransactionalCommand)) {
- command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel())
- .compose(command);
- }
- return new ICommandProxy(command);
- }
- }
- return editPolicyCommand;
- }
-
- /**
- * Check whether the request should be disabled.
- *
- * @param request
- * the request to analyze
- * @return true if the request must not succeed
- * @generated NOT
- */
- private boolean requestIsDisabled(IEditCommandRequest request) {
- if (request instanceof MoveRequest) {
- // prevent moving a constraint to another parent, since the representation would not be the same
- for (Object element : ((MoveRequest) request).getElementsToMove().keySet()) {
- if (element instanceof Constraint) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * @generated
- */
- protected IElementType getContextElementType(IEditCommandRequest request) {
- IElementType requestContextElementType = UMLElementTypes.getElementType(getVisualID(request));
- return requestContextElementType != null ? requestContextElementType : myElementType;
- }
-
- /**
- * @generated
- */
- protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
- if (req instanceof CreateRelationshipRequest) {
- return getCreateRelationshipCommand((CreateRelationshipRequest) req);
- } else if (req instanceof CreateElementRequest) {
- return getCreateCommand((CreateElementRequest) req);
- } else if (req instanceof ConfigureRequest) {
- return getConfigureCommand((ConfigureRequest) req);
- } else if (req instanceof DestroyElementRequest) {
- return getDestroyElementCommand((DestroyElementRequest) req);
- } else if (req instanceof DestroyReferenceRequest) {
- return getDestroyReferenceCommand((DestroyReferenceRequest) req);
- } else if (req instanceof DuplicateElementsRequest) {
- return getDuplicateCommand((DuplicateElementsRequest) req);
- } else if (req instanceof GetEditContextRequest) {
- return getEditContextCommand((GetEditContextRequest) req);
- } else if (req instanceof MoveRequest) {
- return getMoveCommand((MoveRequest) req);
- } else if (req instanceof ReorientReferenceRelationshipRequest) {
- return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
- } else if (req instanceof ReorientRelationshipRequest) {
- return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
- } else if (req instanceof SetRequest) {
- return getSetCommand((SetRequest) req);
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getConfigureCommand(ConfigureRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
- IElementEditService commandService = ElementEditServiceUtils
- .getCommandProvider(((IGraphicalEditPart) getHost()).resolveSemanticElement());
- if (req.getElementType() != null) {
- commandService = ElementEditServiceUtils.getCommandProvider(req.getElementType());
- }
-
- if (commandService == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- ICommand semanticCommand = commandService.getEditCommand(req);
-
- if ((semanticCommand != null) && (semanticCommand.canExecute())) {
- return getGEFWrapper(semanticCommand);
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected Command getCreateCommand(CreateElementRequest req) {
- IElementType requestElementType = req.getElementType();
- if (requestElementType instanceof IElementType) {
- IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(req.getContainer());
- if (commandProvider != null) {
- ICommand command = commandProvider.getEditCommand(req);
- if (command != null && command.canExecute()) {
- return new ICommandProxy(command);
- }
- }
- }
- return null;
- }
-
- /**
- * @generated
- */
- protected ICommand getSemanticCreationCommand(CreateElementRequest req) {
- IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(req.getContainer());
- if (commandService == null) {
- return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
- }
- return commandService.getEditCommand(req);
- }
-
- /**
- * @generated
- */
- protected Command getSetCommand(SetRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getEditContextCommand(GetEditContextRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDestroyElementCommand(DestroyElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getDuplicateCommand(DuplicateElementsRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected Command getMoveCommand(MoveRequest req) {
- EObject targetCEObject = req.getTargetContainer();
- if (targetCEObject != null) {
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject);
- if (provider != null) {
- ICommand moveCommand = provider.getEditCommand(req);
- if (moveCommand != null) {
- return new ICommandProxy(moveCommand);
- }
- }
- return UnexecutableCommand.INSTANCE;
- } else {
- return getGEFWrapper(new MoveElementsCommand(req));
- }
-
- }
-
- /**
- * @generated
- */
- protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- * @generated
- */
- protected final Command getGEFWrapper(ICommand cmd) {
- return (cmd == null) ? UnexecutableCommand.INSTANCE : new ICommandProxy(cmd);
- }
-
- /**
- * Returns editing domain from the host edit part.
- *
- * @generated
- */
- protected TransactionalEditingDomain getEditingDomain() {
- return ((IGraphicalEditPart) getHost()).getEditingDomain();
- }
-
- /**
- * Clean all shortcuts to the host element from the same diagram
- *
- * @generated
- */
- protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) {
- assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$
- for (Iterator<?> it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
- View nextView = (View) it.next();
- if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() //$NON-NLS-1$
- || nextView.getElement() != view.getElement()) {
- continue;
- }
- cmd.add(new DeleteCommand(getEditingDomain(), nextView));
- }
- }
-
- /**
- * @generated
- */
- public static LinkConstraints getLinkConstraints() {
- LinkConstraints cached = UMLDiagramEditorPlugin.getInstance().getLinkConstraints();
- if (cached == null) {
- UMLDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints());
- }
- return cached;
- }
-
- /**
- * @generated
- */
- public static class LinkConstraints {
-
- /**
- * @generated
- */
- public LinkConstraints() { // use static method #getLinkConstraints() to access instance
- }
-
- /**
- * @generated
- */
- public boolean canCreateAction_LocalPreconditionEdge(Action source, Constraint target) {
- if (source != null) {
- if (source.getLocalPreconditions().contains(target)) {
- return false;
- }
- if (source == target) {
- return false;
- }
- }
-
- return canExistAction_LocalPreconditionEdge(source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateAction_LocalPostconditionEdge(Action source, Constraint target) {
- if (source != null) {
- if (source.getLocalPostconditions().contains(target)) {
- return false;
- }
- if (source == target) {
- return false;
- }
- }
-
- return canExistAction_LocalPostconditionEdge(source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateObjectFlow_Edge(Activity container, ActivityNode source, ActivityNode target) {
- return canExistObjectFlow_Edge(container, null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateControlFlow_Edge(Activity container, ActivityNode source, ActivityNode target) {
- return canExistControlFlow_Edge(container, null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateExceptionHandler_Edge(ExecutableNode container, ExecutableNode source,
- ObjectNode target) {
- return canExistExceptionHandler_Edge(container, null, source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateComment_AnnotatedElementEdge(Comment source, Element target) {
- if (source != null) {
- if (source.getAnnotatedElements().contains(target)) {
- return false;
- }
- }
-
- return canExistComment_AnnotatedElementEdge(source, target);
- }
-
- /**
- * @generated
- */
- public boolean canCreateConstraint_ConstrainedElementEdge(Constraint source, Element target) {
- if (source != null) {
- if (source.getConstrainedElements().contains(target)) {
- return false;
- }
- }
-
- return canExistConstraint_ConstrainedElementEdge(source, target);
- }
-
- /**
- * @generated
- */
- public boolean canExistAction_LocalPreconditionEdge(Action source, Constraint target) {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistAction_LocalPostconditionEdge(Action source, Constraint target) {
- return true;
- }
-
- /**
- * modify the generation to call explicitly custom helper
- *
- * @generated NOT
- */
- public boolean canExistObjectFlow_Edge(Activity container, ObjectFlow linkInstance, ActivityNode source,
- ActivityNode target) {
- try {
- if (source instanceof Action) {
- // rule validateObjectFlow_validateNoActions
- // rule workaround by addition of pins in case of Action
- if (!CustomObjectFlowEditHelper.canStartNewObjectFlow((Action) source)) {
- return false;
- }
- }
- if (source instanceof InputPin) {
- // rule validateInputPin_validateOutgoingEdgesStructuredOnly
- if (source.getOwner() instanceof StructuredActivityNode) {
- if (target != null && !source.getOwner().equals(target.getInStructuredNode())) {
- return false;
- }
- } else {
- return false;
- }
- }
- if (source instanceof InitialNode) {
- // rule validateInitialNode_validateControlEdges
- return false;
- }
- if (source instanceof FinalNode) {
- // rule validateFinalNode_validateNoOutgoingEdges
- return false;
- }
- if (source instanceof JoinNode) {
- // rule validateJoinNode_validateOneOutgoingEdge
- if (!source.getOutgoings().isEmpty()) {
- return false;
- }
- /*
- * rule validateJoinNode_validateIncomingObjectFlow :
- * We do not prevent creation of an outgoing ObjectFlow even if there is no incoming ObjectFlow.
- * We let the possibility that the user intends to add an incoming ObjectFlow later.
- */
- }
- if (source instanceof ForkNode) {
- // rule validateForkNode_validateEdges on source Fork node
- ActivityEdge outgoingControlFlow = source.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- ActivityEdge incomingControlFlow = source.getIncoming(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- if (outgoingControlFlow != null || incomingControlFlow != null) {
- // there is a ControlFlow which means there must be no ObjectFlow
- return false;
- }
- }
- if (source instanceof MergeNode) {
- // rule validateMergeNode_validateOneOutgoingEdge
- if (!source.getOutgoings().isEmpty()) {
- return false;
- }
- // rule validateMergeNode_validateEdges on source Merge node
- ActivityEdge outgoingControlFlow = source.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- ActivityEdge incomingControlFlow = source.getIncoming(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- if (outgoingControlFlow != null || incomingControlFlow != null) {
- // there is a ControlFlow which means there must be no ObjectFlow
- return false;
- }
- }
- if (source instanceof DecisionNode) {
- // rule validateDecisionNode_validateEdges on source Decision node
- ActivityEdge outgoingControlFlow = source.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- ActivityEdge incomingControlFlow = source.getIncoming(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- if (outgoingControlFlow != null || incomingControlFlow != null) {
- // there is a ControlFlow which means there must be no ObjectFlow
- return false;
- }
- }
- if (source instanceof ActivityParameterNode) {
- // rule validateActivityParameterNode_validateIncomingOrOutgoing
- EList<ActivityEdge> incomings = source.getIncomings();
- if (!incomings.isEmpty()) {
- return false;
- }
- }
- if (target instanceof Action) {
- // rule validateObjectFlow_validateNoActions
- // rule workaround by addition of pins in case of Action
- if (!CustomObjectFlowEditHelper.canEndNewObjectFlow((Action) target)) {
- return false;
- }
- }
- if (target instanceof OutputPin) {
- // rule validateOutputPin_validateIncomingEdgesStructuredOnly
- if (target.getOwner() instanceof StructuredActivityNode) {
- if (source != null && !target.getOwner().equals(source.getInStructuredNode())) {
- return false;
- }
- } else {
- return false;
- }
- }
- if (target instanceof InitialNode) {
- // rule validateInitialNode_validateNoIncomingEdges
- return false;
- }
- if (target instanceof JoinNode) {
- // rule validateJoinNode_validateIncomingObjectFlow
- ActivityEdge outgoingControlFlow = target.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- if (outgoingControlFlow != null) {
- // the outgoing edge is a ControlFlow which means there must be no incoming ObjectFlow
- return false;
- }
- }
- if (target instanceof ForkNode) {
- // rule validateForkNode_validateOneIncomingEdge
- if (!target.getIncomings().isEmpty()) {
- return false;
- }
- // rule validateForkNode_validateEdges on target Fork node
- ActivityEdge outgoingControlFlow = target.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- ActivityEdge incomingControlFlow = target.getIncoming(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- if (outgoingControlFlow != null || incomingControlFlow != null) {
- // there is a ControlFlow which means there must be no ObjectFlow
- return false;
- }
- }
- if (target instanceof MergeNode) {
- // rule validateMergeNode_validateEdges on target Merge node
- ActivityEdge outgoingControlFlow = target.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- ActivityEdge incomingControlFlow = target.getIncoming(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- if (outgoingControlFlow != null || incomingControlFlow != null) {
- // there is a ControlFlow which means there must be no ObjectFlow
- return false;
- }
- }
- if (target instanceof DecisionNode) {
- // rule validateDecisionNode_validateIncomingOutgoingEdges
- if (target.getIncomings().size() >= 2) {
- // no more than two incoming edges
- return false;
- }
- // rule validateDecisionNode_validateEdges on target Decision node
- ActivityEdge outgoingControlFlow = target.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- ActivityEdge incomingControlFlow = target.getIncoming(null, true,
- UMLPackage.eINSTANCE.getControlFlow());
- if (outgoingControlFlow != null || incomingControlFlow != null) {
- /*
- * There is a ControlFlow which means there must be no
- * ObjectFlow but the decision flow itself.
- * We let the user insert up to one ObjectFlow for being
- * able to select the decision flow among existing
- * input flows.
- */
- if (target.getIncoming(null, true, UMLPackage.eINSTANCE.getObjectFlow()) != null) {
- // there is already an object flow which is intended to become the decision flow
- return false;
- }
- }
- }
- if (target instanceof ActivityParameterNode) {
- // rule validateActivityParameterNode_validateIncomingOrOutgoing
- EList<ActivityEdge> outgoings = target.getOutgoings();
- if (!outgoings.isEmpty()) {
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$
- return false;
- }
- }
-
- /**
- * @generated
- */
- public boolean canExistControlFlow_Edge(Activity container, ControlFlow linkInstance, ActivityNode source,
- ActivityNode target) {
- try {
- if (source instanceof ObjectNode) {
- if (!((ObjectNode) source).isControlType()) {
- // rule validateControlFlow_validateObjectNodes
- return false;
- }
- }
- if (source instanceof InputPin) {
- // rule validateInputPin_validateOutgoingEdgesStructuredOnly
- if (source.getOwner() instanceof StructuredActivityNode) {
- if (target != null && !source.getOwner().equals(target.getInStructuredNode())) {
- return false;
- }
- } else {
- return false;
- }
- }
- if (source instanceof FinalNode) {
- // rule validateFinalNode_validateNoOutgoingEdges
- return false;
- }
- if (source instanceof JoinNode) {
- // rule validateJoinNode_validateOneOutgoingEdge
- if (!source.getOutgoings().isEmpty()) {
- return false;
- }
- // rule validateJoinNode_validateIncomingObjectFlow
- ActivityEdge incomingObjectFlow = source.getIncoming(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- if (incomingObjectFlow != null) {
- // the outgoing edge must be an ObjectFlow
- return false;
- }
- }
- if (source instanceof ForkNode) {
- // rule validateForkNode_validateEdges on source Fork node
- ActivityEdge outgoingObjectFlow = source.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- ActivityEdge incomingObjectFlow = source.getIncoming(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- if (outgoingObjectFlow != null || incomingObjectFlow != null) {
- // there is an ObjectFlow which means there must be no ControlFlow
- return false;
- }
- }
- if (source instanceof MergeNode) {
- // rule validateMergeNode_validateOneOutgoingEdge
- if (!source.getOutgoings().isEmpty()) {
- return false;
- }
- // rule validateMergeNode_validateEdges on source Merge node
- ActivityEdge outgoingObjectFlow = source.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- ActivityEdge incomingObjectFlow = source.getIncoming(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- if (outgoingObjectFlow != null || incomingObjectFlow != null) {
- // there is an ObjectFlow which means there must be no ControlFlow
- return false;
- }
- }
- if (source instanceof DecisionNode) {
- // rule validateDecisionNode_validateEdges on source Decision node
- ActivityEdge outgoingObjectFlow = source.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- int incomingObjectFlowNumber = 0;
- for (ActivityEdge incomingEdge : source.getIncomings()) {
- if (incomingEdge instanceof ObjectFlow) {
- incomingObjectFlowNumber++;
- }
- }
- if (outgoingObjectFlow != null || incomingObjectFlowNumber > 1) {
- // there is an ObjectFlow (not intended for decisionInputFlow) which means there must be no ControlFlow
- return false;
- }
- }
- if (target instanceof ObjectNode) {
- if (!((ObjectNode) target).isControlType()) {
- // rule validateControlFlow_validateObjectNodes
- return false;
- }
- }
- if (target instanceof OutputPin) {
- // rule validateOutputPin_validateIncomingEdgesStructuredOnly
- if (target.getOwner() instanceof StructuredActivityNode) {
- if (source != null && !target.getOwner().equals(source.getInStructuredNode())) {
- return false;
- }
- } else {
- return false;
- }
- }
- if (target instanceof InitialNode) {
- // rule validateInitialNode_validateNoIncomingEdges
- return false;
- }
- if (target instanceof ForkNode) {
- // rule validateForkNode_validateOneIncomingEdge
- if (!target.getIncomings().isEmpty()) {
- return false;
- }
- // rule validateForkNode_validateEdges on target Fork node
- ActivityEdge outgoingObjectFlow = target.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- ActivityEdge incomingObjectFlow = target.getIncoming(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- if (outgoingObjectFlow != null || incomingObjectFlow != null) {
- // there is an ObjectFlow which means there must be no ControlFlow
- return false;
- }
- }
- if (target instanceof MergeNode) {
- // rule validateMergeNode_validateEdges on target Merge node
- ActivityEdge outgoingObjectFlow = target.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- ActivityEdge incomingObjectFlow = target.getIncoming(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- if (outgoingObjectFlow != null || incomingObjectFlow != null) {
- // there is an ObjectFlow which means there must be no ControlFlow
- return false;
- }
- }
- if (target instanceof DecisionNode) {
- // rule validateDecisionNode_validateIncomingOutgoingEdges
- if (target.getIncomings().size() >= 2) {
- // no more than two incoming edges
- return false;
- }
- // rule validateDecisionNode_validateEdges on target Decision node
- ActivityEdge outgoingObjectFlow = target.getOutgoing(null, true,
- UMLPackage.eINSTANCE.getObjectFlow());
- ActivityEdge incomingObjectFlow = null;
- for (ActivityEdge incomingEdge : target.getIncomings()) {
- // filter the decision flow
- if (incomingEdge instanceof ObjectFlow
- && incomingEdge != ((DecisionNode) target).getDecisionInputFlow()) {
- incomingObjectFlow = incomingEdge;
- }
- }
- if (outgoingObjectFlow != null || incomingObjectFlow != null) {
- // there is an ObjectFlow which means there must be no ControlFlow
- return false;
- }
- }
- return true;
- } catch (Exception e) {
- UMLDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$
- return false;
- }
- }
-
- /**
- * @generated
- */
- public boolean canExistExceptionHandler_Edge(ExecutableNode container, ExceptionHandler linkInstance,
- ExecutableNode source, ObjectNode target) {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistComment_AnnotatedElementEdge(Comment source, Element target) {
- return true;
- }
-
- /**
- * @generated
- */
- public boolean canExistConstraint_ConstrainedElementEdge(Constraint source, Element target) {
- return true;
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import java.util.Iterator; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gef.requests.ReconnectRequest; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.common.core.command.ICompositeCommand; +import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.MoveElementsCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.helpers.GeneratedEditHelperBase; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.helper.CustomObjectFlowEditHelper; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.uml2.uml.Action; +import org.eclipse.uml2.uml.Activity; +import org.eclipse.uml2.uml.ActivityEdge; +import org.eclipse.uml2.uml.ActivityNode; +import org.eclipse.uml2.uml.ActivityParameterNode; +import org.eclipse.uml2.uml.Comment; +import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.ControlFlow; +import org.eclipse.uml2.uml.DecisionNode; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.ExceptionHandler; +import org.eclipse.uml2.uml.ExecutableNode; +import org.eclipse.uml2.uml.FinalNode; +import org.eclipse.uml2.uml.ForkNode; +import org.eclipse.uml2.uml.InitialNode; +import org.eclipse.uml2.uml.InputPin; +import org.eclipse.uml2.uml.JoinNode; +import org.eclipse.uml2.uml.MergeNode; +import org.eclipse.uml2.uml.ObjectFlow; +import org.eclipse.uml2.uml.ObjectNode; +import org.eclipse.uml2.uml.OutputPin; +import org.eclipse.uml2.uml.StructuredActivityNode; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class UMLBaseItemSemanticEditPolicy extends SemanticEditPolicy { + + /** + * Extended request data key to hold editpart visual id. + * + * @generated + */ + public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$ + + /** + * Extended request data key to hold the edge view during a reconnect request. + * + * @generated + */ + public static final String GRAPHICAL_RECONNECTED_EDGE = "graphical_edge"; //$NON-NLS-1$ + + /** + * @generated + */ + private final IElementType myElementType; + + /** + * @generated + */ + protected UMLBaseItemSemanticEditPolicy(IElementType elementType) { + myElementType = elementType; + } + + /** + * Extended request data key to hold editpart visual id. + * Add visual id of edited editpart to extended data of the request + * so command switch can decide what kind of diagram element is being edited. + * It is done in those cases when it's not possible to deduce diagram + * element kind from domain element. + * + * @generated + */ + @Override + @SuppressWarnings("unchecked") + public Command getCommand(Request request) { + if (request instanceof ReconnectRequest) { + Object view = ((ReconnectRequest) request).getConnectionEditPart().getModel(); + if (view instanceof View) { + String id = UMLVisualIDRegistry.getVisualID((View) view); + request.getExtendedData().put(VISUAL_ID_KEY, id); + request.getExtendedData().put(GRAPHICAL_RECONNECTED_EDGE, view); + } + } + return super.getCommand(request); + } + + /** + * Returns visual id from request parameters. + * + * @generated + */ + protected String getVisualID(IEditCommandRequest request) { + return (String) request.getParameter(VISUAL_ID_KEY); + } + + /** + * @generated + */ + @Override + protected Command getSemanticCommand(IEditCommandRequest request) { + IEditCommandRequest completedRequest = completeRequest(request); + Command semanticCommand = getSemanticCommandSwitch(completedRequest); + semanticCommand = getEditHelperCommand(completedRequest, semanticCommand); + if (completedRequest instanceof DestroyRequest) { + DestroyRequest destroyRequest = (DestroyRequest) completedRequest; + return shouldProceed(destroyRequest) ? addDeleteViewCommand(semanticCommand, destroyRequest) : null; + } + return semanticCommand; + } + + /** + * @generated + */ + protected Command addDeleteViewCommand(Command mainCommand, DestroyRequest completedRequest) { + Command deleteViewCommand = getGEFWrapper(new DeleteCommand(getEditingDomain(), (View) getHost().getModel())); + return mainCommand == null ? deleteViewCommand : mainCommand.chain(deleteViewCommand); + } + + /** + * @generated NOT adding the possibility to globally disabling a request + */ + private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) { + // disable the request if necessary + if (requestIsDisabled(request)) { + return null; + } + // return command for reorient, as this has already been computed through the edit helpers + if (request instanceof ReorientRelationshipRequest) { + return editPolicyCommand; + } + // generated code + if (editPolicyCommand != null) { + ICommand command = editPolicyCommand instanceof ICommandProxy + ? ((ICommandProxy) editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand); + request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command); + } + IElementType requestContextElementType = getContextElementType(request); + if (requestContextElementType != null) { + request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, requestContextElementType); + ICommand command = requestContextElementType.getEditCommand(request); + request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null); + request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null); + if (command != null) { + if (!(command instanceof CompositeTransactionalCommand)) { + command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel()) + .compose(command); + } + return new ICommandProxy(command); + } + } + return editPolicyCommand; + } + + /** + * Check whether the request should be disabled. + * + * @param request + * the request to analyze + * @return true if the request must not succeed + * @generated NOT + */ + private boolean requestIsDisabled(IEditCommandRequest request) { + if (request instanceof MoveRequest) { + // prevent moving a constraint to another parent, since the representation would not be the same + for (Object element : ((MoveRequest) request).getElementsToMove().keySet()) { + if (element instanceof Constraint) { + return true; + } + } + } + return false; + } + + /** + * @generated + */ + protected IElementType getContextElementType(IEditCommandRequest request) { + IElementType requestContextElementType = UMLElementTypes.getElementType(getVisualID(request)); + return requestContextElementType != null ? requestContextElementType : myElementType; + } + + /** + * @generated + */ + protected Command getSemanticCommandSwitch(IEditCommandRequest req) { + if (req instanceof CreateRelationshipRequest) { + return getCreateRelationshipCommand((CreateRelationshipRequest) req); + } else if (req instanceof CreateElementRequest) { + return getCreateCommand((CreateElementRequest) req); + } else if (req instanceof ConfigureRequest) { + return getConfigureCommand((ConfigureRequest) req); + } else if (req instanceof DestroyElementRequest) { + return getDestroyElementCommand((DestroyElementRequest) req); + } else if (req instanceof DestroyReferenceRequest) { + return getDestroyReferenceCommand((DestroyReferenceRequest) req); + } else if (req instanceof DuplicateElementsRequest) { + return getDuplicateCommand((DuplicateElementsRequest) req); + } else if (req instanceof GetEditContextRequest) { + return getEditContextCommand((GetEditContextRequest) req); + } else if (req instanceof MoveRequest) { + return getMoveCommand((MoveRequest) req); + } else if (req instanceof ReorientReferenceRelationshipRequest) { + return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req); + } else if (req instanceof ReorientRelationshipRequest) { + return getReorientRelationshipCommand((ReorientRelationshipRequest) req); + } else if (req instanceof SetRequest) { + return getSetCommand((SetRequest) req); + } + return null; + } + + /** + * @generated + */ + protected Command getConfigureCommand(ConfigureRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementEditService commandService = ElementEditServiceUtils + .getCommandProvider(((IGraphicalEditPart) getHost()).resolveSemanticElement()); + if (req.getElementType() != null) { + commandService = ElementEditServiceUtils.getCommandProvider(req.getElementType(), req.getClientContext()); + } + + if (commandService == null) { + return UnexecutableCommand.INSTANCE; + } + + ICommand semanticCommand = commandService.getEditCommand(req); + + if ((semanticCommand != null) && (semanticCommand.canExecute())) { + return getGEFWrapper(semanticCommand); + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getCreateCommand(CreateElementRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType instanceof IElementType) { + IElementEditService commandProvider = ElementEditServiceUtils.getCommandProvider(req.getContainer()); + if (commandProvider != null) { + ICommand command = commandProvider.getEditCommand(req); + if (command != null && command.canExecute()) { + return new ICommandProxy(command); + } + } + } + return null; + } + + /** + * @generated + */ + protected ICommand getSemanticCreationCommand(CreateElementRequest req) { + IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(req.getContainer()); + if (commandService == null) { + return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; + } + return commandService.getEditCommand(req); + } + + /** + * @generated + */ + protected Command getSetCommand(SetRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getEditContextCommand(GetEditContextRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getDuplicateCommand(DuplicateElementsRequest req) { + return null; + } + + /** + * @generated + */ + protected Command getMoveCommand(MoveRequest req) { + EObject targetCEObject = req.getTargetContainer(); + if (targetCEObject != null) { + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(targetCEObject); + if (provider != null) { + ICommand moveCommand = provider.getEditCommand(req); + if (moveCommand != null) { + return new ICommandProxy(moveCommand); + } + } + return UnexecutableCommand.INSTANCE; + } else { + return getGEFWrapper(new MoveElementsCommand(req)); + } + + } + + /** + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected final Command getGEFWrapper(ICommand cmd) { + return (cmd == null) ? UnexecutableCommand.INSTANCE : new ICommandProxy(cmd); + } + + /** + * Returns editing domain from the host edit part. + * + * @generated + */ + protected TransactionalEditingDomain getEditingDomain() { + return ((IGraphicalEditPart) getHost()).getEditingDomain(); + } + + /** + * Clean all shortcuts to the host element from the same diagram + * + * @generated + */ + protected void addDestroyShortcutsCommand(ICompositeCommand cmd, View view) { + assert view.getEAnnotation("Shortcut") == null; //$NON-NLS-1$ + for (Iterator<?> it = view.getDiagram().getChildren().iterator(); it.hasNext();) { + View nextView = (View) it.next(); + if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() //$NON-NLS-1$ + || nextView.getElement() != view.getElement()) { + continue; + } + cmd.add(new DeleteCommand(getEditingDomain(), nextView)); + } + } + + /** + * @generated + */ + public static LinkConstraints getLinkConstraints() { + LinkConstraints cached = UMLDiagramEditorPlugin.getInstance().getLinkConstraints(); + if (cached == null) { + UMLDiagramEditorPlugin.getInstance().setLinkConstraints(cached = new LinkConstraints()); + } + return cached; + } + + /** + * @generated + */ + public static class LinkConstraints { + + /** + * @generated + */ + public LinkConstraints() { // use static method #getLinkConstraints() to access instance + } + + /** + * @generated + */ + public boolean canCreateAction_LocalPreconditionEdge(Action source, Constraint target) { + if (source != null) { + if (source.getLocalPreconditions().contains(target)) { + return false; + } + if (source == target) { + return false; + } + } + + return canExistAction_LocalPreconditionEdge(source, target); + } + + /** + * @generated + */ + public boolean canCreateAction_LocalPostconditionEdge(Action source, Constraint target) { + if (source != null) { + if (source.getLocalPostconditions().contains(target)) { + return false; + } + if (source == target) { + return false; + } + } + + return canExistAction_LocalPostconditionEdge(source, target); + } + + /** + * @generated + */ + public boolean canCreateObjectFlow_Edge(Activity container, ActivityNode source, ActivityNode target) { + return canExistObjectFlow_Edge(container, null, source, target); + } + + /** + * @generated + */ + public boolean canCreateControlFlow_Edge(Activity container, ActivityNode source, ActivityNode target) { + return canExistControlFlow_Edge(container, null, source, target); + } + + /** + * @generated + */ + public boolean canCreateExceptionHandler_Edge(ExecutableNode container, ExecutableNode source, + ObjectNode target) { + return canExistExceptionHandler_Edge(container, null, source, target); + } + + /** + * @generated + */ + public boolean canCreateComment_AnnotatedElementEdge(Comment source, Element target) { + if (source != null) { + if (source.getAnnotatedElements().contains(target)) { + return false; + } + } + + return canExistComment_AnnotatedElementEdge(source, target); + } + + /** + * @generated + */ + public boolean canCreateConstraint_ConstrainedElementEdge(Constraint source, Element target) { + if (source != null) { + if (source.getConstrainedElements().contains(target)) { + return false; + } + } + + return canExistConstraint_ConstrainedElementEdge(source, target); + } + + /** + * @generated + */ + public boolean canExistAction_LocalPreconditionEdge(Action source, Constraint target) { + return true; + } + + /** + * @generated + */ + public boolean canExistAction_LocalPostconditionEdge(Action source, Constraint target) { + return true; + } + + /** + * modify the generation to call explicitly custom helper + * + * @generated NOT + */ + public boolean canExistObjectFlow_Edge(Activity container, ObjectFlow linkInstance, ActivityNode source, + ActivityNode target) { + try { + if (source instanceof Action) { + // rule validateObjectFlow_validateNoActions + // rule workaround by addition of pins in case of Action + if (!CustomObjectFlowEditHelper.canStartNewObjectFlow((Action) source)) { + return false; + } + } + if (source instanceof InputPin) { + // rule validateInputPin_validateOutgoingEdgesStructuredOnly + if (source.getOwner() instanceof StructuredActivityNode) { + if (target != null && !source.getOwner().equals(target.getInStructuredNode())) { + return false; + } + } else { + return false; + } + } + if (source instanceof InitialNode) { + // rule validateInitialNode_validateControlEdges + return false; + } + if (source instanceof FinalNode) { + // rule validateFinalNode_validateNoOutgoingEdges + return false; + } + if (source instanceof JoinNode) { + // rule validateJoinNode_validateOneOutgoingEdge + if (!source.getOutgoings().isEmpty()) { + return false; + } + /* + * rule validateJoinNode_validateIncomingObjectFlow : + * We do not prevent creation of an outgoing ObjectFlow even if there is no incoming ObjectFlow. + * We let the possibility that the user intends to add an incoming ObjectFlow later. + */ + } + if (source instanceof ForkNode) { + // rule validateForkNode_validateEdges on source Fork node + ActivityEdge outgoingControlFlow = source.getOutgoing(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + ActivityEdge incomingControlFlow = source.getIncoming(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + if (outgoingControlFlow != null || incomingControlFlow != null) { + // there is a ControlFlow which means there must be no ObjectFlow + return false; + } + } + if (source instanceof MergeNode) { + // rule validateMergeNode_validateOneOutgoingEdge + if (!source.getOutgoings().isEmpty()) { + return false; + } + // rule validateMergeNode_validateEdges on source Merge node + ActivityEdge outgoingControlFlow = source.getOutgoing(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + ActivityEdge incomingControlFlow = source.getIncoming(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + if (outgoingControlFlow != null || incomingControlFlow != null) { + // there is a ControlFlow which means there must be no ObjectFlow + return false; + } + } + if (source instanceof DecisionNode) { + // rule validateDecisionNode_validateEdges on source Decision node + ActivityEdge outgoingControlFlow = source.getOutgoing(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + ActivityEdge incomingControlFlow = source.getIncoming(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + if (outgoingControlFlow != null || incomingControlFlow != null) { + // there is a ControlFlow which means there must be no ObjectFlow + return false; + } + } + if (source instanceof ActivityParameterNode) { + // rule validateActivityParameterNode_validateIncomingOrOutgoing + EList<ActivityEdge> incomings = source.getIncomings(); + if (!incomings.isEmpty()) { + return false; + } + } + if (target instanceof Action) { + // rule validateObjectFlow_validateNoActions + // rule workaround by addition of pins in case of Action + if (!CustomObjectFlowEditHelper.canEndNewObjectFlow((Action) target)) { + return false; + } + } + if (target instanceof OutputPin) { + // rule validateOutputPin_validateIncomingEdgesStructuredOnly + if (target.getOwner() instanceof StructuredActivityNode) { + if (source != null && !target.getOwner().equals(source.getInStructuredNode())) { + return false; + } + } else { + return false; + } + } + if (target instanceof InitialNode) { + // rule validateInitialNode_validateNoIncomingEdges + return false; + } + if (target instanceof JoinNode) { + // rule validateJoinNode_validateIncomingObjectFlow + ActivityEdge outgoingControlFlow = target.getOutgoing(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + if (outgoingControlFlow != null) { + // the outgoing edge is a ControlFlow which means there must be no incoming ObjectFlow + return false; + } + } + if (target instanceof ForkNode) { + // rule validateForkNode_validateOneIncomingEdge + if (!target.getIncomings().isEmpty()) { + return false; + } + // rule validateForkNode_validateEdges on target Fork node + ActivityEdge outgoingControlFlow = target.getOutgoing(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + ActivityEdge incomingControlFlow = target.getIncoming(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + if (outgoingControlFlow != null || incomingControlFlow != null) { + // there is a ControlFlow which means there must be no ObjectFlow + return false; + } + } + if (target instanceof MergeNode) { + // rule validateMergeNode_validateEdges on target Merge node + ActivityEdge outgoingControlFlow = target.getOutgoing(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + ActivityEdge incomingControlFlow = target.getIncoming(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + if (outgoingControlFlow != null || incomingControlFlow != null) { + // there is a ControlFlow which means there must be no ObjectFlow + return false; + } + } + if (target instanceof DecisionNode) { + // rule validateDecisionNode_validateIncomingOutgoingEdges + if (target.getIncomings().size() >= 2) { + // no more than two incoming edges + return false; + } + // rule validateDecisionNode_validateEdges on target Decision node + ActivityEdge outgoingControlFlow = target.getOutgoing(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + ActivityEdge incomingControlFlow = target.getIncoming(null, true, + UMLPackage.eINSTANCE.getControlFlow()); + if (outgoingControlFlow != null || incomingControlFlow != null) { + /* + * There is a ControlFlow which means there must be no + * ObjectFlow but the decision flow itself. + * We let the user insert up to one ObjectFlow for being + * able to select the decision flow among existing + * input flows. + */ + if (target.getIncoming(null, true, UMLPackage.eINSTANCE.getObjectFlow()) != null) { + // there is already an object flow which is intended to become the decision flow + return false; + } + } + } + if (target instanceof ActivityParameterNode) { + // rule validateActivityParameterNode_validateIncomingOrOutgoing + EList<ActivityEdge> outgoings = target.getOutgoings(); + if (!outgoings.isEmpty()) { + return false; + } + } + return true; + } catch (Exception e) { + UMLDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$ + return false; + } + } + + /** + * @generated + */ + public boolean canExistControlFlow_Edge(Activity container, ControlFlow linkInstance, ActivityNode source, + ActivityNode target) { + try { + if (source instanceof ObjectNode) { + if (!((ObjectNode) source).isControlType()) { + // rule validateControlFlow_validateObjectNodes + return false; + } + } + if (source instanceof InputPin) { + // rule validateInputPin_validateOutgoingEdgesStructuredOnly + if (source.getOwner() instanceof StructuredActivityNode) { + if (target != null && !source.getOwner().equals(target.getInStructuredNode())) { + return false; + } + } else { + return false; + } + } + if (source instanceof FinalNode) { + // rule validateFinalNode_validateNoOutgoingEdges + return false; + } + if (source instanceof JoinNode) { + // rule validateJoinNode_validateOneOutgoingEdge + if (!source.getOutgoings().isEmpty()) { + return false; + } + // rule validateJoinNode_validateIncomingObjectFlow + ActivityEdge incomingObjectFlow = source.getIncoming(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + if (incomingObjectFlow != null) { + // the outgoing edge must be an ObjectFlow + return false; + } + } + if (source instanceof ForkNode) { + // rule validateForkNode_validateEdges on source Fork node + ActivityEdge outgoingObjectFlow = source.getOutgoing(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + ActivityEdge incomingObjectFlow = source.getIncoming(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + if (outgoingObjectFlow != null || incomingObjectFlow != null) { + // there is an ObjectFlow which means there must be no ControlFlow + return false; + } + } + if (source instanceof MergeNode) { + // rule validateMergeNode_validateOneOutgoingEdge + if (!source.getOutgoings().isEmpty()) { + return false; + } + // rule validateMergeNode_validateEdges on source Merge node + ActivityEdge outgoingObjectFlow = source.getOutgoing(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + ActivityEdge incomingObjectFlow = source.getIncoming(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + if (outgoingObjectFlow != null || incomingObjectFlow != null) { + // there is an ObjectFlow which means there must be no ControlFlow + return false; + } + } + if (source instanceof DecisionNode) { + // rule validateDecisionNode_validateEdges on source Decision node + ActivityEdge outgoingObjectFlow = source.getOutgoing(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + int incomingObjectFlowNumber = 0; + for (ActivityEdge incomingEdge : source.getIncomings()) { + if (incomingEdge instanceof ObjectFlow) { + incomingObjectFlowNumber++; + } + } + if (outgoingObjectFlow != null || incomingObjectFlowNumber > 1) { + // there is an ObjectFlow (not intended for decisionInputFlow) which means there must be no ControlFlow + return false; + } + } + if (target instanceof ObjectNode) { + if (!((ObjectNode) target).isControlType()) { + // rule validateControlFlow_validateObjectNodes + return false; + } + } + if (target instanceof OutputPin) { + // rule validateOutputPin_validateIncomingEdgesStructuredOnly + if (target.getOwner() instanceof StructuredActivityNode) { + if (source != null && !target.getOwner().equals(source.getInStructuredNode())) { + return false; + } + } else { + return false; + } + } + if (target instanceof InitialNode) { + // rule validateInitialNode_validateNoIncomingEdges + return false; + } + if (target instanceof ForkNode) { + // rule validateForkNode_validateOneIncomingEdge + if (!target.getIncomings().isEmpty()) { + return false; + } + // rule validateForkNode_validateEdges on target Fork node + ActivityEdge outgoingObjectFlow = target.getOutgoing(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + ActivityEdge incomingObjectFlow = target.getIncoming(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + if (outgoingObjectFlow != null || incomingObjectFlow != null) { + // there is an ObjectFlow which means there must be no ControlFlow + return false; + } + } + if (target instanceof MergeNode) { + // rule validateMergeNode_validateEdges on target Merge node + ActivityEdge outgoingObjectFlow = target.getOutgoing(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + ActivityEdge incomingObjectFlow = target.getIncoming(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + if (outgoingObjectFlow != null || incomingObjectFlow != null) { + // there is an ObjectFlow which means there must be no ControlFlow + return false; + } + } + if (target instanceof DecisionNode) { + // rule validateDecisionNode_validateIncomingOutgoingEdges + if (target.getIncomings().size() >= 2) { + // no more than two incoming edges + return false; + } + // rule validateDecisionNode_validateEdges on target Decision node + ActivityEdge outgoingObjectFlow = target.getOutgoing(null, true, + UMLPackage.eINSTANCE.getObjectFlow()); + ActivityEdge incomingObjectFlow = null; + for (ActivityEdge incomingEdge : target.getIncomings()) { + // filter the decision flow + if (incomingEdge instanceof ObjectFlow + && incomingEdge != ((DecisionNode) target).getDecisionInputFlow()) { + incomingObjectFlow = incomingEdge; + } + } + if (outgoingObjectFlow != null || incomingObjectFlow != null) { + // there is an ObjectFlow which means there must be no ControlFlow + return false; + } + } + return true; + } catch (Exception e) { + UMLDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$ + return false; + } + } + + /** + * @generated + */ + public boolean canExistExceptionHandler_Edge(ExecutableNode container, ExceptionHandler linkInstance, + ExecutableNode source, ObjectNode target) { + return true; + } + + /** + * @generated + */ + public boolean canExistComment_AnnotatedElementEdge(Comment source, Element target) { + return true; + } + + /** + * @generated + */ + public boolean canExistConstraint_ConstrainedElementEdge(Constraint source, Element target) { + return true; + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/PackageDiagramEditorFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/PackageDiagramEditorFactory.java index 543bb725198..ae71ceb7538 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/PackageDiagramEditorFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/PackageDiagramEditorFactory.java @@ -1,84 +1,87 @@ -/*****************************************************************************
- * Copyright (c) 2014 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:
- * Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.clazz;
-
-import org.eclipse.emf.common.command.AbstractCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet;
-import org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
-
-/**
- * Factory for legacy package diagrams tht migrates them to the viewpoints-defined ones
- *
- * @author Laurent Wouters
- *
- */
-public class PackageDiagramEditorFactory extends GmfEditorFactory {
-
- /**
- * Initializes this factory
- */
- public PackageDiagramEditorFactory() {
- super(UmlClassDiagramForMultiEditor.class, "Package");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory#createIPageModel(java.lang.Object)
- */
- @Override
- public IPageModel createIPageModel(Object pageIdentifier) {
- migrate((Diagram) pageIdentifier);
- return super.createIPageModel(pageIdentifier);
- }
-
- /**
- * Migrate the given package diagram to the viewpoints-defined one
- *
- * @param diagram
- * The diagram to migrate
- */
- private void migrate(final Diagram diagram) {
- TransactionalEditingDomain domain = null;
- try {
- domain = ServiceUtilsForResourceSet.getInstance().getTransactionalEditingDomain(diagram.eResource().getResourceSet());
- } catch (ServiceException e) {
- return;
- }
- domain.getCommandStack().execute(new AbstractCommand() {
- @Override
- public void execute() {
- ViewPrototype proto = DiagramUtils.getPrototype(diagram);
- DiagramUtils.setPrototype(diagram, proto);
- diagram.setType("PapyrusUMLClassDiagram");
- }
-
- @Override
- public void redo() {
- execute();
- }
-
- @Override
- public boolean canExecute() {
- return true;
- }
- });
- }
-}
+/***************************************************************************** + * Copyright (c) 2014 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: + * Laurent Wouters laurent.wouters@cea.fr - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.clazz; + +import org.eclipse.emf.common.command.AbstractCommand; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; +import org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory; +import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramPrototype; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils; +import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; + +/** + * Factory for legacy package diagrams tht migrates them to the viewpoints-defined ones + * + * @author Laurent Wouters + * + */ +public class PackageDiagramEditorFactory extends GmfEditorFactory { + + /** + * Initializes this factory + */ + public PackageDiagramEditorFactory() { + super(UmlClassDiagramForMultiEditor.class, "Package"); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.papyrus.infra.gmfdiag.common.GmfEditorFactory#createIPageModel(java.lang.Object) + */ + @Override + public IPageModel createIPageModel(Object pageIdentifier) { + migrate((Diagram) pageIdentifier); + return super.createIPageModel(pageIdentifier); + } + + /** + * Migrate the given package diagram to the viewpoints-defined one + * + * @param diagram + * The diagram to migrate + */ + private void migrate(final Diagram diagram) { + TransactionalEditingDomain domain = null; + try { + domain = ServiceUtilsForResourceSet.getInstance().getTransactionalEditingDomain(diagram.eResource().getResourceSet()); + } catch (ServiceException e) { + return; + } + domain.getCommandStack().execute(new AbstractCommand() { + @Override + public void execute() { + ViewPrototype proto = DiagramUtils.getPrototype(diagram); + if (proto instanceof DiagramPrototype) { + DiagramUtils.setPrototype(diagram, (DiagramPrototype) proto); + diagram.setType("PapyrusUMLClassDiagram"); + } + } + + @Override + public void redo() { + execute(); + } + + @Override + public boolean canExecute() { + return true; + } + }); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/migration/ClassReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/migration/ClassReconcilerForCompartment_1_2_0.java index 567e742ec06..3bac8ed066e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/migration/ClassReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/migration/ClassReconcilerForCompartment_1_2_0.java @@ -20,7 +20,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class ClassReconcilerForCompartment extends ReconcilerForCompartment { +public class ClassReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String ClassAttributeCompartmentEditPart_VISUAL_ID = "7017"; //$NON-NLS-1$ private static final String ClassOperationCompartmentEditPart_VISUAL_ID = "7018"; //$NON-NLS-1$ diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/migration/ClassReconciler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/migration/ClassReconciler_1_1_0.java index ab5beda8092..c883e42f143 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/migration/ClassReconciler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/migration/ClassReconciler_1_1_0.java @@ -35,7 +35,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler; /** * Class Diagram Reconciler from 1.0.0 to 1.1.0 */ -public class ClassReconciler extends DiagramReconciler { +public class ClassReconciler_1_1_0 extends DiagramReconciler { private final static String CONTAINMENT_LINK_OLD_VISUAL_ID = "4022"; //$NON-NLS-1$ private final static String CONTAINMENT_LINK_NEW_VISUAL_ID = "4023"; //$NON-NLS-1$ diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/clazzdiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/clazzdiagram.configuration deleted file mode 100644 index 77d0c8d003c..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/clazzdiagram.configuration +++ /dev/null @@ -1,73 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_zzf4YHDtEeWh-MssWmCB_A" name="Inner Class Diagram" icon="platform:/plugin/org.eclipse.papyrus.uml.diagram.clazz/icons/obj16/Diagram_Class.gif" implementationID="PapyrusUMLClassDiagram">
- <modelRules xmi:id="_zzf4YXDtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
- </modelRules>
- <owningRules xmi:id="_zzf4YnDtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
- </owningRules>
- <owningRules xmi:id="_zzf4Y3DtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_zzf4ZHDtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/>
- <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
- <insertionPath xmi:id="_zzf4ZXDtEeWh-MssWmCB_A">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Class/nestedClassifier"/>
- </insertionPath>
- </childRules>
- <childRules xmi:id="_zzf4ZnDtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Comment"/>
- <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
- <insertionPath xmi:id="_zzf4Z3DtEeWh-MssWmCB_A">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Element/ownedComment"/>
- </insertionPath>
- </childRules>
- <paletteRules xmi:id="_zzf4aHDtEeWh-MssWmCB_A" element="clazz.tool.class"/>
- <paletteRules xmi:id="_zzf4aXDtEeWh-MssWmCB_A" element="clazz.tool.comment"/>
- <paletteRules xmi:id="_zzf4anDtEeWh-MssWmCB_A" element="clazz.tool.interface"/>
- <paletteRules xmi:id="_zzf4a3DtEeWh-MssWmCB_A" element="clazz.tool.abstraction"/>
- <paletteRules xmi:id="_zzf4bHDtEeWh-MssWmCB_A" element="clazz.tool.association"/>
- <paletteRules xmi:id="_zzf4bXDtEeWh-MssWmCB_A" element="clazz.tool.generalization"/>
- <paletteRules xmi:id="_zzf4bnDtEeWh-MssWmCB_A" element="clazz.tool.generalizationset"/>
- <paletteRules xmi:id="_zzf4b3DtEeWh-MssWmCB_A" permit="false" element="clazz.tool.*"/>
- <paletteRules xmi:id="_zzf4cHDtEeWh-MssWmCB_A" element=""/>
- </modelKinds>
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_zzf4cXDtEeWh-MssWmCB_A" name="Package Diagram" icon="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/icons/Diagram_Package.gif" implementationID="PapyrusUMLClassDiagram">
- <modelRules xmi:id="_zzf4cnDtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </modelRules>
- <owningRules xmi:id="_zzf4c3DtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_zzf4dHDtEeWh-MssWmCB_A"/>
- <paletteRules xmi:id="_zzf4dXDtEeWh-MssWmCB_A" element="clazz.tool.comment"/>
- <paletteRules xmi:id="_zzf4dnDtEeWh-MssWmCB_A" element="clazz.tool.constraint"/>
- <paletteRules xmi:id="_zzf4d3DtEeWh-MssWmCB_A" element="clazz.tool.model"/>
- <paletteRules xmi:id="_zzf4eHDtEeWh-MssWmCB_A" element="clazz.tool.package"/>
- <paletteRules xmi:id="_zzf4eXDtEeWh-MssWmCB_A" element="clazz.tool.abstraction"/>
- <paletteRules xmi:id="_zzf4enDtEeWh-MssWmCB_A" element="clazz.tool.dependency"/>
- <paletteRules xmi:id="_zzf4e3DtEeWh-MssWmCB_A" element="clazz.tool.packageimport"/>
- <paletteRules xmi:id="_zzf4fHDtEeWh-MssWmCB_A" element="clazz.tool.link"/>
- <paletteRules xmi:id="_zzf4fXDtEeWh-MssWmCB_A" element="clazz.tool.containmentlink"/>
- <paletteRules xmi:id="_zzf4fnDtEeWh-MssWmCB_A" permit="false" element="clazz.tool.*"/>
- <paletteRules xmi:id="_zzf4f3DtEeWh-MssWmCB_A" element=""/>
- </modelKinds>
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_zzf4gHDtEeWh-MssWmCB_A" implementationID="PapyrusUMLClassDiagram">
- <modelRules xmi:id="_zzf4gXDtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </modelRules>
- <owningRules xmi:id="_zzf4gnDtEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_zzf4g3DtEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml index 5d516983f83..0786511df3b 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/plugin.xml @@ -15,14 +15,6 @@ --> <plugin> - <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/clazzdiagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - <extension point="org.eclipse.ui.contexts" id="ui-context"> <?gmfgen generated="true"?> <context @@ -1688,13 +1680,6 @@ <?gmfgen generated="true"?> </extension> <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/classdiagram.elementtypesconfigurations"> - </elementTypeSet> -</extension> -<extension point="org.eclipse.papyrus.infra.gmfdiag.assistant.modelProviders"> <modelProvider uri="model/classdiagram.assistants"></modelProvider> @@ -1703,21 +1688,21 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="PapyrusUMLClassDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.clazz.custom.migration.ClassReconciler" + reconcilerClass="org.eclipse.papyrus.uml.diagram.clazz.custom.migration.ClassReconciler_1_1_0" source="1.0.0" - target="1.1.0"> + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLClassDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.clazz.custom.migration.ClassReconcilerForCompartment" - source="1.0.0" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.clazz.custom.migration.ClassReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLClassDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.clazz.custom.migration.ClassReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml index 470b3d50ce4..d98fa765037 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml @@ -214,16 +214,6 @@ realization="org.eclipse.papyrus.uml.diagram.common.providers.DefaultPasteCommandProvider"> </PasteCommandProvider> </extension> - <extension - point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> - <diagramCategory - class="org.eclipse.papyrus.uml.diagram.common.commands.CreateUMLModelCommand" - description="Create Unified Modeling Language diagrams" - icon="icons/category_uml.gif" - id="uml" - label="UML"> - </diagramCategory> - </extension> <!-- Property tester to check the nature (UML Model or Profile) of currently opened project --> <extension @@ -610,9 +600,9 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="AllDiagrams" - reconcilerClass="org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler" - source="Undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> </extension> </plugin> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateBehavioredClassifierDiagramCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateBehavioredClassifierDiagramCommand.java index 68ca41c9922..741c98217a7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateBehavioredClassifierDiagramCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateBehavioredClassifierDiagramCommand.java @@ -1,144 +1,142 @@ -/*******************************************************************************
- * Copyright (c) 2010 AtosOrigin.
- * 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:
- * AtosOrigin - initial API and implementation
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.common.commands;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils;
-import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
-import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil;
-import org.eclipse.uml2.uml.Behavior;
-import org.eclipse.uml2.uml.BehavioredClassifier;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-
-/**
- * Define a command to create a new Behavioral Diagram. This command is used by
- * all UI (toolbar, outline, creation wizards) to create a new Behavioral
- * Diagram. This class should be extended by behavioral diagram only.
- */
-public abstract class CreateBehavioredClassifierDiagramCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler {
-
- private Behavior behavior = null;
-
- private String name = ""; //$NON-NLS-1$
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void initializeDiagram(EObject diagram) {
- if (diagram instanceof Diagram) {
- Diagram diag = (Diagram) diagram;
- if (behavior != null) {
- diag.setElement(behavior);
- createBehaviorView(diag);
- }
- diag.setName(getName());
- }
-
- }
-
- /**
- * Create the associated behavior
- *
- * @return
- */
- protected Behavior createBehavior() {
- Behavior newBehavior = (Behavior) UMLFactory.eINSTANCE.create(getBehaviorEClass());
-
- return newBehavior;
- }
-
- /**
- * Get the kind of behavior associated to the diagram
- *
- * @return the EClass of the behavior supposed to own the diagram.
- */
- protected abstract EClass getBehaviorEClass();
-
- /**
- * {@inheritDoc}
- */
- protected void initializeModel(EObject owner) {
-
- if (owner.eClass() == getBehaviorEClass()) {
- behavior = (Behavior) owner;
-
- } else {
- behavior = (Behavior) UMLFactory.eINSTANCE.create(getBehaviorEClass());
-
- if (owner instanceof BehavioredClassifier) {
- BehavioredClassifier behaviorClassifier = (BehavioredClassifier) owner;
- behaviorClassifier.getOwnedBehaviors().add(behavior);
-
- } else if (owner instanceof Package) {
- org.eclipse.uml2.uml.Package pack = (org.eclipse.uml2.uml.Package) owner;
- pack.getPackagedElements().add(behavior);
-
- }
- behavior.setName(NamedElementUtil.getName(behavior));
- }
- }
-
- private void createBehaviorView(Diagram diagram) {
- ViewService.getInstance().createView(Node.class, new EObjectAdapter(behavior), diagram, null, ViewUtil.APPEND, true, getPreferenceHint());
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected Diagram doCreateDiagram(Resource diagramResource, EObject owner, EObject element, ViewPrototype prototype, String name) {
- Diagram diagram = null;
- if (element instanceof org.eclipse.uml2.uml.Package) {
- diagram = ViewService.createDiagram(element, getDiagramNotationID(), getPreferenceHint());
- } else if (element instanceof BehavioredClassifier) {
- diagram = ViewService.createDiagram(((BehavioredClassifier) element).getNearestPackage(), getDiagramNotationID(), getPreferenceHint());
- }
- // create diagram
- if (diagram != null) {
- setName(name);
- diagram.setElement(element);
- DiagramUtils.setOwner(diagram, owner);
- if (!prototype.isNatural()) {
- DiagramUtils.setPrototype(diagram, prototype);
- }
- initializeModel(element);
- initializeDiagram(diagram);
- diagramResource.getContents().add(diagram);
- }
- return diagram;
- }
-
- /**
- * Set the name of the diagram and its containing element
- *
- * @param newName
- */
- protected void setName(String newName) {
- if (newName == null || newName.equals(name)) {
- return;
- }
- name = newName;
- }
-
- protected String getName() {
- return name;
- }
-}
+/******************************************************************************* + * Copyright (c) 2010 AtosOrigin. + * 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: + * AtosOrigin - initial API and implementation + *******************************************************************************/ +package org.eclipse.papyrus.uml.diagram.common.commands; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.gmf.runtime.diagram.core.services.ViewService; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler; +import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramPrototype; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils; +import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; +import org.eclipse.uml2.uml.Behavior; +import org.eclipse.uml2.uml.BehavioredClassifier; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.UMLFactory; + +/** + * Define a command to create a new Behavioral Diagram. This command is used by + * all UI (toolbar, outline, creation wizards) to create a new Behavioral + * Diagram. This class should be extended by behavioral diagram only. + */ +public abstract class CreateBehavioredClassifierDiagramCommand extends AbstractPapyrusGmfCreateDiagramCommandHandler { + + private Behavior behavior = null; + + private String name = ""; //$NON-NLS-1$ + + /** + * {@inheritDoc} + */ + @Override + protected void initializeDiagram(EObject diagram) { + if (diagram instanceof Diagram) { + Diagram diag = (Diagram) diagram; + if (behavior != null) { + diag.setElement(behavior); + createBehaviorView(diag); + } + diag.setName(getName()); + } + + } + + /** + * Create the associated behavior + * + * @return + */ + protected Behavior createBehavior() { + Behavior newBehavior = (Behavior) UMLFactory.eINSTANCE.create(getBehaviorEClass()); + + return newBehavior; + } + + /** + * Get the kind of behavior associated to the diagram + * + * @return the EClass of the behavior supposed to own the diagram. + */ + protected abstract EClass getBehaviorEClass(); + + /** + * {@inheritDoc} + */ + protected void initializeModel(EObject owner) { + + if (owner.eClass() == getBehaviorEClass()) { + behavior = (Behavior) owner; + + } else { + behavior = (Behavior) UMLFactory.eINSTANCE.create(getBehaviorEClass()); + + if (owner instanceof BehavioredClassifier) { + BehavioredClassifier behaviorClassifier = (BehavioredClassifier) owner; + behaviorClassifier.getOwnedBehaviors().add(behavior); + + } else if (owner instanceof Package) { + org.eclipse.uml2.uml.Package pack = (org.eclipse.uml2.uml.Package) owner; + pack.getPackagedElements().add(behavior); + + } + behavior.setName(NamedElementUtil.getName(behavior)); + } + } + + private void createBehaviorView(Diagram diagram) { + ViewService.getInstance().createView(Node.class, new EObjectAdapter(behavior), diagram, null, ViewUtil.APPEND, true, getPreferenceHint()); + } + + /** + * {@inheritDoc} + */ + @Override + protected Diagram doCreateDiagram(Resource diagramResource, EObject owner, EObject element, DiagramPrototype prototype, String name) { + Diagram diagram = null; + if (element instanceof org.eclipse.uml2.uml.Package) { + diagram = ViewService.createDiagram(element, getDiagramNotationID(), getPreferenceHint()); + } else if (element instanceof BehavioredClassifier) { + diagram = ViewService.createDiagram(((BehavioredClassifier) element).getNearestPackage(), getDiagramNotationID(), getPreferenceHint()); + } + // create diagram + if (diagram != null) { + setName(name); + diagram.setElement(element); + DiagramUtils.setOwner(diagram, owner); + DiagramUtils.setPrototype(diagram, prototype); + initializeModel(element); + initializeDiagram(diagram); + diagramResource.getContents().add(diagram); + } + return diagram; + } + + /** + * Set the name of the diagram and its containing element + * + * @param newName + */ + protected void setName(String newName) { + if (newName == null || newName.equals(name)) { + return; + } + name = newName; + } + + protected String getName() { + return name; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateUMLModelCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateUMLModelCommand.java index 4190a606438..d6c743006b1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateUMLModelCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/CreateUMLModelCommand.java @@ -21,8 +21,6 @@ import org.eclipse.uml2.uml.UMLFactory; */ public class CreateUMLModelCommand extends ModelCreationCommandBase { - public static final String COMMAND_ID = "uml"; - /** * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#createRootElement() * diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/ModelCreationCommandBase.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/ModelCreationCommandBase.java index e723d778fd2..8f391aba395 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/ModelCreationCommandBase.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/commands/ModelCreationCommandBase.java @@ -13,19 +13,10 @@ *****************************************************************************/ package org.eclipse.papyrus.uml.diagram.common.commands; -import java.util.Collections; - -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.emf.ecore.resource.Resource; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.papyrus.infra.architecture.commands.IModelCreationCommand; import org.eclipse.papyrus.infra.core.resource.ModelSet; -import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; -import org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand; import org.eclipse.papyrus.uml.tools.model.UmlUtils; /** @@ -34,41 +25,14 @@ import org.eclipse.papyrus.uml.tools.model.UmlUtils; public abstract class ModelCreationCommandBase implements IModelCreationCommand { /** - * @see org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand#createModel(org.eclipse.papyrus.infra.core.utils.DiResourceSet) - * - * @param diResourceSet + * @param modelSet */ @Override public void createModel(final ModelSet modelSet) { - runAsTransaction(modelSet); - } - - /** - * Run as transaction. - * - * @param diResourceSet - * the di resource set - */ - protected void runAsTransaction(final ModelSet modelSet) { - // Get the uml element to which the newly created diagram will be - // attached. - // Create the diagram final Resource modelResource = UmlUtils.getUmlResource(modelSet); - TransactionalEditingDomain editingDomain = modelSet.getTransactionalEditingDomain(); - - AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, "Initialize model", Collections.EMPTY_LIST) { - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - EObject model = getRootElement(modelResource); - attachModelToResource(model, modelResource); - - initializeModel(model); - return CommandResult.newOKCommandResult(); - - } - }; - editingDomain.getCommandStack().execute(new GMFtoEMFCommandWrapper(command)); + EObject model = getRootElement(modelResource); + attachModelToResource(model, modelResource); + initializeModel(model); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/dialogs/CreateUmlElementDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/dialogs/CreateUmlElementDialog.java index 36b2875b928..a75e773556c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/dialogs/CreateUmlElementDialog.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/dialogs/CreateUmlElementDialog.java @@ -31,6 +31,7 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; +import org.eclipse.gmf.runtime.emf.type.core.IClientContext; import org.eclipse.gmf.runtime.emf.type.core.IElementType; import org.eclipse.gmf.runtime.emf.type.core.commands.CreateRelationshipCommand; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; @@ -39,8 +40,11 @@ import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.services.edit.context.TypeContext; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.common.Messages; import org.eclipse.papyrus.uml.tools.utils.ElementUtil; import org.eclipse.papyrus.uml.tools.utils.NamedElementUtil; @@ -297,13 +301,19 @@ public class CreateUmlElementDialog extends ElementTreeSelectionDialog { * The command corresponding to this request or an {@link UnexecutableCommand} when the command can not be build */ private ICommand getCommand(IEditCommandRequest request) { - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(UMLPackage.eINSTANCE.getNamedElement()); - { - if (provider != null) { - ICommand cmd = provider.getEditCommand(request); - if (cmd != null && cmd.canExecute()) { - return cmd; - } + IClientContext context; + try { + context = TypeContext.getContext(domain); + } catch (ServiceException e) { + Activator.log.error(e); + return UnexecutableCommand.INSTANCE; + } + + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(UMLPackage.eINSTANCE.getNamedElement(), context); + if (provider != null) { + ICommand cmd = provider.getEditCommand(request); + if (cmd != null && cmd.canExecute()) { + return cmd; } } return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/EditableLabelForNodeEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/EditableLabelForNodeEditPart.java index c62a031a360..174b4790ed3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/EditableLabelForNodeEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editparts/EditableLabelForNodeEditPart.java @@ -1,747 +1,736 @@ -/**
- * Copyright (c) 2015 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.uml.diagram.common.editparts;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Point;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.RunnableWithResult;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gef.AccessibleEditPart;
-import org.eclipse.gef.EditPolicy;
-import org.eclipse.gef.Request;
-import org.eclipse.gef.requests.DirectEditRequest;
-import org.eclipse.gef.tools.CellEditorLocator;
-import org.eclipse.gef.tools.DirectEditManager;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
-import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
-import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
-import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
-import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
-import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
-import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
-import org.eclipse.gmf.runtime.notation.FontStyle;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.directedit.locator.CellEditorLocatorAccess;
-import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.window.Window;
-import org.eclipse.papyrus.extensionpoints.editors.Activator;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog;
-import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper;
-import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil;
-import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds;
-import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper;
-import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy;
-import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel;
-import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition;
-import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure;
-import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure;
-import org.eclipse.papyrus.uml.diagram.common.locator.MultilineCellEditorLocator;
-import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter;
-import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser;
-import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.uml2.uml.Feature;
-
-public class EditableLabelForNodeEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit {
-
-
- private DirectEditManager manager;
-
- private IParser parser;
-
- private List<?> parserElements;
-
- private String defaultText;
-
- /**
- * direct edition mode (default, undefined, registered editor, etc.)
- *
- */
- protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR;
-
- protected IDirectEditorConfiguration configuration;
-
- public EditableLabelForNodeEditPart(View view) {
- super(view);
- }
-
- @Override
- protected void createDefaultEditPolicies() {
- super.createDefaultEditPolicies();
- installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
- installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
- installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy());
- }
-
- protected String getLabelTextHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getText();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getText();
- } else {
- return ((Label) figure).getText();
- }
- }
-
- protected void setLabelTextHelper(IFigure figure, String text) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setText(text);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setText(text);
- } else {
- ((Label) figure).setText(text);
- }
- }
-
- protected Image getLabelIconHelper(IFigure figure) {
- if (figure instanceof WrappingLabel) {
- return ((WrappingLabel) figure).getIcon();
- } else if (figure instanceof ILabelFigure) {
- return ((ILabelFigure) figure).getIcon();
- } else {
- return ((Label) figure).getIcon();
- }
- }
-
- protected void setLabelIconHelper(IFigure figure, Image icon) {
- if (figure instanceof WrappingLabel) {
- ((WrappingLabel) figure).setIcon(icon);
- } else if (figure instanceof ILabelFigure) {
- ((ILabelFigure) figure).setIcon(icon);
- } else {
- ((Label) figure).setIcon(icon);
- }
- }
-
- public void setLabel(IFigure
- figure) {
- unregisterVisuals();
- setFigure(figure);
- defaultText = getLabelTextHelper(figure);
- registerVisuals();
- refreshVisuals();
- }
-
- @Override
- protected List<?> getModelChildren() {
- return Collections.EMPTY_LIST;
- }
-
- @Override
- public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
- return null;
- }
-
- @Override
- public void setParser(IParser parser) {
- this.parser = parser;
- }
-
- protected EObject getParserElement() {
- return resolveSemanticElement();
- }
-
- protected Image getLabelIcon() {
- EObject parserElement = getParserElement();
- if(parserElement == null) {
- return null;
- }
- List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer());
- for(View view : views) {
- if(AppearanceHelper.showElementIcon(view)) {
- return org.eclipse.papyrus.uml.diagram.common.Activator.getDefault().getImage(parserElement.eClass());
- }
- }
- return null;
- }
-
- protected String getLabelText() {
- String text = null;
- EObject parserElement = getParserElement();
- if (parserElement != null && getParser() != null) {
- text = getParser().getPrintString(
- new EObjectAdapter(parserElement),
- getParserOptions().intValue());
- }
- if (text == null || text.length() == 0) {
- text = defaultText;
- }
- return text;
- }
-
- @Override
- public void setLabelText(String text) {
- setLabelTextHelper(getFigure(), text);
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- @Override
- public String getEditText() {
- if (getParserElement() == null || getParser() == null) {
- return ""; //$NON-NLS-1$
- }
- return getParser().getEditString(
- new EObjectAdapter(getParserElement()),
- getParserOptions().intValue());
- }
-
- protected boolean isEditable() {
- return getParser() != null;
- }
-
- @Override
- public ICellEditorValidator getEditTextValidator() {
- return new ICellEditorValidator() {
-
- @Override
- public String isValid(final Object value) {
- if (value instanceof String) {
- final EObject element = getParserElement();
- final IParser parser = getParser();
- try {
- IParserEditStatus valid =
- (IParserEditStatus) getEditingDomain().runExclusive(
- new RunnableWithResult.Impl<java.lang.Object>() {
-
- @Override
- public void run() {
- setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
- }
- });
- return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage();
- } catch (InterruptedException ie) {
- ie.printStackTrace();
- }
- }
-
- // shouldn't get here
- return null;
- }
- };
- }
-
- @Override
- public IContentAssistProcessor getCompletionProcessor() {
- if (getParserElement() == null || getParser() == null) {
- return null;
- }
- return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
- }
-
- @Override
- public ParserOptions getParserOptions() {
- return ParserOptions.NONE;
- }
-
- public IParser getParser() {
-
- if(parser == null) {
- parser =ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), resolveSemanticElement(), getNotationView().getType()));
- if(parser == null) {
- parser = new NamedElementLabelParser();
- }
- }
- return parser;
- }
-
- protected DirectEditManager getManager() {
- if (manager == null) {
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), getTextCellEditorLocator(this)));
- }
- return manager;
- }
-
- protected void setManager(DirectEditManager manager) {
- this.manager = manager;
- }
-
- protected void performDirectEdit() {
- BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() {
-
- @Override
- public void run() {
- getManager().show();
- }
- });
- }
-
- protected void performDirectEdit(Point eventLocation) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
- }
- }
-
- private void performDirectEdit(char initialCharacter) {
- if (getManager() instanceof TextDirectEditManager) {
- ((TextDirectEditManager) getManager()).show(initialCharacter);
- } else {
- performDirectEdit();
- }
- }
-
- public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
- if (source.getFigure() instanceof IMultilineEditableFigure) {
- return new MultilineCellEditorLocator(
- (IMultilineEditableFigure) source.getFigure());
- }
- else {
- return CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
-
- }
- }
- @Override
- protected void performDirectEditRequest(Request request) {
-
- final Request theRequest = request;
-
- if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) {
- directEditionMode = getDirectEditionType();
- }
- switch (directEditionMode) {
- case IDirectEdition.NO_DIRECT_EDITION:
- // no direct edition mode => does nothing
- return;
- case IDirectEdition.EXTENDED_DIRECT_EDITOR:
- updateExtendedEditorConfiguration();
- if (configuration == null || configuration.getLanguage() == null) {
- // Create default edit manager
- setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this),getTextCellEditorLocator(this)));
- performDefaultDirectEditorEdit(theRequest);
- } else {
- configuration.preEditAction(resolveSemanticElement());
- Dialog dialog = null;
- if (configuration instanceof ICustomDirectEditorConfiguration) {
- setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this));
- initializeDirectEditManager(theRequest);
- return;
- } else if (configuration instanceof IPopupEditorConfiguration) {
- IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this);
- helper.showEditor();
- return;
- }
- else if (configuration instanceof IAdvancedEditorConfiguration) {
- dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()));
- } else if (configuration instanceof IDirectEditorConfiguration) {
- dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration);
- } else {
- return;
- }
- final Dialog finalDialog = dialog;
-
- if (Window.OK == dialog.open()) {
- TransactionalEditingDomain domain = getEditingDomain();
- RecordingCommand command = new RecordingCommand(domain, "Edit Label") {
-
- @Override
- protected void doExecute() {
- configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue());
-
- }
- };
- domain.getCommandStack().execute(command);
- }
- }
- break;
- case IDirectEdition.DEFAULT_DIRECT_EDITOR:
- initializeDirectEditManager(theRequest);
- break;
- default:
- break;
- }
- }
-
- protected void initializeDirectEditManager(final Request request) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (request.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- }
- else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- protected void refreshVisuals() {
- super.refreshVisuals();
- refreshLabel();
- refreshFont();
- refreshFontColor();
- refreshUnderline();
- refreshStrikeThrough();
- }
-
- protected void refreshLabel() {
- EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY);
- if (maskLabelPolicy == null) {
- maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL);
- }
- if (maskLabelPolicy == null) {
- View view = (View) getModel();
- if (view.isVisible()) {
- setLabelTextHelper(getFigure(), getLabelText());
- setLabelIconHelper(getFigure(), getLabelIcon());
- }
- else {
- setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$
- setLabelIconHelper(getFigure(), null);
- }
- }
- Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
- if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
- }
- Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE);
- if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) {
- ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback();
- }
- }
-
- protected void refreshUnderline() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
- }
- if (resolveSemanticElement() instanceof Feature) {
- if (((Feature) resolveSemanticElement()).isStatic()) {
- ((WrappingLabel) getFigure()).setTextUnderline(true);
- }
- else {
- ((WrappingLabel) getFigure()).setTextUnderline(false);
- }
- }
- }
-
- protected void refreshStrikeThrough() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null && getFigure() instanceof WrappingLabel) {
- ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
- }
- }
-
- @Override
- protected void refreshFont() {
- FontStyle style =
- (FontStyle) getFontStyleOwnerView().getStyle(
- NotationPackage.eINSTANCE.getFontStyle());
- if (style != null) {
- FontData fontData = new FontData(
- style.getFontName(), style.getFontHeight(),
- (style.isBold() ? SWT.BOLD : SWT.NORMAL) |
- (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
- setFont(fontData);
- }
- }
-
- @Override
- protected void setFontColor(Color color) {
- getFigure().setForegroundColor(color);
- }
-
- @Override
- protected void addSemanticListeners() {
- if (getParser() instanceof ISemanticParser) {
- EObject element = resolveSemanticElement();
- parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
- for (int i = 0; i < parserElements.size(); i++) {
- addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
- }
- } else {
- super.addSemanticListeners();
- }
- }
-
- @Override
- protected void removeSemanticListeners() {
- if (parserElements != null) {
- for (int i = 0; i < parserElements.size(); i++) {
- removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
- }
- } else {
- super.removeSemanticListeners();
- }
- }
-
- @Override
- protected AccessibleEditPart getAccessibleEditPart() {
- if (accessibleEP == null) {
- accessibleEP = new AccessibleGraphicalEditPart() {
-
- @Override
- public void getName(AccessibleEvent e) {
- e.result = getLabelTextHelper(getFigure());
- }
- };
- }
- return accessibleEP;
- }
-
- private View getFontStyleOwnerView() {
- return getPrimaryView();
- }
-
- /**
- * Returns the kind of associated editor for direct edition.
- *
- * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition
- */
- public int getDirectEditionType() {
- if (checkExtendedEditor()) {
- initExtendedEditorConfiguration();
- return IDirectEdition.EXTENDED_DIRECT_EDITOR;
- }
- if (checkDefaultEdition()) {
- return IDirectEdition.DEFAULT_DIRECT_EDITOR;
- }
-
- // not a named element. no specific editor => do nothing
- return IDirectEdition.NO_DIRECT_EDITION;
- }
-
- /**
- * Checks if an extended editor is present.
- *
- * @return <code>true</code> if an extended editor is present.
- */
- protected boolean checkExtendedEditor() {
- if (resolveSemanticElement() != null) {
- return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName());
- }
- return false;
- }
-
- /**
- * Checks if a default direct edition is available
- *
- * @return <code>true</code> if a default direct edition is available
- */
- protected boolean checkDefaultEdition() {
- return (getParser() != null);
- }
-
- /**
- * Initializes the extended editor configuration
- *
- */
- protected void initExtendedEditorConfiguration() {
- if (configuration == null) {
- final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("")) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName());
- } else {
- configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName());
- }
- }
- }
-
- /**
- * Updates the preference configuration
- *
- */
- protected void updateExtendedEditorConfiguration() {
- String languagePreferred = Activator.getDefault().getPreferenceStore().getString(
- IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName());
- if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) {
- configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement()
- .eClass().getInstanceClassName());
- } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) {
- configuration = null;
- }
- }
-
- /**
- * Performs the direct edit usually used by GMF editors.
- *
- * @param theRequest
- * the direct edit request that starts the direct edit system
- */
- protected void performDefaultDirectEditorEdit(final Request theRequest) {
- // initialize the direct edit manager
- try {
- getEditingDomain().runExclusive(new Runnable() {
-
- @Override
- public void run() {
- if (isActive() && isEditable()) {
- if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
- Character initialChar = (Character) theRequest.getExtendedData().get(
- RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
- performDirectEdit(initialChar.charValue());
- } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
- DirectEditRequest editRequest = (DirectEditRequest) theRequest;
- performDirectEdit(editRequest.getLocation());
- } else {
- performDirectEdit();
- }
- }
- }
- });
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- protected void addNotationalListeners() {
- super.addNotationalListeners();
- addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
- }
-
- @Override
- protected void removeNotationalListeners() {
- super.removeNotationalListeners();
- removeListenerFilter("PrimaryView"); //$NON-NLS-1$
- }
-
- @Override
- protected void handleNotificationEvent(Notification event) {
- refreshLabel();
- Object feature = event.getFeature();
- if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
- Integer c = (Integer) event.getNewValue();
- setFontColor(DiagramColorRegistry.getInstance().getColor(c));
- } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
- refreshUnderline();
- } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
- refreshStrikeThrough();
- } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
- NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
- refreshFont();
- } else {
- if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
- refreshLabel();
- }
- if (getParser() instanceof ISemanticParser) {
- ISemanticParser modelParser =
- (ISemanticParser) getParser();
- if (modelParser.areSemanticElementsAffected(null, event)) {
- removeSemanticListeners();
- if (resolveSemanticElement() != null) {
- addSemanticListeners();
- }
- refreshLabel();
- }
- }
- }
- if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) {
- refreshLabel();
- }
- super.handleNotificationEvent(event);
- }
-
- protected IFigure createFigure() {
- IFigure label=null;
- if(getParent() instanceof ContainerNodeEditPart){
- label= ((ContainerNodeEditPart)getParent()).getPrimaryShape().getNameLabel();
- }
- else{
- label = createFigurePrim();
- }
- defaultText = getLabelTextHelper(label);
- return label;
- }
-
- protected IFigure createFigurePrim() {
- return new PapyrusWrappingLabel();
- }
-
- private static final String ADD_PARENT_MODEL = "AddParentModel";
-
- @Override
- public void activate() {
- super.activate();
- addOwnerElementListeners();
- }
-
- protected void addOwnerElementListeners() {
- addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel()));
-
- }
-
- @Override
- public void deactivate() {
- removeOwnerElementListeners();
- super.deactivate();
-
- }
-
- protected void removeOwnerElementListeners() {
- removeListenerFilter(ADD_PARENT_MODEL);
-
- }
-
- @Override
- public boolean isSelectable() {
- return getFigure().isShowing();
- }
-}
+/** + * Copyright (c) 2015 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.uml.diagram.common.editparts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.Label; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.emf.transaction.RunnableWithResult; +import org.eclipse.emf.transaction.TransactionalEditingDomain; +import org.eclipse.gef.AccessibleEditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.Request; +import org.eclipse.gef.requests.DirectEditRequest; +import org.eclipse.gef.tools.CellEditorLocator; +import org.eclipse.gef.tools.DirectEditManager; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParser; +import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions; +import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; +import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants; +import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager; +import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; +import org.eclipse.gmf.runtime.notation.FontStyle; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.window.Window; +import org.eclipse.papyrus.extensionpoints.editors.Activator; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IAdvancedEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.ICustomDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IDirectEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.configuration.IPopupEditorConfiguration; +import org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.ILabelEditorDialog; +import org.eclipse.papyrus.extensionpoints.editors.ui.IPopupEditorHelper; +import org.eclipse.papyrus.extensionpoints.editors.utils.DirectEditorsUtil; +import org.eclipse.papyrus.extensionpoints.editors.utils.IDirectEditorsIds; +import org.eclipse.papyrus.infra.emf.appearance.helper.AppearanceHelper; +import org.eclipse.papyrus.infra.emf.appearance.helper.VisualInformationPapyrusConstants; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.IControlParserForDirectEdit; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusCompartmentEditPart; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IndirectMaskLabelEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel; +import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramEditPartsUtil; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.directedit.locator.CellEditorLocatorAccess; +import org.eclipse.papyrus.infra.gmfdiag.tooling.runtime.edit.policies.DefaultNodeLabelDragPolicy; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.papyrus.uml.diagram.common.figure.node.IMultilineEditableFigure; +import org.eclipse.papyrus.uml.diagram.common.locator.MultilineCellEditorLocator; +import org.eclipse.papyrus.uml.diagram.common.parser.DefaultParserHintAdapter; +import org.eclipse.papyrus.uml.diagram.common.parser.NamedElementLabelParser; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.uml2.uml.Feature; + +public class EditableLabelForNodeEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { + + + private DirectEditManager manager; + + private IParser parser; + + private List<?> parserElements; + + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + protected IDirectEditorConfiguration configuration; + + public EditableLabelForNodeEditPart(View view) { + super(view); + } + + @Override + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultNodeLabelDragPolicy()); + } + + protected String getLabelTextHelper(IFigure figure) { + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getText(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getText(); + } else { + return ((Label) figure).getText(); + } + } + + protected void setLabelTextHelper(IFigure figure, String text) { + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setText(text); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setText(text); + } else { + ((Label) figure).setText(text); + } + } + + protected Image getLabelIconHelper(IFigure figure) { + if (figure instanceof WrappingLabel) { + return ((WrappingLabel) figure).getIcon(); + } else if (figure instanceof ILabelFigure) { + return ((ILabelFigure) figure).getIcon(); + } else { + return ((Label) figure).getIcon(); + } + } + + protected void setLabelIconHelper(IFigure figure, Image icon) { + if (figure instanceof WrappingLabel) { + ((WrappingLabel) figure).setIcon(icon); + } else if (figure instanceof ILabelFigure) { + ((ILabelFigure) figure).setIcon(icon); + } else { + ((Label) figure).setIcon(icon); + } + } + + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + @Override + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + @Override + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + @Override + public void setParser(IParser parser) { + this.parser = parser; + } + + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + protected Image getLabelIcon() { + EObject parserElement = getParserElement(); + if (parserElement == null) { + return null; + } + List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); + for (View view : views) { + if (AppearanceHelper.showElementIcon(view)) { + return org.eclipse.papyrus.uml.diagram.common.Activator.getDefault().getImage(parserElement.eClass()); + } + } + return null; + } + + protected String getLabelText() { + String text = null; + EObject parserElement = getParserElement(); + if (parserElement != null && getParser() != null) { + text = getParser().getPrintString( + new EObjectAdapter(parserElement), + getParserOptions().intValue()); + } + if (text == null || text.length() == 0) { + text = defaultText; + } + return text; + } + + @Override + public void setLabelText(String text) { + setLabelTextHelper(getFigure(), text); + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + @Override + public String getEditText() { + if (getParserElement() == null || getParser() == null) { + return ""; //$NON-NLS-1$ + } + return getParser().getEditString( + new EObjectAdapter(getParserElement()), + getParserOptions().intValue()); + } + + protected boolean isEditable() { + return getParser() != null; + } + + @Override + public ICellEditorValidator getEditTextValidator() { + return new ICellEditorValidator() { + + @Override + public String isValid(final Object value) { + if (value instanceof String) { + final EObject element = getParserElement(); + final IParser parser = getParser(); + try { + IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive( + new RunnableWithResult.Impl<java.lang.Object>() { + + @Override + public void run() { + setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value)); + } + }); + return valid.getCode() == IParserEditStatus.EDITABLE ? null : valid.getMessage(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + + // shouldn't get here + return null; + } + }; + } + + @Override + public IContentAssistProcessor getCompletionProcessor() { + if (getParserElement() == null || getParser() == null) { + return null; + } + return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + } + + @Override + public ParserOptions getParserOptions() { + return ParserOptions.NONE; + } + + public IParser getParser() { + + if (parser == null) { + parser = ParserService.getInstance().getParser(new DefaultParserHintAdapter(getNotationView().getDiagram(), resolveSemanticElement(), getNotationView().getType())); + if (parser == null) { + parser = new NamedElementLabelParser(); + } + } + return parser; + } + + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), getTextCellEditorLocator(this))); + } + return manager; + } + + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) { + if (source.getFigure() instanceof IMultilineEditableFigure) { + return new MultilineCellEditorLocator( + (IMultilineEditableFigure) source.getFigure()); + } else { + return CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source); + + } + } + + @Override + protected void performDirectEditRequest(Request request) { + + final Request theRequest = request; + + if (IDirectEdition.UNDEFINED_DIRECT_EDITOR == directEditionMode) { + directEditionMode = getDirectEditionType(); + } + switch (directEditionMode) { + case IDirectEdition.NO_DIRECT_EDITION: + // no direct edition mode => does nothing + return; + case IDirectEdition.EXTENDED_DIRECT_EDITOR: + updateExtendedEditorConfiguration(); + if (configuration == null || configuration.getLanguage() == null) { + // Create default edit manager + setManager(new MultilineLabelDirectEditManager(this, MultilineLabelDirectEditManager.getTextCellEditorClass(this), getTextCellEditorLocator(this))); + performDefaultDirectEditorEdit(theRequest); + } else { + configuration.preEditAction(resolveSemanticElement()); + Dialog dialog = null; + if (configuration instanceof ICustomDirectEditorConfiguration) { + setManager(((ICustomDirectEditorConfiguration) configuration).createDirectEditManager(this)); + initializeDirectEditManager(theRequest); + return; + } else if (configuration instanceof IPopupEditorConfiguration) { + IPopupEditorHelper helper = ((IPopupEditorConfiguration) configuration).createPopupEditorHelper(this); + helper.showEditor(); + return; + } else if (configuration instanceof IAdvancedEditorConfiguration) { + dialog = ((IAdvancedEditorConfiguration) configuration).createDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement())); + } else if (configuration instanceof IDirectEditorConfiguration) { + dialog = new ExtendedDirectEditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), resolveSemanticElement(), configuration.getTextToEdit(resolveSemanticElement()), configuration); + } else { + return; + } + final Dialog finalDialog = dialog; + + if (Window.OK == dialog.open()) { + TransactionalEditingDomain domain = getEditingDomain(); + RecordingCommand command = new RecordingCommand(domain, "Edit Label") { + + @Override + protected void doExecute() { + configuration.postEditAction(resolveSemanticElement(), ((ILabelEditorDialog) finalDialog).getValue()); + + } + }; + domain.getCommandStack().execute(command); + } + } + break; + case IDirectEdition.DEFAULT_DIRECT_EDITOR: + initializeDirectEditManager(theRequest); + break; + default: + break; + } + } + + protected void initializeDirectEditManager(final Request request) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + @Override + public void run() { + if (isActive() && isEditable()) { + if (request.getExtendedData().get( + RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) request.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @Override + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + protected void refreshLabel() { + EditPolicy maskLabelPolicy = getEditPolicy(IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY); + if (maskLabelPolicy == null) { + maskLabelPolicy = getEditPolicy(IndirectMaskLabelEditPolicy.INDRIRECT_MASK_MANAGED_LABEL); + } + if (maskLabelPolicy == null) { + View view = (View) getModel(); + if (view.isVisible()) { + setLabelTextHelper(getFigure(), getLabelText()); + setLabelIconHelper(getFigure(), getLabelIcon()); + } else { + setLabelTextHelper(getFigure(), ""); //$NON-NLS-1$ + setLabelIconHelper(getFigure(), null); + } + } + Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (pdEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) pdEditPolicy).refreshFeedback(); + } + Object sfEditPolicy = getEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE); + if (sfEditPolicy instanceof UMLTextSelectionEditPolicy) { + ((UMLTextSelectionEditPolicy) sfEditPolicy).refreshFeedback(); + } + } + + protected void refreshUnderline() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline()); + } + if (resolveSemanticElement() instanceof Feature) { + if (((Feature) resolveSemanticElement()).isStatic()) { + ((WrappingLabel) getFigure()).setTextUnderline(true); + } else { + ((WrappingLabel) getFigure()).setTextUnderline(false); + } + } + } + + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + @Override + protected void refreshFont() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null) { + FontData fontData = new FontData( + style.getFontName(), style.getFontHeight(), + (style.isBold() ? SWT.BOLD : SWT.NORMAL) | + (style.isItalic() ? SWT.ITALIC : SWT.NORMAL)); + setFont(fontData); + } + } + + @Override + protected void setFontColor(Color color) { + getFigure().setForegroundColor(color); + } + + @Override + protected void addSemanticListeners() { + if (getParser() instanceof ISemanticParser) { + EObject element = resolveSemanticElement(); + parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element); + for (int i = 0; i < parserElements.size(); i++) { + addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$ + } + } else { + super.addSemanticListeners(); + } + } + + @Override + protected void removeSemanticListeners() { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { + removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ + } + } else { + super.removeSemanticListeners(); + } + } + + @Override + protected AccessibleEditPart getAccessibleEditPart() { + if (accessibleEP == null) { + accessibleEP = new AccessibleGraphicalEditPart() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + private View getFontStyleOwnerView() { + return getPrimaryView(); + } + + /** + * Returns the kind of associated editor for direct edition. + * + * @return an <code>int</code> corresponding to the kind of direct editor, @see org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition + */ + public int getDirectEditionType() { + if (checkExtendedEditor()) { + initExtendedEditorConfiguration(); + return IDirectEdition.EXTENDED_DIRECT_EDITOR; + } + if (checkDefaultEdition()) { + return IDirectEdition.DEFAULT_DIRECT_EDITOR; + } + + // not a named element. no specific editor => do nothing + return IDirectEdition.NO_DIRECT_EDITION; + } + + /** + * Checks if an extended editor is present. + * + * @return <code>true</code> if an extended editor is present. + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement().eClass().getInstanceClassName()); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * + */ + protected void initExtendedEditorConfiguration() { + if (configuration == null) { + final String languagePreferred = Activator.getDefault().getPreferenceStore().getString(IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("")) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * Updates the preference configuration + * + */ + protected void updateExtendedEditorConfiguration() { + String languagePreferred = Activator.getDefault().getPreferenceStore().getString( + IDirectEditorsIds.EDITOR_FOR_ELEMENT + resolveSemanticElement().eClass().getInstanceClassName()); + if (languagePreferred != null && !languagePreferred.equals("") && !languagePreferred.equals(configuration.getLanguage())) { + configuration = DirectEditorsUtil.findEditorConfiguration(languagePreferred, resolveSemanticElement() + .eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + */ + protected void performDefaultDirectEditorEdit(final Request theRequest) { + // initialize the direct edit manager + try { + getEditingDomain().runExclusive(new Runnable() { + + @Override + public void run() { + if (isActive() && isEditable()) { + if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) { + Character initialChar = (Character) theRequest.getExtendedData().get( + RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR); + performDirectEdit(initialChar.charValue()); + } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) { + DirectEditRequest editRequest = (DirectEditRequest) theRequest; + performDirectEdit(editRequest.getLocation()); + } else { + performDirectEdit(); + } + } + } + }); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + @Override + protected void addNotationalListeners() { + super.addNotationalListeners(); + addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ + } + + @Override + protected void removeNotationalListeners() { + super.removeNotationalListeners(); + removeListenerFilter("PrimaryView"); //$NON-NLS-1$ + } + + @Override + protected void handleNotificationEvent(Notification event) { + refreshLabel(); + Object feature = event.getFeature(); + if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) { + Integer c = (Integer) event.getNewValue(); + setFontColor(DiagramColorRegistry.getInstance().getColor(c)); + } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) { + refreshUnderline(); + } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) { + refreshStrikeThrough(); + } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || + NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) || + NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || + NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) { + refreshFont(); + } else { + if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) { + refreshLabel(); + } + if (getParser() instanceof ISemanticParser) { + ISemanticParser modelParser = (ISemanticParser) getParser(); + if (modelParser.areSemanticElementsAffected(null, event)) { + removeSemanticListeners(); + if (resolveSemanticElement() != null) { + addSemanticListeners(); + } + refreshLabel(); + } + } + } + if (event.getNewValue() instanceof EAnnotation && VisualInformationPapyrusConstants.DISPLAY_NAMELABELICON.equals(((EAnnotation) event.getNewValue()).getSource())) { + refreshLabel(); + } + super.handleNotificationEvent(event); + } + + protected IFigure createFigure() { + IFigure label = null; + if (getParent() instanceof ContainerNodeEditPart) { + label = ((ContainerNodeEditPart) getParent()).getPrimaryShape().getNameLabel(); + } else { + label = createFigurePrim(); + } + defaultText = getLabelTextHelper(label); + return label; + } + + protected IFigure createFigurePrim() { + return new PapyrusWrappingLabel(); + } + + private static final String ADD_PARENT_MODEL = "AddParentModel"; + + @Override + public void activate() { + super.activate(); + addOwnerElementListeners(); + } + + protected void addOwnerElementListeners() { + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + + } + + @Override + public void deactivate() { + removeOwnerElementListeners(); + super.deactivate(); + + } + + protected void removeOwnerElementListeners() { + removeListenerFilter(ADD_PARENT_MODEL); + + } + + @Override + public boolean isSelectable() { + return getFigure().isShowing(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java index 87a03052d44..04e5c0da46b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/ConstraintLabelParser.java @@ -27,11 +27,13 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; +import org.eclipse.gmf.runtime.emf.type.core.IClientContext; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.infra.services.edit.context.TypeContext; import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.uml.diagram.common.Activator; @@ -171,7 +173,8 @@ public class ConstraintLabelParser extends NamedElementLabelParser { try { if (updateRequest != null) { - command = ElementEditServiceUtils.getEditServiceProvider().getEditService(constraint).getEditCommand(updateRequest); + IClientContext context = TypeContext.getContext(constraint); + command = ElementEditServiceUtils.getEditServiceProvider(context).getEditService(constraint).getEditCommand(updateRequest); } } catch (ServiceException e) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java index 1da684d9783..ace38c1c8cf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/parser/NamedElementLabelParser.java @@ -28,6 +28,7 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand; import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus; import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; +import org.eclipse.gmf.runtime.emf.type.core.IClientContext; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; @@ -37,6 +38,7 @@ import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.gmfdiag.common.helper.MaskLabelHelper; import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.infra.services.edit.context.TypeContext; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; @@ -91,7 +93,8 @@ public class NamedElementLabelParser implements IMaskManagedSemanticParser { final ModelSet modelSet = (ModelSet)objectToEdit.eResource().getResourceSet(); command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement)objectToEdit, newString, null)); }else{ - command = ElementEditServiceUtils.getEditServiceProvider().getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); + IClientContext context = TypeContext.getContext(objectToEdit); + command = ElementEditServiceUtils.getEditServiceProvider(context).getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); } } catch (ServiceException e) { Activator.log.error(e); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java index 1aa258833df..df76d78fa31 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/part/UmlGmfDiagramEditor.java @@ -14,7 +14,6 @@ package org.eclipse.papyrus.uml.diagram.common.part; import org.eclipse.core.commands.operations.IUndoContext; -import org.eclipse.core.runtime.CoreException; import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.Notifier; @@ -25,15 +24,12 @@ import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.core.services.ServicesRegistry; import org.eclipse.papyrus.infra.gmfdiag.common.SynchronizableGmfDiagramEditor; import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper; -import org.eclipse.papyrus.infra.gmfdiag.common.helper.ReconcileHelper; -import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramVersioningUtils; import org.eclipse.papyrus.infra.internationalization.InternationalizationPackage; import org.eclipse.papyrus.infra.internationalization.common.editor.IInternationalizationEditor; import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalization; import org.eclipse.papyrus.infra.internationalization.utils.utils.LabelInternationalizationUtils; import org.eclipse.papyrus.infra.ui.lifecycleevents.ISaveAndDirtyService; import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.IEditorInput; import org.eclipse.ui.contexts.IContextService; /** @@ -86,14 +82,6 @@ public class UmlGmfDiagramEditor extends SynchronizableGmfDiagramEditor implemen saveAndDirtyService.registerIsaveablePart(this); } - @Override - public void doSetInput(IEditorInput input, boolean releaseEditorContents) throws CoreException { - super.doSetInput(input, releaseEditorContents); - if (getDiagram() != null && !DiagramVersioningUtils.isOfCurrentPapyrusVersion(getDiagram())) { - new ReconcileHelper(getEditingDomain()).reconcileDiagram(getDiagram()); - } - } - /** * Dispose services used in this part. * diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java index e864690a591..fdfafff7e7e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/FilteringPaletteProvider.java @@ -34,7 +34,7 @@ import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor; import org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider; import org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider; import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.papyrus.infra.viewpoints.configuration.PapyrusDiagram; +import org.eclipse.papyrus.infra.gmfdiag.representation.PapyrusDiagram; import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; import org.eclipse.papyrus.uml.diagram.common.Activator; @@ -204,7 +204,8 @@ public class FilteringPaletteProvider implements IPaletteProvider { return true; } } - return PolicyChecker.getCurrent().isInPalette(((DiagramEditor) editor).getDiagram(), entryID); + Diagram diagram = ((DiagramEditor) editor).getDiagram(); + return PolicyChecker.getFor(diagram).isInPalette(diagram, entryID); } /** @@ -230,7 +231,7 @@ public class FilteringPaletteProvider implements IPaletteProvider { */ private String getCustomPalette(Diagram diagram) { ViewPrototype proto = ViewPrototype.get(diagram); - PapyrusDiagram pd = (PapyrusDiagram) proto.getConfiguration(); + PapyrusDiagram pd = (PapyrusDiagram) proto.getRepresentationKind(); if (pd == null) { return null; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/LocalExtendedPaletteProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/LocalExtendedPaletteProvider.java index 95fb80987e9..d0dd6ff5721 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/LocalExtendedPaletteProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/LocalExtendedPaletteProvider.java @@ -24,6 +24,8 @@ import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.gmf.runtime.diagram.ui.services.palette.IPaletteProvider; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.services.edit.context.TypeContext; import org.eclipse.papyrus.infra.types.ElementTypeSetConfiguration; import org.eclipse.papyrus.infra.types.core.registries.ElementTypeSetConfigurationRegistry; import org.eclipse.papyrus.uml.diagram.common.Messages; @@ -120,13 +122,18 @@ public class LocalExtendedPaletteProvider extends ExtendedPluginPaletteProvider if (!elementTypeUIResource.getContents().isEmpty() && !elementTypeSemResource.getContents().isEmpty()) { // deploy element types configuration files - String clientContext = "org.eclipse.papyrus.infra.services.edit.TypeContext";//$NON-NLS-1$ + String clientContextId = ""; + try { + clientContextId = TypeContext.getDefaultContext().getId(); + } catch (ServiceException e) { + Activator.log.error(e); + } - ElementTypeSetConfigurationRegistry.getInstance().unload(clientContext, ((ElementTypeSetConfiguration) elementTypeSemResource.getContents().get(0)).getIdentifier()); - ElementTypeSetConfigurationRegistry.getInstance().unload(clientContext, ((ElementTypeSetConfiguration) elementTypeUIResource.getContents().get(0)).getIdentifier()); + ElementTypeSetConfigurationRegistry.getInstance().unload(clientContextId, ((ElementTypeSetConfiguration) elementTypeSemResource.getContents().get(0)).getIdentifier()); + ElementTypeSetConfigurationRegistry.getInstance().unload(clientContextId, ((ElementTypeSetConfiguration) elementTypeUIResource.getContents().get(0)).getIdentifier()); - ElementTypeSetConfigurationRegistry.getInstance().loadElementTypeSetConfiguration(clientContext, ((ElementTypeSetConfiguration) elementTypeSemResource.getContents().get(0))); - ElementTypeSetConfigurationRegistry.getInstance().loadElementTypeSetConfiguration(clientContext, ((ElementTypeSetConfiguration) elementTypeUIResource.getContents().get(0))); + ElementTypeSetConfigurationRegistry.getInstance().loadElementTypeSetConfiguration(clientContextId, ((ElementTypeSetConfiguration) elementTypeSemResource.getContents().get(0))); + ElementTypeSetConfigurationRegistry.getInstance().loadElementTypeSetConfiguration(clientContextId, ((ElementTypeSetConfiguration) elementTypeUIResource.getContents().get(0))); } } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PapyrusPaletteService.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PapyrusPaletteService.java index ff93ae87e4a..8cc3f07db37 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PapyrusPaletteService.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/PapyrusPaletteService.java @@ -985,16 +985,17 @@ public class PapyrusPaletteService extends PaletteService implements IPalettePro } Diagram diagram = ((DiagramEditor) editor).getDiagram(); + PolicyChecker checker = PolicyChecker.getFor(diagram); for (Object o : root.getChildren()) { if (o instanceof PaletteDrawer) { PaletteDrawer drawer = (PaletteDrawer) o; - boolean isVisible = PolicyChecker.getCurrent().isInPalette(diagram, drawer.getId()); + boolean isVisible = checker.isInPalette(diagram, drawer.getId()); drawer.setVisible(isVisible); if (isVisible) { for (Object x : drawer.getChildren()) { if (x instanceof PaletteEntry) { PaletteEntry entry = (PaletteEntry) x; - entry.setVisible(PolicyChecker.getCurrent().isInPalette(diagram, entry.getId())); + entry.setVisible(checker.isInPalette(diagram, entry.getId())); } } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteApplicator.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteApplicator.java index df003e3e789..dbe157cf5b0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteApplicator.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/service/XMLPaletteApplicator.java @@ -155,7 +155,7 @@ public class XMLPaletteApplicator implements XMLPaletteDefinitionVisitor, IPapyr public void onToolEntry(Node node) { String id = node.getAttributes().getNamedItem(ID).getNodeValue(); PaletteEntry entry = predefinedEntries.get(id); - if (PolicyChecker.getCurrent().isInPalette(diagram, id)) { + if (PolicyChecker.getFor(diagram).isInPalette(diagram, id)) { appendPaletteEntry(computePath(node), entry); } } @@ -206,7 +206,7 @@ public class XMLPaletteApplicator implements XMLPaletteDefinitionVisitor, IPapyr CombinedTemplateCreationEntry realEntry = new AspectCreationEntry(name, desc, id, iconDesc, entry, properties); predefinedEntries.put(id, realEntry); - if (PolicyChecker.getCurrent().isInPalette(diagram, id)) { + if (PolicyChecker.getFor(diagram).isInPalette(diagram, id)) { appendPaletteEntry(computePath(node), realEntry); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeDisplayDiagramReconciler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeDisplayDiagramReconciler_1_2_0.java index 07a4b0f863f..6fd156c4d51 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeDisplayDiagramReconciler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/StereotypeDisplayDiagramReconciler_1_2_0.java @@ -25,7 +25,7 @@ import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil; /** * */ -public class StereotypeDisplayDiagramReconciler extends DiagramReconciler { +public class StereotypeDisplayDiagramReconciler_1_2_0 extends DiagramReconciler { /** * {@inheritDoc} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationLabelMigrationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationLabelMigrationEditPolicy.java index 5cc40882dee..dacf47eea10 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationLabelMigrationEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationLabelMigrationEditPolicy.java @@ -19,7 +19,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain; import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationDetailCommand; -import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler; +import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler_1_2_0; import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayMigrationConstant; import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypeLabelMigrationCommand; import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil; @@ -30,7 +30,7 @@ import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil; * * @author Céline JANSSENS * - * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler} + * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler_1_2_0} */ @Deprecated public class StereotypeEAnnotationLabelMigrationEditPolicy extends StereotypeEAnnotationMigrationEditPolicy { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationMigrationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationMigrationEditPolicy.java index 3f60438d974..7b3d05ed21b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationMigrationEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationMigrationEditPolicy.java @@ -32,7 +32,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationCommand; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart; import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayUtil; -import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler; +import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler_1_2_0; import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeMigrationHelper; import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil; @@ -42,7 +42,7 @@ import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil; * * @author Céline JANSSENS * - * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler} + * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler_1_2_0} */ @Deprecated public abstract class StereotypeEAnnotationMigrationEditPolicy extends AbstractEditPolicy { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationNestedMigrationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationNestedMigrationEditPolicy.java index adf3e0cafd7..0ee68ebade4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationNestedMigrationEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationNestedMigrationEditPolicy.java @@ -19,7 +19,7 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler; +import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler_1_2_0; import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypeNestedPropertiesMigrationCommand; /** @@ -36,7 +36,7 @@ import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.Ster * * @author Céline JANSSENS * - * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler} + * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler_1_2_0} */ @Deprecated public class StereotypeEAnnotationNestedMigrationEditPolicy extends StereotypeEAnnotationPropertiesMigrationEditPolicy { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationPropertiesMigrationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationPropertiesMigrationEditPolicy.java index 86fdc7c2c28..c0898263fae 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationPropertiesMigrationEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/stereotype/migration/editpolicies/StereotypeEAnnotationPropertiesMigrationEditPolicy.java @@ -20,7 +20,7 @@ import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.emf.commands.RemoveEAnnotationDetailCommand; import org.eclipse.papyrus.uml.diagram.common.stereotype.display.helper.StereotypeDisplayConstant; -import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler; +import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler_1_2_0; import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayMigrationConstant; import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypeCommentPropertiesMigrationCommand; import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.commands.StereotypePropertiesMigrationCommand; @@ -32,7 +32,7 @@ import org.eclipse.papyrus.uml.diagram.common.util.CommandUtil; * * @author Céline JANSSENS * - * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler} + * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler_1_2_0} */ @Deprecated public class StereotypeEAnnotationPropertiesMigrationEditPolicy extends StereotypeEAnnotationMigrationEditPolicy { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconcilerForCompartment_1_2_0.java index c8848da86ff..228d30ae7c9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconcilerForCompartment_1_2_0.java @@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class CommunicationReconcilerForCompartment extends ReconcilerForCompartment { +public class CommunicationReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String InteractionCompartmentEditPart_VISUAL_ID = "7001"; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconciler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconciler_1_1_0.java index 77336af6620..ab9706e9c7d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconciler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/migration/CommunicationReconciler_1_1_0.java @@ -1,58 +1,58 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2015 CEA LIST and others.
- *
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.communication.custom.migration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand;
-import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler;
-
-/**
- * Communication Diagram Reconciler from 1.0.0 to 1.1.0
- */
-public class CommunicationReconciler extends DiagramReconciler {
-
- private static final String InteractionEditPart_VISUAL_ID = "8002";
- private static final String InteractionFloatingLabelEditPart_VISUAL_ID = "6013";
- private static final String LifelineEditPartCN_VISUAL_ID = "8001";
- private static final String LifelineFloatingLabelEditPartCN_VISUAL_ID = "6014";
-
- /**
- * Gets the reconcile command.
- *
- * @param diagram
- * the diagram
- * @return the reconcile command
- * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram)
- */
- @Override
- public ICommand getReconcileCommand(Diagram diagram) {
- return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap());
- }
-
- /**
- * Gets the floating label map to add.
- *
- * @return the floating label map
- */
- private Map<String, String> getFloatingLabelMap() {
- Map<String, String> map = new HashMap<String, String>();
- map.put(InteractionEditPart_VISUAL_ID, InteractionFloatingLabelEditPart_VISUAL_ID);
- map.put(LifelineEditPartCN_VISUAL_ID, LifelineFloatingLabelEditPartCN_VISUAL_ID);
-
- return map;
- }
-}
+/***************************************************************************** + * Copyright (c) 2010, 2015 CEA LIST and others. + * + * 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: + * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.communication.custom.migration; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand; +import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler; + +/** + * Communication Diagram Reconciler from 1.0.0 to 1.1.0 + */ +public class CommunicationReconciler_1_1_0 extends DiagramReconciler { + + private static final String InteractionEditPart_VISUAL_ID = "8002"; + private static final String InteractionFloatingLabelEditPart_VISUAL_ID = "6013"; + private static final String LifelineEditPartCN_VISUAL_ID = "8001"; + private static final String LifelineFloatingLabelEditPartCN_VISUAL_ID = "6014"; + + /** + * Gets the reconcile command. + * + * @param diagram + * the diagram + * @return the reconcile command + * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram) + */ + @Override + public ICommand getReconcileCommand(Diagram diagram) { + return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap()); + } + + /** + * Gets the floating label map to add. + * + * @return the floating label map + */ + private Map<String, String> getFloatingLabelMap() { + Map<String, String> map = new HashMap<String, String>(); + map.put(InteractionEditPart_VISUAL_ID, InteractionFloatingLabelEditPart_VISUAL_ID); + map.put(LifelineEditPartCN_VISUAL_ID, LifelineFloatingLabelEditPartCN_VISUAL_ID); + + return map; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomLifelineItemSemanticEditPolicyCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomLifelineItemSemanticEditPolicyCN.java index fb68d4e0f9f..0590a9f3f88 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomLifelineItemSemanticEditPolicyCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/custom-src/org/eclipse/papyrus/uml/diagram/communication/custom/policies/itemsemantic/CustomLifelineItemSemanticEditPolicyCN.java @@ -1,132 +1,146 @@ -/*****************************************************************************
- * Copyright (c) 2010 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:
- * Saadia DHOUIB (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.communication.custom.policies.itemsemantic;
-
-import java.util.Iterator;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-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.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.communication.custom.commands.CustomMessageCreateCommand;
-import org.eclipse.papyrus.uml.diagram.communication.custom.commands.CustomMessagesReorientCommand;
-import org.eclipse.papyrus.uml.diagram.communication.edit.commands.CommentAnnotatedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConnectorDurationObservationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConnectorTimeObservationCreateCommand;
-import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConstraintConstrainedElementCreateCommand;
-import org.eclipse.papyrus.uml.diagram.communication.edit.parts.MessageEditPart;
-import org.eclipse.papyrus.uml.diagram.communication.edit.policies.LifelineItemSemanticEditPolicyCN;
-import org.eclipse.papyrus.uml.diagram.communication.edit.policies.UMLBaseItemSemanticEditPolicy;
-import org.eclipse.papyrus.uml.diagram.communication.providers.UMLElementTypes;
-import org.eclipse.uml2.uml.Message;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * this is a specialization to manage creation of Message,
- * CommentAnnotatedElement, ConstraintConstrainedElement,
- * DurationObservationEvent and TimeObservationEvent
- */
-public class CustomLifelineItemSemanticEditPolicyCN extends LifelineItemSemanticEditPolicyCN {
-
- @Override
- protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
-
- if (UMLElementTypes.Path_Edge == req.getElementType()) {
-
- return getGEFWrapper(new CustomMessageCreateCommand(req, req.getSource(), req.getTarget()));
- }
-
- if (UMLElementTypes.Comment_AnnotatedElementEdge == req.getElementType()) {
- return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget()));
- }
- if (UMLElementTypes.Constraint_ConstrainedElementEdge == req.getElementType()) {
- return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget()));
- }
-
- if (UMLElementTypes.DurationObservation_EventEdge == req.getElementType()) {
- return getGEFWrapper(new ConnectorDurationObservationCreateCommand(req, req.getSource(), req.getTarget()));
- }
-
- if (UMLElementTypes.TimeObservation_EventEdge == req.getElementType()) {
- return getGEFWrapper(new ConnectorTimeObservationCreateCommand(req, req.getSource(), req.getTarget()));
- }
-
- return null;
- }
-
- @Override
- protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
- if (UMLElementTypes.Path_Edge == req.getElementType()) {
- return getGEFWrapper(new CustomMessageCreateCommand(req, req.getSource(), req.getTarget()));
- }
-
- return null;
- }
-
- @Override
- protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
-
- // System.err.println("getReorientRelationshipCommand VisualID of element to reorient :" + getVisualID(req));
- switch (getVisualID(req)) {
- case MessageEditPart.VISUAL_ID:
-
- // return getGEFWrapper(new CustomMessagesReorientCommand(req));
- View connector = (View) req.getParameter(UMLBaseItemSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE);
- Object elementToedit = UMLPackage.eINSTANCE.getMessage();
- IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToedit);
- if (provider == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- ICommand reorientCommand = null;
- // 1. add the reorient messages command
- reorientCommand = CompositeCommand.compose(reorientCommand, new CustomMessagesReorientCommand(req));
-
- Iterator<?> it = connector.getChildren().iterator();
- while (it.hasNext()) {
- Object object = it.next();
-
- if (object instanceof View) {
- View child = (View) object;
-
- if ((child.getElement() != null) && (child.getElement() instanceof Message)) {
-
- Message messageToReorient = (Message) child.getElement();
- ReorientRequest reorientMessageRequest = new ReorientRelationshipRequest(messageToReorient, req.getNewRelationshipEnd(), req.getOldRelationshipEnd(), req.getDirection());
- reorientMessageRequest.setParameter(UMLBaseItemSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE, connector);
- ICommand reorientMessageCommand = provider.getEditCommand(reorientMessageRequest);
- reorientCommand = CompositeCommand.compose(reorientCommand, reorientMessageCommand);
- break;
- }
- }
-
- }
-
- if (reorientCommand == null) {
- return UnexecutableCommand.INSTANCE;
- }
- return getGEFWrapper(reorientCommand.reduce());
- }
- return super.getReorientRelationshipCommand(req);
- }
-
-
-}
+/***************************************************************************** + * Copyright (c) 2010 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: + * Saadia DHOUIB (CEA LIST) saadia.dhouib@cea.fr - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.communication.custom.policies.itemsemantic; + +import java.util.Iterator; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +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.IClientContext; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.services.edit.context.TypeContext; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.communication.custom.commands.CustomMessageCreateCommand; +import org.eclipse.papyrus.uml.diagram.communication.custom.commands.CustomMessagesReorientCommand; +import org.eclipse.papyrus.uml.diagram.communication.edit.commands.CommentAnnotatedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConnectorDurationObservationCreateCommand; +import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConnectorTimeObservationCreateCommand; +import org.eclipse.papyrus.uml.diagram.communication.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.communication.edit.parts.MessageEditPart; +import org.eclipse.papyrus.uml.diagram.communication.edit.policies.LifelineItemSemanticEditPolicyCN; +import org.eclipse.papyrus.uml.diagram.communication.edit.policies.UMLBaseItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.communication.part.UMLDiagramEditorPlugin; +import org.eclipse.papyrus.uml.diagram.communication.providers.UMLElementTypes; +import org.eclipse.uml2.uml.Message; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * this is a specialization to manage creation of Message, + * CommentAnnotatedElement, ConstraintConstrainedElement, + * DurationObservationEvent and TimeObservationEvent + */ +public class CustomLifelineItemSemanticEditPolicyCN extends LifelineItemSemanticEditPolicyCN { + + @Override + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + + if (UMLElementTypes.Path_Edge == req.getElementType()) { + + return getGEFWrapper(new CustomMessageCreateCommand(req, req.getSource(), req.getTarget())); + } + + if (UMLElementTypes.Comment_AnnotatedElementEdge == req.getElementType()) { + return getGEFWrapper(new CommentAnnotatedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.Constraint_ConstrainedElementEdge == req.getElementType()) { + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + + if (UMLElementTypes.DurationObservation_EventEdge == req.getElementType()) { + return getGEFWrapper(new ConnectorDurationObservationCreateCommand(req, req.getSource(), req.getTarget())); + } + + if (UMLElementTypes.TimeObservation_EventEdge == req.getElementType()) { + return getGEFWrapper(new ConnectorTimeObservationCreateCommand(req, req.getSource(), req.getTarget())); + } + + return null; + } + + @Override + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + if (UMLElementTypes.Path_Edge == req.getElementType()) { + return getGEFWrapper(new CustomMessageCreateCommand(req, req.getSource(), req.getTarget())); + } + + return null; + } + + @Override + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + + // System.err.println("getReorientRelationshipCommand VisualID of element to reorient :" + getVisualID(req)); + switch (getVisualID(req)) { + case MessageEditPart.VISUAL_ID: + + // return getGEFWrapper(new CustomMessagesReorientCommand(req)); + View connector = (View) req.getParameter(UMLBaseItemSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE); + EClass elementToedit = UMLPackage.eINSTANCE.getMessage(); + + IClientContext context; + try { + context = TypeContext.getContext(getEditingDomain()); + } catch (ServiceException e) { + UMLDiagramEditorPlugin.getInstance().getLogHelper().error(e); + return UnexecutableCommand.INSTANCE; + } + + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(elementToedit, context); + if (provider == null) { + return UnexecutableCommand.INSTANCE; + } + + ICommand reorientCommand = null; + // 1. add the reorient messages command + reorientCommand = CompositeCommand.compose(reorientCommand, new CustomMessagesReorientCommand(req)); + + Iterator<?> it = connector.getChildren().iterator(); + while (it.hasNext()) { + Object object = it.next(); + + if (object instanceof View) { + View child = (View) object; + + if ((child.getElement() != null) && (child.getElement() instanceof Message)) { + + Message messageToReorient = (Message) child.getElement(); + ReorientRequest reorientMessageRequest = new ReorientRelationshipRequest(messageToReorient, req.getNewRelationshipEnd(), req.getOldRelationshipEnd(), req.getDirection()); + reorientMessageRequest.setParameter(UMLBaseItemSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE, connector); + ICommand reorientMessageCommand = provider.getEditCommand(reorientMessageRequest); + reorientCommand = CompositeCommand.compose(reorientCommand, reorientMessageCommand); + break; + } + } + + } + + if (reorientCommand == null) { + return UnexecutableCommand.INSTANCE; + } + return getGEFWrapper(reorientCommand.reduce()); + } + return super.getReorientRelationshipCommand(req); + } + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.configuration deleted file mode 100644 index d40dee1b1e2..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/model/communicationdiagram.configuration +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_jRtroHDuEeWh-MssWmCB_A" implementationID="PapyrusUMLCommunicationDiagram">
- <modelRules xmi:id="_jRtroXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interaction"/>
- </modelRules>
- <owningRules xmi:id="_jRtronDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interaction"/>
- </owningRules>
- <owningRules xmi:id="_jRtro3DuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/>
- <newModelPath xmi:id="_jRtrpHDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_jRtrpXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/>
- <newModelPath xmi:id="_jRtrpnDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_jRtrp3DuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- <newModelPath xmi:id="_jRtrqHDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/>
- </newModelPath>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_jRtrqXDuEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml index 4a57beb83a4..1b800d7b8d1 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/plugin.xml @@ -16,14 +16,6 @@ --> <plugin> <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/communicationdiagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - - <extension point="org.eclipse.ui.commands"> <command categoryId="org.eclipse.papyrus.editor.category" @@ -540,21 +532,21 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="PapyrusUMLCommunicationDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.communication.custom.migration.CommunicationReconciler" - source="undefined" - target="1.1.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.communication.custom.migration.CommunicationReconciler_1_1_0" + source="1.0.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLCommunicationDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.communication.custom.migration.CommunicationReconcilerForCompartment" - source="undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.communication.custom.migration.CommunicationReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLCommunicationDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.communication.custom.migration.CommunicationReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> @@ -578,14 +570,4 @@ path="model/communicationdiagram-notation.elementtypesconfigurations"> </elementTypeSet> </extension> - <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/communicationdiagram-uml.elementtypesconfigurations"> - </elementTypeSet> - </extension> - - - </plugin> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java index 2f6ed62de1c..6520e077b93 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/CommentCreateCommandCN.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.communication.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class CommentCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Comment newElement = UMLFactory.eINSTANCE.createComment();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Element qualifiedTarget = (Element) target;
- qualifiedTarget.getOwnedComments()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Comment_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Comment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.communication.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.Comment; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class CommentCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public CommentCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Comment newElement = UMLFactory.eINSTANCE.createComment(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Element qualifiedTarget = (Element) target; + qualifiedTarget.getOwnedComments() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_Comment_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Comment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java index 766d19c5178..b481bb9a180 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/ConstraintCreateCommandCN.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.communication.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ConstraintCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Namespace qualifiedTarget = (Namespace) target;
- qualifiedTarget.getOwnedRules()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Constraint_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Constraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.communication.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ConstraintCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Constraint newElement = UMLFactory.eINSTANCE.createConstraint(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Namespace qualifiedTarget = (Namespace) target; + qualifiedTarget.getOwnedRules() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_Constraint_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Constraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java index 24f6b455f56..ada8432ae64 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/DurationObservationCreateCommandCN.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.communication.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DurationObservationCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public DurationObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_DurationObservation_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(DurationObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.communication.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.DurationObservation; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class DurationObservationCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public DurationObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_DurationObservation_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(DurationObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java index b22b3c41e45..a61802a6192 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/InteractionCreateCommand.java @@ -1,131 +1,131 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.communication.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Component;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class InteractionCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public InteractionCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
- Component childHolder = (Component) getElementToEdit();
- childHolder.getPackagedElements()
- .add(newElement);
-
- ElementInitializers.getInstance().init_Interaction_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Interaction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.communication.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.Component; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class InteractionCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public InteractionCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Interaction newElement = UMLFactory.eINSTANCE.createInteraction(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + Component childHolder = (Component) getElementToEdit(); + childHolder.getPackagedElements() + .add(newElement); + + ElementInitializers.getInstance().init_Interaction_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Interaction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java index b1e4b9835ec..6e359c9d63d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/LifelineCreateCommandCN.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.communication.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class LifelineCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public LifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getLifelines()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Lifeline_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.communication.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class LifelineCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public LifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Lifeline newElement = UMLFactory.eINSTANCE.createLifeline(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getLifelines() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_Lifeline_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java index af9c4e68618..190a4e90dc1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.communication/src-gen/org/eclipse/papyrus/uml/diagram/communication/edit/commands/TimeObservationCreateCommandCN.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.communication.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.TimeObservation;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class TimeObservationCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public TimeObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_TimeObservation_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(TimeObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.communication.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.communication.providers.ElementInitializers; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.TimeObservation; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class TimeObservationCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public TimeObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_TimeObservation_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(TimeObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/migration/ComponentReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/migration/ComponentReconcilerForCompartment_1_2_0.java index f9b4f52ee91..65ceca684d0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/migration/ComponentReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/migration/ComponentReconcilerForCompartment_1_2_0.java @@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class ComponentReconcilerForCompartment extends ReconcilerForCompartment { +public class ComponentReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String ComponentCompositeCompartmentEditPart_VISUAL_ID = "7001"; //$NON-NLS-1$ private static final String ModelPackageableElementCompartmentEditPart_VISUAL_ID = "7006"; //$NON-NLS-1$ diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/migration/ComponentReconciler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/migration/ComponentReconciler_1_1_0.java index 5d6f313ccc2..1c7e0829d31 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/migration/ComponentReconciler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/custom-src/org/eclipse/papyrus/uml/diagram/component/custom/migration/ComponentReconciler_1_1_0.java @@ -1,76 +1,76 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2015 CEA LIST and others.
- *
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.component.custom.migration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand;
-import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler;
-
-/**
- * Component Diagram Reconciler from 1.0.0 to 1.1.0
- */
-public class ComponentReconciler extends DiagramReconciler {
-
- private final static String ComponentEditPart_VISUAL_ID = "2002"; //$NON-NLS-1$
- private final static String ComponentFloatingLabelEditPart_VISUAL_ID = "6030"; //$NON-NLS-1$
- private final static String ComponentEditPartCN_VISUAL_ID = "3070"; //$NON-NLS-1$
- private final static String ComponentFloatingLabelEditPartCN_VISUAL_ID = "6026"; //$NON-NLS-1$
- private final static String ComponentEditPartPCN_VISUAL_ID = "3071"; //$NON-NLS-1$
- private final static String ComponentFloatingLabelEditPartPCN_VISUAL_ID = "6027"; //$NON-NLS-1$
- private final static String DependencyNodeEditPart_VISUAL_ID = "3203"; //$NON-NLS-1$
- private final static String DependencyNodeFloatingLabelEditPart_VISUAL_ID = "6029"; //$NON-NLS-1$
- private final static String InterfaceEditPart_VISUAL_ID = "2003"; //$NON-NLS-1$
- private final static String InterfaceFloatingLabelEditPart_VISUAL_ID = "6032"; //$NON-NLS-1$
- private final static String InterfaceEditPartPCN_VISUAL_ID = "3072"; //$NON-NLS-1$
- private final static String InterfaceFloatingLabelEditPartPCN_VISUAL_ID = "6028"; //$NON-NLS-1$
- private final static String RectangleInterfaceEditPart_VISUAL_ID = "3205"; //$NON-NLS-1$
- private final static String RectangleInterfaceFloatingLabelEditPart_VISUAL_ID = "6031"; //$NON-NLS-1$
- private final static String RectangleInterfaceEditPartCN_VISUAL_ID = "3078"; //$NON-NLS-1$
- private final static String RectangleInterfaceFloatingLabelEditPartCN_VISUAL_ID = "6033"; //$NON-NLS-1$
-
- /**
- * Gets the reconcile command.
- *
- * @param diagram
- * the diagram
- * @return the reconcile command
- * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram)
- */
- @Override
- public ICommand getReconcileCommand(Diagram diagram) {
- return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap());
- }
-
- /**
- * Gets the floating label map to add.
- *
- * @return the floating label map
- */
- private Map<String, String> getFloatingLabelMap() {
- Map<String, String> map = new HashMap<>();
- map.put(ComponentEditPart_VISUAL_ID, ComponentFloatingLabelEditPart_VISUAL_ID);
- map.put(ComponentEditPartCN_VISUAL_ID, ComponentFloatingLabelEditPartCN_VISUAL_ID);
- map.put(ComponentEditPartPCN_VISUAL_ID, ComponentFloatingLabelEditPartPCN_VISUAL_ID);
- map.put(DependencyNodeEditPart_VISUAL_ID, DependencyNodeFloatingLabelEditPart_VISUAL_ID);
- map.put(InterfaceEditPart_VISUAL_ID, InterfaceFloatingLabelEditPart_VISUAL_ID);
- map.put(InterfaceEditPartPCN_VISUAL_ID, InterfaceFloatingLabelEditPartPCN_VISUAL_ID);
- map.put(RectangleInterfaceEditPart_VISUAL_ID, RectangleInterfaceFloatingLabelEditPart_VISUAL_ID);
- map.put(RectangleInterfaceEditPartCN_VISUAL_ID, RectangleInterfaceFloatingLabelEditPartCN_VISUAL_ID);
-
- return map;
- }
-}
+/***************************************************************************** + * Copyright (c) 2010, 2015 CEA LIST and others. + * + * 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: + * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.component.custom.migration; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand; +import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler; + +/** + * Component Diagram Reconciler from 1.0.0 to 1.1.0 + */ +public class ComponentReconciler_1_1_0 extends DiagramReconciler { + + private final static String ComponentEditPart_VISUAL_ID = "2002"; //$NON-NLS-1$ + private final static String ComponentFloatingLabelEditPart_VISUAL_ID = "6030"; //$NON-NLS-1$ + private final static String ComponentEditPartCN_VISUAL_ID = "3070"; //$NON-NLS-1$ + private final static String ComponentFloatingLabelEditPartCN_VISUAL_ID = "6026"; //$NON-NLS-1$ + private final static String ComponentEditPartPCN_VISUAL_ID = "3071"; //$NON-NLS-1$ + private final static String ComponentFloatingLabelEditPartPCN_VISUAL_ID = "6027"; //$NON-NLS-1$ + private final static String DependencyNodeEditPart_VISUAL_ID = "3203"; //$NON-NLS-1$ + private final static String DependencyNodeFloatingLabelEditPart_VISUAL_ID = "6029"; //$NON-NLS-1$ + private final static String InterfaceEditPart_VISUAL_ID = "2003"; //$NON-NLS-1$ + private final static String InterfaceFloatingLabelEditPart_VISUAL_ID = "6032"; //$NON-NLS-1$ + private final static String InterfaceEditPartPCN_VISUAL_ID = "3072"; //$NON-NLS-1$ + private final static String InterfaceFloatingLabelEditPartPCN_VISUAL_ID = "6028"; //$NON-NLS-1$ + private final static String RectangleInterfaceEditPart_VISUAL_ID = "3205"; //$NON-NLS-1$ + private final static String RectangleInterfaceFloatingLabelEditPart_VISUAL_ID = "6031"; //$NON-NLS-1$ + private final static String RectangleInterfaceEditPartCN_VISUAL_ID = "3078"; //$NON-NLS-1$ + private final static String RectangleInterfaceFloatingLabelEditPartCN_VISUAL_ID = "6033"; //$NON-NLS-1$ + + /** + * Gets the reconcile command. + * + * @param diagram + * the diagram + * @return the reconcile command + * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram) + */ + @Override + public ICommand getReconcileCommand(Diagram diagram) { + return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap()); + } + + /** + * Gets the floating label map to add. + * + * @return the floating label map + */ + private Map<String, String> getFloatingLabelMap() { + Map<String, String> map = new HashMap<>(); + map.put(ComponentEditPart_VISUAL_ID, ComponentFloatingLabelEditPart_VISUAL_ID); + map.put(ComponentEditPartCN_VISUAL_ID, ComponentFloatingLabelEditPartCN_VISUAL_ID); + map.put(ComponentEditPartPCN_VISUAL_ID, ComponentFloatingLabelEditPartPCN_VISUAL_ID); + map.put(DependencyNodeEditPart_VISUAL_ID, DependencyNodeFloatingLabelEditPart_VISUAL_ID); + map.put(InterfaceEditPart_VISUAL_ID, InterfaceFloatingLabelEditPart_VISUAL_ID); + map.put(InterfaceEditPartPCN_VISUAL_ID, InterfaceFloatingLabelEditPartPCN_VISUAL_ID); + map.put(RectangleInterfaceEditPart_VISUAL_ID, RectangleInterfaceFloatingLabelEditPart_VISUAL_ID); + map.put(RectangleInterfaceEditPartCN_VISUAL_ID, RectangleInterfaceFloatingLabelEditPartCN_VISUAL_ID); + + return map; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.configuration deleted file mode 100644 index 49c8ae8a468..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/model/ComponentDiagram.configuration +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_fa4kAHDuEeWh-MssWmCB_A" implementationID="PapyrusUMLComponentDiagram">
- <modelRules xmi:id="_fa4kAXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </modelRules>
- <owningRules xmi:id="_fa4kAnDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_fa4kA3DuEeWh-MssWmCB_A"/>
- </modelKinds>
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_fa4kBHDuEeWh-MssWmCB_A" implementationID="PapyrusUMLComponentDiagram">
- <modelRules xmi:id="_fa4kBXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/>
- </modelRules>
- <owningRules xmi:id="_fa4kBnDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/>
- </owningRules>
- <owningRules xmi:id="_fa4kB3DuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_fa4kCHDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/>
- <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/>
- <insertionPath xmi:id="_fa4kCXDuEeWh-MssWmCB_A">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Class/nestedClassifier"/>
- </insertionPath>
- </childRules>
- <childRules xmi:id="_fa4kCnDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Comment"/>
- <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/>
- <insertionPath xmi:id="_fa4kC3DuEeWh-MssWmCB_A">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Element/ownedComment"/>
- </insertionPath>
- </childRules>
- <childRules xmi:id="_fa4kDHDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Constraint"/>
- <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/>
- <insertionPath xmi:id="_fa4kDXDuEeWh-MssWmCB_A">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Namespace/ownedRule"/>
- </insertionPath>
- </childRules>
- <childRules xmi:id="_fa4kDnDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Port"/>
- <origin href="http://www.eclipse.org/uml2/5.0.0/UML#//Component"/>
- <insertionPath xmi:id="_fa4kD3DuEeWh-MssWmCB_A">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//EncapsulatedClassifier/ownedPort"/>
- </insertionPath>
- </childRules>
- <paletteRules xmi:id="_fa4kEHDuEeWh-MssWmCB_A" permit="false" element="component.tool.model"/>
- <paletteRules xmi:id="_fa4kEXDuEeWh-MssWmCB_A" permit="false" element="component.tool.package"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml index 2075685f23b..5bf98565fa2 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/plugin.xml @@ -15,14 +15,6 @@ --> <plugin> <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/ComponentDiagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - -<extension point="org.eclipse.ui.commands"> <command categoryId="org.eclipse.papyrus.editor.category" @@ -965,21 +957,21 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="PapyrusUMLComponentDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.component.custom.migration.ComponentReconciler" - source="undefined" - target="1.1.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.component.custom.migration.ComponentReconciler_1_1_0" + source="1.0.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLComponentDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.component.custom.migration.ComponentReconcilerForCompartment" - source="undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.component.custom.migration.ComponentReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLComponentDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.component.custom.migration.ComponentReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java index ae59beb70b9..5637da197e5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.component/src-gen/org/eclipse/papyrus/uml/diagram/component/edit/commands/PortCreateCommand.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.component.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.component.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Port;
-import org.eclipse.uml2.uml.StructuredClassifier;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class PortCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public PortCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPort());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Port newElement = UMLFactory.eINSTANCE.createPort();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- StructuredClassifier qualifiedTarget = (StructuredClassifier) target;
- qualifiedTarget.getOwnedAttributes()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Port_Shape(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Port newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.component.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.component.providers.ElementInitializers; +import org.eclipse.uml2.uml.Port; +import org.eclipse.uml2.uml.StructuredClassifier; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class PortCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public PortCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getPort()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Port newElement = UMLFactory.eINSTANCE.createPort(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + StructuredClassifier qualifiedTarget = (StructuredClassifier) target; + qualifiedTarget.getOwnedAttributes() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_Port_Shape(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Port newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramCommand.java index fa1851698af..b4f4b956fb2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/CreateCompositeDiagramCommand.java @@ -25,7 +25,7 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler; -import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; +import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramPrototype; import org.eclipse.papyrus.uml.diagram.composite.edit.parts.CompositeStructureDiagramEditPart; import org.eclipse.papyrus.uml.diagram.composite.part.UMLDiagramEditorPlugin; import org.eclipse.uml2.uml.Collaboration; @@ -100,7 +100,7 @@ public class CreateCompositeDiagramCommand extends AbstractPapyrusGmfCreateDiagr * {@inheritDoc} */ @Override - protected Diagram doCreateDiagram(Resource diagramResource, EObject owner, EObject element, ViewPrototype prototype, String name) { + protected Diagram doCreateDiagram(Resource diagramResource, EObject owner, EObject element, DiagramPrototype prototype, String name) { Diagram diagram = null; if (element instanceof org.eclipse.uml2.uml.Class || (element instanceof Collaboration)) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconcilerForCompartment_1_2_0.java index de5f4495dde..6c3847e7852 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconcilerForCompartment_1_2_0.java @@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class CompositeReconcilerForCompartment extends ReconcilerForCompartment { +public class CompositeReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String DataTypeAttributeCompartmentEditPart_VISUAL_ID = "7033"; //$NON-NLS-1$ private static final String DataTypeOperationCompartmentEditPart_VISUAL_ID = "7034"; //$NON-NLS-1$ diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconciler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconciler_1_1_0.java index b72c6b599eb..d9b4e6e1bad 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconciler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/migration/CompositeReconciler_1_1_0.java @@ -24,7 +24,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler; /** * Composite Diagram Reconciler from 1.0.0 to 1.1.0 */ -public class CompositeReconciler extends DiagramReconciler { +public class CompositeReconciler_1_1_0 extends DiagramReconciler { private final static String ActivityCompositeEditPart_VISUAL_ID = "2060"; //$NON-NLS-1$ private final static String ActivityCompositeFloatingLabelEditPart_VISUAL_ID = "6079"; //$NON-NLS-1$ diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/NamedElementLabelParser.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/NamedElementLabelParser.java index bfc9de47a96..309c3202e97 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/NamedElementLabelParser.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/parsers/NamedElementLabelParser.java @@ -28,11 +28,13 @@ import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus; import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest; import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.gmf.runtime.emf.type.core.IClientContext; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.emf.gmf.command.EMFtoGMFCommandWrapper; import org.eclipse.papyrus.infra.emf.utils.EMFHelper; import org.eclipse.papyrus.infra.internationalization.common.utils.InternationalizationPreferencesUtils; +import org.eclipse.papyrus.infra.services.edit.context.TypeContext; import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.internationalization.utils.utils.UMLLabelInternationalization; @@ -87,7 +89,8 @@ public class NamedElementLabelParser implements ISemanticParser { final ModelSet modelSet = (ModelSet)objectToEdit.eResource().getResourceSet(); command = new EMFtoGMFCommandWrapper(UMLLabelInternationalization.getInstance().getSetLabelCommand(modelSet.getTransactionalEditingDomain(), (NamedElement)objectToEdit, newString, null)); }else{ - command = ElementEditServiceUtils.getEditServiceProvider().getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); + IClientContext context = TypeContext.getContext(objectToEdit); + command = ElementEditServiceUtils.getEditServiceProvider(context).getEditService(objectToEdit).getEditCommand(new SetRequest(objectToEdit, UMLPackage.eINSTANCE.getNamedElement_Name(), newString)); } } catch (ServiceException e) { Activator.log.error(e); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.configuration deleted file mode 100644 index c14ed30d72e..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/model/compositediagram.configuration +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_bKiwMHDuEeWh-MssWmCB_A" implementationID="CompositeStructure">
- <modelRules xmi:id="_bKiwMXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </modelRules>
- <owningRules xmi:id="_bKiwMnDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_bKiwM3DuEeWh-MssWmCB_A"/>
- </modelKinds>
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_bKiwNHDuEeWh-MssWmCB_A" implementationID="CompositeStructure">
- <modelRules xmi:id="_bKiwNXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//StructuredClassifier"/>
- </modelRules>
- <owningRules xmi:id="_bKiwNnDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//StructuredClassifier"/>
- </owningRules>
- <owningRules xmi:id="_bKiwN3DuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_bKiwOHDuEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml index f7c0dbbeff2..2ea2838337c 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/plugin.xml @@ -15,14 +15,6 @@ --> <plugin> - <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/compositediagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - <extension point="org.eclipse.ui.contexts" id="ui-context"> <?gmfgen generated="true"?> <context @@ -939,13 +931,6 @@ </enablement> </semanticChildrenStrategy> </extension> -<extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/compositediagram.elementtypesconfigurations"> - </elementTypeSet> -</extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping"> <?gmfgen generated="true"?> @@ -1513,21 +1498,21 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="CompositeStructure" - reconcilerClass="org.eclipse.papyrus.uml.diagram.composite.custom.migration.CompositeReconciler" - source="undefined" - target="1.1.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.composite.custom.migration.CompositeReconciler_1_1_0" + source="1.0.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="CompositeStructure" - reconcilerClass="org.eclipse.papyrus.uml.diagram.composite.custom.migration.CompositeReconcilerForCompartment" - source="undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.composite.custom.migration.CompositeReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="CompositeStructure" reconcilerClass="org.eclipse.papyrus.uml.diagram.composite.custom.migration.CompositeReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconcilerForCompartment_1_2_0.java index 56b218a0301..266390e3b41 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconcilerForCompartment_1_2_0.java @@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class DeploymentReconcilerForCompartment extends ReconcilerForCompartment { +public class DeploymentReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String ModelPackageableElementCompartmentEditPart_VISUAL_ID = "51"; private static final String PackagePackageableElementCompartmentEditPart_VISUAL_ID = "38"; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconciler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconciler_1_1_0.java index 0b1b8e0051f..5fd3e472d72 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconciler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/migration/DeploymentReconciler_1_1_0.java @@ -1,62 +1,62 @@ -/*****************************************************************************
- * Copyright (c) 2009-2015 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.deployment.custom.migration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand;
-import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler;
-
-/**
- * Deployment Diagram Reconciler from 1.0.0 to 1.1.0
- */
-public class DeploymentReconciler extends DiagramReconciler {
-
- private final static String ArtifactEditPart_VISUAL_ID = "2006";
- private final static String ArtifactFloatingLabelEditPart_VISUAL_ID = "61";
- private final static String ArtifactEditPartACN_VISUAL_ID = "28";
- private final static String ArtifactFloatingLabelEditPartACN_VISUAL_ID = "60";
- private final static String ArtifactEditPartCN_VISUAL_ID = "25";
- private final static String ArtifactFloatingLabelEditPartCN_VISUAL_ID = "59";
-
- /**
- * Gets the reconcile command.
- *
- * @param diagram
- * the diagram
- * @return the reconcile command
- * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram)
- */
- @Override
- public ICommand getReconcileCommand(Diagram diagram) {
- return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap());
- }
-
- /**
- * Gets the floating label map to add.
- *
- * @return the floating label map
- */
- private Map<String, String> getFloatingLabelMap() {
- Map<String, String> map = new HashMap<String, String>();
- map.put(ArtifactEditPart_VISUAL_ID, ArtifactFloatingLabelEditPart_VISUAL_ID);
- map.put(ArtifactEditPartACN_VISUAL_ID, ArtifactFloatingLabelEditPartACN_VISUAL_ID);
- map.put(ArtifactEditPartCN_VISUAL_ID, ArtifactFloatingLabelEditPartCN_VISUAL_ID);
-
- return map;
- }
-}
+/***************************************************************************** + * Copyright (c) 2009-2015 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: + * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.deployment.custom.migration; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand; +import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler; + +/** + * Deployment Diagram Reconciler from 1.0.0 to 1.1.0 + */ +public class DeploymentReconciler_1_1_0 extends DiagramReconciler { + + private final static String ArtifactEditPart_VISUAL_ID = "2006"; + private final static String ArtifactFloatingLabelEditPart_VISUAL_ID = "61"; + private final static String ArtifactEditPartACN_VISUAL_ID = "28"; + private final static String ArtifactFloatingLabelEditPartACN_VISUAL_ID = "60"; + private final static String ArtifactEditPartCN_VISUAL_ID = "25"; + private final static String ArtifactFloatingLabelEditPartCN_VISUAL_ID = "59"; + + /** + * Gets the reconcile command. + * + * @param diagram + * the diagram + * @return the reconcile command + * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram) + */ + @Override + public ICommand getReconcileCommand(Diagram diagram) { + return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap()); + } + + /** + * Gets the floating label map to add. + * + * @return the floating label map + */ + private Map<String, String> getFloatingLabelMap() { + Map<String, String> map = new HashMap<String, String>(); + map.put(ArtifactEditPart_VISUAL_ID, ArtifactFloatingLabelEditPart_VISUAL_ID); + map.put(ArtifactEditPartACN_VISUAL_ID, ArtifactFloatingLabelEditPartACN_VISUAL_ID); + map.put(ArtifactEditPartCN_VISUAL_ID, ArtifactFloatingLabelEditPartCN_VISUAL_ID); + + return map; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.configuration deleted file mode 100644 index e12548d2e03..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.configuration +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_ARGokHDuEeWh-MssWmCB_A" implementationID="PapyrusUMLDeploymentDiagram">
- <modelRules xmi:id="_ARGokXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </modelRules>
- <owningRules xmi:id="_ARGoknDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_ARGok3DuEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml index 9b4c8d055c9..90b4cd183fd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/plugin.xml @@ -14,14 +14,6 @@ --> <plugin> - <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/DeploymentDiagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - <extension point="org.eclipse.ui.commands"> <command @@ -716,21 +708,21 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="PapyrusUMLDeploymentDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.deployment.custom.migration.DeploymentReconciler" - source="undefined" - target="1.1.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.deployment.custom.migration.DeploymentReconciler_1_1_0" + source="1.0.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLDeploymentDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.deployment.custom.migration.DeploymentReconcilerForCompartment" - source="undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.deployment.custom.migration.DeploymentReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLDeploymentDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.deployment.custom.migration.DeploymentReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/build.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/build.properties index 218388d3d0b..d23d7a93367 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/build.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/build.properties @@ -1,15 +1,14 @@ -source.. = src/,\
- src-gen/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- palettes/,\
- icons/,\
- about.html,\
- plugin.properties,\
- messages.properties,\
- model/interactionOverviewDiagram.elementtypesconfigurations,\
- model/InteractionOverviewDiagram.configuration
-
-src.includes = about.html
+source.. = src/,\ + src-gen/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + palettes/,\ + icons/,\ + about.html,\ + plugin.properties,\ + messages.properties,\ + model/interactionOverviewDiagram.elementtypesconfigurations + +src.includes = about.html diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/model/InteractionOverviewDiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/model/InteractionOverviewDiagram.configuration deleted file mode 100755 index 02826b837d9..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/model/InteractionOverviewDiagram.configuration +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/Activity_Shape/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_FuMjYHDuEeWh-MssWmCB_A" implementationID="PapyrusUMLInteractionOverviewDiagram">
- <modelRules xmi:id="_FuMjYXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Activity"/>
- </modelRules>
- <owningRules xmi:id="_FuMjYnDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Activity"/>
- </owningRules>
- <owningRules xmi:id="_FuMjY3DuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/>
- <newModelPath xmi:id="_FuMjZHDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_FuMjZXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/>
- <newModelPath xmi:id="_FuMjZnDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_FuMjZ3DuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- <newModelPath xmi:id="_FuMjaHDuEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Activity">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/>
- </newModelPath>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_FuMjaXDuEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml index ab5f80c2b92..f8b4282b4bb 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/plugin.xml @@ -1,719 +1,704 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<!--
- Copyright (c) 2013, 2014 CEA and others.
-
- 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 - Initial API and implementation
- Christian W. Damus (CEA) - bug 323802
-
--->
-<plugin>
- <extension
- point="org.eclipse.papyrus.infra.viewpoints.policy.custom">
- <contribution
- file="model/InteractionOverviewDiagram.configuration"
- original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration">
- </contribution>
- </extension>
-
- <!-- Diagram declaration -->
- <extension point="org.eclipse.papyrus.infra.ui.papyrusDiagram">
- <creationCommand
- creationCommandClass="org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramCreateCommand"
- creationCondition="org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramCreationCondition"
- icon="icons/obj16/interactionOverviewDiagram.gif"
- id="org.eclipse.papyrus.uml.diagram.interactionoverview.CreateCommand"
- label="Interaction Overview Diagram"
- language="uml"/>
- <editorDiagram
- actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor"
- factoryClass="org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramEditorFactory"
- icon="icons/obj16/interactionOverviewDiagram.gif"/>
- </extension>
-
- <!-- Diagram creation command and handler -->
- <extension point="org.eclipse.ui.commands">
- <command
- id="org.eclipse.papyrus.uml.diagram.interactionoverview.CreateCommand"
- name="Create a new Interaction Overview Diagram"
- description="Create a new Interaction Overview Diagram"
- categoryId="org.eclipse.papyrus.editor.category"/>
- </extension>
-
-
- <!-- Diagram creation command registration in menu and toolbar -->
-
- <!-- Palette tool declaration (declares the real palette containment) -->
- <extension
- point="org.eclipse.papyrus.uml.diagram.common.paletteDefinition"
- name="UML_InteractionOverviewDiagram">
-
- <paletteDefinition
- ID="UML_InteractionOverviewDiagram"
- class="org.eclipse.papyrus.uml.diagram.common.service.PluginPaletteProvider"
- name="UML_InteractionOverviewDiagram"
- icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif"
- path="palettes/interactionoverviewdiagram.palette.xml"
- provider="CEA LIST">
- <Priority name="Low"/>
-
- <!-- Specify diagram this palette tools relate to -->
- <editor
- id="org.eclipse.papyrus.uml.diagram.interactionoverview"/>
- </paletteDefinition>
- </extension>
-
- <!-- Diagram view providers declaration -->
- <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders">
- <!-- Diagram view provider -->
- <viewProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.InteractionOverviewDiagramViewProvider">
- <Priority name="Medium"/>
- <context
- viewClass="org.eclipse.gmf.runtime.notation.Diagram"
- semanticHints=""/>
-
-
- </viewProvider>
-
- <!-- ViewProvider for inherited elements (from ActivityDiagram ViewProvider) -->
- <viewProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.InheritedActivityDiagramViewProvider">
- <Priority name="Low"/>
-
- <context
- viewClass="org.eclipse.gmf.runtime.notation.Node"
- semanticHints="ActivityFinalNode_Shape, CallBehaviorAction_Shape, Comment_Shape, ConditionalNode_Shape, DecisionNode_Shape, FlowFinalNode_Shape, ForkNode_Shape, InitialNode_Shape, JoinNode_Shape, LoopNode_Shape, MergeNode_Shape, NamedElement_DefaultShape, Activity_Shape, SequenceNode_Shape, Constraint_Shape"/>
-
- <context
- viewClass="org.eclipse.gmf.runtime.notation.Node"
- semanticHints="Parameter_ParameterLabel, Constraint_PreconditionLabel, Constraint_PostconditionLabel"/>
-
- <context
- viewClass="org.eclipse.gmf.runtime.notation.Edge"
- semanticHints="Comment_AnnotatedElementEdge, ControlFlow_Edge"/>
-
- <object
- id="elementtype.node"
- class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)">
-
- <method
- name="getSemanticHint()"
- value="ActivityFinalNode_Shape, CallBehaviorAction_Shape, Comment_Shape, ConditionalNode_Shape, DecisionNode_Shape, FlowFinalNode_Shape, ForkNode_Shape, InitialNode_Shape, JoinNode_Shape, LoopNode_Shape, MergeNode_Shape, NamedElement_DefaultShape, Activity_Shape, SequenceNode_Shape, Constraint_Shape">
- </method>
- </object>
- <context
- viewClass="org.eclipse.gmf.runtime.notation.Node"
- elements="elementtype.node"/>
-
- <object
- id="elementtype.edge"
- class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)">
-
- <method
- name="getSemanticHint()"
- value="Comment_AnnotatedElementEdge, ControlFlow_Edge">
- </method>
- </object>
- <context
- viewClass="org.eclipse.gmf.runtime.notation.Edge"
- elements="elementtype.edge"/>
-
-
- <!-- Additional descriptors provided in case the semantic hint is is not provided -->
-
- <!-- "uml.ActivityFinalNode" -->
- <object
- id="uml.ActivityFinalNode"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.ActivityFinalNode"/>
- </object>
-
- <!-- "uml.CallBehaviorAction" -->
- <object
- id="uml.CallBehaviorAction"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.CallBehaviorAction"/>
- </object>
-
- <!-- "uml.Comment" -->
- <object
- id="uml.Comment"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.Comment"/>
- </object>
-
- <!-- "uml.ConditionalNode" -->
- <object
- id="uml.ConditionalNode"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.ConditionalNode"/>
- </object>
-
- <!-- "uml.DecisionNode" -->
- <object
- id="uml.DecisionNode"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.DecisionNode"/>
- </object>
-
- <!-- "uml.FlowFinalNode" -->
- <object
- id="uml.FlowFinalNode"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.FlowFinalNode"/>
- </object>
-
- <!-- "uml.ForkNode" -->
- <object
- id="uml.ForkNode"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.ForkNode"/>
- </object>
-
- <!-- "uml.InitialNode" -->
- <object
- id="uml.InitialNode"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.InitialNode"/>
- </object>
-
- <!-- "uml.JoinNode" -->
- <object
- id="uml.JoinNode"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.JoinNode"/>
- </object>
-
- <!-- "uml.LoopNode" -->
- <object
- id="uml.LoopNode"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.LoopNode"/>
- </object>
-
- <!-- "uml.MergeNode" -->
- <object
- id="uml.MergeNode"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.MergeNode"/>
- </object>
-
- <!-- "uml.NamedElement" -->
- <object
- id="uml.NamedElement"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.NamedElement"/>
- </object>
-
- <!-- "uml.Activity" -->
- <object
- id="uml.Activity"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.Activity"/>
- </object>
-
- <!-- "uml.SequenceNode" -->
- <object
- id="uml.SequenceNode"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.SequenceNode"/>
- </object>
-
- <!-- "uml.Constraint" -->
- <object
- id="uml.Constraint"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.Constraint"/>
- </object>
-
- <!-- "uml.Parameter" -->
- <object
- id="uml.Parameter"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.Parameter"/>
- </object>
-
- <!-- "uml.ControlFlow" -->
- <object
- id="uml.ControlFlow"
- class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)">
- <method
- name="getProxyClassID()"
- value="uml.ControlFlow"/>
- </object>
-
- <!-- Additional activation contexts for nodes semantic objects -->
- <context
- viewClass="org.eclipse.gmf.runtime.notation.Node"
- elements="uml.ActivityFinalNode, uml.CallBehaviorAction, uml.Comment, uml.ConditionalNode, uml.DecisionNode, uml.FlowFinalNode, uml.ForkNode, uml.InitialNode, uml.JoinNode, uml.LoopNode, uml.MergeNode, uml.NamedElement, uml.Activity, uml.SequenceNode, uml.Constraint, uml.Parameter"/>
-
- <!-- Additional activation contexts for edges semantic objects -->
- <context
- viewClass="org.eclipse.gmf.runtime.notation.Edge"
- elements="uml.ControlFlow"/>
-
- </viewProvider>
- <viewProvider
- class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.CustomViewProvider">
- <Priority
- name="High">
- </Priority>
- <context
- viewClass="org.eclipse.gmf.runtime.notation.Node"
- semanticHints="CallBehaviorAction_InteractionShape, CallBehaviorAction_InteractionUseShape"/>
-
- <object
- id="elementtype.node"
- class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)">
-
- <method
- name="getSemanticHint()"
- value="CallBehaviorAction_InteractionShape">
- </method>
- </object>
- <object
- id=""
- class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)">
-
- <method
- name="getSemanticHint()"
- value="CallBehaviorAction_InteractionUseShape">
- </method>
- </object>
- <context
- viewClass="org.eclipse.gmf.runtime.notation.Node"
- elements="elementtype.node"/>
-
- </viewProvider>
- </extension>
-
- <!-- Diagram edit part providers declaration -->
- <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
-
- <!-- Diagram edit part provider -->
- <editpartProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.InteractionOverviewDiagramEditPartProvider">
- <Priority name="Low"/>
- <object
- id="org.eclipse.papyrus.uml.diagram.interactionoverview.Diagram"
- class="org.eclipse.gmf.runtime.notation.Diagram">
- <method
- name="getType()"
- value="PapyrusUMLInteractionOverviewDiagram"/>
- </object>
- <context views="org.eclipse.papyrus.uml.diagram.interactionoverview.Diagram"/>
- </editpartProvider>
-
- <!-- EditPartProvider for inherited elements (from ActivityDiagram) -->
- <editpartProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.InheritedActivityDiagramEditPartProvider">
- <Priority name="Low"/>
- <object
- id="ACTIVITY_FINAL_NODE_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="ActivityFinalNode_Shape, ActivityFinalNode_StereotypeLabel"/>
- </object>
- <object
- id="CALL_BEHAVIOR_ACTION_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="CallBehaviorAction_Shape, CallBehaviorAction_NameLabel"/>
- </object>
- <object
- id="COMMENT_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="Comment_Shape, Comment_BodyLabel"/>
- </object>
- <object
- id="CONDITIONAL_NODE_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="ConditionalNode_Shape, ConditionalNode_KeywordLabel, ConditionalNode_ActivityNodeCompartment"/>
- </object>
- <object
- id="DECISION_NODE_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="DecisionNode_Shape, DecisionNode_DecisionInputLabel, DecisionNode_StereotypeLabel"/>
- </object>
- <object
- id="FLOW_FINAL_NODE_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="FlowFinalNode_Shape, FlowFinalNode_StereotypeLabel"/>
- </object>
- <object
- id="FORK_NODE_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="ForkNode_Shape, ForkNode_StereotypeLabel"/>
- </object>
- <object
- id="INITIAL_NODE_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="InitialNode_Shape, InitialNode_StereotypeLabel"/>
- </object>
- <object
- id="JOIN_NODE_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="JoinNode_Shape, JoinNode_JoinSpecLabel, JoinNode_StereotypeLabel"/>
- </object>
- <object
- id="LOOP_NODE_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="LoopNode_Shape, LoopNode_KeywordLabel, LoopNode_ActivityNodeCompartment"/>
- </object>
- <object
- id="MERGE_NODE_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="MergeNode_Shape, MergeNode_StereotypeLabel"/>
- </object>
- <object
- id="SHAPE_NAMED_ELEMENT_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="NamedElement_DefaultShape, NamedElement_NameLabel"/>
- </object>
- <object
- id="ACTIVITY"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="Activity_NameLabel, Activity_KeywordLabel, Activity_ParameterCompartment, Activity_PreconditionCompartment, Activity_PostconditionCompartment, Activity_ActivityNodeCompartment"/>
- </object>
- <object
- id="SEQUENCE_NODE_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="SequenceNode_Shape, SequenceNode_KeywordLabel, SequenceNode_ActivityNodeCompartment"/>
- </object>
- <object
- id="CONSTRAINT_CN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="Constraint_Shape, Constraint_NameLabel, Constraint_BodyLabel"/>
- </object>
-
- <object
- id="ACTIVITY_PARAMETER_CLN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="Parameter_ParameterLabel"/>
- </object>
- <object
- id="ACTIVITY_CONSTRAINT_CLN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="Constraint_PreconditionLabel"/>
- </object>
- <object
- id="ACTIVITY_CONSTRAINT_CLN"
- class="org.eclipse.gmf.runtime.notation.Node">
- <method
- name="getType()"
- value="Constraint_PostconditionLabel"/>
- </object>
-
- <object
- id="COMMENT_ANNOTATED_ELEMENT"
- class="org.eclipse.gmf.runtime.notation.Edge">
- <method
- name="getType()"
- value="Comment_AnnotatedElementEdge"/>
- </object>
- <object
- id="CONTROL_FLOW"
- class="org.eclipse.gmf.runtime.notation.Edge">
- <method
- name="getType()"
- value="ControlFlow_Edge, ControlFlow_NameLabel, ControlFlow_WeightLabel, ControlFlow_GuardLabel, ControlFlow_StereotypeLabel, ControlFlow_IconLabel"/>
- </object>
-
- <context
- views="ACTIVITY_FINAL_NODE_CN, CALL_BEHAVIOR_ACTION_CN, COMMENT_CN, CONDITIONAL_NODE_CN, DECISION_NODE_CN, FLOW_FINAL_NODE_CN, FORK_NODE_CN, INITIAL_NODE_CN, JOIN_NODE_CN, LOOP_NODE_CN, MERGE_NODE_CN, SHAPE_NAMED_ELEMENT_CN, SEQUENCE_NODE_CN, CONSTRAINT_CN"/>
- <context views="ACTIVITY_PARAMETER_CLN, ACTIVITY_CONSTRAINT_CLN, ACTIVITY_CONSTRAINT_CLN"/>
- <context views="COMMENT_ANNOTATED_ELEMENT, CONTROL_FLOW"/>
-
- </editpartProvider>
- </extension>
-
-<extension
- id="custom-ep-provider"
- point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
- <editpartProvider
- class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.CustomEditPartProvider">
- <Priority name="Medium"/>
- <object
- class="org.eclipse.gmf.runtime.notation.Node"
- id="ACTIVITY">
- <method name="getType()" value="Activity_Shape"/>
- </object>
- <context views="ACTIVITY"/>
- </editpartProvider>
- </extension>
-
- <!-- Diagram edit policy provider -->
- <extension point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders">
- <editpolicyProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.CustomEditPolicyProvider">
- <Priority name="Low"/>
- </editpolicyProvider>
- </extension>
-
- <!-- Preference pages declaration -->
- <extension
- point="org.eclipse.ui.preferencePages"
- id="prefpages">
-
- <!-- Diagram Preference pages declaration -->
- <page
- id="org.eclipse.papyrus.uml.diagram.interactionoverview.preferences"
- name="InteractionOverviewDiagram Diagram"
- category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams"
- class="org.eclipse.papyrus.uml.diagram.interactionoverview.preferences.InteractionOverviewDiagramGeneralPreferencePage">
- </page>
-
- <!-- Element Preference pages declaration -->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- </extension>
-
- <!-- // Start of user code custom extensions -->
-
- <extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider">
- <?gmfgen generated="true"?>
- <ParserProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.CustomUMLParserProvider">
- <Priority name="Low"/>
- </ParserProvider>
- </extension>
- <extension
- id="org.eclipse.papyrus.uml.diagram.timing.palettedefinition"
- name="Papyrus Interaction Overview Diagram Predefined Entries"
- point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders">
- <paletteProvider
- class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider">
- <Priority
- name="Medium">
- </Priority>
- <contribution
- factoryClass="org.eclipse.papyrus.uml.diagram.interactionoverview.part.CustomIODPaletteFactory">
- <entry
- defineOnly="false"
- description="Create a new Interaction with snapshot"
- id="createCallBehaviorActionAsInteractionCreationTool"
- kind="tool"
- label="Interaction"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interaction.gif"
- path="/interactionoverview.drawer.nodes/"
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interaction.gif">
- </entry>
- <entry
- defineOnly="false"
- description="Create a new InteractionUse"
- id="interactionoverview.drawer.nodes.interactionuse"
- kind="tool"
- label="Interaction Use"
- large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InteractionUse.gif"
- path="/interactionoverview.drawer.nodes/"
- small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InteractionUse.gif">
- </entry>
- </contribution>
- <editor
- id="org.eclipse.papyrus.uml.diagram.interactionoverview">
- </editor>
- </paletteProvider>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- defaultHandler="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands.UpdateDiagramInSnapshotCommandHandler"
- description="Update Snapshot in Interaction"
- id="org.eclipse.papyrus.uml.diagram.interactionoverview.updateSnapshotCommand"
- name="Update Snapshot in Interaction">
- </command>
- <command
- defaultHandler="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands.SwitchInteractionFormCommandHandler"
- description="Switch Interaction <-> InteractionUse"
- id="org.eclipse.papyrus.uml.diagram.interactionoverview.switchInteraction"
- name="Switch Interaction <-> InteractionUse">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="true"
- locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?after=additions">
- <command
- commandId="org.eclipse.papyrus.uml.diagram.interactionoverview.updateSnapshotCommand"
- label="Update Snapshot"
- style="push">
- <visibleWhen>
-
- <iterate
- ifEmpty="false"
- operator="or">
- <instanceof value="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CallBehaviorActionAsInteractionEditPart">
- </instanceof>
- </iterate>
-
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.papyrus.uml.diagram.interactionoverview.switchInteraction"
- label="Switch Interaction <->InteractionUse"
- style="push">
- <visibleWhen>
- <iterate
- ifEmpty="false"
- operator="or">
- <instanceof
- value="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CallBehaviorActionAsInteractionEditPart">
- </instanceof>
- <instanceof
- value="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomInteractionUseEditPartCN">
- </instanceof>
- </iterate>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.papyrus.infra.gmfdiag.dnd.dropStrategy">
- <strategy
- strategy="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands.CallBehaviorActionToInteractionDropStrategy">
- </strategy>
- </extension>
- <!-- Insert custom extensions here. -->
-
- <!-- // End of user code -->
-<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping">
- <diagramMappings diagramID="PapyrusUMLInteractionOverviewDiagram">
- <mapping type="PapyrusUMLInteractionOverviewDiagram" humanReadableType="InteractionOverviewDiagram"/>
- <!-- Compartments -->
-
- <!-- Link labels -->
- </diagramMappings>
-</extension>
-<extension
- point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration">
- <elementTypeSet
- clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext"
- path="model/interactionOverviewDiagram.elementtypesconfigurations">
- </elementTypeSet>
-</extension>
-
-<extension
- point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler">
- <diagramReconciler
- diagramType="PapyrusUMLInteractionOverviewDiagram"
- reconcilerClass="org.eclipse.papyrus.uml.diagram.activity.migration.ActivityReconciler"
- source="undefined"
- target="1.1.0">
- </diagramReconciler>
- <diagramReconciler
- diagramType="PapyrusUMLInteractionOverviewDiagram"
- reconcilerClass="org.eclipse.papyrus.uml.diagram.interactionoverview.migration.InteractionOverviewReconciler_1_2_0"
- source="1.1.0"
- target="1.2.0">
- </diagramReconciler>
-</extension>
-
- <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders">
- <?gmfgen generated="true"?>
- <visualTypeProvider
- class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.UMLVisualTypeProvider"
- diagramType="PapyrusUMLInteractionOverviewDiagram">
- </visualTypeProvider>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<!-- + Copyright (c) 2013, 2014 CEA and others. + + 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 - Initial API and implementation + Christian W. Damus (CEA) - bug 323802 + +--> +<plugin> + <!-- Diagram declaration --> + <extension point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> + <creationCommand + creationCommandClass="org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramCreateCommand" + creationCondition="org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramCreationCondition" + icon="icons/obj16/interactionOverviewDiagram.gif" + id="org.eclipse.papyrus.uml.diagram.interactionoverview.CreateCommand" + label="Interaction Overview Diagram" + language="uml"/> + <editorDiagram + actionBarContributorId="org.eclipse.papyrus.uml.diagram.common.part.UMLDiagramActionBarContributor" + factoryClass="org.eclipse.papyrus.uml.diagram.interactionoverview.InteractionOverviewDiagramEditorFactory" + icon="icons/obj16/interactionOverviewDiagram.gif"/> + </extension> + + <!-- Diagram creation command and handler --> + <extension point="org.eclipse.ui.commands"> + <command + id="org.eclipse.papyrus.uml.diagram.interactionoverview.CreateCommand" + name="Create a new Interaction Overview Diagram" + description="Create a new Interaction Overview Diagram" + categoryId="org.eclipse.papyrus.editor.category"/> + </extension> + + + <!-- Diagram creation command registration in menu and toolbar --> + + <!-- Palette tool declaration (declares the real palette containment) --> + <extension + point="org.eclipse.papyrus.uml.diagram.common.paletteDefinition" + name="UML_InteractionOverviewDiagram"> + + <paletteDefinition + ID="UML_InteractionOverviewDiagram" + class="org.eclipse.papyrus.uml.diagram.common.service.PluginPaletteProvider" + name="UML_InteractionOverviewDiagram" + icon="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif" + path="palettes/interactionoverviewdiagram.palette.xml" + provider="CEA LIST"> + <Priority name="Low"/> + + <!-- Specify diagram this palette tools relate to --> + <editor + id="org.eclipse.papyrus.uml.diagram.interactionoverview"/> + </paletteDefinition> + </extension> + + <!-- Diagram view providers declaration --> + <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders"> + <!-- Diagram view provider --> + <viewProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.InteractionOverviewDiagramViewProvider"> + <Priority name="Medium"/> + <context + viewClass="org.eclipse.gmf.runtime.notation.Diagram" + semanticHints=""/> + + + </viewProvider> + + <!-- ViewProvider for inherited elements (from ActivityDiagram ViewProvider) --> + <viewProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.InheritedActivityDiagramViewProvider"> + <Priority name="Low"/> + + <context + viewClass="org.eclipse.gmf.runtime.notation.Node" + semanticHints="ActivityFinalNode_Shape, CallBehaviorAction_Shape, Comment_Shape, ConditionalNode_Shape, DecisionNode_Shape, FlowFinalNode_Shape, ForkNode_Shape, InitialNode_Shape, JoinNode_Shape, LoopNode_Shape, MergeNode_Shape, NamedElement_DefaultShape, Activity_Shape, SequenceNode_Shape, Constraint_Shape"/> + + <context + viewClass="org.eclipse.gmf.runtime.notation.Node" + semanticHints="Parameter_ParameterLabel, Constraint_PreconditionLabel, Constraint_PostconditionLabel"/> + + <context + viewClass="org.eclipse.gmf.runtime.notation.Edge" + semanticHints="Comment_AnnotatedElementEdge, ControlFlow_Edge"/> + + <object + id="elementtype.node" + class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)"> + + <method + name="getSemanticHint()" + value="ActivityFinalNode_Shape, CallBehaviorAction_Shape, Comment_Shape, ConditionalNode_Shape, DecisionNode_Shape, FlowFinalNode_Shape, ForkNode_Shape, InitialNode_Shape, JoinNode_Shape, LoopNode_Shape, MergeNode_Shape, NamedElement_DefaultShape, Activity_Shape, SequenceNode_Shape, Constraint_Shape"> + </method> + </object> + <context + viewClass="org.eclipse.gmf.runtime.notation.Node" + elements="elementtype.node"/> + + <object + id="elementtype.edge" + class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)"> + + <method + name="getSemanticHint()" + value="Comment_AnnotatedElementEdge, ControlFlow_Edge"> + </method> + </object> + <context + viewClass="org.eclipse.gmf.runtime.notation.Edge" + elements="elementtype.edge"/> + + + <!-- Additional descriptors provided in case the semantic hint is is not provided --> + + <!-- "uml.ActivityFinalNode" --> + <object + id="uml.ActivityFinalNode" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.ActivityFinalNode"/> + </object> + + <!-- "uml.CallBehaviorAction" --> + <object + id="uml.CallBehaviorAction" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.CallBehaviorAction"/> + </object> + + <!-- "uml.Comment" --> + <object + id="uml.Comment" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.Comment"/> + </object> + + <!-- "uml.ConditionalNode" --> + <object + id="uml.ConditionalNode" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.ConditionalNode"/> + </object> + + <!-- "uml.DecisionNode" --> + <object + id="uml.DecisionNode" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.DecisionNode"/> + </object> + + <!-- "uml.FlowFinalNode" --> + <object + id="uml.FlowFinalNode" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.FlowFinalNode"/> + </object> + + <!-- "uml.ForkNode" --> + <object + id="uml.ForkNode" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.ForkNode"/> + </object> + + <!-- "uml.InitialNode" --> + <object + id="uml.InitialNode" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.InitialNode"/> + </object> + + <!-- "uml.JoinNode" --> + <object + id="uml.JoinNode" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.JoinNode"/> + </object> + + <!-- "uml.LoopNode" --> + <object + id="uml.LoopNode" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.LoopNode"/> + </object> + + <!-- "uml.MergeNode" --> + <object + id="uml.MergeNode" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.MergeNode"/> + </object> + + <!-- "uml.NamedElement" --> + <object + id="uml.NamedElement" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.NamedElement"/> + </object> + + <!-- "uml.Activity" --> + <object + id="uml.Activity" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.Activity"/> + </object> + + <!-- "uml.SequenceNode" --> + <object + id="uml.SequenceNode" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.SequenceNode"/> + </object> + + <!-- "uml.Constraint" --> + <object + id="uml.Constraint" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.Constraint"/> + </object> + + <!-- "uml.Parameter" --> + <object + id="uml.Parameter" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.Parameter"/> + </object> + + <!-- "uml.ControlFlow" --> + <object + id="uml.ControlFlow" + class="org.eclipse.gmf.runtime.emf.core.util.IProxyEObject(org.eclipse.gmf.runtime.emf.core)"> + <method + name="getProxyClassID()" + value="uml.ControlFlow"/> + </object> + + <!-- Additional activation contexts for nodes semantic objects --> + <context + viewClass="org.eclipse.gmf.runtime.notation.Node" + elements="uml.ActivityFinalNode, uml.CallBehaviorAction, uml.Comment, uml.ConditionalNode, uml.DecisionNode, uml.FlowFinalNode, uml.ForkNode, uml.InitialNode, uml.JoinNode, uml.LoopNode, uml.MergeNode, uml.NamedElement, uml.Activity, uml.SequenceNode, uml.Constraint, uml.Parameter"/> + + <!-- Additional activation contexts for edges semantic objects --> + <context + viewClass="org.eclipse.gmf.runtime.notation.Edge" + elements="uml.ControlFlow"/> + + </viewProvider> + <viewProvider + class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.CustomViewProvider"> + <Priority + name="High"> + </Priority> + <context + viewClass="org.eclipse.gmf.runtime.notation.Node" + semanticHints="CallBehaviorAction_InteractionShape, CallBehaviorAction_InteractionUseShape"/> + + <object + id="elementtype.node" + class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)"> + + <method + name="getSemanticHint()" + value="CallBehaviorAction_InteractionShape"> + </method> + </object> + <object + id="" + class="org.eclipse.papyrus.gmf.diagram.common.commands.ISemanticHintAdapter(org.eclipse.papyrus.sysml.diagram.common)"> + + <method + name="getSemanticHint()" + value="CallBehaviorAction_InteractionUseShape"> + </method> + </object> + <context + viewClass="org.eclipse.gmf.runtime.notation.Node" + elements="elementtype.node"/> + + </viewProvider> + </extension> + + <!-- Diagram edit part providers declaration --> + <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders"> + + <!-- Diagram edit part provider --> + <editpartProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.InteractionOverviewDiagramEditPartProvider"> + <Priority name="Low"/> + <object + id="org.eclipse.papyrus.uml.diagram.interactionoverview.Diagram" + class="org.eclipse.gmf.runtime.notation.Diagram"> + <method + name="getType()" + value="PapyrusUMLInteractionOverviewDiagram"/> + </object> + <context views="org.eclipse.papyrus.uml.diagram.interactionoverview.Diagram"/> + </editpartProvider> + + <!-- EditPartProvider for inherited elements (from ActivityDiagram) --> + <editpartProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.InheritedActivityDiagramEditPartProvider"> + <Priority name="Low"/> + <object + id="ACTIVITY_FINAL_NODE_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="ActivityFinalNode_Shape, ActivityFinalNode_StereotypeLabel"/> + </object> + <object + id="CALL_BEHAVIOR_ACTION_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="CallBehaviorAction_Shape, CallBehaviorAction_NameLabel"/> + </object> + <object + id="COMMENT_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="Comment_Shape, Comment_BodyLabel"/> + </object> + <object + id="CONDITIONAL_NODE_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="ConditionalNode_Shape, ConditionalNode_KeywordLabel, ConditionalNode_ActivityNodeCompartment"/> + </object> + <object + id="DECISION_NODE_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="DecisionNode_Shape, DecisionNode_DecisionInputLabel, DecisionNode_StereotypeLabel"/> + </object> + <object + id="FLOW_FINAL_NODE_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="FlowFinalNode_Shape, FlowFinalNode_StereotypeLabel"/> + </object> + <object + id="FORK_NODE_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="ForkNode_Shape, ForkNode_StereotypeLabel"/> + </object> + <object + id="INITIAL_NODE_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="InitialNode_Shape, InitialNode_StereotypeLabel"/> + </object> + <object + id="JOIN_NODE_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="JoinNode_Shape, JoinNode_JoinSpecLabel, JoinNode_StereotypeLabel"/> + </object> + <object + id="LOOP_NODE_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="LoopNode_Shape, LoopNode_KeywordLabel, LoopNode_ActivityNodeCompartment"/> + </object> + <object + id="MERGE_NODE_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="MergeNode_Shape, MergeNode_StereotypeLabel"/> + </object> + <object + id="SHAPE_NAMED_ELEMENT_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="NamedElement_DefaultShape, NamedElement_NameLabel"/> + </object> + <object + id="ACTIVITY" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="Activity_NameLabel, Activity_KeywordLabel, Activity_ParameterCompartment, Activity_PreconditionCompartment, Activity_PostconditionCompartment, Activity_ActivityNodeCompartment"/> + </object> + <object + id="SEQUENCE_NODE_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="SequenceNode_Shape, SequenceNode_KeywordLabel, SequenceNode_ActivityNodeCompartment"/> + </object> + <object + id="CONSTRAINT_CN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="Constraint_Shape, Constraint_NameLabel, Constraint_BodyLabel"/> + </object> + + <object + id="ACTIVITY_PARAMETER_CLN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="Parameter_ParameterLabel"/> + </object> + <object + id="ACTIVITY_CONSTRAINT_CLN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="Constraint_PreconditionLabel"/> + </object> + <object + id="ACTIVITY_CONSTRAINT_CLN" + class="org.eclipse.gmf.runtime.notation.Node"> + <method + name="getType()" + value="Constraint_PostconditionLabel"/> + </object> + + <object + id="COMMENT_ANNOTATED_ELEMENT" + class="org.eclipse.gmf.runtime.notation.Edge"> + <method + name="getType()" + value="Comment_AnnotatedElementEdge"/> + </object> + <object + id="CONTROL_FLOW" + class="org.eclipse.gmf.runtime.notation.Edge"> + <method + name="getType()" + value="ControlFlow_Edge, ControlFlow_NameLabel, ControlFlow_WeightLabel, ControlFlow_GuardLabel, ControlFlow_StereotypeLabel, ControlFlow_IconLabel"/> + </object> + + <context + views="ACTIVITY_FINAL_NODE_CN, CALL_BEHAVIOR_ACTION_CN, COMMENT_CN, CONDITIONAL_NODE_CN, DECISION_NODE_CN, FLOW_FINAL_NODE_CN, FORK_NODE_CN, INITIAL_NODE_CN, JOIN_NODE_CN, LOOP_NODE_CN, MERGE_NODE_CN, SHAPE_NAMED_ELEMENT_CN, SEQUENCE_NODE_CN, CONSTRAINT_CN"/> + <context views="ACTIVITY_PARAMETER_CLN, ACTIVITY_CONSTRAINT_CLN, ACTIVITY_CONSTRAINT_CLN"/> + <context views="COMMENT_ANNOTATED_ELEMENT, CONTROL_FLOW"/> + + </editpartProvider> + </extension> + +<extension + id="custom-ep-provider" + point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders"> + <editpartProvider + class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.CustomEditPartProvider"> + <Priority name="Medium"/> + <object + class="org.eclipse.gmf.runtime.notation.Node" + id="ACTIVITY"> + <method name="getType()" value="Activity_Shape"/> + </object> + <context views="ACTIVITY"/> + </editpartProvider> + </extension> + + <!-- Diagram edit policy provider --> + <extension point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders"> + <editpolicyProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.CustomEditPolicyProvider"> + <Priority name="Low"/> + </editpolicyProvider> + </extension> + + <!-- Preference pages declaration --> + <extension + point="org.eclipse.ui.preferencePages" + id="prefpages"> + + <!-- Diagram Preference pages declaration --> + <page + id="org.eclipse.papyrus.uml.diagram.interactionoverview.preferences" + name="InteractionOverviewDiagram Diagram" + category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams" + class="org.eclipse.papyrus.uml.diagram.interactionoverview.preferences.InteractionOverviewDiagramGeneralPreferencePage"> + </page> + + <!-- Element Preference pages declaration --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + </extension> + + <!-- // Start of user code custom extensions --> + + <extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider"> + <?gmfgen generated="true"?> + <ParserProvider class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.CustomUMLParserProvider"> + <Priority name="Low"/> + </ParserProvider> + </extension> + <extension + id="org.eclipse.papyrus.uml.diagram.timing.palettedefinition" + name="Papyrus Interaction Overview Diagram Predefined Entries" + point="org.eclipse.gmf.runtime.diagram.ui.paletteProviders"> + <paletteProvider + class="org.eclipse.gmf.runtime.diagram.ui.providers.DefaultPaletteProvider"> + <Priority + name="Medium"> + </Priority> + <contribution + factoryClass="org.eclipse.papyrus.uml.diagram.interactionoverview.part.CustomIODPaletteFactory"> + <entry + defineOnly="false" + description="Create a new Interaction with snapshot" + id="createCallBehaviorActionAsInteractionCreationTool" + kind="tool" + label="Interaction" + large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interaction.gif" + path="/interactionoverview.drawer.nodes/" + small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Interaction.gif"> + </entry> + <entry + defineOnly="false" + description="Create a new InteractionUse" + id="interactionoverview.drawer.nodes.interactionuse" + kind="tool" + label="Interaction Use" + large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InteractionUse.gif" + path="/interactionoverview.drawer.nodes/" + small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InteractionUse.gif"> + </entry> + </contribution> + <editor + id="org.eclipse.papyrus.uml.diagram.interactionoverview"> + </editor> + </paletteProvider> + </extension> + <extension + point="org.eclipse.ui.commands"> + <command + defaultHandler="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands.UpdateDiagramInSnapshotCommandHandler" + description="Update Snapshot in Interaction" + id="org.eclipse.papyrus.uml.diagram.interactionoverview.updateSnapshotCommand" + name="Update Snapshot in Interaction"> + </command> + <command + defaultHandler="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands.SwitchInteractionFormCommandHandler" + description="Switch Interaction <-> InteractionUse" + id="org.eclipse.papyrus.uml.diagram.interactionoverview.switchInteraction" + name="Switch Interaction <-> InteractionUse"> + </command> + </extension> + <extension + point="org.eclipse.ui.menus"> + <menuContribution + allPopups="true" + locationURI="popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu?after=additions"> + <command + commandId="org.eclipse.papyrus.uml.diagram.interactionoverview.updateSnapshotCommand" + label="Update Snapshot" + style="push"> + <visibleWhen> + + <iterate + ifEmpty="false" + operator="or"> + <instanceof value="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CallBehaviorActionAsInteractionEditPart"> + </instanceof> + </iterate> + + </visibleWhen> + </command> + <command + commandId="org.eclipse.papyrus.uml.diagram.interactionoverview.switchInteraction" + label="Switch Interaction <->InteractionUse" + style="push"> + <visibleWhen> + <iterate + ifEmpty="false" + operator="or"> + <instanceof + value="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CallBehaviorActionAsInteractionEditPart"> + </instanceof> + <instanceof + value="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.part.CustomInteractionUseEditPartCN"> + </instanceof> + </iterate> + </visibleWhen> + </command> + </menuContribution> + </extension> + <extension + point="org.eclipse.papyrus.infra.gmfdiag.dnd.dropStrategy"> + <strategy + strategy="org.eclipse.papyrus.uml.diagram.interactionoverview.edit.commands.CallBehaviorActionToInteractionDropStrategy"> + </strategy> + </extension> + <!-- Insert custom extensions here. --> + + <!-- // End of user code --> +<extension point="org.eclipse.papyrus.infra.gmfdiag.common.notationTypesMapping"> + <diagramMappings diagramID="PapyrusUMLInteractionOverviewDiagram"> + <mapping type="PapyrusUMLInteractionOverviewDiagram" humanReadableType="InteractionOverviewDiagram"/> + <!-- Compartments --> + + <!-- Link labels --> + </diagramMappings> +</extension> + +<extension + point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> + <diagramReconciler + diagramType="PapyrusUMLInteractionOverviewDiagram" + reconcilerClass="org.eclipse.papyrus.uml.diagram.activity.migration.ActivityReconciler_1_1_0" + source="1.0.0" + target="1.3.0"> + </diagramReconciler> + <diagramReconciler + diagramType="PapyrusUMLInteractionOverviewDiagram" + reconcilerClass="org.eclipse.papyrus.uml.diagram.interactionoverview.migration.InteractionOverviewReconciler_1_2_0" + source="1.1.0" + target="1.3.0"> + </diagramReconciler> +</extension> + + <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> + <?gmfgen generated="true"?> + <visualTypeProvider + class="org.eclipse.papyrus.uml.diagram.interactionoverview.provider.UMLVisualTypeProvider" + diagramType="PapyrusUMLInteractionOverviewDiagram"> + </visualTypeProvider> + </extension> +</plugin> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/policy/DiagramSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/policy/DiagramSemanticEditPolicy.java index f412f123a9f..8d77aebb030 100755..100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/policy/DiagramSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.interactionoverview/src-gen/org/eclipse/papyrus/uml/diagram/interactionoverview/edit/policy/DiagramSemanticEditPolicy.java @@ -1,43 +1,43 @@ -/*****************************************************************************
- * Copyright (c) 2013 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
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.interactionoverview.edit.policy;
-
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gef.commands.UnexecutableCommand;
-import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes;
-import org.eclipse.papyrus.uml.diagram.interactionoverview.provider.ElementTypes;
-// Start of user code custom imports
-// End of user code
-
-public class DiagramSemanticEditPolicy extends SemanticEditPolicy {
-
- protected Command getCreateCommand(final CreateElementRequest req) {
-
- final IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(UMLElementTypes.Package_ActivityDiagram);
- if (commandService == null) {
- return UnexecutableCommand.INSTANCE;
- }
-
- // Start of user code custom creation commands
- // End of user code
-
- if (ElementTypes.ACTIVITY == req.getElementType()) {
- final CreateElementRequest createRequest = new CreateElementRequest(req.getContainer(), UMLElementTypes.Activity_Shape);
- return new ICommandProxy(commandService.getEditCommand(createRequest));
- }
- return UnexecutableCommand.INSTANCE;
- }
-}
+/***************************************************************************** + * Copyright (c) 2013 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 + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.interactionoverview.edit.policy; + +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.interactionoverview.provider.ElementTypes; +// Start of user code custom imports +// End of user code + +public class DiagramSemanticEditPolicy extends SemanticEditPolicy { + + protected Command getCreateCommand(final CreateElementRequest req) { + + final IElementEditService commandService = ElementEditServiceUtils.getCommandProvider(UMLElementTypes.Package_ActivityDiagram, req.getClientContext()); + if (commandService == null) { + return UnexecutableCommand.INSTANCE; + } + + // Start of user code custom creation commands + // End of user code + + if (ElementTypes.ACTIVITY == req.getElementType()) { + final CreateElementRequest createRequest = new CreateElementRequest(req.getContainer(), UMLElementTypes.Activity_Shape); + return new ICommandProxy(commandService.getEditCommand(createRequest)); + } + return UnexecutableCommand.INSTANCE; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/CreateProfileModelCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/CreateProfileModelCommand.java index 6ea452c1d7b..48de978b291 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/CreateProfileModelCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/custom-src/org/eclipse/papyrus/uml/diagram/profile/CreateProfileModelCommand.java @@ -1,59 +1,57 @@ -/*****************************************************************************
- * Copyright (c) 2010 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:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.profile;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.papyrus.uml.diagram.common.commands.ModelCreationCommandBase;
-import org.eclipse.uml2.uml.UMLFactory;
-
-
-/**
- * The Class CreateProfileModelCommand.
- */
-public class CreateProfileModelCommand extends ModelCreationCommandBase {
-
- public static final String COMMAND_ID = "profile";
-
- /**
- * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#createRootElement()
- *
- * @return
- */
-
- @Override
- protected EObject createRootElement() {
- return UMLFactory.eINSTANCE.createProfile();
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#initializeModel(org.eclipse.emf.ecore.EObject)
- *
- * @param owner
- */
-
- @Override
- protected void initializeModel(EObject owner) {
- super.initializeModel(owner);
- ((org.eclipse.uml2.uml.Package) owner).setName(getModelName());
- }
-
- /**
- * Gets the model name.
- *
- * @return the model name
- */
- protected String getModelName() {
- return "profile"; //$NON-NLS-1$
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 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: + * Tatiana Fesenko (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.profile; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.papyrus.uml.diagram.common.commands.ModelCreationCommandBase; +import org.eclipse.uml2.uml.UMLFactory; + + +/** + * The Class CreateProfileModelCommand. + */ +public class CreateProfileModelCommand extends ModelCreationCommandBase { + + /** + * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#createRootElement() + * + * @return + */ + + @Override + protected EObject createRootElement() { + return UMLFactory.eINSTANCE.createProfile(); + } + + /** + * @see org.eclipse.papyrus.infra.core.extension.commands.ModelCreationCommandBase#initializeModel(org.eclipse.emf.ecore.EObject) + * + * @param owner + */ + + @Override + protected void initializeModel(EObject owner) { + super.initializeModel(owner); + ((org.eclipse.uml2.uml.Package) owner).setName(getModelName()); + } + + /** + * Gets the model name. + * + * @return the model name + */ + protected String getModelName() { + return "profile"; //$NON-NLS-1$ + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.configuration deleted file mode 100644 index 154f3ca79de..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/model/profilediagram.configuration +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmlns:constraints="http://www.eclipse.org/papyrus/constraints/0.9" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_UekVgHDwEeWh-MssWmCB_A" implementationID="PapyrusUMLProfileDiagram">
- <modelRules xmi:id="_UekVgXDwEeWh-MssWmCB_A">
- <constraints xsi:type="constraints:SimpleConstraint" xmi:id="_UekVgnDwEeWh-MssWmCB_A" name="IsContainedByProfile">
- <constraintType href="platform:/plugin/org.eclipse.papyrus.infra.constraints/Model/ConstraintEnvironment.xmi#//@constraintTypes.4"/>
- <properties xsi:type="constraints:ValueProperty" xmi:id="_UekVg3DwEeWh-MssWmCB_A" name="className" value="org.eclipse.papyrus.infra.viewpoints.policy.query.IsContainedByProfileQuery"/>
- </constraints>
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </modelRules>
- <owningRules xmi:id="_UekVhHDwEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <owningRules xmi:id="_UekVhXDwEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Profile"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb5NxhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_UekVhnDwEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml index 8a891dcfe9d..859b4a18895 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/plugin.xml @@ -15,14 +15,6 @@ --> <plugin> - <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/profilediagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - <extension point="org.eclipse.ui.contexts" id="ui-context"> <?gmfgen generated="true"?> <context @@ -692,18 +684,6 @@ </command> </extension> -<extension - point="org.eclipse.papyrus.infra.ui.papyrusDiagram"> - <diagramCategory - class="org.eclipse.papyrus.uml.diagram.profile.CreateProfileModelCommand" - description="Profile diagram" - extensionPrefix="profile" - icon="icons/wizban/category_profile.gif" - id="profile" - label="Profile"> - </diagramCategory> -</extension> - <extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders" id="parser-provider"> <?gmfgen generated="true"?> <ParserProvider class="org.eclipse.papyrus.uml.diagram.profile.providers.UMLParserProvider"> @@ -948,7 +928,7 @@ diagramType="PapyrusUMLProfileDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.profile.custom.migration.ProfileReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src-gen/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassPropertyCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src-gen/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassPropertyCreateCommand.java index aca088e7930..01042d3f895 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src-gen/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassPropertyCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.profile/src-gen/org/eclipse/papyrus/uml/diagram/profile/edit/commands/ClassPropertyCreateCommand.java @@ -1,127 +1,127 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.profile.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.profile.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Property;
-import org.eclipse.uml2.uml.StructuredClassifier;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ClassPropertyCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public ClassPropertyCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Property newElement = UMLFactory.eINSTANCE.createProperty();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- StructuredClassifier qualifiedTarget = (StructuredClassifier) target;
- qualifiedTarget.getOwnedAttributes()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
- ElementInitializers.getInstance().init_Property_ClassAttributeLabel(newElement);
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Property newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.profile.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.profile.providers.ElementInitializers; +import org.eclipse.uml2.uml.Property; +import org.eclipse.uml2.uml.StructuredClassifier; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ClassPropertyCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ClassPropertyCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getProperty()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Property newElement = UMLFactory.eINSTANCE.createProperty(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + StructuredClassifier qualifiedTarget = (StructuredClassifier) target; + qualifiedTarget.getOwnedAttributes() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + ElementInitializers.getInstance().init_Property_ClassAttributeLabel(newElement); + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Property newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/build.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/build.properties index eaf6940f889..e20fc25145c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/build.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/build.properties @@ -9,7 +9,6 @@ bin.includes = META-INF/,\ plugin.xml,\ about.html,\ custom-messages.properties,\ - model/sequenceDiagram.configuration,\ model/sequencediagram-uml.elementtypesconfigurations,\ model/sequencediagram.elementtypesconfigurations output..=bin/ diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/migration/SequenceReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/migration/SequenceReconcilerForCompartment_1_2_0.java index b392cc05ff2..043417932f5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/migration/SequenceReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/custom-src/org/eclipse/papyrus/uml/diagram/sequence/migration/SequenceReconcilerForCompartment_1_2_0.java @@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class SequenceReconcilerForCompartment extends ReconcilerForCompartment { +public class SequenceReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String InteractionInteractionCompartmentEditPart_VISUAL_ID = "7001"; private static final String CombinedFragmentCombinedFragmentCompartmentEditPart_VISUAL_ID = "7004"; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.configuration deleted file mode 100644 index 2322f2f4a16..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/model/sequenceDiagram.configuration +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_TR15IHDvEeWh-MssWmCB_A" implementationID="PapyrusUMLSequenceDiagram">
- <modelRules xmi:id="_TR15IXDvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interaction"/>
- </modelRules>
- <owningRules xmi:id="_TR15InDvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interaction"/>
- </owningRules>
- <owningRules xmi:id="_TR15I3DvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/>
- <newModelPath xmi:id="_TR15JHDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_TR15JXDvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/>
- <newModelPath xmi:id="_TR15JnDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_TR15J3DvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- <newModelPath xmi:id="_TR15KHDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/>
- </newModelPath>
- </owningRules>
- <owningRules xmi:id="_TR15KXDvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//UseCase"/>
- <newModelPath xmi:id="_TR15KnDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.Interaction">
- <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/>
- </newModelPath>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_TR15K3DvEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml index b1c9e0a9ba7..1b1404602c0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/plugin.xml @@ -14,15 +14,6 @@ --> <plugin> - <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/sequenceDiagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - - <extension point="org.eclipse.ui.contexts" id="ui-context"> <?gmfgen generated="true"?> <context @@ -1436,21 +1427,21 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="PapyrusUMLSequenceDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.sequence.migration.SequenceReconcilerForCompartment" - source="undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.sequence.migration.SequenceReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLSequenceDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.sequence.migration.SequenceReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLSequenceDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.sequence.migration.SequenceDiagramLunaToMarsReconciler" source="1.0.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> @@ -1470,13 +1461,6 @@ path="model/sequencediagram.elementtypesconfigurations"> </elementTypeSet> </extension> -<extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/sequencediagram-uml.elementtypesconfigurations"> - </elementTypeSet> -</extension> <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes" id="element-types"> <?gmfgen generated="true"?> <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ActionExecutionSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ActionExecutionSpecificationCreateCommand.java index 6e3d7062210..be36f1672f2 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ActionExecutionSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ActionExecutionSpecificationCreateCommand.java @@ -1,141 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.ActionExecutionSpecification;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ActionExecutionSpecificationCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public ActionExecutionSpecificationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static ActionExecutionSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new ActionExecutionSpecificationCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public ActionExecutionSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionExecutionSpecification());
- return data.isPermitted();
- }
-
- /**
- * To add the lifeline to the attribute covered of the AES
- *
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- ActionExecutionSpecification newElement = UMLFactory.eINSTANCE.createActionExecutionSpecification();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getFragments().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(ActionExecutionSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.ActionExecutionSpecification; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ActionExecutionSpecificationCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public ActionExecutionSpecificationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static ActionExecutionSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new ActionExecutionSpecificationCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public ActionExecutionSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionExecutionSpecification()); + return data.isPermitted(); + } + + /** + * To add the lifeline to the attribute covered of the AES + * + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ActionExecutionSpecification newElement = UMLFactory.eINSTANCE.createActionExecutionSpecification(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getFragments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ActionExecutionSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java index dd0fb407d06..ec0002963da 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/BehaviorExecutionSpecificationCreateCommand.java @@ -1,141 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.BehaviorExecutionSpecification;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class BehaviorExecutionSpecificationCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public BehaviorExecutionSpecificationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static BehaviorExecutionSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new BehaviorExecutionSpecificationCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public BehaviorExecutionSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getBehaviorExecutionSpecification());
- return data.isPermitted();
- }
-
- /**
- * To add the lifeline to the attribute covered of the AES
- *
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- BehaviorExecutionSpecification newElement = UMLFactory.eINSTANCE.createBehaviorExecutionSpecification();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getFragments().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(BehaviorExecutionSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.BehaviorExecutionSpecification; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class BehaviorExecutionSpecificationCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public BehaviorExecutionSpecificationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static BehaviorExecutionSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new BehaviorExecutionSpecificationCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public BehaviorExecutionSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getBehaviorExecutionSpecification()); + return data.isPermitted(); + } + + /** + * To add the lifeline to the attribute covered of the AES + * + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + BehaviorExecutionSpecification newElement = UMLFactory.eINSTANCE.createBehaviorExecutionSpecification(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getFragments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(BehaviorExecutionSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragment2CreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragment2CreateCommand.java index 0189cde6749..9bed99d049f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragment2CreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragment2CreateCommand.java @@ -1,145 +1,145 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class CombinedFragment2CreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public CombinedFragment2CreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static CombinedFragment2CreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new CombinedFragment2CreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public CombinedFragment2CreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCombinedFragment());
- return data.isPermitted();
- }
-
- /**
- * Create a CoRegion :
- * - creates two operands
- * - set the Interaction Operator to parallel
- *
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- CombinedFragment newElement = UMLFactory.eINSTANCE.createCombinedFragment();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getFragments().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_CombinedFragment_CoRegionShape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(CombinedFragment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.CombinedFragment; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class CombinedFragment2CreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public CombinedFragment2CreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static CombinedFragment2CreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new CombinedFragment2CreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public CombinedFragment2CreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCombinedFragment()); + return data.isPermitted(); + } + + /** + * Create a CoRegion : + * - creates two operands + * - set the Interaction Operator to parallel + * + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + CombinedFragment newElement = UMLFactory.eINSTANCE.createCombinedFragment(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getFragments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_CombinedFragment_CoRegionShape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(CombinedFragment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java index 3bce792cf24..a41f8c5730f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CombinedFragmentCreateCommand.java @@ -1,146 +1,146 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class CombinedFragmentCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public CombinedFragmentCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static CombinedFragmentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new CombinedFragmentCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public CombinedFragmentCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * The creation command can only be executed if the elementToEdit (i.e the container) is an Interaction or an InteractionOperand
- *
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCombinedFragment());
- return data.isPermitted();
- }
-
- /**
- * Handle creation on InteractionOperand
- *
- * @generated
- */
- @Override
- @SuppressWarnings("unchecked")
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- CombinedFragment newElement = UMLFactory.eINSTANCE.createCombinedFragment();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getFragments().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_CombinedFragment_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(CombinedFragment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.CombinedFragment; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class CombinedFragmentCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public CombinedFragmentCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static CombinedFragmentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new CombinedFragmentCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public CombinedFragmentCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * The creation command can only be executed if the elementToEdit (i.e the container) is an Interaction or an InteractionOperand + * + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getCombinedFragment()); + return data.isPermitted(); + } + + /** + * Handle creation on InteractionOperand + * + * @generated + */ + @Override + @SuppressWarnings("unchecked") + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + CombinedFragment newElement = UMLFactory.eINSTANCE.createCombinedFragment(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getFragments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_CombinedFragment_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(CombinedFragment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentCreateCommand.java index a8335a3a056..d994f4bf0cb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/CommentCreateCommand.java @@ -1,141 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Comment;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class CommentCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public CommentCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static CommentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new CommentCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public CommentCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment());
- return data.isPermitted();
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Comment newElement = UMLFactory.eINSTANCE.createComment();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Element qualifiedTarget = (Element) target;
- qualifiedTarget.getOwnedComments().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_Comment_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Comment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.Comment; +import org.eclipse.uml2.uml.Element; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class CommentCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public CommentCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static CommentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new CommentCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public CommentCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getComment()); + return data.isPermitted(); + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + Comment newElement = UMLFactory.eINSTANCE.createComment(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Element qualifiedTarget = (Element) target; + qualifiedTarget.getOwnedComments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_Comment_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Comment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConsiderIgnoreFragmentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConsiderIgnoreFragmentCreateCommand.java index c752d6b19f2..fb016e80183 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConsiderIgnoreFragmentCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConsiderIgnoreFragmentCreateCommand.java @@ -1,146 +1,146 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.ConsiderIgnoreFragment;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ConsiderIgnoreFragmentCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public ConsiderIgnoreFragmentCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static ConsiderIgnoreFragmentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new ConsiderIgnoreFragmentCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public ConsiderIgnoreFragmentCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * The creation command can only be executed if the elementToEdit (i.e the container) is an Interaction or an InteractionOperand
- *
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConsiderIgnoreFragment());
- return data.isPermitted();
- }
-
- /**
- * Handle creation on InteractionOperand
- *
- * @generated
- */
- @Override
- @SuppressWarnings("unchecked")
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- ConsiderIgnoreFragment newElement = UMLFactory.eINSTANCE.createConsiderIgnoreFragment();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getFragments().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_ConsiderIgnoreFragment_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(ConsiderIgnoreFragment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.ConsiderIgnoreFragment; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ConsiderIgnoreFragmentCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public ConsiderIgnoreFragmentCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static ConsiderIgnoreFragmentCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new ConsiderIgnoreFragmentCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public ConsiderIgnoreFragmentCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * The creation command can only be executed if the elementToEdit (i.e the container) is an Interaction or an InteractionOperand + * + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConsiderIgnoreFragment()); + return data.isPermitted(); + } + + /** + * Handle creation on InteractionOperand + * + * @generated + */ + @Override + @SuppressWarnings("unchecked") + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ConsiderIgnoreFragment newElement = UMLFactory.eINSTANCE.createConsiderIgnoreFragment(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getFragments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ConsiderIgnoreFragment_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ConsiderIgnoreFragment newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintCreateCommand.java index 9d5bce04d81..cb5b3ee0c9e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ConstraintCreateCommand.java @@ -1,141 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Constraint;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ConstraintCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public ConstraintCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static ConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new ConstraintCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public ConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint());
- return data.isPermitted();
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Constraint newElement = UMLFactory.eINSTANCE.createConstraint();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Namespace qualifiedTarget = (Namespace) target;
- qualifiedTarget.getOwnedRules().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_Constraint_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Constraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.Constraint; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ConstraintCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public ConstraintCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static ConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new ConstraintCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public ConstraintCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getConstraint()); + return data.isPermitted(); + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + Constraint newElement = UMLFactory.eINSTANCE.createConstraint(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Namespace qualifiedTarget = (Namespace) target; + qualifiedTarget.getOwnedRules().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_Constraint_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Constraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ContinuationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ContinuationCreateCommand.java index 60cee3f4707..4053962cd72 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ContinuationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/ContinuationCreateCommand.java @@ -1,143 +1,143 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Continuation;
-import org.eclipse.uml2.uml.InteractionOperand;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class ContinuationCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public ContinuationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static ContinuationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new ContinuationCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public ContinuationCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getContinuation());
- return data.isPermitted();
- }
-
- /**
- * Generated not to handle the constraint on covered lifelines.
- *
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Continuation newElement = UMLFactory.eINSTANCE.createContinuation();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- InteractionOperand qualifiedTarget = (InteractionOperand) target;
- qualifiedTarget.getFragments().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_Continuation_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Continuation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.Continuation; +import org.eclipse.uml2.uml.InteractionOperand; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ContinuationCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public ContinuationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static ContinuationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new ContinuationCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public ContinuationCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getContinuation()); + return data.isPermitted(); + } + + /** + * Generated not to handle the constraint on covered lifelines. + * + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + Continuation newElement = UMLFactory.eINSTANCE.createContinuation(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + InteractionOperand qualifiedTarget = (InteractionOperand) target; + qualifiedTarget.getFragments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_Continuation_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Continuation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DestructionOccurrenceSpecificationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DestructionOccurrenceSpecificationCreateCommand.java index 6020044a1ba..1a4c9fbe0ff 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DestructionOccurrenceSpecificationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DestructionOccurrenceSpecificationCreateCommand.java @@ -1,130 +1,130 @@ -package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DestructionOccurrenceSpecificationCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public DestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static DestructionOccurrenceSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new DestructionOccurrenceSpecificationCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public DestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * A DestructionEvent on a lifeline can only be created if it doesn't exist yet a destructionEvent on that lifeline.
- *
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification());
- return data.isPermitted();
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- DestructionOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getFragments().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_DestructionOccurrenceSpecification_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(DestructionOccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.DestructionOccurrenceSpecification; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class DestructionOccurrenceSpecificationCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public DestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static DestructionOccurrenceSpecificationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new DestructionOccurrenceSpecificationCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public DestructionOccurrenceSpecificationCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * A DestructionEvent on a lifeline can only be created if it doesn't exist yet a destructionEvent on that lifeline. + * + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification()); + return data.isPermitted(); + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + DestructionOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getFragments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_DestructionOccurrenceSpecification_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(DestructionOccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintCreateCommand.java index a3f0eac504a..b390b7e9512 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintCreateCommand.java @@ -1,141 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DurationConstraintCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public DurationConstraintCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static DurationConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new DurationConstraintCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public DurationConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint());
- return data.isPermitted();
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Namespace qualifiedTarget = (Namespace) target;
- qualifiedTarget.getOwnedRules().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_DurationConstraint_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(DurationConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.DurationConstraint; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class DurationConstraintCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public DurationConstraintCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static DurationConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new DurationConstraintCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public DurationConstraintCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint()); + return data.isPermitted(); + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Namespace qualifiedTarget = (Namespace) target; + qualifiedTarget.getOwnedRules().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_DurationConstraint_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(DurationConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintInMessageCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintInMessageCreateCommand.java index 2211e50d0c3..fe025f99ee7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintInMessageCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationConstraintInMessageCreateCommand.java @@ -1,141 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DurationConstraintInMessageCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public DurationConstraintInMessageCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static DurationConstraintInMessageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new DurationConstraintInMessageCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public DurationConstraintInMessageCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint());
- return data.isPermitted();
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Namespace qualifiedTarget = (Namespace) target;
- qualifiedTarget.getOwnedRules().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_DurationConstraint_Shape_CN(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(DurationConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.DurationConstraint; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class DurationConstraintInMessageCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public DurationConstraintInMessageCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static DurationConstraintInMessageCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new DurationConstraintInMessageCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public DurationConstraintInMessageCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint()); + return data.isPermitted(); + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Namespace qualifiedTarget = (Namespace) target; + qualifiedTarget.getOwnedRules().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_DurationConstraint_Shape_CN(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(DurationConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationObservationCreateCommand.java index 242cb05d010..57393a8f312 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/DurationObservationCreateCommand.java @@ -1,141 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DurationObservationCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public DurationObservationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static DurationObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new DurationObservationCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public DurationObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation());
- return data.isPermitted();
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_DurationObservation_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(DurationObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.DurationObservation; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class DurationObservationCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public DurationObservationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static DurationObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new DurationObservationCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public DurationObservationCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation()); + return data.isPermitted(); + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_DurationObservation_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(DurationObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionCreateCommand.java index 664aea72e32..2b4c7fa455b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionCreateCommand.java @@ -1,141 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class InteractionCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public InteractionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static InteractionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new InteractionCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public InteractionCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction());
- return data.isPermitted();
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_Interaction_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Interaction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class InteractionCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public InteractionCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static InteractionCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new InteractionCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public InteractionCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction()); + return data.isPermitted(); + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + Interaction newElement = UMLFactory.eINSTANCE.createInteraction(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_Interaction_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Interaction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionOperandCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionOperandCreateCommand.java index 1d89779f94e..5d6785f41da 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionOperandCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionOperandCreateCommand.java @@ -1,142 +1,142 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.CombinedFragment;
-import org.eclipse.uml2.uml.InteractionOperand;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class InteractionOperandCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public InteractionOperandCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static InteractionOperandCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new InteractionOperandCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public InteractionOperandCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteractionOperand());
- return data.isPermitted();
- }
-
- /**
- * Generated not for add combined fragment's covered lifelines on interaction operand
- *
- * @generated
- */
- @Override
- @SuppressWarnings({ "unchecked" })
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- InteractionOperand newElement = UMLFactory.eINSTANCE.createInteractionOperand();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- CombinedFragment qualifiedTarget = (CombinedFragment) target;
- qualifiedTarget.getOperands().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(InteractionOperand newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.CombinedFragment; +import org.eclipse.uml2.uml.InteractionOperand; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class InteractionOperandCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public InteractionOperandCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static InteractionOperandCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new InteractionOperandCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public InteractionOperandCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteractionOperand()); + return data.isPermitted(); + } + + /** + * Generated not for add combined fragment's covered lifelines on interaction operand + * + * @generated + */ + @Override + @SuppressWarnings({ "unchecked" }) + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + InteractionOperand newElement = UMLFactory.eINSTANCE.createInteractionOperand(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + CombinedFragment qualifiedTarget = (CombinedFragment) target; + qualifiedTarget.getOperands().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(InteractionOperand newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionUseCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionUseCreateCommand.java index f7a3e979b60..cac5d8b2d00 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionUseCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/InteractionUseCreateCommand.java @@ -1,145 +1,145 @@ -/*****************************************************************************
- * Copyright (c) 2009 Atos Origin.
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.InteractionUse;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class InteractionUseCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public InteractionUseCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static InteractionUseCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new InteractionUseCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public InteractionUseCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * The creation command can only be executed if the elementToEdit (i.e the container) is an Interaction or an InteractionOperand
- *
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteractionUse());
- return data.isPermitted();
- }
-
- /**
- * Handle creation on InteractionOperand
- *
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- InteractionUse newElement = UMLFactory.eINSTANCE.createInteractionUse();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getFragments().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_InteractionUse_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(InteractionUse newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 Atos Origin. + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.InteractionUse; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class InteractionUseCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public InteractionUseCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static InteractionUseCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new InteractionUseCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public InteractionUseCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * The creation command can only be executed if the elementToEdit (i.e the container) is an Interaction or an InteractionOperand + * + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteractionUse()); + return data.isPermitted(); + } + + /** + * Handle creation on InteractionOperand + * + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + InteractionUse newElement = UMLFactory.eINSTANCE.createInteractionUse(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getFragments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_InteractionUse_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(InteractionUse newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/LifelineCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/LifelineCreateCommand.java index 4036574d088..f7323008a42 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/LifelineCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/LifelineCreateCommand.java @@ -1,145 +1,145 @@ -/*****************************************************************************
- * Copyright (c) 2009 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class LifelineCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public LifelineCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static LifelineCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new LifelineCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public LifelineCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * Add generated NOT to constrain the creation of a lifeline
- *
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
- return data.isPermitted();
- }
-
- /**
- * Generated not for add lifelines on lifeline
- *
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getLifelines().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_Lifeline_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2009 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class LifelineCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public LifelineCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static LifelineCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new LifelineCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public LifelineCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * Add generated NOT to constrain the creation of a lifeline + * + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline()); + return data.isPermitted(); + } + + /** + * Generated not for add lifelines on lifeline + * + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + Lifeline newElement = UMLFactory.eINSTANCE.createLifeline(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getLifelines().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_Lifeline_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/StateInvariantCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/StateInvariantCreateCommand.java index b68dc1fb0d8..ff05ad2b6ed 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/StateInvariantCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/StateInvariantCreateCommand.java @@ -1,143 +1,143 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class StateInvariantCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public StateInvariantCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static StateInvariantCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new StateInvariantCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public StateInvariantCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateInvariant());
- return data.isPermitted();
- }
-
- /**
- * The StateInvariant is created on the lifeline and not on its container
- *
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getFragments().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_StateInvariant_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(StateInvariant newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.StateInvariant; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class StateInvariantCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public StateInvariantCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static StateInvariantCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new StateInvariantCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public StateInvariantCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateInvariant()); + return data.isPermitted(); + } + + /** + * The StateInvariant is created on the lifeline and not on its container + * + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getFragments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_StateInvariant_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(StateInvariant newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeConstraintCreateCommand.java index ee614b29441..e0fb7510bcf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeConstraintCreateCommand.java @@ -1,141 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.TimeConstraint;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class TimeConstraintCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public TimeConstraintCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static TimeConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new TimeConstraintCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public TimeConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeConstraint());
- return data.isPermitted();
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Namespace qualifiedTarget = (Namespace) target;
- qualifiedTarget.getOwnedRules().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_TimeConstraint_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(TimeConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.TimeConstraint; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class TimeConstraintCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public TimeConstraintCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static TimeConstraintCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new TimeConstraintCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public TimeConstraintCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeConstraint()); + return data.isPermitted(); + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Namespace qualifiedTarget = (Namespace) target; + qualifiedTarget.getOwnedRules().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_TimeConstraint_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(TimeConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeObservationCreateCommand.java index a653b6911a3..a377a6ccf29 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.sequence/src-gen/org/eclipse/papyrus/uml/diagram/sequence/edit/commands/TimeObservationCreateCommand.java @@ -1,141 +1,141 @@ -/*****************************************************************************
- * Copyright (c) 2010 CEA
- *
- *
- * 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:
- * Atos Origin - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.sequence.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.TimeObservation;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class TimeObservationCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- private EObject eObject = null;
-
- /**
- * @generated
- */
- public TimeObservationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.eObject = eObject;
- this.diagram = diagram;
- }
-
- /**
- * @generated
- */
- public static TimeObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) {
- return new TimeObservationCreateCommand(req, eObject, diagram);
- }
-
- /**
- * @generated
- */
- public TimeObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- if (container != null) {
- return container;
- }
- return eObject;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation());
- return data.isPermitted();
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements().add(newElement);
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
- ElementInitializers.getInstance().init_TimeObservation_Shape(newElement);
- doConfigure(newElement, monitor, info);
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(TimeObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/***************************************************************************** + * Copyright (c) 2010 CEA + * + * + * 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: + * Atos Origin - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.sequence.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.sequence.providers.ElementInitializers; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.TimeObservation; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class TimeObservationCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + private EObject eObject = null; + + /** + * @generated + */ + public TimeObservationCreateCommand(CreateElementRequest req, EObject eObject, Diagram diagram) { + super(req.getLabel(), null, req); + this.eObject = eObject; + this.diagram = diagram; + } + + /** + * @generated + */ + public static TimeObservationCreateCommand create(CreateElementRequest req, EObject eObject, Diagram diagram) { + return new TimeObservationCreateCommand(req, eObject, diagram); + } + + /** + * @generated + */ + public TimeObservationCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + if (container != null) { + return container; + } + return eObject; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation()); + return data.isPermitted(); + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_TimeObservation_Shape(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(TimeObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/CreateStateMachineDiagramCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/CreateStateMachineDiagramCommand.java index 689ddf4e220..8c7ae73eb84 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/CreateStateMachineDiagramCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/CreateStateMachineDiagramCommand.java @@ -27,8 +27,8 @@ import org.eclipse.gmf.runtime.notation.Diagram; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.NotationFactory; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramPrototype; import org.eclipse.papyrus.infra.gmfdiag.common.utils.DiagramUtils; -import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; import org.eclipse.papyrus.uml.diagram.common.commands.CreateBehavioredClassifierDiagramCommand; import org.eclipse.papyrus.uml.diagram.common.commands.SemanticAdapter; import org.eclipse.papyrus.uml.diagram.statemachine.custom.helpers.Zone; @@ -104,7 +104,7 @@ public class CreateStateMachineDiagramCommand extends CreateBehavioredClassifier * @return */ @Override - protected Diagram doCreateDiagram(Resource diagramResource, EObject owner, EObject element, ViewPrototype prototype, String name) { + protected Diagram doCreateDiagram(Resource diagramResource, EObject owner, EObject element, DiagramPrototype prototype, String name) { Diagram diagram = super.doCreateDiagram(diagramResource, owner, element, prototype, name); if (diagram == null) { if (element instanceof State) { @@ -115,9 +115,7 @@ public class CreateStateMachineDiagramCommand extends CreateBehavioredClassifier setName(name); diagram.setElement(element); DiagramUtils.setOwner(diagram, owner); - if (!prototype.isNatural()) { - DiagramUtils.setPrototype(diagram, prototype); - } + DiagramUtils.setPrototype(diagram, prototype); initializeModel(element); initializeDiagram(diagram); diagramResource.getContents().add(diagram); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/migration/StateMachineReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/migration/StateMachineReconcilerForCompartment_1_2_0.java index 3b8a294c8e4..eccfa0c3846 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/migration/StateMachineReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/migration/StateMachineReconcilerForCompartment_1_2_0.java @@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class StateMachineReconcilerForCompartment extends ReconcilerForCompartment { +public class StateMachineReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String RegionCompartmentEditPart_VISUAL_ID = "3002"; private static final String StateMachineCompartmentEditPart_VISUAL_ID = "2002"; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.configuration deleted file mode 100644 index 66dd0dbe7cd..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/model/stateMachineDiagram.configuration +++ /dev/null @@ -1,47 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg"> - <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint"> - <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_PwD0cHDvEeWh-MssWmCB_A" implementationID="PapyrusUMLStateMachineDiagram"> - <modelRules xmi:id="_PwD0cXDvEeWh-MssWmCB_A"> - <element href="http://www.eclipse.org/uml2/5.0.0/UML#//StateMachine"/> - </modelRules> - <modelRules xmi:id="_H-oCgB0UEea_bcpknMJ7-w"> - <element href="http://www.eclipse.org/uml2/5.0.0/UML#//State"/> - </modelRules> - <owningRules xmi:id="_PwD0cnDvEeWh-MssWmCB_A"> - <element href="http://www.eclipse.org/uml2/5.0.0/UML#//StateMachine"/> - </owningRules> - <owningRules xmi:id="_PwD0c3DvEeWh-MssWmCB_A"> - <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> - <newModelPath xmi:id="_PwD0dHDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.StateMachine"> - <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/classifierBehavior"/> - </newModelPath> - </owningRules> - <owningRules xmi:id="_PwD0dXDvEeWh-MssWmCB_A"> - <element href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier"/> - <newModelPath xmi:id="_PwD0dnDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.StateMachine"> - <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//BehavioredClassifier/ownedBehavior"/> - </newModelPath> - </owningRules> - <owningRules xmi:id="_PwD0d3DvEeWh-MssWmCB_A"> - <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> - <newModelPath xmi:id="_PwD0eHDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.StateMachine"> - <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Package/packagedElement"/> - </newModelPath> - </owningRules> - <owningRules xmi:id="_PwD0eXDvEeWh-MssWmCB_A"> - <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Interface"/> - <newModelPath xmi:id="_PwD0enDvEeWh-MssWmCB_A" creationType="org.eclipse.papyrus.uml.ProtocolStateMachine"> - <feature href="http://www.eclipse.org/uml2/5.0.0/UML#//Interface/protocol"/> - </newModelPath> - </owningRules> - <owningRules xmi:id="_5kmMcB0UEea_bcpknMJ7-w"> - <element href="http://www.eclipse.org/uml2/5.0.0/UML#//State"/> - </owningRules> - <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/> - <childRules xmi:id="_PwD0e3DvEeWh-MssWmCB_A"/> - </modelKinds> - </viewpoints> - <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/> - <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/> -</configuration:PapyrusConfiguration> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml index 7307cc90b99..3ab6cfa9503 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml @@ -15,14 +15,6 @@ --> <plugin> - <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/stateMachineDiagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - <extension point="org.eclipse.gmf.runtime.common.ui.services.markerNavigationProviders" id="markers-navigation"> <?gmfgen generated="true"?> <MarkerNavigationProvider class="org.eclipse.papyrus.uml.diagram.statemachine.providers.UMLMarkerNavigationProvider"> @@ -792,13 +784,6 @@ <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/stateMachineDiagram.elementtypesconfigurations"> - </elementTypeSet> -</extension> -<extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders"> <ParserProvider class="org.eclipse.papyrus.uml.diagram.statemachine.custom.providers.CustomUMLParserProvider"> @@ -811,15 +796,15 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="PapyrusUMLStateMachineDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.statemachine.custom.migration.StateMachineReconcilerForCompartment" - source="undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.statemachine.custom.migration.StateMachineReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLStateMachineDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.statemachine.custom.migration.StateMachineReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml index 6230fb968ea..d4e504812d3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/plugin.xml @@ -25,12 +25,4 @@ </editpartProvider> </extension> - <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/stereotype-edit.elementtypesconfigurations"> - </elementTypeSet> - </extension> - </plugin> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java index cb8b8aba4fc..0582b316b8e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.stereotype.edition/src/org/eclipse/papyrus/uml/diagram/stereotype/edition/provider/StereotypeDisplayMigrationEditPolicyProvider.java @@ -26,7 +26,7 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.core.services.ServiceException; import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart; import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart; -import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler; +import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeDisplayDiagramReconciler_1_2_0; import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.StereotypeMigrationHelper; import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationLabelMigrationEditPolicy; import org.eclipse.papyrus.uml.diagram.common.stereotype.migration.editpolicies.StereotypeEAnnotationNestedMigrationEditPolicy; @@ -36,7 +36,7 @@ import org.eclipse.papyrus.uml.tools.utils.UMLUtil; /** * @author Céline JANSSENS * - * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler} + * @deprecated Replaced by {@link StereotypeDisplayDiagramReconciler_1_2_0} */ @Deprecated public class StereotypeDisplayMigrationEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/migration/TimingReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/migration/TimingReconcilerForCompartment_1_2_0.java index 82caf7b5141..031fa565d6d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/migration/TimingReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/custom-src/org/eclipse/papyrus/uml/diagram/timing/custom/migration/TimingReconcilerForCompartment_1_2_0.java @@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class TimingReconcilerForCompartment extends ReconcilerForCompartment { +public class TimingReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String InteractionCompartmentEditPartTN_VISUAL_ID = "5"; private static final String FullLifelineStateDefinitionCompartmentEditPartCN_VISUAL_ID = "7"; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.configuration deleted file mode 100644 index b4dabe5abf1..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/model/timingdiagram.configuration +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_LzyMIHDvEeWh-MssWmCB_A" implementationID="PapyrusUMLTimingDiagram">
- <modelRules xmi:id="_LzyMIXDvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </modelRules>
- <owningRules xmi:id="_LzyMInDvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_LzyMI3DvEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml index 6a222b06415..f025d9981f5 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/plugin.xml @@ -14,14 +14,6 @@ --> <plugin> - <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="model/timingdiagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - <extension point="org.eclipse.ui.contexts" id="ui-context"> <?gmfgen generated="true"?> <context @@ -873,15 +865,15 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="PapyrusUMLTimingDiagram" - reconcilerClass="org.eclipse.papyrus.uml.diagram.timing.custom.migration.TimingReconcilerForCompartment" - source="undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.timing.custom.migration.TimingReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="PapyrusUMLTimingDiagram" reconcilerClass="org.eclipse.papyrus.uml.diagram.timing.custom.migration.TimingReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.common.visualTypeProviders"> @@ -891,17 +883,5 @@ diagramType="PapyrusUMLTimingDiagram"> </visualTypeProvider> </extension> - <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/timingdiagram-uml.elementtypesconfigurations"> - </elementTypeSet> - </extension> - - - - - </plugin> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java index bb06d49336f..33739b9e7f3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactLifelineCreateCommandCN.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class CompactLifelineCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public CompactLifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getLifelines()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class CompactLifelineCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public CompactLifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Lifeline newElement = UMLFactory.eINSTANCE.createLifeline(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getLifelines() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java index 6984313d4dc..36a055ff6f4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/CompactStateInvariantCreateCommandCN.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class CompactStateInvariantCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public CompactStateInvariantCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateInvariant());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getFragments()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(StateInvariant newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.StateInvariant; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class CompactStateInvariantCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public CompactStateInvariantCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateInvariant()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getFragments() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(StateInvariant newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java index 68f53be70d1..a9275903518 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DestructionOccurrenceSpecificationCreateCommandCN.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.DestructionOccurrenceSpecification;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DestructionOccurrenceSpecificationCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public DestructionOccurrenceSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- DestructionOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Lifeline qualifiedTarget = (Lifeline) target;
- qualifiedTarget.getCoveredBys()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(DestructionOccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.DestructionOccurrenceSpecification; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class DestructionOccurrenceSpecificationCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public DestructionOccurrenceSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDestructionOccurrenceSpecification()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + DestructionOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createDestructionOccurrenceSpecification(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Lifeline qualifiedTarget = (Lifeline) target; + qualifiedTarget.getCoveredBys() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(DestructionOccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java index e72b810cfa6..bbcdfa45b79 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationConstraintCreateCommandCN.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.DurationConstraint;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DurationConstraintCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public DurationConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Namespace qualifiedTarget = (Namespace) target;
- qualifiedTarget.getOwnedRules()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(DurationConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.DurationConstraint; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class DurationConstraintCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public DurationConstraintCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationConstraint()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + DurationConstraint newElement = UMLFactory.eINSTANCE.createDurationConstraint(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Namespace qualifiedTarget = (Namespace) target; + qualifiedTarget.getOwnedRules() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(DurationConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java index 5854ac184aa..c2fe44a0e4c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/DurationObservationCreateCommandCN.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.DurationObservation;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class DurationObservationCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public DurationObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(DurationObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.DurationObservation; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class DurationObservationCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public DurationObservationCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getDurationObservation()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + DurationObservation newElement = UMLFactory.eINSTANCE.createDurationObservation(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(DurationObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java index e6ad389e55e..95e6091d7c0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullLifelineCreateCommandCN.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class FullLifelineCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public FullLifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getLifelines()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class FullLifelineCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public FullLifelineCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Lifeline newElement = UMLFactory.eINSTANCE.createLifeline(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getLifelines() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java index 5fb4188b2ed..f0936287fde 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/FullStateInvariantCreateCommandCN.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.StateInvariant;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class FullStateInvariantCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public FullStateInvariantCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateInvariant());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Lifeline qualifiedTarget = (Lifeline) target;
- qualifiedTarget.getCoveredBys()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(StateInvariant newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.StateInvariant; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class FullStateInvariantCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public FullStateInvariantCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStateInvariant()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + StateInvariant newElement = UMLFactory.eINSTANCE.createStateInvariant(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Lifeline qualifiedTarget = (Lifeline) target; + qualifiedTarget.getCoveredBys() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(StateInvariant newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java index e2c32bf5148..c505ac08372 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GateCreateCommand.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Gate;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class GateCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public GateCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getGate());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Gate newElement = UMLFactory.eINSTANCE.createGate();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getFormalGates()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Gate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Gate; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class GateCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public GateCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getGate()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Gate newElement = UMLFactory.eINSTANCE.createGate(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getFormalGates() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Gate newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java index 96a94dc36b1..4657bcaf4b4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/GeneralOrderingCreateCommand.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.GeneralOrdering;
-import org.eclipse.uml2.uml.InteractionFragment;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class GeneralOrderingCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public GeneralOrderingCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getGeneralOrdering());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- GeneralOrdering newElement = UMLFactory.eINSTANCE.createGeneralOrdering();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- InteractionFragment qualifiedTarget = (InteractionFragment) target;
- qualifiedTarget.getGeneralOrderings()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(GeneralOrdering newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.GeneralOrdering; +import org.eclipse.uml2.uml.InteractionFragment; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class GeneralOrderingCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public GeneralOrderingCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getGeneralOrdering()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + GeneralOrdering newElement = UMLFactory.eINSTANCE.createGeneralOrdering(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + InteractionFragment qualifiedTarget = (InteractionFragment) target; + qualifiedTarget.getGeneralOrderings() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(GeneralOrdering newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java index bfbf2701915..1e1a90fb477 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/InteractionCreateCommandTN.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class InteractionCreateCommandTN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public InteractionCreateCommandTN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Interaction newElement = UMLFactory.eINSTANCE.createInteraction();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Interaction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class InteractionCreateCommandTN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public InteractionCreateCommandTN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInteraction()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Interaction newElement = UMLFactory.eINSTANCE.createInteraction(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Interaction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java index fbf09853ae3..98072166ca3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/LifelineCreateCommand.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Interaction;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class LifelineCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public LifelineCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- Lifeline newElement = UMLFactory.eINSTANCE.createLifeline();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Interaction qualifiedTarget = (Interaction) target;
- qualifiedTarget.getLifelines()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Interaction; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class LifelineCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public LifelineCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getLifeline()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + Lifeline newElement = UMLFactory.eINSTANCE.createLifeline(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Interaction qualifiedTarget = (Interaction) target; + qualifiedTarget.getLifelines() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(Lifeline newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java index 1540e22abec..7f37aed43b9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/MessageOccurrenceSpecificationCreateCommandCN.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.MessageOccurrenceSpecification;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class MessageOccurrenceSpecificationCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public MessageOccurrenceSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getMessageOccurrenceSpecification());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- MessageOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createMessageOccurrenceSpecification();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Lifeline qualifiedTarget = (Lifeline) target;
- qualifiedTarget.getCoveredBys()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(MessageOccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.MessageOccurrenceSpecification; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class MessageOccurrenceSpecificationCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public MessageOccurrenceSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getMessageOccurrenceSpecification()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + MessageOccurrenceSpecification newElement = UMLFactory.eINSTANCE.createMessageOccurrenceSpecification(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Lifeline qualifiedTarget = (Lifeline) target; + qualifiedTarget.getCoveredBys() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(MessageOccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java index 8bc81fb77cb..9af557ae975 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/OccurrenceSpecificationCreateCommandCN.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Lifeline;
-import org.eclipse.uml2.uml.OccurrenceSpecification;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class OccurrenceSpecificationCreateCommandCN extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public OccurrenceSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOccurrenceSpecification());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- OccurrenceSpecification newElement = UMLFactory.eINSTANCE.createOccurrenceSpecification();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Lifeline qualifiedTarget = (Lifeline) target;
- qualifiedTarget.getCoveredBys()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(OccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Lifeline; +import org.eclipse.uml2.uml.OccurrenceSpecification; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class OccurrenceSpecificationCreateCommandCN extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public OccurrenceSpecificationCreateCommandCN(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOccurrenceSpecification()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + OccurrenceSpecification newElement = UMLFactory.eINSTANCE.createOccurrenceSpecification(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Lifeline qualifiedTarget = (Lifeline) target; + qualifiedTarget.getCoveredBys() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(OccurrenceSpecification newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java index e99323b8a28..991d6737c27 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeConstraintCreateCommand.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Namespace;
-import org.eclipse.uml2.uml.TimeConstraint;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class TimeConstraintCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public TimeConstraintCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeConstraint());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Namespace qualifiedTarget = (Namespace) target;
- qualifiedTarget.getOwnedRules()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(TimeConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Namespace; +import org.eclipse.uml2.uml.TimeConstraint; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class TimeConstraintCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public TimeConstraintCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeConstraint()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + TimeConstraint newElement = UMLFactory.eINSTANCE.createTimeConstraint(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Namespace qualifiedTarget = (Namespace) target; + qualifiedTarget.getOwnedRules() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(TimeConstraint newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java index 6eb9212623c..b99a310761a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.timing/src-gen/org/eclipse/papyrus/uml/diagram/timing/edit/commands/TimeObservationCreateCommand.java @@ -1,125 +1,125 @@ -/**
- * Copyright (c) 2014 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.uml.diagram.timing.edit.commands;
-
-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.CommandResult;
-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.commands.EditElementCommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.uml2.uml.Package;
-import org.eclipse.uml2.uml.TimeObservation;
-import org.eclipse.uml2.uml.UMLFactory;
-import org.eclipse.uml2.uml.UMLPackage;
-
-/**
- * @generated
- */
-public class TimeObservationCreateCommand extends EditElementCommand {
-
- /**
- * @generated
- */
- private Diagram diagram = null;
-
- /**
- * @generated
- */
- public TimeObservationCreateCommand(CreateElementRequest req, Diagram diagram) {
- super(req.getLabel(), null, req);
- this.diagram = diagram;
- }
-
- /**
- * FIXME: replace with setElementToEdit()
- *
- * @generated
- */
- @Override
- protected EObject getElementToEdit() {
- EObject container = ((CreateElementRequest) getRequest()).getContainer();
- if (container instanceof View) {
- container = ((View) container).getElement();
- }
- return container;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean canExecute() {
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation());
- return data.isPermitted();
-
-
- }
-
- /**
- * @generated
- */
- @Override
- protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-
- TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation();
-
- EObject target = getElementToEdit();
- ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement);
- if (data.isPermitted()) {
- if (data.isPathDefined()) {
- if (!data.execute(target, newElement)) {
- return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element");
- }
- } else {
-
- Package qualifiedTarget = (Package) target;
- qualifiedTarget.getPackagedElements()
- .add(newElement);
-
- }
- } else {
- return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element");
- }
-
-
-
- doConfigure(newElement, monitor, info);
-
- ((CreateElementRequest) getRequest()).setNewElement(newElement);
- return CommandResult.newOKCommandResult(newElement);
- }
-
- /**
- * @generated
- */
- protected void doConfigure(TimeObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
- IElementType elementType = ((CreateElementRequest) getRequest()).getElementType();
- ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType);
- configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext());
- configureRequest.addParameters(getRequest().getParameters());
- ICommand configureCommand = elementType.getEditCommand(configureRequest);
- if (configureCommand != null && configureCommand.canExecute()) {
- configureCommand.execute(monitor, info);
- }
- }
-}
+/** + * Copyright (c) 2014 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.uml.diagram.timing.edit.commands; + +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.CommandResult; +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.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.uml2.uml.Package; +import org.eclipse.uml2.uml.TimeObservation; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class TimeObservationCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public TimeObservationCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + @Override + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + @Override + public boolean canExecute() { + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getTimeObservation()); + return data.isPermitted(); + + + } + + /** + * @generated + */ + @Override + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + + TimeObservation newElement = UMLFactory.eINSTANCE.createTimeObservation(); + + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getFor(target).getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + + Package qualifiedTarget = (Package) target; + qualifiedTarget.getPackagedElements() + .add(newElement); + + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + + + + doConfigure(newElement, monitor, info); + + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(TimeObservation newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/migration/UseCaseReconcilerForCompartment.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/migration/UseCaseReconcilerForCompartment_1_2_0.java index 2128c85a26d..07dff370c6b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/migration/UseCaseReconcilerForCompartment.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/migration/UseCaseReconcilerForCompartment_1_2_0.java @@ -21,7 +21,7 @@ import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.ReconcilerForCompartm /** * Diagram Reconciler for compartment from 1.1.0 to 1.2.0 */ -public class UseCaseReconcilerForCompartment extends ReconcilerForCompartment { +public class UseCaseReconcilerForCompartment_1_2_0 extends ReconcilerForCompartment { private static final String UseCasePointsEditPartTN_VISUAL_ID = "7009"; private static final String UseCasePointsInRectangleEditPart_VISUAL_ID = "7010"; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/migration/UseCaseReconciler.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/migration/UseCaseReconciler_1_1_0.java index 9079884be2f..e5b8dab2c7b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/migration/UseCaseReconciler.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/custom-src/org/eclipse/papyrus/uml/diagram/usecase/custom/migration/UseCaseReconciler_1_1_0.java @@ -1,76 +1,76 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2015 CEA LIST and others.
- *
- * 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:
- * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.usecase.custom.migration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand;
-import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler;
-
-/**
- * UseCase Diagram Reconciler from 1.0.0 to 1.1.0
- */
-public class UseCaseReconciler extends DiagramReconciler {
-
- private final static String ActorEditPartTN_VISUAL_ID = "2011";
- private final static String ActorFloatingLabelEditPartTN_VISUAL_ID = "6048";
- private final static String ActorInComponentEditPart_VISUAL_ID = "3018";
- private final static String ActorInComponentFloatingLabelEditPart_VISUAL_ID = "6050";
- private final static String ActorInPackageEditPart_VISUAL_ID = "3011";
- private final static String ActorInPackageFloatingLabelEditPart_VISUAL_ID = "6049";
- private final static String ComponentInPackageEditPart_VISUAL_ID = "3013";
- private final static String ComponentInPackageFloatingLabelEditPart_VISUAL_ID = "6051";
- private final static String SubjectClassifierEditPartTN_VISUAL_ID = "2015";
- private final static String SubjectClassifierFloatingLabelEditPartTN_VISUAL_ID = "6047";
- private final static String UseCaseEditPartTN_VISUAL_ID = "2013";
- private final static String UseCaseFloatingLabelEditPartTN_VISUAL_ID = "6038";
- private final static String UseCaseInComponentEditPart_VISUAL_ID = "3009";
- private final static String UseCaseInComponentFloatingLabelEditPart_VISUAL_ID = "6045";
- private final static String UseCaseInPackageEditPart_VISUAL_ID = "3012";
- private final static String UseCaseInPackageFloatingLabelEditPart_VISUAL_ID = "6046";
-
- /**
- * Gets the reconcile command.
- *
- * @param diagram
- * the diagram
- * @return the reconcile command
- * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram)
- */
- @Override
- public ICommand getReconcileCommand(Diagram diagram) {
- return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap());
- }
-
- /**
- * Gets the floating label map to add.
- *
- * @return the floating label map
- */
- private Map<String, String> getFloatingLabelMap() {
- Map<String, String> map = new HashMap<String, String>();
- map.put(ActorEditPartTN_VISUAL_ID, ActorFloatingLabelEditPartTN_VISUAL_ID);
- map.put(ActorInComponentEditPart_VISUAL_ID, ActorInComponentFloatingLabelEditPart_VISUAL_ID);
- map.put(ActorInPackageEditPart_VISUAL_ID, ActorInPackageFloatingLabelEditPart_VISUAL_ID);
- map.put(ComponentInPackageEditPart_VISUAL_ID, ComponentInPackageFloatingLabelEditPart_VISUAL_ID);
- map.put(SubjectClassifierEditPartTN_VISUAL_ID, SubjectClassifierFloatingLabelEditPartTN_VISUAL_ID);
- map.put(UseCaseEditPartTN_VISUAL_ID, UseCaseFloatingLabelEditPartTN_VISUAL_ID);
- map.put(UseCaseInComponentEditPart_VISUAL_ID, UseCaseInComponentFloatingLabelEditPart_VISUAL_ID);
- map.put(UseCaseInPackageEditPart_VISUAL_ID, UseCaseInPackageFloatingLabelEditPart_VISUAL_ID);
-
- return map;
- }
-}
+/***************************************************************************** + * Copyright (c) 2010, 2015 CEA LIST and others. + * + * 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: + * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - Initial API and Implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.usecase.custom.migration; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.papyrus.infra.gmfdiag.common.commands.InsertFloatingLabelFromMapCommand; +import org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler; + +/** + * UseCase Diagram Reconciler from 1.0.0 to 1.1.0 + */ +public class UseCaseReconciler_1_1_0 extends DiagramReconciler { + + private final static String ActorEditPartTN_VISUAL_ID = "2011"; + private final static String ActorFloatingLabelEditPartTN_VISUAL_ID = "6048"; + private final static String ActorInComponentEditPart_VISUAL_ID = "3018"; + private final static String ActorInComponentFloatingLabelEditPart_VISUAL_ID = "6050"; + private final static String ActorInPackageEditPart_VISUAL_ID = "3011"; + private final static String ActorInPackageFloatingLabelEditPart_VISUAL_ID = "6049"; + private final static String ComponentInPackageEditPart_VISUAL_ID = "3013"; + private final static String ComponentInPackageFloatingLabelEditPart_VISUAL_ID = "6051"; + private final static String SubjectClassifierEditPartTN_VISUAL_ID = "2015"; + private final static String SubjectClassifierFloatingLabelEditPartTN_VISUAL_ID = "6047"; + private final static String UseCaseEditPartTN_VISUAL_ID = "2013"; + private final static String UseCaseFloatingLabelEditPartTN_VISUAL_ID = "6038"; + private final static String UseCaseInComponentEditPart_VISUAL_ID = "3009"; + private final static String UseCaseInComponentFloatingLabelEditPart_VISUAL_ID = "6045"; + private final static String UseCaseInPackageEditPart_VISUAL_ID = "3012"; + private final static String UseCaseInPackageFloatingLabelEditPart_VISUAL_ID = "6046"; + + /** + * Gets the reconcile command. + * + * @param diagram + * the diagram + * @return the reconcile command + * @see org.eclipse.papyrus.infra.gmfdiag.common.reconciler.DiagramReconciler#getReconcileCommand(org.eclipse.gmf.runtime.notation.Diagram) + */ + @Override + public ICommand getReconcileCommand(Diagram diagram) { + return new InsertFloatingLabelFromMapCommand(diagram, getFloatingLabelMap()); + } + + /** + * Gets the floating label map to add. + * + * @return the floating label map + */ + private Map<String, String> getFloatingLabelMap() { + Map<String, String> map = new HashMap<String, String>(); + map.put(ActorEditPartTN_VISUAL_ID, ActorFloatingLabelEditPartTN_VISUAL_ID); + map.put(ActorInComponentEditPart_VISUAL_ID, ActorInComponentFloatingLabelEditPart_VISUAL_ID); + map.put(ActorInPackageEditPart_VISUAL_ID, ActorInPackageFloatingLabelEditPart_VISUAL_ID); + map.put(ComponentInPackageEditPart_VISUAL_ID, ComponentInPackageFloatingLabelEditPart_VISUAL_ID); + map.put(SubjectClassifierEditPartTN_VISUAL_ID, SubjectClassifierFloatingLabelEditPartTN_VISUAL_ID); + map.put(UseCaseEditPartTN_VISUAL_ID, UseCaseFloatingLabelEditPartTN_VISUAL_ID); + map.put(UseCaseInComponentEditPart_VISUAL_ID, UseCaseInComponentFloatingLabelEditPart_VISUAL_ID); + map.put(UseCaseInPackageEditPart_VISUAL_ID, UseCaseInPackageFloatingLabelEditPart_VISUAL_ID); + + return map; + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.configuration b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.configuration deleted file mode 100644 index 4cbb4a6544e..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/models/usecaseDiagram.configuration +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_yeY0sHDvEeWh-MssWmCB_A" implementationID="UseCase" customStyle="platform:/plugin/org.eclipse.papyrus.uml.diagram.usecase/models/usecase.css">
- <modelRules xmi:id="_yeY0sXDvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </modelRules>
- <modelRules xmi:id="_yeY0snDvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
- </modelRules>
- <owningRules xmi:id="_yeY0s3DvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <owningRules xmi:id="_yeY0tHDvEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <childRules xmi:id="_yeY0tXDvEeWh-MssWmCB_A"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml index 43559c557ae..74bc8a9e953 100755 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.usecase/plugin.xml @@ -15,14 +15,6 @@ --> <plugin> - <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="models/usecaseDiagram.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - <extension point="org.eclipse.ui.contexts" id="ui-context"> <?gmfgen generated="true"?> <context @@ -972,21 +964,21 @@ point="org.eclipse.papyrus.infra.gmfdiag.common.diagramReconciler"> <diagramReconciler diagramType="UseCase" - reconcilerClass="org.eclipse.papyrus.uml.diagram.usecase.custom.migration.UseCaseReconciler" - source="undefined" - target="1.1.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.usecase.custom.migration.UseCaseReconciler_1_1_0" + source="1.0.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="UseCase" - reconcilerClass="org.eclipse.papyrus.uml.diagram.usecase.custom.migration.UseCaseReconcilerForCompartment" - source="undefined" - target="1.2.0"> + reconcilerClass="org.eclipse.papyrus.uml.diagram.usecase.custom.migration.UseCaseReconcilerForCompartment_1_2_0" + source="1.1.0" + target="1.3.0"> </diagramReconciler> <diagramReconciler diagramType="UseCase" reconcilerClass="org.eclipse.papyrus.uml.diagram.usecase.custom.migration.UseCaseReconciler_1_2_0" source="1.1.0" - target="1.2.0"> + target="1.3.0"> </diagramReconciler> </extension> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/.classpath b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/.classpath index 8a8f1668cdc..eca7bdba8f0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/.classpath +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/.classpath @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/.settings/org.eclipse.jdt.core.prefs b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/.settings/org.eclipse.jdt.core.prefs index 09308dbc127..43d10874e2c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/.settings/org.eclipse.jdt.core.prefs @@ -1,295 +1,295 @@ -eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=260
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=false
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=260
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=tab
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.formatter.comment.line_length=260 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=false +org.eclipse.jdt.core.formatter.join_wrapped_lines=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=260 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=5 +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/META-INF/MANIFEST.MF index 108992885c6..ff222ac5588 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/META-INF/MANIFEST.MF @@ -1,6 +1,5 @@ Manifest-Version: 1.0 Export-Package: org.eclipse.papyrus.uml.diagram.wizards, - org.eclipse.papyrus.uml.diagram.wizards.category, org.eclipse.papyrus.uml.diagram.wizards.command, org.eclipse.papyrus.uml.diagram.wizards.kind, org.eclipse.papyrus.uml.diagram.wizards.messages, @@ -18,7 +17,9 @@ Require-Bundle: org.eclipse.m2m.qvt.oml;bundle-version="[3.6.0,4.0.0)";visibilit org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)", org.eclipse.help;bundle-version="[3.7.0,4.0.0)", - org.eclipse.papyrus.uml.extensionpoints;bundle-version="[1.2.0,2.0.0)" + org.eclipse.papyrus.uml.extensionpoints;bundle-version="[1.2.0,2.0.0)", + org.eclipse.papyrus.infra.core.architecture;bundle-version="0.1.0", + org.eclipse.papyrus.infra.ui.architecture;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %pluginProvider Bundle-ActivationPolicy: lazy Bundle-Version: 3.0.0.qualifier diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryDescriptor.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryDescriptor.java deleted file mode 100644 index 7a1c1011211..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryDescriptor.java +++ /dev/null @@ -1,179 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2010 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:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.wizards.category;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand;
-
-/**
- * The Class DiagramCategoryDescriptor.
- */
-public class DiagramCategoryDescriptor {
-
- /** The my id. */
- private String myId;
-
- /** The my label. */
- private String myLabel;
-
- /** The my description. */
- private String myDescription;
-
- /** The my file extension. */
- private String myFileExtension;
-
- /** The my icon. */
- private ImageDescriptor myIcon;
-
- /** The instance. */
- private IModelCreationCommand instance;
-
- /** The my creation command class. */
- protected Class<? extends IModelCreationCommand> myCreationCommandClass;
-
- /**
- * Instantiates a new diagram category descriptor.
- *
- * @param id
- * the id
- * @param label
- * the label
- * @param creationCommandClass
- * the creation command class
- */
- public DiagramCategoryDescriptor(String id, String label, Class<? extends IModelCreationCommand> creationCommandClass) {
- myId = id;
- myLabel = label;
- myCreationCommandClass = creationCommandClass;
- }
-
- /**
- * Gets the id.
- *
- * @return the id
- */
- public String getId() {
- return myId;
- }
-
- /**
- * Gets the label.
- *
- * @return the label
- */
- public String getLabel() {
- return myLabel;
- }
-
- /**
- * constructor.
- *
- * @return the creation command
- * @throws BackboneException
- * the backbone exception
- */
- public IModelCreationCommand getCommand() throws BackboneException {
- if (instance == null) {
- instance = createCommand();
- }
-
- return instance;
- }
-
- /**
- * Creates the command.
- *
- * @return the i model creation command
- * @throws BackboneException
- * the backbone exception
- */
- private IModelCreationCommand createCommand() throws BackboneException {
- try {
- IModelCreationCommand command = myCreationCommandClass.newInstance();
- return command;
- } catch (SecurityException e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new RuntimeException(e);
- } catch (InstantiationException e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
- // Lets propagate. This is an implementation problem that should be solved by
- // programmer.
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return myDescription;
- }
-
- /**
- * Gets the icon.
- *
- * @return the icon
- */
- public ImageDescriptor getIcon() {
- return myIcon;
- }
-
- /**
- * Gets the file extension.
- *
- * @return the file extension
- */
- public String getExtensionPrefix() {
- return myFileExtension;
- }
-
- /**
- * Sets the description.
- *
- * @param description
- * the new description
- */
- public void setDescription(String description) {
- myDescription = description;
- }
-
- /**
- * Sets the icon.
- *
- * @param icon
- * the new icon
- */
- public void setIcon(ImageDescriptor icon) {
- myIcon = icon;
- }
-
- /**
- * Sets the file extension.
- *
- * @param fileExtension
- * the new file extension
- */
- public void setExtensionPrefix(String fileExtension) {
- myFileExtension = fileExtension;
- }
-
-
-}
\ No newline at end of file diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryRegistry.java deleted file mode 100644 index 328b9a63447..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/category/DiagramCategoryRegistry.java +++ /dev/null @@ -1,156 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2010 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:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.wizards.category;
-
-import static org.eclipse.papyrus.uml.diagram.wizards.Activator.log;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.papyrus.infra.core.extension.BadClassNameException;
-import org.eclipse.papyrus.infra.core.extension.ExtensionUtils;
-import org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand;
-import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The Class DiagramCategoryRegistry reads available DiagramCategories from plugin descriptors.
- */
-public class DiagramCategoryRegistry extends ExtensionUtils {
-
- /** The Constant CATEGORY_EXTENSION_POINT_NAME. */
- private static final String CATEGORY_EXTENSION_POINT_NAME = "org.eclipse.papyrus.infra.ui.papyrusDiagram"; //$NON-NLS-1$
-
- /** ID of the editor extension (schema filename). */
- public static final String CATEGORY_ELEMENT_NAME = "diagramCategory"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_ID. */
- private static final String CATEGORY_ID = "id"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_LABEL. */
- private static final String CATEGORY_LABEL = "label"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_DESCRIPTION. */
- private static final String CATEGORY_DESCRIPTION = "description"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_ICON. */
- private static final String CATEGORY_ICON = "icon"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_CLASS. */
- private static final String CATEGORY_CLASS = "class"; //$NON-NLS-1$
-
- /** The Constant CATEGORY_FILE_EXTENSION_PREFIX. */
- private static final String CATEGORY_FILE_EXTENSION_PREFIX = "extensionPrefix"; //$NON-NLS-1$
-
- /** The diagram categories. */
- private static Map<String, DiagramCategoryDescriptor> diagramCategories;
-
- /** The our instance. */
- private static DiagramCategoryRegistry ourInstance;
-
- /**
- * Instantiates a new diagram category registry.
- */
- private DiagramCategoryRegistry() {
- }
-
- /**
- * Gets the single instance of DiagramCategoryRegistry.
- *
- * @return single instance of DiagramCategoryRegistry
- */
- public static DiagramCategoryRegistry getInstance() {
- if (ourInstance == null) {
- ourInstance = new DiagramCategoryRegistry();
- }
- return ourInstance;
- }
-
- /**
- * Gets the diagram categories.
- *
- * @return the diagram categories
- */
- public List<DiagramCategoryDescriptor> getDiagramCategories() {
- if (diagramCategories == null) {
- diagramCategories = buildDiagramCategories();
- }
- return new ArrayList<DiagramCategoryDescriptor>(diagramCategories.values());
- }
-
- /**
- * Gets the diagram category map.
- *
- * @return the diagram category map
- */
- public Map<String, DiagramCategoryDescriptor> getDiagramCategoryMap() {
- if (diagramCategories == null) {
- diagramCategories = buildDiagramCategories();
- }
- return diagramCategories;
- }
-
- /**
- * Builds the diagram categories.
- *
- * @return the hash map
- */
- public Map<String, DiagramCategoryDescriptor> buildDiagramCategories() {
- Map<String, DiagramCategoryDescriptor> result = new HashMap<String, DiagramCategoryDescriptor>();
-
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CATEGORY_EXTENSION_POINT_NAME);
- for (IExtension extension : extensionPoint.getExtensions()) {
- for (IConfigurationElement confElement : extension.getConfigurationElements()) {
- if (CATEGORY_ELEMENT_NAME.equals(confElement.getName())) {
- DiagramCategoryDescriptor diagramCategoryDescriptor;
- try {
- diagramCategoryDescriptor = buildCategoryDescriptor(confElement);
- result.put(diagramCategoryDescriptor.getId(), diagramCategoryDescriptor);
- } catch (BadClassNameException e) {
- log.error(Messages.DiagramCategoryRegistry_bad_class_name_of_category, e);
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Builds the category descriptor.
- *
- * @param confElement
- * the conf element
- * @return the diagram category descriptor
- * @throws BadClassNameException
- * the bad class name exception
- */
- protected DiagramCategoryDescriptor buildCategoryDescriptor(IConfigurationElement confElement) throws BadClassNameException {
- Class<IModelCreationCommand> commandClazz = (Class<IModelCreationCommand>) parseClass(confElement, CATEGORY_CLASS, CATEGORY_ELEMENT_NAME);
- DiagramCategoryDescriptor diagramCategoryDescriptor = new DiagramCategoryDescriptor(confElement.getAttribute(CATEGORY_ID), confElement.getAttribute(CATEGORY_LABEL), commandClazz);
- diagramCategoryDescriptor.setDescription(confElement.getAttribute(CATEGORY_DESCRIPTION));
- diagramCategoryDescriptor.setExtensionPrefix(confElement.getAttribute(CATEGORY_FILE_EXTENSION_PREFIX));
- String iconPath = confElement.getAttribute(CATEGORY_ICON);
- if (iconPath != null) {
- diagramCategoryDescriptor.setIcon(AbstractUIPlugin.imageDescriptorFromPlugin(confElement.getNamespaceIdentifier(), iconPath));
- }
- return diagramCategoryDescriptor;
- }
-
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/command/NewPapyrusModelCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/command/NewPapyrusModelCommand.java index 98b4ad0a95a..36c6c0ae486 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/command/NewPapyrusModelCommand.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/command/NewPapyrusModelCommand.java @@ -1,51 +1,55 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2013 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:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- * Christian W. Damus (CEA) - Support creating models in repositories (CDO)
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.wizards.command;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-
-/**
- * The Command to create a new Papyrus Model.
- */
-public class NewPapyrusModelCommand extends RecordingCommand {
-
- /** The my model set. */
- private final ModelSet myModelSet;
-
- /** The URI of the model to create. */
- private final URI myURI;
-
- /**
- * Instantiates a new new papyrus model command.
- *
- * @param modelSet
- * the di resource set
- * @param newURI
- * the URI of the new model's principal resource
- */
- public NewPapyrusModelCommand(ModelSet modelSet, URI newURI) {
- super(modelSet.getTransactionalEditingDomain());
- myModelSet = modelSet;
- myURI = newURI;
- }
-
- @Override
- protected void doExecute() {
- myModelSet.createModels(myURI);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2010, 2013 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: + * Tatiana Fesenko (CEA LIST) - Initial API and implementation + * Christian W. Damus (CEA) - Support creating models in repositories (CDO) + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.wizards.command; + +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.papyrus.infra.core.resource.ModelSet; + +/** + * The Command to create a new Papyrus Model. + */ +public class NewPapyrusModelCommand extends RecordingCommand { + + /** The my model set. */ + private final ModelSet myModelSet; + + /** The URI of the model to create. */ + private final URI myURI; + + /** + * Instantiates a new new papyrus model command. + * + * @param modelSet + * the di resource set + * @param newURI + * the URI of the new model's principal resource + * @param contextId + * the id of the architecture context + * @param viewpointIds + * the ids of the architecture viewpoints + */ + public NewPapyrusModelCommand(ModelSet modelSet, URI newURI) { + super(modelSet.getTransactionalEditingDomain()); + myModelSet = modelSet; + myURI = newURI; + } + + @Override + protected void doExecute() { + myModelSet.createModels(myURI); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindContentProvider.java deleted file mode 100644 index af93c20da23..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindContentProvider.java +++ /dev/null @@ -1,136 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2010 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:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.wizards.kind;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.papyrus.infra.viewpoints.configuration.Category;
-import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
-import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
-
-/**
- * The ContentProvider for DiagramCategory table.
- * Returns available diagram kinds for the given diagram category(ies).
- */
-public class DiagramKindContentProvider implements IStructuredContentProvider {
-
- private final Map<String, Collection<ViewPrototype>> prototypes;
-
- /**
- * Instantiates a new diagram kind content provider.
- *
- */
- public DiagramKindContentProvider() {
- Collection<ViewPrototype> vps = PolicyChecker.getCurrent().getAllPrototypes();
- this.prototypes = new HashMap<String, Collection<ViewPrototype>>();
- for (ViewPrototype vp : vps) {
- for (Category category : vp.getCategories()) {
- cache(category.getName(), vp);
- }
- }
- }
-
- /**
- * Stores the given diagram prototype in the cache
- *
- * @param prototype
- * The prototype to cache
- */
- private void cache(String category, ViewPrototype prototype) {
- if (!prototypes.containsKey(category)) {
- prototypes.put(category, new ArrayList<ViewPrototype>());
- }
- prototypes.get(category).add(prototype);
- }
-
- /**
- * Dispose.
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- prototypes.clear();
- }
-
- /**
- * Input changed.
- *
- * @param viewer
- * the viewer
- * @param oldInput
- * the old input
- * @param newInput
- * the new input
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- /**
- * Gets the elements.
- *
- * @param inputElement
- * the input element
- * @return the elements
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof Object[]) {
- List<ViewPrototype> result = new ArrayList<ViewPrototype>();
- for (Object next : (Object[]) inputElement) {
- if (next instanceof String) {
- String diagramCategory = (String) next;
- result.addAll(getPrototypes(diagramCategory));
- }
- }
- Collections.sort(result, new ViewPrototype.Comp());
- return result.toArray(new Object[result.size()]);
- }
- if (inputElement instanceof String) {
- String diagramCategory = (String) inputElement;
- List<ViewPrototype> result = getPrototypes(diagramCategory);
- return result.toArray(new Object[result.size()]);
- }
- return null;
- }
-
- /**
- * Gets the creation commands.
- *
- * @param diagramCategory
- * the diagram category
- * @return the creation commands
- */
- protected List<ViewPrototype> getPrototypes(String diagramCategory) {
- HashMap<String, ViewPrototype> result = new HashMap<String, ViewPrototype>();
- if (prototypes.containsKey(diagramCategory)) {
- // Look for all diagram kind of the category
- for (ViewPrototype prototype : prototypes.get(diagramCategory)) {
- String label = prototype.getLabel();
- // If the diagram is not contains in the result add it
- if (!result.containsKey(label)) {
- result.put(label, prototype);
- }
- }
- }
- return new ArrayList<ViewPrototype>(result.values());
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindComposite.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/RepresentationKindComposite.java index 537ba3e0d90..729c6feb436 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/DiagramKindComposite.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/RepresentationKindComposite.java @@ -1,354 +1,382 @@ -/*****************************************************************************
- * Copyright (c) 2014 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:
- * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.wizards.kind;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-//import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CheckboxCellEditor;
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.EditingSupport;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
-import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-
-public class DiagramKindComposite extends Composite {
-
- private static final Image CHECKED = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage("org.eclipse.papyrus.uml.diagram.wizards", "icons/checked.gif"); //$NON-NLS-1$ //$NON-NLS-2$
-
- private static final Image UNCHECKED = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage("org.eclipse.papyrus.uml.diagram.wizards", "icons/unchecked.gif"); //$NON-NLS-1$ //$NON-NLS-2$
-
- private Map<ViewPrototype, String> diagramNames = new HashMap<ViewPrototype, String>();
-
- List<String> listNames = new ArrayList<String>();
-
-
- private Map<ViewPrototype, Integer> selectedDiagrams = new HashMap<ViewPrototype, Integer>();
-
- public TableViewer viewer;
-
- private GridData gridData;
-
-
-
-
- public DiagramKindComposite(Composite parent) {
- super(parent, SWT.NONE);
- this.setLayout(new GridLayout());
- this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
-
- createTableViewer(this);
- }
-
- public void createTableViewer(final Composite container) {
-
- viewer = new TableViewer(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER);
- gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- viewer.getTable().setLayoutData(gridData);
-
- // viewer.setContentProvider(new ArrayContentProvider());
- final Table table = viewer.getTable();
- viewer.setContentProvider(new DiagramKindContentProvider());
- table.setHeaderVisible(true);
-
- // The check column
- TableViewerColumn colCheckbox = createTableViewerColumn("", 20, viewer); //$NON-NLS-1$
- colCheckbox.setLabelProvider(new ColumnLabelProvider() {
-
- @Override
- public String getText(Object element) {
- return ""; //$NON-NLS-1$
- }
-
- @Override
- public Image getImage(Object element) {
- if (selectedDiagrams.containsKey(element)) {
- return CHECKED;
- } else {
- return UNCHECKED;
- }
- }
-
- });
- colCheckbox.setEditingSupport(new EditingSupport(viewer) {
-
- private CheckboxCellEditor checkboxCellEditor;
-
- @Override
- protected void setValue(Object element, Object value) {
- if (checkboxCellEditor.getValue() == Boolean.TRUE) {
- selectedDiagrams.put((ViewPrototype) element, 1);
- } else {
- selectedDiagrams.remove(element);
- }
- viewer.update(element, null);
- }
-
- @Override
- protected Object getValue(Object element) {
- return selectedDiagrams.containsKey(element);
- }
-
- @Override
- protected CellEditor getCellEditor(Object element) {
- checkboxCellEditor = new CheckboxCellEditor(container, SWT.CHECK | SWT.READ_ONLY);
- return checkboxCellEditor;
- }
-
- @Override
- protected boolean canEdit(Object element) {
- return true;
- }
- });
- // no need to enable the resize on the check box column
- colCheckbox.getColumn().setResizable(false);
-
-
- // The Diagram name column
- TableViewerColumn colDiagramKind = createTableViewerColumn(Messages.DiagramKindComposite_0, 200, viewer);
- colDiagramKind.setLabelProvider(new ColumnLabelProvider() {
-
- @Override
- public String getText(Object element) {
- if (element instanceof ViewPrototype) {
- return ((ViewPrototype) element).getLabel();
- }
- return ""; //$NON-NLS-1$
- }
-
- @Override
- public Image getImage(Object element) {
- if (element instanceof ViewPrototype) {
- return ((ViewPrototype) element).getIcon();
- }
- return null;
- }
-
-
- });
-
-
- // the name of the diagram the user can edit it to set his onw name
- TableViewerColumn colDiagramName = createTableViewerColumn(Messages.DiagramKindComposite_2, 300, viewer);
- colDiagramName.setEditingSupport(new EditingSupport(viewer) {
-
- @Override
- protected void setValue(Object element, Object value) {
-
- diagramNames.put((ViewPrototype) element, (String) value);
- viewer.update(element, null);
-
- }
-
- @Override
- protected Object getValue(Object element) {
-
- if (diagramNames.containsKey(element)) {
- return diagramNames.get(element);
- }
- return ""; //$NON-NLS-1$
-
- }
-
- @Override
- protected CellEditor getCellEditor(Object element) {
- return new TextCellEditor(viewer.getTable());
- }
-
- @Override
- protected boolean canEdit(Object element) {
- return true;
- }
- });
- colDiagramName.setLabelProvider(new ColumnLabelProvider() {
-
- @Override
- public String getText(Object element) {
-
- return diagramNames.get(element);
- }
- });
-
-
- // the quantity of the diagram the user would like to create
- TableViewerColumn colDiagramQuantity = createTableViewerColumn(Messages.DiagramKindComposite_3, 70, viewer);
- colDiagramQuantity.setEditingSupport(new EditingSupport(viewer) {
-
- @Override
- protected void setValue(Object element, Object value) {
- selectedDiagrams.put((ViewPrototype) element, Integer.parseInt((String) value));
- viewer.update(element, null);
- }
-
- @Override
- protected Object getValue(Object element) {
- if (selectedDiagrams.containsKey(element)) {
- return selectedDiagrams.get(element).toString();
- }
- return "0"; //$NON-NLS-1$
- }
-
- @Override
- protected CellEditor getCellEditor(Object element) {
- TextCellEditor textCellEditor = new TextCellEditor(viewer.getTable());
- textCellEditor.setValidator(new ICellEditorValidator() {
-
- @Override
- public String isValid(Object value) {
- if (!(value instanceof Integer)) {
- return null;
- }
- return value.toString();
- }
- });
- return textCellEditor;
- }
-
- @Override
- protected boolean canEdit(Object element) {
- return true;
- }
- });
- colDiagramQuantity.setLabelProvider(new ColumnLabelProvider() {
-
- @Override
- public String getText(Object element) {
- if (selectedDiagrams.containsKey(element)) {
- return selectedDiagrams.get(element).toString();
- }
- // return "0"; //$NON-NLS-1$
- return ""; //$NON-NLS-1$
- }
- });
-
-
- // TODO - The description of the diagram not yet implemented, should be implemented will generating the diagram
- // TableViewerColumn colDiagramDescription = createTableViewerColumn("Description", 400, viewer);
- // colDiagramDescription.setLabelProvider(new ColumnLabelProvider() {
- //
- // @Override
- // public String getText(Object element) {
- // return null;
- // }
- //
- // });
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- // if(selectedConfigs.size() > 0) {
- // setPageComplete(true);
- // } else {
- // setPageComplete(false);
- // }
- }
- });
-
- }
-
- /**
- * Constructor.
- *
- * @param title
- * @param bound
- * @param viewer
- * @return
- */
- private TableViewerColumn createTableViewerColumn(String title, int bound, TableViewer viewer) {
- final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE);
- final TableColumn column = viewerColumn.getColumn();
- column.setText(title);
- column.setWidth(bound);
- column.setResizable(true);
- column.setMoveable(false);
- return viewerColumn;
- }
-
-
- /**
- * Creates the diagram kind label provider.
- *
- * @return the i base label provider
- */
- protected IBaseLabelProvider createDiagramKindLabelProvider() {
- return new DiagramKindLabelProvider();
- }
-
-
- public void setInput(Object input) {
- viewer.setInput(input);
-
- // Resize the diagram table to minimize the space lost
- int tableItemHeight = viewer.getTable().getItemHeight();
- int tableItemCount = ((DiagramKindContentProvider) viewer.getContentProvider()).getElements(input).length;
- gridData.minimumHeight = tableItemHeight * Math.max(3, Math.round((tableItemCount / 2)));
- gridData.heightHint = tableItemHeight * Math.max(3, Math.round((tableItemCount / 2)));
-
- // Notifies the shell that the layout needs to be resized
- ((Composite) viewer.getControl()).layout(true, true);
- }
-
- public ArrayList<ViewPrototype> getCheckElement() {
- ArrayList<ViewPrototype> list = new ArrayList<ViewPrototype>();
- Set<Entry<ViewPrototype, Integer>> set = selectedDiagrams.entrySet();
- Iterator<Entry<ViewPrototype, Integer>> ite = set.iterator();
- while (ite.hasNext()) {
- Entry<ViewPrototype, Integer> me = ite.next();
- int nb = me.getValue();
- String tempname = diagramNames.get(me.getKey());
- // If the name field was not filled
- if (tempname == null || tempname.equalsIgnoreCase("")) {
- tempname = me.getKey().getLabel();
- }
-
- for (int i = 0; i < nb; i++) {
- list.add(me.getKey());
- if (nb > 1) {
- listNames.add(tempname + "_" + i); //$NON-NLS-1$
- } else {
- listNames.add(tempname);
- }
- }
- }
- return list;
- }
-
-
- /**
- * @return
- */
- public List<String> getDiagramName() {
- return listNames;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2014 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: + * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.wizards.kind; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +//import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.CheckboxCellEditor; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.IBaseLabelProvider; +import org.eclipse.jface.viewers.ICellEditorValidator; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TextCellEditor; +import org.eclipse.papyrus.infra.core.architecture.RepresentationKind; +import org.eclipse.papyrus.uml.diagram.wizards.Activator; +import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; + + +public class RepresentationKindComposite extends Composite { + + private static final Image CHECKED = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage("org.eclipse.papyrus.uml.diagram.wizards", "icons/checked.gif"); //$NON-NLS-1$ //$NON-NLS-2$ + + private static final Image UNCHECKED = org.eclipse.papyrus.infra.widgets.Activator.getDefault().getImage("org.eclipse.papyrus.uml.diagram.wizards", "icons/unchecked.gif"); //$NON-NLS-1$ //$NON-NLS-2$ + + private Map<RepresentationKind, String> representationNames = new HashMap<RepresentationKind, String>(); + + List<String> listNames = new ArrayList<String>(); + + + private Map<RepresentationKind, Integer> selectedRepresentations = new HashMap<RepresentationKind, Integer>(); + + public TableViewer viewer; + + private GridData gridData; + + private ImageRegistry imageRegistry; + + + public RepresentationKindComposite(Composite parent) { + super(parent, SWT.NONE); + this.setLayout(new GridLayout()); + this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + createTableViewer(this); + imageRegistry = new ImageRegistry(); + } + + public void createTableViewer(final Composite container) { + + viewer = new TableViewer(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); + gridData = new GridData(SWT.FILL, SWT.FILL, true, true); + viewer.getTable().setLayoutData(gridData); + + // viewer.setContentProvider(new ArrayContentProvider()); + final Table table = viewer.getTable(); + viewer.setContentProvider(new RepresentationKindContentProvider()); + table.setHeaderVisible(true); + + // The check column + TableViewerColumn colCheckbox = createTableViewerColumn("", 20, viewer); //$NON-NLS-1$ + colCheckbox.setLabelProvider(new ColumnLabelProvider() { + + @Override + public String getText(Object element) { + return ""; //$NON-NLS-1$ + } + + @Override + public Image getImage(Object element) { + if (selectedRepresentations.containsKey(element)) { + return CHECKED; + } else { + return UNCHECKED; + } + } + + }); + colCheckbox.setEditingSupport(new EditingSupport(viewer) { + + private CheckboxCellEditor checkboxCellEditor; + + @Override + protected void setValue(Object element, Object value) { + if (checkboxCellEditor.getValue() == Boolean.TRUE) { + selectedRepresentations.put((RepresentationKind) element, 1); + } else { + selectedRepresentations.remove(element); + } + viewer.update(element, null); + } + + @Override + protected Object getValue(Object element) { + return selectedRepresentations.containsKey(element); + } + + @Override + protected CellEditor getCellEditor(Object element) { + checkboxCellEditor = new CheckboxCellEditor(container, SWT.CHECK | SWT.READ_ONLY); + return checkboxCellEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + // no need to enable the resize on the check box column + colCheckbox.getColumn().setResizable(false); + + + // The Diagram name column + TableViewerColumn colDiagramKind = createTableViewerColumn(Messages.RepresentationKindComposite_0, 200, viewer); + colDiagramKind.setLabelProvider(new ColumnLabelProvider() { + + @Override + public String getText(Object element) { + if (element instanceof RepresentationKind) { + return ((RepresentationKind) element).getName(); + } + return ""; //$NON-NLS-1$ + } + + @Override + public Image getImage(Object element) { + if (element instanceof RepresentationKind) { + return getIcon((RepresentationKind) element); + } + return null; + } + + + }); + + + // the name of the diagram the user can edit it to set his onw name + TableViewerColumn colDiagramName = createTableViewerColumn(Messages.RepresentationKindComposite_2, 300, viewer); + colDiagramName.setEditingSupport(new EditingSupport(viewer) { + + @Override + protected void setValue(Object element, Object value) { + + representationNames.put((RepresentationKind) element, (String) value); + viewer.update(element, null); + + } + + @Override + protected Object getValue(Object element) { + + if (representationNames.containsKey(element)) { + return representationNames.get(element); + } + return ""; //$NON-NLS-1$ + + } + + @Override + protected CellEditor getCellEditor(Object element) { + return new TextCellEditor(viewer.getTable()); + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + colDiagramName.setLabelProvider(new ColumnLabelProvider() { + + @Override + public String getText(Object element) { + + return representationNames.get(element); + } + }); + + + // the quantity of the diagram the user would like to create + TableViewerColumn colDiagramQuantity = createTableViewerColumn(Messages.RepresentationKindComposite_3, 70, viewer); + colDiagramQuantity.setEditingSupport(new EditingSupport(viewer) { + + @Override + protected void setValue(Object element, Object value) { + selectedRepresentations.put((RepresentationKind) element, Integer.parseInt((String) value)); + viewer.update(element, null); + } + + @Override + protected Object getValue(Object element) { + if (selectedRepresentations.containsKey(element)) { + return selectedRepresentations.get(element).toString(); + } + return "0"; //$NON-NLS-1$ + } + + @Override + protected CellEditor getCellEditor(Object element) { + TextCellEditor textCellEditor = new TextCellEditor(viewer.getTable()); + textCellEditor.setValidator(new ICellEditorValidator() { + + @Override + public String isValid(Object value) { + if (!(value instanceof Integer)) { + return null; + } + return value.toString(); + } + }); + return textCellEditor; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + }); + colDiagramQuantity.setLabelProvider(new ColumnLabelProvider() { + + @Override + public String getText(Object element) { + if (selectedRepresentations.containsKey(element)) { + return selectedRepresentations.get(element).toString(); + } + // return "0"; //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + }); + + + // TODO - The description of the diagram not yet implemented, should be implemented will generating the diagram + // TableViewerColumn colDiagramDescription = createTableViewerColumn("Description", 400, viewer); + // colDiagramDescription.setLabelProvider(new ColumnLabelProvider() { + // + // @Override + // public String getText(Object element) { + // return null; + // } + // + // }); + viewer.addSelectionChangedListener(new ISelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent event) { + // if(selectedConfigs.size() > 0) { + // setPageComplete(true); + // } else { + // setPageComplete(false); + // } + } + }); + + } + + /** + * Constructor. + * + * @param title + * @param bound + * @param viewer + * @return + */ + private TableViewerColumn createTableViewerColumn(String title, int bound, TableViewer viewer) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(false); + return viewerColumn; + } + + + /** + * Creates the diagram kind label provider. + * + * @return the i base label provider + */ + protected IBaseLabelProvider createDiagramKindLabelProvider() { + return new DiagramKindLabelProvider(); + } + + + public void setInput(Object input) { + viewer.setInput(input); + + // Resize the diagram table to minimize the space lost + int tableItemHeight = viewer.getTable().getItemHeight(); + int tableItemCount = ((RepresentationKindContentProvider) viewer.getContentProvider()).getElements(input).length; + gridData.minimumHeight = tableItemHeight * Math.max(3, Math.round((tableItemCount / 2))); + gridData.heightHint = tableItemHeight * Math.max(3, Math.round((tableItemCount / 2))); + + // Notifies the shell that the layout needs to be resized + ((Composite) viewer.getControl()).layout(true, true); + } + + public ArrayList<RepresentationKind> getCheckElement() { + ArrayList<RepresentationKind> list = new ArrayList<RepresentationKind>(); + Set<Entry<RepresentationKind, Integer>> set = selectedRepresentations.entrySet(); + Iterator<Entry<RepresentationKind, Integer>> ite = set.iterator(); + while (ite.hasNext()) { + Entry<RepresentationKind, Integer> me = ite.next(); + int nb = me.getValue(); + String tempname = representationNames.get(me.getKey()); + // If the name field was not filled + if (tempname == null || tempname.equalsIgnoreCase("")) { + tempname = me.getKey().getName(); + } + + for (int i = 0; i < nb; i++) { + list.add(me.getKey()); + if (nb > 1) { + listNames.add(tempname + "_" + i); //$NON-NLS-1$ + } else { + listNames.add(tempname); + } + } + } + return list; + } + + + /** + * @return + */ + public List<String> getDiagramName() { + return listNames; + } + + private Image getIcon(final RepresentationKind kind) { + Image image = imageRegistry.get(kind.getIcon()); + if (image == null) { + String uri = kind.getIcon(); + if (uri != null) { + try { + ImageDescriptor descriptor = ImageDescriptor.createFromURL(new URL(uri)); + imageRegistry.put(kind.getIcon(), descriptor); + image = imageRegistry.get(kind.getIcon()); + } catch (MalformedURLException e) { + Activator.log.error(e); + } + } + } + return image; + } + + @Override + public void dispose() { + super.dispose(); + imageRegistry.dispose(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/RepresentationKindContentProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/RepresentationKindContentProvider.java new file mode 100644 index 00000000000..9771247f34e --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/kind/RepresentationKindContentProvider.java @@ -0,0 +1,82 @@ +/***************************************************************************** + * Copyright (c) 2010 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: + * Tatiana Fesenko (CEA LIST) - Initial API and implementation + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.wizards.kind; + +import java.util.Collection; +import java.util.Comparator; +import java.util.Set; +import java.util.TreeSet; + +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.papyrus.infra.core.architecture.RepresentationKind; +import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureViewpoint; +import org.eclipse.papyrus.infra.architecture.ArchitectureDomainManager; + +/** + * The ContentProvider for DiagramCategory table. + * Returns available diagram kinds for the given diagram category(ies). + */ +public class RepresentationKindContentProvider implements IStructuredContentProvider { + + /** + * Input changed. + * + * @param viewer + * the viewer + * @param oldInput + * the old input + * @param newInput + * the new input + * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) + */ + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + /** + * Gets the elements. + * + * @param inputElement + * the input element + * @return the elements + * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) + */ + public Object[] getElements(Object inputElement) { + ArchitectureDomainManager manager = ArchitectureDomainManager.getInstance(); + if (inputElement instanceof Object[]) { + Set<RepresentationKind> result = new TreeSet<RepresentationKind>(new Comparator<RepresentationKind>() { + @Override + public int compare(RepresentationKind o1, RepresentationKind o2) { + return o1.getName().compareTo(o2.getName()); + } + }); + for (Object next : (Object[]) inputElement) { + if (next instanceof String) { + String viewpointId = (String) next; + MergedArchitectureViewpoint viewpoint = manager.getArchitectureViewpointById(viewpointId); + result.addAll(viewpoint.getRepresentationKinds()); + } + } + return result.toArray(new Object[result.size()]); + } + if (inputElement instanceof String) { + String viewpointId = (String) inputElement; + MergedArchitectureViewpoint viewpoint = manager.getArchitectureViewpointById(viewpointId); + Collection<RepresentationKind> result = viewpoint.getRepresentationKinds(); + return result.toArray(new Object[result.size()]); + } + return null; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/Messages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/Messages.java index e6286d0e35a..08c380636be 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/Messages.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/Messages.java @@ -60,11 +60,11 @@ public class Messages extends NLS { public static String DiagramCategoryRegistry_bad_class_name_of_category; - public static String DiagramKindComposite_0; + public static String RepresentationKindComposite_0; - public static String DiagramKindComposite_2; + public static String RepresentationKindComposite_2; - public static String DiagramKindComposite_3; + public static String RepresentationKindComposite_3; /** The Diagram kind label provider_undefined_element. */ public static String DiagramKindLabelProvider_undefined_element; @@ -97,52 +97,47 @@ public class Messages extends NLS { /** The Select diagram category page_cannot_find_category. */ - public static String SelectDiagramCategoryPage_cannot_find_category; + public static String SelectArchitectureContextPage_cannot_find_category; /** The Select diagram category page_diagram_language_group. */ - public static String SelectDiagramCategoryPage_diagram_language_group; + public static String SelectArchitectureContextPage_diagram_language_group; /** The Select diagram category page_select_language. */ - public static String SelectDiagramCategoryPage_select_language; + public static String SelectArchitectureContextPage_select_language; /** The Select diagram category page_select_one_category. */ - public static String SelectDiagramCategoryPage_select_one_category; + public static String SelectArchitectureContextPage_select_one_category; - public static String SelectDiagramCategoryPage_umlGroup; - - public static String SelectDiagramCategoryPage_dsmlGroup; - - - public static String SelectDiagramKindPage_0; + public static String SelectRepresentationKindPage_0; /** The Select diagram kind page_default_diagram_name. */ - public static String SelectDiagramKindPage_default_diagram_name; + public static String SelectRepresentationKindPage_default_diagram_name; /** The Select diagram kind page_diagram_name_group. */ - public static String SelectDiagramKindPage_diagram_name_group; + public static String SelectRepresentationKindPage_diagram_name_group; /** The Select diagram kind page_diagram_name_is_empty. */ - public static String SelectDiagramKindPage_diagram_name_is_empty; + public static String SelectRepresentationKindPage_diagram_name_is_empty; /** The Select diagram kind page_load_template_group. */ - public static String SelectDiagramKindPage_load_template_group; + public static String SelectRepresentationKindPage_load_template_group; /** The Select diagram kind page_page_desc. */ - public static String SelectDiagramKindPage_page_desc; + public static String SelectRepresentationKindPage_page_desc; /** The Select diagram kind page_page_title. */ - public static String SelectDiagramKindPage_page_title; + public static String SelectRepresentationKindPage_page_title; /** The Select diagram kind page_remember_current_selection_text. */ - public static String SelectDiagramKindPage_remember_current_selection_text; + public static String SelectRepresentationKindPage_remember_current_selection_text; /** The Select diagram kind page_remember_current_selection_tooltip. */ - public static String SelectDiagramKindPage_remember_current_selection_tooltip; + public static String SelectRepresentationKindPage_remember_current_selection_tooltip; /** The Select diagram kind page_select_kind_group. */ - public static String SelectDiagramKindPage_select_kind_group; + public static String SelectRepresentationKindPage_select_kind_group; - public static String SelectDiagramKindPage_Set_Root_Name_Error; + public static String SelectRepresentationKindPage_Set_Root_Name_Error; public static String ProfileChooserComposite_RegisteredProfilesDialog; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/messages.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/messages.properties index ac436090969..6b98d0f0153 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/messages.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/messages/messages.properties @@ -30,9 +30,9 @@ PapyrusProjectCreationPage_page_null_name_desc=The project's name is undefined, DiagramCategoryRegistry_bad_class_name_of_category=Could not find implementation for a diagram category -DiagramKindComposite_0=Diagram name -DiagramKindComposite_2=Name -DiagramKindComposite_3=Quantity +RepresentationKindComposite_0=Representation name +RepresentationKindComposite_2=Name +RepresentationKindComposite_3=Quantity DiagramKindLabelProvider_undefined_element=<undefined> FileChooser_0=Browse workspace @@ -46,25 +46,23 @@ NewModelFilePage_page_desc=Create a new {0} model NewModelFilePage_page_same_case_desc=There already is a model with this name: NewModelFilePage_set_a_container=Please select a valid container for the new model -SelectDiagramCategoryPage_cannot_find_category=Could not find DiagramCategory for {0} -SelectDiagramCategoryPage_diagram_language_group=Diagram Language: -SelectDiagramCategoryPage_select_language=Select the language of the new diagrams -SelectDiagramCategoryPage_select_one_category=Please select at least one category -SelectDiagramCategoryPage_umlGroup=UML core: -SelectDiagramCategoryPage_dsmlGroup=DSML: +SelectArchitectureContextPage_cannot_find_category=Could not find Architecture Context for {0} +SelectArchitectureContextPage_diagram_language_group=Architecture Context: +SelectArchitectureContextPage_select_language=Select the context of the new representations +SelectArchitectureContextPage_select_one_category=Please select at least one context -SelectDiagramKindPage_0=Choose a profile to apply -SelectDiagramKindPage_default_diagram_name=RootElement -SelectDiagramKindPage_diagram_name_group=Root model element name: -SelectDiagramKindPage_diagram_name_is_empty=The diagram name should not be empty. -SelectDiagramKindPage_load_template_group=You can load a template: -SelectDiagramKindPage_page_desc=Select root element name and diagram kind -SelectDiagramKindPage_page_title=Initialization information -SelectDiagramKindPage_remember_current_selection_text=Remember current selection -SelectDiagramKindPage_remember_current_selection_tooltip=The current selection will be used when you open the wizard next time -SelectDiagramKindPage_select_kind_group=Select a Diagram Kind: -SelectDiagramKindPage_Set_Root_Name_Error=The Root model element name cannot be deduced from the current workspace selection +SelectRepresentationKindPage_0=Choose a profile to apply +SelectRepresentationKindPage_default_diagram_name=RootElement +SelectRepresentationKindPage_diagram_name_group=Root model element name: +SelectRepresentationKindPage_diagram_name_is_empty=The representation name should not be empty. +SelectRepresentationKindPage_load_template_group=You can load a template: +SelectRepresentationKindPage_page_desc=Select root element name and representation kind +SelectRepresentationKindPage_page_title=Initialization information +SelectRepresentationKindPage_remember_current_selection_text=Remember current selection +SelectRepresentationKindPage_remember_current_selection_tooltip=The current selection will be used when you open the wizard next time +SelectRepresentationKindPage_select_kind_group=Select a Representation Kind: +SelectRepresentationKindPage_Set_Root_Name_Error=The Root model element name cannot be deduced from the current workspace selection ProfileChooserComposite_RegisteredProfilesDialog=Registered Profile Selection ProfileChooserComposite_WorkspaceSelectionButton=Browse Workspace diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/NewModelFilePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/NewModelFilePage.java index f06726ac12f..ff2bff0e42a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/NewModelFilePage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/NewModelFilePage.java @@ -110,7 +110,7 @@ public class NewModelFilePage extends WizardNewFileCreationPage { */ public IStatus diagramExtensionChanged(String newExtension) { String currentExtension = getFileExtension(); - if (!currentExtension.equals(newExtension)) { + if (!currentExtension.equals(newExtension) && this.getControl() != null) { // String oldFileName = getFileName(); String newFileName = NewModelFilePage.getUniqueFileName(getContainerFullPath(), getFileName().replace(currentExtension, ""), newExtension); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectArchitectureContextPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectArchitectureContextPage.java new file mode 100644 index 00000000000..7445713c287 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectArchitectureContextPage.java @@ -0,0 +1,252 @@ +/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.uml.diagram.wizards.pages; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureContext; +import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureViewpoint; +import org.eclipse.papyrus.infra.architecture.ArchitectureDomainManager; +import org.eclipse.papyrus.infra.ui.architecture.widgets.ArchitectureContextComposite; +import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages; +import org.eclipse.papyrus.uml.diagram.wizards.utils.SettingsHelper; +import org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Layout; +import org.eclipse.ui.PlatformUI; + +/** + * @author melaasar + * + */ +public class SelectArchitectureContextPage extends WizardPage { + + /** The Constant PAGE_ID. */ + public static final String PAGE_ID = "SelectArchitectureContextPage"; //$NON-NLS-1$ + + private SettingsHelper settingsHelper; + + private final boolean allowSeveralContexts; + + private String[] selectedContexts; + + private String[] selectedViewpoints; + + public SelectArchitectureContextPage() { + this(false); + } + + public SelectArchitectureContextPage(boolean allowSeveralContexts) { + super(PAGE_ID); + setTitle("Select Architecture Context"); + setDescription("Select the architecture context(s) and viewpoints to apply to the Papyrus model"); + this.allowSeveralContexts = allowSeveralContexts; + } + + @Override + public void setWizard(IWizard newWizard) { + super.setWizard(newWizard); + settingsHelper = new SettingsHelper(getDialogSettings()); + + List<String> contextIds = asList(settingsHelper.getArchitectureContexts()); + if (!allowSeveralContexts) { + String defaultContextId = ArchitectureDomainManager.getInstance().getDefaultArchitectureContextId(); + if (defaultContextId != null) + contextIds = asList(defaultContextId); + else if (!contextIds.isEmpty()) + contextIds = asList(contextIds.get(0)); + else + contextIds = Collections.emptyList(); + } + + List<String> viewpoints = new ArrayList<String>(); + for (Iterator<String> i = contextIds.iterator(); i.hasNext();) { + String contextId = i.next(); + if (isVisibleContext(contextId)) { + MergedArchitectureContext context = ArchitectureDomainManager.getInstance().getArchitectureContextById(contextId); + for (MergedArchitectureViewpoint viewpoint : context.getViewpoints()) { + viewpoints.add(viewpoint.getId()); + } + } else + i.remove(); + } + + selectedContexts = contextIds.toArray(new String[0]); + selectedViewpoints = viewpoints.toArray(new String[0]); + } + + private <T> List<T> asList(T... elements) { + List<T> list = new ArrayList<T>(); + for (T element : elements) + list.add(element); + return list; + } + + private boolean isVisibleContext(String contextId) { + for (MergedArchitectureContext context : ArchitectureDomainManager.getInstance().getVisibleArchitectureContexts()) { + if (context.getId().equals(contextId)) + return true; + } + return false; + } + + /** + * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) + * + * @param parent + */ + @Override + public void createControl(Composite parent) { + Composite comp = createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0); + ((GridData) comp.getLayoutData()).widthHint = 350; + createVerticalSpacer(comp, 1); + setControl(comp); + + ArchitectureDomainManager manager = ArchitectureDomainManager.getInstance(); + MergedArchitectureContext[] contexts; + //if (allowSeveralContexts || manager.getDefaultArchitectureContext() == null) + contexts = manager.getVisibleArchitectureContexts().toArray(new MergedArchitectureContext[0]); + //else + //contexts = new ArchitectureContext[] { manager.getDefaultArchitectureContext() }; + + final ArchitectureContextComposite acc = new ArchitectureContextComposite(comp, 1, 1, GridData.FILL_BOTH, 0, 0); + acc.setAllowSeveralContexts(allowSeveralContexts); + acc.setSelectedContexts(selectedContexts); + acc.setSelectedViewpoints(selectedViewpoints); + acc.setInput(contexts); + acc.setUpdater(new ArchitectureContextComposite.Updater() { + @Override + public void update() { + selectedContexts = acc.getSelectedContexts(); + selectedViewpoints = acc.getSelectedViewpoints(); + updateButtons(); + } + }); + updateButtons(); + } + + @Override + public void performHelp() { + PlatformUI.getWorkbench().getHelpSystem().displayHelp("org.eclipse.papyrus.uml.diagram.wizards.Category"); //$NON-NLS-1$ + } + + /** + * Gets the selected architecture contexts. + * + * @return the architecture contexts + */ + public String[] getSelectedContexts() { + return selectedContexts; + } + + /** + * Respond to completion of the wizard. Includes saving settings for the next + * invocation of the wizard. + * + * @since 2.0 + */ + public void performFinish() { + settingsHelper.saveArchitectureContexts(selectedContexts); + } + + public String[] getSelectContexts() { + return selectedContexts; + } + + public String[] getSelectViewpoints() { + return selectedViewpoints; + } + + private void updateButtons() { + setPageComplete(selectedContexts.length!=0 && validatePage()); + } + + /** + * Validate page. + * + * @return true, if successful + */ + protected boolean validatePage() { + setMessage(null); + setErrorMessage(null); + String[] categories = selectedContexts; + if (categories == null || categories.length == 0) { + setErrorMessage(Messages.SelectArchitectureContextPage_select_one_category); + return false; + } + if (!validateFileExtension(categories)) { + return false; + } + + return true; + } + + /** + * Validate file extension. + * + * @param categories + * the categories + * @return true, if successful + */ + protected boolean validateFileExtension(String... contexts) { + IStatus status = ((CreateModelWizard) getWizard()).architectureContextChanged(contexts); + switch (status.getSeverity()) { + case Status.WARNING: + setMessage(status.getMessage(), IMessageProvider.WARNING); + break; + case IStatus.INFO: + setMessage(status.getMessage(), IMessageProvider.INFORMATION); + break; + } + return true; + } + + private static Composite createComposite(Composite parent, int columns, int hspan, int fill, int marginwidth, int marginheight) { + Composite g = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(columns, false); + layout.marginWidth = marginwidth; + layout.marginHeight = marginheight; + g.setLayout(layout); + g.setFont(parent.getFont()); + GridData gd = new GridData(fill); + gd.horizontalSpan = hspan; + g.setLayoutData(gd); + return g; + } + + private static void createVerticalSpacer(Composite parent, int numlines) { + Label lbl = new Label(parent, SWT.NONE); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + Layout layout = parent.getLayout(); + if (layout instanceof GridLayout) { + gd.horizontalSpan = ((GridLayout) parent.getLayout()).numColumns; + } + gd.heightHint = numlines; + lbl.setLayoutData(gd); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramCategoryPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramCategoryPage.java deleted file mode 100644 index d63a662ade0..00000000000 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramCategoryPage.java +++ /dev/null @@ -1,471 +0,0 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2016 CEA LIST, Christian W. Damus, and others.
- *
- *
- * 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:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- * Christian W. Damus - bugs 466850, 490936
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.wizards.pages;
-
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryDescriptor;
-import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryRegistry;
-import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages;
-import org.eclipse.papyrus.uml.diagram.wizards.utils.SettingsHelper;
-import org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
-
-
-/**
- * The Class SelectDiagramCategoryPage.
- */
-public class SelectDiagramCategoryPage extends WizardPage {
-
- /** The my diagram kind buttons. */
- final private List<Button> myDiagramKindButtons = new ArrayList<Button>();
-
- /** The diagram category. */
- private final List<String> mySelectedDiagramCategoryIds = new LinkedList<String>();
-
- /** The most recently selected category, even if multiple selection is permitted. */
- private String lastSelectedCategory;
-
- /** The Constant PAGE_ID. */
- public static final String PAGE_ID = "SelectDiagramCategory"; //$NON-NLS-1$
-
- /** The Constant DEFAULT_EXTENSION. */
- public static final String DEFAULT_EXTENSION = "uml"; //$NON-NLS-1$
-
- /** uml core languages label */
- private static final List<String> umlCore = Arrays.asList("UML", "Profile"); //$NON-NLS-1$ //$NON-NLS-2$
-
- /** The my allow several categories. */
- private final boolean myAllowSeveralCategories;
-
- private SettingsHelper settingsHelper;
-
- private final Collator collator = Collator.getInstance();
-
-
- /**
- * Instantiates a new select diagram category page.
- *
- */
- public SelectDiagramCategoryPage() {
- this(false);
- }
-
- /**
- * Instantiates a new select diagram category page.
- *
- * @param allowSeveralCategories
- * the allow several categories
- */
- public SelectDiagramCategoryPage(boolean allowSeveralCategories) {
- super(PAGE_ID);
- myAllowSeveralCategories = allowSeveralCategories;
- setTitle(Messages.SelectDiagramCategoryPage_select_language);
- }
-
- /**
- * Sets the wizard.
- *
- * @param newWizard
- * the new wizard
- * @see org.eclipse.jface.wizard.WizardPage#setWizard(org.eclipse.jface.wizard.IWizard)
- */
- @Override
- public void setWizard(IWizard newWizard) {
- super.setWizard(newWizard);
- settingsHelper = new SettingsHelper(getDialogSettings());
- String[] defaultDiagramCategory = settingsHelper.getDefaultDiagramCategories();
-
- if (defaultDiagramCategory != null && defaultDiagramCategory.length > 0) {
- String defaultSelection = Arrays.asList(defaultDiagramCategory).contains(DEFAULT_EXTENSION) ? DEFAULT_EXTENSION : defaultDiagramCategory[0];
- if (myAllowSeveralCategories) {
- setDefaultDiagramCategories(defaultDiagramCategory);
- } else {
- String previousSelection = settingsHelper.getPreviousSelection();
- // Retrieves the previous selection or the selects the default behavior
- if (settingsHelper.rememberCurrentSelection(getDialogSettings()) && previousSelection != null) {
- setDefaultDiagramCategories(new String[] { previousSelection });
- } else {
- setDefaultDiagramCategories(new String[] { defaultSelection });
- }
- }
- }
- }
-
- /**
- * Creates the control.
- *
- * @param parent
- * the parent
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public void createControl(Composite parent) {
- Composite plate = new Composite(parent, SWT.NONE);
- plate.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginWidth = 10;
- plate.setLayout(gridLayout);
- setControl(plate);
- createDiagramCategoryForm(plate);
-
- // Bug(466850): Do this later because the new-file page's resource group is not yet created
- plate.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- setPageComplete(validatePage());
- }
- });
- }
-
- @Override
- public void setVisible(boolean visible) {
- super.setVisible(visible);
-
- // re-validate in case the user changed the file name on previous page
- setPageComplete(validatePage());
- }
-
-
- /**
- * Gets the diagram categories.
- *
- * @return the diagram categories
- */
- public String[] getDiagramCategories() {
- return mySelectedDiagramCategoryIds.toArray(new String[mySelectedDiagramCategoryIds.size()]);
- }
-
- /**
- * Sets the default diagram categories.
- *
- * @param categories
- * the new default diagram categories
- */
- protected final void setDefaultDiagramCategories(String[] categories) {
- mySelectedDiagramCategoryIds.clear();
- mySelectedDiagramCategoryIds.addAll(Arrays.asList(categories));
- }
-
-
- /**
- * Validate page.
- *
- * @return true, if successful
- */
- protected boolean validatePage() {
- setMessage(null);
- setErrorMessage(null);
- String[] categories = getDiagramCategories();
- if (categories == null || categories.length == 0) {
- setErrorMessage(Messages.SelectDiagramCategoryPage_select_one_category);
- return false;
- }
- if (!validateFileExtension(categories)) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Validate file extension.
- *
- * @param categories
- * the categories
- * @return true, if successful
- */
- protected boolean validateFileExtension(String... categories) {
- IStatus status = ((CreateModelWizard) getWizard()).diagramCategoryChanged(categories);
- switch (status.getSeverity()) {
- // case Status.ERROR:
- // setErrorMessage(status.getMessage());
- // return false;
- case Status.WARNING:
- setMessage(status.getMessage(), IMessageProvider.WARNING);
- break;
- case IStatus.INFO:
- setMessage(status.getMessage(), IMessageProvider.INFORMATION);
- break;
- }
- return true;
- }
-
- /**
- * Gets the diagram category map.
- *
- * @return the diagram category map
- */
- protected Map<String, DiagramCategoryDescriptor> getDiagramCategoryMap() {
- return DiagramCategoryRegistry.getInstance().getDiagramCategoryMap();
- }
-
- /**
- * Creates the diagram language form.
- *
- * @param composite
- * the composite
- */
- private void createDiagramCategoryForm(Composite composite) {
- Group group = createGroup(composite, Messages.SelectDiagramCategoryPage_diagram_language_group);
-
- // To sort the different languages by name
- collator.setStrength(Collator.SECONDARY);
- Comparator<DiagramCategoryDescriptor> setComparator = new Comparator<DiagramCategoryDescriptor>() {
-
- @Override
- public int compare(DiagramCategoryDescriptor descriptor1, DiagramCategoryDescriptor descriptor2) {
- String button1Data = descriptor1.getLabel();
- String button2Data = descriptor2.getLabel();
- // Special consideration for the UML language as it should always be on top
- if (button2Data.equalsIgnoreCase(DEFAULT_EXTENSION)) {
- return 1;
- } else if (button1Data.equalsIgnoreCase(DEFAULT_EXTENSION)) {
- return -1;
- } else {
- // This if the usual sorting method
- return collator.compare(button1Data, button2Data);
- }
- }
-
- };
- // To store the different languages and display them
- SortedSet<DiagramCategoryDescriptor> descriptorUMLSet = new TreeSet<DiagramCategoryDescriptor>(setComparator);
- SortedSet<DiagramCategoryDescriptor> descriptorDSMLSet = new TreeSet<DiagramCategoryDescriptor>(setComparator);
-
- SelectionListener listener = new SelectionListener() {
-
- private SelectionEvent prevEvent;
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (e == prevEvent) {
- return;
- }
- Button selected = ((Button) e.widget);
- diagramCategorySelected((String) selected.getData(), selected.getSelection());
- setPageComplete(validatePage());
- prevEvent = e;
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- };
-
- for (DiagramCategoryDescriptor diagramCategoryDescriptor : getDiagramCategoryMap().values()) {
- String descriptorLabel = diagramCategoryDescriptor.getLabel();
- if (umlCore.contains(descriptorLabel)) {
- descriptorUMLSet.add(diagramCategoryDescriptor);
- } else {
- descriptorDSMLSet.add(diagramCategoryDescriptor);
- }
- }
-
- if (!descriptorUMLSet.isEmpty()) {
- Label coreLabel = new Label(group, SWT.NONE);
- coreLabel.setText(Messages.SelectDiagramCategoryPage_umlGroup);
- for (DiagramCategoryDescriptor diagramCategoryDescriptor : descriptorUMLSet) {
- Button button = createCategoryButton(diagramCategoryDescriptor, group);
- button.addSelectionListener(listener);
- myDiagramKindButtons.add(button);
- }
- }
-
- if (!descriptorDSMLSet.isEmpty()) {
- Label dsmlLabel = new Label(group, SWT.NONE);
- dsmlLabel.setText(Messages.SelectDiagramCategoryPage_dsmlGroup);
- for (DiagramCategoryDescriptor diagramCategoryDescriptor : descriptorDSMLSet) {
- Button button = createCategoryButton(diagramCategoryDescriptor, group);
- button.addSelectionListener(listener);
- myDiagramKindButtons.add(button);
- }
- }
-
- checkDiagramCategoryButtons();
- // Initialize the first selection upon opening the wizard
- setDefaultSelection(DEFAULT_EXTENSION);
- }
-
- /**
- * Sets the default language selection based on the DEFAULT_EXTENSION parameter
- *
- * @param defaultExtension
- */
- private void setDefaultSelection(String defaultExtension) {
- String previousSelection = settingsHelper.getPreviousSelection();
- String defaultSelection = previousSelection != null ? previousSelection : defaultExtension;
-
- for (Button button : myDiagramKindButtons) {
- if (defaultSelection.equalsIgnoreCase((String) button.getData())) {
- button.setSelection(true);
- diagramCategorySelected(defaultSelection, button.getSelection());
- }
- }
- }
-
- /**
- * Diagram category selected.
- *
- * @param category
- * the category
- * @param checked
- * the checked
- */
- protected void diagramCategorySelected(String category, boolean checked) {
- if (checked) {
- if (!mySelectedDiagramCategoryIds.contains(category)) {
- if (!myAllowSeveralCategories) {
- // Can only have one selection
- mySelectedDiagramCategoryIds.clear();
- }
- mySelectedDiagramCategoryIds.add(category);
- }
- lastSelectedCategory = category;
- } else {
- mySelectedDiagramCategoryIds.remove(category);
- lastSelectedCategory = mySelectedDiagramCategoryIds.isEmpty()
- ? null
- : mySelectedDiagramCategoryIds.get(mySelectedDiagramCategoryIds.size() - 1);
- }
-
- }
-
- /**
- * Check diagram category buttons.
- */
- protected void checkDiagramCategoryButtons() {
- checkButtonsFor(mySelectedDiagramCategoryIds.toArray(new String[mySelectedDiagramCategoryIds.size()]));
- }
-
- /**
- * Check buttons for.
- *
- * @param diagramCategories
- * the diagram categories
- */
- protected void checkButtonsFor(String... diagramCategories) {
- for (Button button : myDiagramKindButtons) {
- button.setSelection(false);
- }
- for (Button button : myDiagramKindButtons) {
- for (String diagramCategory : diagramCategories) {
- if (diagramCategory.equalsIgnoreCase((String) button.getData())) {
- button.setSelection(true);
- }
- }
- }
- }
-
- /**
- * Creates the category button.
- *
- * @param diagramCategoryDescriptor
- * the diagram category descriptor
- * @param group
- * the group
- * @return the button
- */
- private Button createCategoryButton(DiagramCategoryDescriptor diagramCategoryDescriptor, Group group) {
- Button button = new Button(group, myAllowSeveralCategories ? SWT.CHECK : SWT.RADIO);
- button.setText(diagramCategoryDescriptor.getLabel());
- button.setData(diagramCategoryDescriptor.getId());
- Image image = getImage(diagramCategoryDescriptor.getIcon());
- if (image != null) {
- button.setImage(image);
- }
- button.setToolTipText(diagramCategoryDescriptor.getDescription());
- return button;
- }
-
- /**
- * Gets the image.
- *
- * @param imageDescriptor
- * the image descriptor
- * @return the image
- */
- private static Image getImage(ImageDescriptor imageDescriptor) {
- if (imageDescriptor != null) {
- return new Image(null, imageDescriptor.getImageData());
- }
- return null;
- }
-
- /**
- * Creates the group.
- *
- * @param parent
- * the parent
- * @param name
- * the name
- * @return the group
- */
- private static Group createGroup(Composite parent, String name) {
- Group group = new Group(parent, SWT.NONE);
- group.setText(name);
- GridLayout layout = new GridLayout(1, false);
- layout.marginHeight = 5;
- layout.marginWidth = 5;
- group.setLayout(layout);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- group.setLayoutData(data);
- return group;
- }
-
- @Override
- public void performHelp() {
- PlatformUI.getWorkbench().getHelpSystem().displayHelp("org.eclipse.papyrus.uml.diagram.wizards.Category"); //$NON-NLS-1$
-
- }
-
- /**
- * Respond to completion of the wizard. Includes saving settings for the next
- * invocation of the wizard.
- *
- * @since 2.0
- */
- public void performFinish() {
- // Notifies the settings file that the selection has been set and to what
- settingsHelper.setCurrentSelection(lastSelectedCategory);
- settingsHelper.saveRememberCurrentSelection(true);
-
- }
-}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramKindPage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectRepresentationKindPage.java index 90f48ab2ee9..24f81732563 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectDiagramKindPage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/pages/SelectRepresentationKindPage.java @@ -13,7 +13,9 @@ package org.eclipse.papyrus.uml.diagram.wizards.pages; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.IAdaptable; @@ -29,11 +31,13 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.papyrus.commands.CreationCommandRegistry; import org.eclipse.papyrus.commands.ICreationCommandRegistry; -import org.eclipse.papyrus.infra.viewpoints.configuration.Category; -import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; +import org.eclipse.papyrus.infra.core.architecture.RepresentationKind; +import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureContext; +import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureViewpoint; +import org.eclipse.papyrus.infra.architecture.ArchitectureDomainManager; import org.eclipse.papyrus.uml.diagram.wizards.Activator; -import org.eclipse.papyrus.uml.diagram.wizards.kind.DiagramKindComposite; import org.eclipse.papyrus.uml.diagram.wizards.kind.DiagramKindLabelProvider; +import org.eclipse.papyrus.uml.diagram.wizards.kind.RepresentationKindComposite; import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages; import org.eclipse.papyrus.uml.diagram.wizards.profile.ProfileChooserComposite; import org.eclipse.papyrus.uml.diagram.wizards.template.ModelTemplateDescription; @@ -57,7 +61,7 @@ import org.eclipse.uml2.uml.NamedElement; * @author <a href="mailto:jerome.benois@obeo.fr">Jerome Benois</a> * @author Tatiana Fesenko */ -public class SelectDiagramKindPage extends WizardPage { +public class SelectRepresentationKindPage extends WizardPage { /** The Constant PAGE_ID. */ public static final String PAGE_ID = "SelectDiagramKind"; //$NON-NLS-1$ @@ -69,12 +73,12 @@ public class SelectDiagramKindPage extends WizardPage { private SelectModelTemplateComposite selectTemplateComposite; /** the select diagram Kind composite */ - private DiagramKindComposite diagramKindComposite; + private RepresentationKindComposite representationKindComposite; private ProfileChooserComposite profileChooserComposite; /** The my category provider. */ - private final CategoryProvider myCategoryProvider; + private final ViewpointProvider myViewpointProvider; /** The allow templates. */ private final boolean allowTemplates; @@ -90,11 +94,11 @@ public class SelectDiagramKindPage extends WizardPage { /** * Instantiates a new select diagram kind page. * - * @param categoryProvider + * @param viewpointProvider * the category provider */ - public SelectDiagramKindPage(CategoryProvider categoryProvider) { - this(true, categoryProvider, DEFAULT_CREATION_COMMAND_REGISTRY); + public SelectRepresentationKindPage(ViewpointProvider viewpointProvider) { + this(true, viewpointProvider, DEFAULT_CREATION_COMMAND_REGISTRY); } /** @@ -102,17 +106,17 @@ public class SelectDiagramKindPage extends WizardPage { * * @param allowTemplates * the allow templates - * @param categoryProvider + * @param viewpointProvider * the category provider * @param creationCommandRegistry * the creation command registry */ - public SelectDiagramKindPage(boolean allowTemplates, CategoryProvider categoryProvider, ICreationCommandRegistry creationCommandRegistry) { + public SelectRepresentationKindPage(boolean allowTemplates, ViewpointProvider viewpointProvider, ICreationCommandRegistry creationCommandRegistry) { super(PAGE_ID); - setTitle(Messages.SelectDiagramKindPage_page_title); - setDescription(Messages.SelectDiagramKindPage_page_desc); + setTitle(Messages.SelectRepresentationKindPage_page_title); + setDescription(Messages.SelectRepresentationKindPage_page_desc); this.allowTemplates = allowTemplates; - myCategoryProvider = categoryProvider; + myViewpointProvider = viewpointProvider; myCreationCommandRegistry = creationCommandRegistry; } @@ -127,24 +131,24 @@ public class SelectDiagramKindPage extends WizardPage { Composite pageComposite = new Composite(parent, SWT.NONE); pageComposite.setLayout(new GridLayout()); pageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - String[] categories = getDiagramCategories(); + String[] viewpoints = getViewpoints(); Composite nameFormComposite = new Composite(pageComposite, SWT.NONE); nameFormComposite.setLayout(new GridLayout()); nameFormComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); createNameForm(nameFormComposite); - Composite diagramKindComposite = new Composite(pageComposite, SWT.NONE); - diagramKindComposite.setLayout(new GridLayout()); - diagramKindComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - createDiagramKindForm(diagramKindComposite); - this.diagramKindComposite.setInput(categories); + Composite representationKindComposite = new Composite(pageComposite, SWT.NONE); + representationKindComposite.setLayout(new GridLayout()); + representationKindComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + createPresentationKindForm(representationKindComposite); + this.representationKindComposite.setInput(viewpoints); Composite modelTemplateComposite = new Composite(pageComposite, SWT.NONE); modelTemplateComposite.setLayout(new GridLayout()); modelTemplateComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); createModelTemplateComposite(modelTemplateComposite); - fillInTables(categories); + fillInTables(viewpoints); Composite profileChooserComposite = new Composite(pageComposite, SWT.NONE); profileChooserComposite.setLayout(new GridLayout()); @@ -160,7 +164,7 @@ public class SelectDiagramKindPage extends WizardPage { * @param parent */ private void createProfileFileChooser(Composite parent) { - Group group = createGroup(parent, Messages.SelectDiagramKindPage_0); + Group group = createGroup(parent, Messages.SelectRepresentationKindPage_0); profileChooserComposite = new ProfileChooserComposite(group); profileChooserComposite.getTextField().addModifyListener(new ModifyListener() { @@ -197,7 +201,7 @@ public class SelectDiagramKindPage extends WizardPage { public void setVisible(boolean visible) { super.setVisible(visible); if (visible) { - fillInTables(getDiagramCategories()); + fillInTables(getViewpoints()); validatePage(); // Deactivates the viewer if its contained list is empty Combo templateCombo = selectTemplateComposite.getTemplateCombo(); @@ -216,15 +220,15 @@ public class SelectDiagramKindPage extends WizardPage { /** * Fill in tables. * - * @param categories - * the categories + * @param viewpoints + * the viewpoints */ - private void fillInTables(String[] categories) { - if (categories == null || categories.length == 0) { + private void fillInTables(String[] viewpoints) { + if (viewpoints == null || viewpoints.length == 0) { return; } - diagramKindComposite.setInput(categories); - selectTemplateComposite.setInput(categories); + representationKindComposite.setInput(viewpoints); + selectTemplateComposite.setInput(viewpoints); getShell().pack(true); } @@ -267,12 +271,12 @@ public class SelectDiagramKindPage extends WizardPage { } /** - * Gets the diagram category. + * Gets the viewpoints. * - * @return the diagram category + * @return the viewpoint */ - private String[] getDiagramCategories() { - return myCategoryProvider.getCurrentCategories(); + private String[] getViewpoints() { + return myViewpointProvider.getCurrentViewpoints(); } @@ -282,7 +286,7 @@ public class SelectDiagramKindPage extends WizardPage { * @return the new diagram name */ public List<String> getDiagramName() { - return diagramKindComposite.getDiagramName(); + return representationKindComposite.getDiagramName(); } public String getRootElementName() { @@ -299,24 +303,23 @@ public class SelectDiagramKindPage extends WizardPage { } /** - * Gets the selected command descriptors. + * Gets the selected representation kinds for a given viewpoint * - * @param categoryId - * the category id - * @return the selected command descriptors + * @param contextId + * the architecture context id + * @return the selected repersentation kinds */ - public List<ViewPrototype> getSelectedPrototypes(String categoryId) { - ViewPrototype[] selected = getSelectedPrototypes(); - List<ViewPrototype> commands = new ArrayList<ViewPrototype>(); - for (int i = 0; i < selected.length; i++) { - for (Category category : selected[i].getCategories()) { - if (category.getName().equals(categoryId)) { - commands.add(selected[i]); - break; - } - } + public List<RepresentationKind> getSelectedRepresentationKinds(String contextId) { + MergedArchitectureContext context = ArchitectureDomainManager.getInstance().getArchitectureContextById(contextId); + Set<RepresentationKind> allowedKinds = new HashSet<RepresentationKind>(); + for (MergedArchitectureViewpoint viewpoint : context.getViewpoints()) + allowedKinds.addAll(viewpoint.getRepresentationKinds()); + List<RepresentationKind> selectedKinds = new ArrayList<RepresentationKind>(); + for (RepresentationKind kind : getSelectedRepresentationKinds()) { + if (allowedKinds.contains(kind)) + selectedKinds.add(kind); } - return commands; + return selectedKinds; } /** @@ -326,7 +329,7 @@ public class SelectDiagramKindPage extends WizardPage { * the composite */ private void createModelTemplateComposite(Composite composite) { - Group group = createGroup(composite, Messages.SelectDiagramKindPage_load_template_group); + Group group = createGroup(composite, Messages.SelectRepresentationKindPage_load_template_group); selectTemplateComposite = new SelectModelTemplateComposite(group); } @@ -336,9 +339,9 @@ public class SelectDiagramKindPage extends WizardPage { * @param composite * the composite */ - private void createDiagramKindForm(Composite composite) { - Group group = createGroup(composite, Messages.SelectDiagramKindPage_select_kind_group); - diagramKindComposite = new DiagramKindComposite(group); + private void createPresentationKindForm(Composite composite) { + Group group = createGroup(composite, Messages.SelectRepresentationKindPage_select_kind_group); + representationKindComposite = new RepresentationKindComposite(group); } /** @@ -379,10 +382,10 @@ public class SelectDiagramKindPage extends WizardPage { * the composite */ private void createNameForm(Composite composite) { - Group group = createGroup(composite, Messages.SelectDiagramKindPage_diagram_name_group); + Group group = createGroup(composite, Messages.SelectRepresentationKindPage_diagram_name_group); nameText = new Text(group, SWT.BORDER); nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - nameText.setText(Messages.SelectDiagramKindPage_default_diagram_name); + nameText.setText(Messages.SelectRepresentationKindPage_default_diagram_name); ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() > 0) { @@ -407,7 +410,7 @@ public class SelectDiagramKindPage extends WizardPage { } } } catch (Exception e) { - this.setErrorMessage(Messages.SelectDiagramKindPage_Set_Root_Name_Error); + this.setErrorMessage(Messages.SelectRepresentationKindPage_Set_Root_Name_Error); Activator.log.error(e); } } @@ -440,7 +443,7 @@ public class SelectDiagramKindPage extends WizardPage { } else { // Resets the displayed message this.setErrorMessage(null); - this.setMessage(Messages.SelectDiagramKindPage_page_desc); + this.setMessage(Messages.SelectRepresentationKindPage_page_desc); } return true; } @@ -461,9 +464,9 @@ public class SelectDiagramKindPage extends WizardPage { * * @return the selected diagram kind descriptors */ - protected ViewPrototype[] getSelectedPrototypes() { - List<ViewPrototype> checked = diagramKindComposite.getCheckElement(); - ViewPrototype[] result = checked.toArray(new ViewPrototype[checked.size()]); + protected RepresentationKind[] getSelectedRepresentationKinds() { + List<RepresentationKind> checked = representationKindComposite.getCheckElement(); + RepresentationKind[] result = checked.toArray(new RepresentationKind[checked.size()]); return result; } @@ -478,16 +481,16 @@ public class SelectDiagramKindPage extends WizardPage { } /** - * The Interface CategoryProvider. + * The Interface ViewpointProvider. */ - public static interface CategoryProvider { + public static interface ViewpointProvider { /** * Gets the current categories. * * @return the current categories */ - String[] getCurrentCategories(); + String[] getCurrentViewpoints(); } public List<ModelTemplateDescription> getTemplateTransfo() { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/AbstractNewModelStorageProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/AbstractNewModelStorageProvider.java index 57b6f267488..9bb947845ee 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/AbstractNewModelStorageProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/AbstractNewModelStorageProvider.java @@ -18,7 +18,7 @@ import org.eclipse.core.runtime.Status; import org.eclipse.emf.common.ui.URIEditorInput; import org.eclipse.emf.common.util.URI; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectArchitectureContextPage; import org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IFileEditorInput; @@ -33,7 +33,7 @@ public abstract class AbstractNewModelStorageProvider implements INewModelStorag // pass } - public IStatus validateDiagramCategories(String... newCategories) { + public IStatus validateArchitectureContexts(String... newContexts) { return Status.OK_STATUS; } @@ -52,7 +52,7 @@ public abstract class AbstractNewModelStorageProvider implements INewModelStorag return null; } - public SelectDiagramCategoryPage getDiagramCategoryPage() { + public SelectArchitectureContextPage getArchitectureContextPage() { return null; } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/INewModelStorageProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/INewModelStorageProvider.java index 8d9c93a1475..860356a8cf0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/INewModelStorageProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/INewModelStorageProvider.java @@ -17,7 +17,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.common.util.URI; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectArchitectureContextPage; import org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -48,7 +48,7 @@ public interface INewModelStorageProvider { List<? extends IWizardPage> createPages(); - IStatus validateDiagramCategories(String... newCategories); + IStatus validateArchitectureContexts(String... newContexts); /** * Create the URI identifying a new model, as indicated by my wizard page @@ -85,7 +85,7 @@ public interface INewModelStorageProvider { */ ISelectProviderPart createSelectProviderPart(); - SelectDiagramCategoryPage getDiagramCategoryPage(); + SelectArchitectureContextPage getArchitectureContextPage(); // // Nested types diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/NewModelStorageProviderRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/NewModelStorageProviderRegistry.java index 3e0402f268f..b9dacc1501d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/NewModelStorageProviderRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/NewModelStorageProviderRegistry.java @@ -30,7 +30,7 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.papyrus.uml.diagram.wizards.Activator; -import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectArchitectureContextPage; import org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.services.IEvaluationService; @@ -181,8 +181,8 @@ public class NewModelStorageProviderRegistry implements Iterable<NewModelStorage return getInstance().createEditorInput(uri); } - public IStatus validateDiagramCategories(String... newCategories) { - return getInstance().validateDiagramCategories(newCategories); + public IStatus validateArchitectureContexts(String... newContexts) { + return getInstance().validateArchitectureContexts(newContexts); } public ISelectProviderPart createSelectProviderPart() { @@ -200,10 +200,10 @@ public class NewModelStorageProviderRegistry implements Iterable<NewModelStorage } } - public SelectDiagramCategoryPage getDiagramCategoryPage() { - return getInstance().getDiagramCategoryPage(); + public SelectArchitectureContextPage getArchitectureContextPage() { + return getInstance().getArchitectureContextPage(); } - } +} private static final class NullProvider extends AbstractNewModelStorageProvider { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/WorkspaceNewModelStorageProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/WorkspaceNewModelStorageProvider.java index f0c46d56cfd..0594ca88dd4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/WorkspaceNewModelStorageProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/providers/WorkspaceNewModelStorageProvider.java @@ -28,7 +28,7 @@ import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.papyrus.commands.Activator; import org.eclipse.papyrus.uml.diagram.wizards.pages.NewDiagramForExistingModelPage; import org.eclipse.papyrus.uml.diagram.wizards.pages.NewModelFilePage; -import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectArchitectureContextPage; import org.eclipse.papyrus.uml.diagram.wizards.utils.WizardsHelper; import org.eclipse.papyrus.uml.diagram.wizards.wizards.CreateModelWizard; import org.eclipse.papyrus.uml.diagram.wizards.wizards.InitModelWizard; @@ -43,7 +43,7 @@ public class WorkspaceNewModelStorageProvider extends AbstractNewModelStoragePro /** New model file page for the file. */ private NewModelFilePage newModelFilePage; - private SelectDiagramCategoryPage newDiagramCategoryPage; + private SelectArchitectureContextPage newSelectArchitectureContextPage; public WorkspaceNewModelStorageProvider() { super(); @@ -69,33 +69,33 @@ public class WorkspaceNewModelStorageProvider extends AbstractNewModelStoragePro this.wizard = wizard; newModelFilePage = createNewModelFilePage(selection); - newDiagramCategoryPage = createNewDiagramCategoryPage(selection); + newSelectArchitectureContextPage = createNewArchitectureContextPage(selection); } @Override public List<? extends IWizardPage> createPages() { - if (newModelFilePage == null && newDiagramCategoryPage == null) { + if (newModelFilePage == null && newSelectArchitectureContextPage == null) { return Collections.emptyList(); } - return Arrays.asList(newDiagramCategoryPage, newModelFilePage); + return Arrays.asList(newSelectArchitectureContextPage, newModelFilePage); } @Override - public IStatus validateDiagramCategories(String... newCategories) { + public IStatus validateArchitectureContexts(String... newContexts) { if (newModelFilePage != null) { - String firstCategory = newCategories.length > 0 ? newCategories[0] : null; - if (newCategories.length > 0) { + String firstContext = newContexts.length > 0 ? newContexts[0] : null; + if (newContexts.length > 0) { // 316943 - [Wizard] Wrong suffix for file name when creating a // profile model - return newModelFilePage.diagramExtensionChanged(wizard.getDiagramFileExtension(firstCategory)); + return newModelFilePage.diagramExtensionChanged(wizard.getDiagramFileExtension(firstContext)); } } - return super.validateDiagramCategories(newCategories); + return super.validateArchitectureContexts(newContexts); } /** @@ -152,18 +152,16 @@ public class WorkspaceNewModelStorageProvider extends AbstractNewModelStoragePro // return (newFile == null) ? null : } - private SelectDiagramCategoryPage createNewDiagramCategoryPage(IStructuredSelection selection) { + private SelectArchitectureContextPage createNewArchitectureContextPage(IStructuredSelection selection) { if (wizard.isCreateProjectWizard() || wizard.isCreateMultipleModelsWizard() || !wizard.isPapyrusRootWizard()) { - return null; } - return new SelectDiagramCategoryPage(); + return new SelectArchitectureContextPage(); } @Override - public SelectDiagramCategoryPage getDiagramCategoryPage() { - return this.newDiagramCategoryPage; + public SelectArchitectureContextPage getArchitectureContextPage() { + return this.newSelectArchitectureContextPage; } - } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/utils/SettingsHelper.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/utils/SettingsHelper.java index 1f28d479a92..c0784feb83a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/utils/SettingsHelper.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/utils/SettingsHelper.java @@ -1,216 +1,56 @@ -/*****************************************************************************
- * Copyright (c) 2014 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:
- * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation
- *****************************************************************************/
-
-package org.eclipse.papyrus.uml.diagram.wizards.utils;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-
-
-public class SettingsHelper {
-
- /** The Constant DIAGRAM_KIND_SEPARATOR. */
- private static final String DIAGRAM_KIND_SEPARATOR = ","; //$NON-NLS-1$
-
- /** The Constant TEMPLATE_SEPARATOR. */
- private static final String TEMPLATE_SEPARATOR = ","; //$NON-NLS-1$
-
- /** The Constant SETTINGS_KEY_REMEMBER_CURRENT_SELECTION. */
- private static final String SETTINGS_KEY_REMEMBER_CURRENT_SELECTION = "RememberCurrentSelection"; //$NON-NLS-1$
-
- /** The Constant SETTINGS_KEY_DIAGRAM_KINDS. */
- private static final String SETTINGS_KEY_DIAGRAM_KINDS = "DiagramKindsFor_"; //$NON-NLS-1$
-
- /** The Constant SETTINGS_KEY_DIAGRAM_TEMPLATES. */
- private static final String SETTINGS_KEY_DIAGRAM_TEMPLATES = "DiagramTemplatesFor_"; //$NON-NLS-1$
-
- /** The Constant LAST_SELECTED_CATEGORY. */
- private static final String DIAGRAM_CATEGORIES = "diagramCategory"; //$NON-NLS-1$
-
- /** The Constant used to access the last selected category */
- private static final String SETTINGS_KEY_DIAGRAM_CATEGORY = "lastSelectedCategory"; //$NON-NLS-1$
-
- /** The my settings. */
- private final IDialogSettings mySettings;
-
- /**
- * Instantiates a new settings utils.
- *
- * @param settings
- * the settings
- */
- public SettingsHelper(IDialogSettings settings) {
- mySettings = settings;
- }
-
- /**
- * Gets the default diagram category.
- *
- * @return the default diagram category
- */
- public String[] getDefaultDiagramCategories() {
- return mySettings.getArray(DIAGRAM_CATEGORIES);
- }
-
- /**
- * Save default diagram category.
- *
- * @param categories
- * the categories
- */
- public void saveDefaultDiagramCategory(String[] categories) {
- mySettings.put(DIAGRAM_CATEGORIES, categories);
- }
-
- /**
- * Gets the default diagram kinds.
- *
- * @param category
- * the category
- * @return the default diagram kinds
- */
- public List<String> getDefaultDiagramKinds(String category) {
- String csl = mySettings.get(getKeyForDiagramKind(category));
- if (csl == null || csl.equals("")) { //$NON-NLS-1$
- return Collections.emptyList();
- }
- List<String> result = new ArrayList<String>();
- StringTokenizer tokenizer = new StringTokenizer(csl, DIAGRAM_KIND_SEPARATOR);
- while (tokenizer.hasMoreTokens()) {
- result.add(tokenizer.nextToken().trim());
- }
- return result;
- }
-
- /**
- * Save default diagram kinds.
- *
- * @param category
- * the category
- * @param kinds
- * the kinds
- */
- public void saveDefaultDiagramKinds(String category, List<String> kinds) {
- String value = ""; //$NON-NLS-1$
- for (String kind : kinds) {
- value += kind;
- value += DIAGRAM_KIND_SEPARATOR;
- }
- mySettings.put(getKeyForDiagramKind(category), value);
- }
-
- /**
- * Gets the default templates.
- *
- * @param category
- * the category
- * @return the default templates
- */
- public List<String> getDefaultTemplates(String category) {
- String csl = mySettings.get(getKeyForTemplate(category));
- if (csl == null || csl.equals("")) { //$NON-NLS-1$
- return Collections.emptyList();
- }
- List<String> result = new ArrayList<String>();
- StringTokenizer tokenizer = new StringTokenizer(csl, TEMPLATE_SEPARATOR);
- while (tokenizer.hasMoreTokens()) {
- result.add(tokenizer.nextToken().trim());
- }
- return result;
- }
-
- /**
- * Save default templates.
- *
- * @param category
- * the category
- * @param templates
- * the templates
- */
- public void saveDefaultTemplates(String category, List<String> templates) {
- String value = ""; //$NON-NLS-1$
- for (String template : templates) {
- value += template;
- value += TEMPLATE_SEPARATOR;
- }
- mySettings.put(getKeyForTemplate(category), value);
- }
-
- /**
- * Save remember current selection.
- *
- * @param remember
- * the remember
- */
- public void saveRememberCurrentSelection(boolean remember) {
- mySettings.put(SETTINGS_KEY_REMEMBER_CURRENT_SELECTION, remember);
- }
-
- /**
- * Remember current selection.
- *
- * @param settings
- * the settings
- * @return true, if successful
- */
- public boolean rememberCurrentSelection(IDialogSettings settings) {
- return mySettings.getBoolean(SETTINGS_KEY_REMEMBER_CURRENT_SELECTION);
- }
-
- /**
- * Puts the most recently selected category tag in the settings to retrieve it on the next execution
- *
- * @param category
- * The language tag
- */
- public void setCurrentSelection(String category) {
- mySettings.put(SETTINGS_KEY_DIAGRAM_CATEGORY, category);
- }
-
- /**
- * Retrieves the most recently selected category tag from the settings
- *
- * @return
- * The category tag
- */
- public String getPreviousSelection() {
- return mySettings.get(SETTINGS_KEY_DIAGRAM_CATEGORY);
- }
-
-
- /**
- * Gets the key for diagram kind.
- *
- * @param category
- * the category
- * @return the key for diagram kind
- */
- private String getKeyForDiagramKind(String category) {
- return SETTINGS_KEY_DIAGRAM_KINDS + category;
- }
-
- /**
- * Gets the key for template.
- *
- * @param category
- * the category
- * @return the key for template
- */
- private String getKeyForTemplate(String category) {
- return SETTINGS_KEY_DIAGRAM_TEMPLATES + category;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2014 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: + * Thibault Le Ouay (Sherpa Engineering) t.leouay@sherpa-eng.com - Initial API and implementation + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.wizards.utils; + +import org.eclipse.jface.dialogs.IDialogSettings; + + +public class SettingsHelper { + + /** The Constant ARCHITECTURE_CONTEXTS. */ + private static final String ARCHITECTURE_CONTEXTS = "architectureContexts"; //$NON-NLS-1$ + + /** The my settings. */ + private final IDialogSettings mySettings; + + /** + * Instantiates a new settings utils. + * + * @param settings + * the settings + */ + public SettingsHelper(IDialogSettings settings) { + mySettings = settings; + } + + /** + * Gets the saved architecture contexts. + * + * @return the saved architecture contexts + */ + public String[] getArchitectureContexts() { + String[] contexts = mySettings.getArray(ARCHITECTURE_CONTEXTS); + return (contexts != null) ? contexts : new String[0]; + } + + /** + * Save the given architecture contexts. + * + * @param contexts + * the architecture contexts + */ + public void saveArchitectureContexts(String[] contexts) { + mySettings.put(ARCHITECTURE_CONTEXTS, contexts); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateModelWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateModelWizard.java index e58e8608847..fb9c9c50299 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateModelWizard.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateModelWizard.java @@ -1,966 +1,1001 @@ -/*******************************************************************************
- * Copyright (c) 2008, 2016 Obeo, CEA LIST, Christian W. Damus, and others.
- * 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:
- * Obeo - initial API and implementation
- * Tatiana Fesenko(CEA) - [313179] Refactor CreateModelWizard
- * Saadia Dhouib (CEA LIST) - Implementation of loading diagrams from template files (.uml, .di , .notation)
- * Christian W. Damus (CEA) - create models by URI, not IFile (CDO)
- * Christian W. Damus (CEA) - Support creating models in repositories (CDO)
- * Christian W. Damus - bug 490936
- *
- *******************************************************************************/
-package org.eclipse.papyrus.uml.diagram.wizards.wizards;
-
-import static org.eclipse.papyrus.uml.diagram.wizards.Activator.log;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.emf.common.command.CommandStack;
-import org.eclipse.emf.common.ui.URIEditorInput;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModelUtils;
-import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
-import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand;
-import org.eclipse.papyrus.infra.ui.util.EditorUtils;
-import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
-import org.eclipse.papyrus.uml.diagram.wizards.Activator;
-import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryDescriptor;
-import org.eclipse.papyrus.uml.diagram.wizards.category.DiagramCategoryRegistry;
-import org.eclipse.papyrus.uml.diagram.wizards.command.InitFromTemplateCommand;
-import org.eclipse.papyrus.uml.diagram.wizards.command.NewPapyrusModelCommand;
-import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.NewModelFilePage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.PapyrusProjectCreationPage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage.CategoryProvider;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectStorageProviderPage;
-import org.eclipse.papyrus.uml.diagram.wizards.providers.INewModelStorageProvider;
-import org.eclipse.papyrus.uml.diagram.wizards.providers.NewModelStorageProviderRegistry;
-import org.eclipse.papyrus.uml.diagram.wizards.providers.WorkspaceNewModelStorageProvider;
-import org.eclipse.papyrus.uml.diagram.wizards.template.ModelTemplateDescription;
-import org.eclipse.papyrus.uml.diagram.wizards.transformation.IGenerator;
-import org.eclipse.papyrus.uml.tools.commands.ApplyProfileCommand;
-import org.eclipse.papyrus.uml.tools.commands.RenameElementCommand;
-import org.eclipse.papyrus.uml.tools.model.UmlModel;
-import org.eclipse.papyrus.uml.tools.model.UmlUtils;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IURIEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.ui.services.IEvaluationService;
-import org.eclipse.uml2.uml.NamedElement;
-import org.eclipse.uml2.uml.Profile;
-
-/**
- * Create new model file and initialize a selected diagram. This wizard create
- * several files :
- * <li>*.di : the DI file to store Di diagrams and references all external diagrams like GMF diagrams.</li>
- * <li>*.notation : the file to store pure GMF diagrams</li>
- * <li>*.uml : the standard UML file to store UML semantics elements. (Model,
- * Package, Class,...)</li>
- *
- * Those files can be used with the PapyrusEditor (see plugin.xml).
- */
-public class CreateModelWizard extends Wizard implements INewWizard {
-
- /** The Constant WIZARD_ID. */
- public static final String WIZARD_ID = "org.eclipse.papyrus.uml.diagram.wizards.createmodel"; //$NON-NLS-1$
-
- /** The Constant NEW_MODEL_SETTINGS. */
- public static final String NEW_MODEL_SETTINGS = "NewModelWizard"; //$NON-NLS-1$
-
- private SelectStorageProviderPage selectStorageProviderPage;
-
- /** Select kind of new diagram the wizard must create. */
- private SelectDiagramKindPage selectDiagramKindPage;
-
- /** The select diagram category page. */
- protected SelectDiagramCategoryPage selectDiagramCategoryPage;
-
- /** Current workbench. */
- private IWorkbench workbench;
-
- private NewModelStorageProviderRegistry storageProviderRegistry;
-
- private INewModelStorageProvider selectedStorageProvider;
-
- private Map<INewModelStorageProvider, List<IWizardPage>> providerPages = new java.util.HashMap<INewModelStorageProvider, List<IWizardPage>>();
-
- private Map<IWizardPage, INewModelStorageProvider> providersByPage = new java.util.HashMap<IWizardPage, INewModelStorageProvider>();
-
- private int startProviderPageIndex; // index of last page before provider pages
-
- private int endProviderPageIndex; // index of first page after provider pages
-
- protected IWizardPage newProjectPage;
-
- protected static final String EXTENSION_POINT_ID = "org.eclipse.papyrus.uml.diagram.wizards.templates"; //$NON-NLS-1$
-
- /**
- * Instantiates a new creates the model wizard.
- */
- public CreateModelWizard() {
- super();
- setWindowTitle(Messages.CreateModelWizard_new_papyrus_model_title);
- setDefaultPageImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/papyrus/PapyrusWizban_75x66.gif")); //$NON-NLS-1$
- // setHelpAvailable(true);
-
- }
-
- /**
- * Adds the pages.
- *
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- // ModelCreation: the selectDiagramCategoryPage exists
- if (selectedStorageProvider.getDiagramCategoryPage() == null) {
- addPageIfNotNull(selectDiagramCategoryPage);
- } else {
- addPageIfNotNull(selectedStorageProvider.getDiagramCategoryPage());
- }
-
- // The selectStorageProviderPage is only set if a model is created, cf initStorageProvider(IWorkbench, IStructuredSelection)
- // The storage page for a project, newProjectPage, is handled by the PapyrusProjectCreationPage
- addPageIfNotNull(selectStorageProviderPage);
- addPageIfNotNull(newProjectPage);
-
- startProviderPageIndex = getPageCount() - 1;
- for (INewModelStorageProvider next : getStorageProviders()) {
- List<IWizardPage> pageList = new java.util.ArrayList<IWizardPage>(3);
- for (IWizardPage page : next.createPages()) {
- if (page != null) {
- pageList.add(page);
- providersByPage.put(page, next);
- if (!page.equals(selectedStorageProvider.getDiagramCategoryPage())) {
- addPage(page);
- }
- }
- }
- providerPages.put(next, pageList);
- }
- endProviderPageIndex = getPageCount();
-
- addPageIfNotNull(selectDiagramKindPage);
- }
-
- protected void setNewProjectPage(IWizardPage page) {
- this.newProjectPage = page;
- }
-
- /**
- * Adds the page if not null.
- *
- * @param page
- * the page
- */
- protected final void addPageIfNotNull(IWizardPage page) {
- if (page != null) {
- addPage(page);
- }
- }
-
- public boolean isInitModelWizard() {
- return false;
- }
-
- public boolean isCreateProjectWizard() {
- return false;
- }
-
- public boolean isCreateMultipleModelsWizard() {
- return false;
- }
-
- /**
- * Inits the.
- *
- * @param workbench
- * the workbench
- * @param selection
- * the selection {@inheritDoc}
- */
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- this.workbench = workbench;
-
- initStorageProvider(workbench, selection);
-
- IDialogSettings workbenchSettings = Activator.getDefault().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection(NEW_MODEL_SETTINGS);
- if (section == null) {
- section = workbenchSettings.addNewSection(NEW_MODEL_SETTINGS);
- }
- setDialogSettings(section);
-
- selectStorageProviderPage = createSelectStorageProviderPage();
-
- for (INewModelStorageProvider next : getStorageProviders()) {
- next.init(this, selection);
- }
-
- selectDiagramKindPage = createSelectDiagramKindPage();
- }
-
- /**
- * Perform finish.
- *
- * @return true, if successful {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- String[] diagramCategoryIds = getDiagramCategoryIds();
- if (diagramCategoryIds.length == 0) {
- return false;
- }
-
- SelectDiagramCategoryPage selectDiagramCategoryPage = getSelectDiagramCategoryPage();
- if (selectDiagramCategoryPage != null) {
- selectDiagramCategoryPage.performFinish();
- }
-
- String diagramCategoryId = diagramCategoryIds[0];
- final URI newURI = createNewModelURI(diagramCategoryId);
-
- createAndOpenPapyrusModel(newURI, diagramCategoryId);
-
- return true;
- }
-
- protected URI createNewModelURI(String diagramCategoryID) {
- return getSelectedStorageProvider().createNewModelURI(diagramCategoryID);
- }
-
- /**
- * Creates the and open papyrus model.
- *
- * @param modelSet
- * the di resource set
- * @param newURI
- * the URI of the new model's principal resource
- * @param diagramCategoryId
- * the diagram category id
- * @return true, if successful
- */
- protected boolean createAndOpenPapyrusModel(URI newURI, String diagramCategoryId) {
-
- if (newURI == null) {
- return false;
- }
-
- ServicesRegistry registry = createServicesRegistry();
- if (registry == null) {
- return false;
- }
-
- try {
- // have to create the model set and populate it with the DI model
- // before initializing other services that actually need the DI
- // model, such as the SashModel Manager service
- ModelSet modelSet = registry.getService(ModelSet.class);
-
- createPapyrusModels(modelSet, newURI);
-
- initServicesRegistry(registry);
-
- initDomainModel(modelSet, newURI, diagramCategoryId);
-
- initDiagramModel(modelSet, diagramCategoryId);
-
- initProfile(modelSet);
-
- initTemplate(modelSet);
-
- saveDiagram(modelSet);
-
- openDiagram(newURI);
-
- } catch (ServiceException e) {
- Activator.log.error(e);
- this.selectDiagramKindPage.setErrorMessage(e.getMessage());
- return false;
-
- } finally {
- try {
- registry.disposeRegistry();
- } catch (ServiceException ex) {
- // Ignore
- }
- }
-
- return true;
- }
-
- private void initProfile(ModelSet modelSet) {
- boolean isToApplyProfile = selectDiagramKindPage.getProfileURI() != null;
- boolean isProfileDefined = selectDiagramKindPage.getProfileDefinitionStatus().isOK();
- if (isToApplyProfile & isProfileDefined) {
- applyProfile(modelSet);
- }
- }
-
- private void initTemplate(ModelSet modelSet) {
- boolean isToInitFromTemplateTransfo = selectDiagramKindPage.getTemplateTransfo().size() > 0;
- if (isToInitFromTemplateTransfo) {
- applyTemplateTransfo(modelSet);
- }
- }
-
- protected ServicesRegistry createServicesRegistry() {
- ServicesRegistry result = null;
-
- try {
- result = new ExtensionServicesRegistry(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID);
- } catch (ServiceException e) {
- // couldn't create the registry? Fatal problem
- Activator.log.error(e);
- }
-
- try {
- // have to create the model set and populate it with the DI model
- // before initializing other services that actually need the DI
- // model, such as the SashModel Manager service
- result.startServicesByClassKeys(ModelSet.class);
- } catch (ServiceException ex) {
- // Ignore this exception: some services may not have been loaded,
- // which is probably normal at this point
- }
-
- return result;
- }
-
- protected void initServicesRegistry(ServicesRegistry registry) throws ServiceException {
- try {
- registry.startRegistry();
- } catch (ServiceException ex) {
- // Ignore this exception: some services may not have been loaded,
- // which is probably normal at this point
- }
-
- registry.getService(IPageManager.class);
- }
-
- /**
- * Gets the diagram category ids.
- *
- * @return the diagram category ids
- */
- protected String[] getDiagramCategoryIds() {
- SelectDiagramCategoryPage page = getSelectDiagramCategoryPage();
- if (page != null) {
- return page.getDiagramCategories();
- }
- return null;
- }
-
- private SelectDiagramCategoryPage getSelectDiagramCategoryPage() {
- return (selectDiagramCategoryPage != null)
- ? selectDiagramCategoryPage
- : (selectedStorageProvider != null)
- ? selectedStorageProvider.getDiagramCategoryPage()
- : null;
- }
-
- /**
- * Gets the diagram file extension.
- *
- * @param diagramCategoryId
- * the diagram category id
- * @return the diagram file extension
- */
- public String getDiagramFileExtension(String diagramCategoryId) {
- return getDiagramFileExtension(diagramCategoryId, NewModelFilePage.DEFAULT_DIAGRAM_EXTENSION);
- }
-
- /**
- * Gets the diagram file extension.
- *
- * @param categoryId
- * the category id
- * @param defaultExtension
- * the default extension
- * @return the diagram file extension
- */
- public String getDiagramFileExtension(String categoryId, String defaultExtension) {
- DiagramCategoryDescriptor diagramCategory = getDiagramCategoryMap().get(categoryId);
- String extensionPrefix = diagramCategory != null ? diagramCategory.getExtensionPrefix() : null;
- return (extensionPrefix != null) ? extensionPrefix + "." + defaultExtension : defaultExtension; //$NON-NLS-1$
- }
-
- /**
- * Creates the select diagram category page.
- *
- * @return the select diagram category page
- */
- protected SelectDiagramCategoryPage createSelectDiagramCategoryPage() {
- return new SelectDiagramCategoryPage();
- }
-
- /**
- * Creates the select diagram kind page.
- *
- * @return the select diagram kind page
- */
- protected SelectDiagramKindPage createSelectDiagramKindPage() {
- return new SelectDiagramKindPage(new CategoryProvider() {
-
- @Override
- public String[] getCurrentCategories() {
- return getDiagramCategoryIds();
- }
-
- });
- }
-
- /**
- * Inits the domain model.
- *
- * @param modelSet
- * the di resource set
- * @param newURI
- * the URI of the new model's principal resource
- * @param diagramCategoryId
- * the diagram category id
- */
- protected void initDomainModel(ModelSet modelSet, final URI newURI, String diagramCategoryId) {
-
- boolean isToInitFromTemplate = selectDiagramKindPage.getTemplatePath() != null;
- if (isToInitFromTemplate) {
- initDomainModelFromTemplate(modelSet);
- } else {
- createEmptyDomainModel(modelSet, diagramCategoryId);
- }
- }
-
- protected void applyProfile(ModelSet modelSet) {
- String profilePath = selectDiagramKindPage.getProfileURI();
- Resource resource = modelSet.getResource(URI.createURI(profilePath), true);
- Profile profileToApply = (Profile) resource.getContents().get(0);
-
- Resource myModelUMLResource = UmlUtils.getUmlResource(modelSet);
- org.eclipse.uml2.uml.Package manipulatedModel = (org.eclipse.uml2.uml.Package) myModelUMLResource.getContents().get(0);
-
- RecordingCommand applyProfileCommand = new ApplyProfileCommand(manipulatedModel, profileToApply, modelSet.getTransactionalEditingDomain());
- getCommandStack(modelSet).execute(applyProfileCommand);
- }
-
- protected void applyTemplateTransfo(ModelSet modelSet) {
- List<ModelTemplateDescription> templateList = selectDiagramKindPage.getTemplateTransfo();
- // // This is an example of the use of QVT Transformations
- // QVToGenerator generator = new QVToGenerator();
- //
- // for (final ModelTemplateDescription currentTemplate : templateList) {
- // // fetches the tranformation URI encoded in the extension point, if it has that attribute
- // // generator.setTransformationURI(URI.createPlatformPluginURI("org.eclipse.papyrus.uml.diagram.wizards/transforms/UMLCopyTemplateTransfo.qvto", true));//$NON-NLS-1$
- // generator.setTransformationURI(URI.createPlatformPluginURI(currentTemplate.getTransfoURI(), true));
- // generator.setModelSet(modelSet);
- // generator.setTemplateModel(currentTemplate.getUml_path());
- // generator.setPluginId(currentTemplate.getPluginId());
- // generator.execute();
- // }
-
- // This is an example of transformations without using the QVToGenerator
- // TODO make it prettier
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- // get all the extensions configured into the extension point corresponding to the 'templates' Point ID from the 'org.eclipse.papyrus.uml.diagram.wizards' plugin
- IExtension[] extensions = registry.getExtensionPoint(EXTENSION_POINT_ID).getExtensions();
-
- for (IExtension extension : extensions) {
- for (IConfigurationElement configElement : extension.getConfigurationElements()) {
- if ("template".equals(configElement.getName())) { //$NON-NLS-1$
- // not handled here
- } else if ("transformation".equals(configElement.getName())) { //$NON-NLS-1$
- for (ModelTemplateDescription currentTemplate : templateList) {
- if (currentTemplate.getName().equals(configElement.getAttribute("name"))) { //$NON-NLS-1$
- IGenerator iGenerator;
- try {
- iGenerator = (IGenerator) configElement.createExecutableExtension("Transformation"); //$NON-NLS-1$
- iGenerator.setModelSet(modelSet);
- iGenerator.execute();
- } catch (CoreException e) {
- Activator.log.error(e);
- }
- }
- }
-
- }
- }
- }
-
- }
-
- /**
- * Inits the domain model from template.
- *
- * @param modelSet
- * the di resource set
- */
- protected void initDomainModelFromTemplate(ModelSet modelSet) {
- getCommandStack(modelSet).execute(
- new InitFromTemplateCommand(modelSet.getTransactionalEditingDomain(), modelSet, selectDiagramKindPage.getTemplatePluginId(), selectDiagramKindPage.getTemplatePath(), selectDiagramKindPage.getNotationTemplatePath(), selectDiagramKindPage
- .getDiTemplatePath()));
- }
-
- /**
- * Creates the empty domain model.
- *
- * @param modelSet
- * the di resource set
- * @param diagramCategoryId
- * the diagram category id
- */
- protected void createEmptyDomainModel(ModelSet modelSet, String diagramCategoryId) {
- try {
- IModelCreationCommand creationCommand = getDiagramCategoryMap().get(diagramCategoryId).getCommand();
- creationCommand.createModel(modelSet);
- } catch (BackboneException e) {
- log.error(e);
- }
- }
-
- /**
- * Creates the papyrus models.
- *
- * @param modelSet
- * the di resource set
- * @param newURI
- * the URI of the new model's principal resource
- */
- protected void createPapyrusModels(ModelSet modelSet, URI newURI) {
- RecordingCommand command = new NewPapyrusModelCommand(modelSet, newURI);
- getCommandStack(modelSet).execute(command);
- }
-
-
- /**
- * Open diagram.
- *
- * @param newURI
- * the URI of the new model's principal resource
- */
- protected void openDiagram(final URI newURI) {
- IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
- if (page != null) {
- try {
- IEditorInput editorInput = createEditorInput(newURI);
- IDE.openEditor(page, editorInput, getPreferredEditorID(editorInput), true);
- } catch (PartInitException e) {
- log.error(e);
- }
- }
- }
-
- protected IEditorInput createEditorInput(URI uri) {
- return getSelectedStorageProvider().createEditorInput(uri);
- }
-
- protected String getPreferredEditorID(IEditorInput input) throws PartInitException {
- IEditorDescriptor desc;
-
- if (input instanceof IFileEditorInput) {
- desc = IDE.getEditorDescriptor(((IFileEditorInput) input).getFile());
- } else {
- // try to get a URI
- URI uri = null;
- if (input instanceof IURIEditorInput) {
- uri = URI.createURI(((IURIEditorInput) input).getURI().toString(), true);
- } else if (input instanceof URIEditorInput) {
- uri = ((URIEditorInput) input).getURI();
- }
-
- if (uri != null) {
- desc = IDE.getEditorDescriptor(uri.lastSegment());
- } else {
- // hope that the input name is the file name
- desc = IDE.getEditorDescriptor(input.getName());
- }
- }
-
- return (desc == null) ? "org.eclipse.papyrus.infra.core.papyrusEditor" : desc.getId(); //$NON-NLS-1$
- }
-
- /**
- * Inits the diagram model.
- *
- * @param modelSet
- * the di resource set
- * @param categoryId
- * the category id
- */
- protected void initDiagramModel(ModelSet modelSet, String categoryId) {
- initDiagrams(modelSet, categoryId);
- }
-
-
- /**
- * Save diagram.
- *
- * @param modelSet
- * the di resource set
- */
- private void saveDiagram(ModelSet modelSet) {
- // TODO verify that there are no conflicts with the existing files and the newly created one
- try {
- modelSet.save(new NullProgressMonitor());
- } catch (IOException e) {
- log.error(e);
- }
- }
-
- /**
- * Inits the diagrams.
- *
- * @param modelSet
- * the di resource set
- * @param categoryId
- * the category id
- */
- protected void initDiagrams(ModelSet modelSet, String categoryId) {
- initDiagrams(modelSet, null, categoryId);
- }
-
- /**
- * Inits the diagrams.
- *
- * @param resourceSet
- * the resource set
- * @param root
- * the root
- * @param categoryId
- * the category id
- */
- protected void initDiagrams(ModelSet resourceSet, EObject root, String categoryId) {
- UmlModel model = (UmlModel) resourceSet.getModel(UmlModel.MODEL_ID);
- EList<EObject> roots = model.getResource().getContents();
- if (!roots.isEmpty()) {
- root = roots.get(0);
- if (root instanceof NamedElement) {
- getCommandStack(resourceSet).execute(new RenameElementCommand(resourceSet.getTransactionalEditingDomain(), (NamedElement) root, getRootElementName()));
-
- }
-
- }
- List<ViewPrototype> creationCommands = getPrototypesFor(categoryId);
- List<String> diagramName = selectDiagramKindPage.getDiagramName();
- if (creationCommands.isEmpty()) {
- createEmptyDiagramEditor(resourceSet);
- } else {
- for (int i = 0; i < creationCommands.size(); i++) {
- creationCommands.get(i).instantiateOn(root, diagramName.get(i));
- }
- }
- }
-
- /**
- * Gets the diagram kinds for.
- *
- * @param categoryId
- * the category id
- * @return the diagram kinds for
- */
- protected List<ViewPrototype> getPrototypesFor(String categoryId) {
- return selectDiagramKindPage.getSelectedPrototypes(categoryId);
- }
-
-
- protected List<String> getDiagramNames() {
- return selectDiagramKindPage.getDiagramName();
- }
-
- protected String getRootElementName() {
- return selectDiagramKindPage.getRootElementName();
- }
-
- /**
- * Creates the empty diagram editor.
- *
- * @param modelSet
- * the model set
- */
- private void createEmptyDiagramEditor(ModelSet modelSet) {
- // Create an empty editor (no diagrams opened)
- // Geting an IPageMngr is enough to initialize the
- // SashSystem.
- EditorUtils.getIPageMngr(DiModelUtils.getDiResource(modelSet));
- }
-
- /**
- * Gets the command stack.
- *
- * @param modelSet
- * the model set
- * @return the command stack
- */
- protected final CommandStack getCommandStack(ModelSet modelSet) {
- return modelSet.getTransactionalEditingDomain().getCommandStack();
- }
-
- /**
- * Gets the diagram category map.
- *
- * @return the diagram category map
- */
- protected Map<String, DiagramCategoryDescriptor> getDiagramCategoryMap() {
- return DiagramCategoryRegistry.getInstance().getDiagramCategoryMap();
- }
-
- /**
- * Diagram category changed.
- *
- * @param newCategories
- * the new categories
- * @return the i status
- */
- public IStatus diagramCategoryChanged(String... newCategories) {
- return getSelectedStorageProvider().validateDiagramCategories(newCategories);
- }
-
- protected void initStorageProvider(IWorkbench workbench, IStructuredSelection selection) {
-
- NewModelStorageProviderRegistry registry = new NewModelStorageProviderRegistry(workbench.getService(IEvaluationService.class));
-
- // if we are creating a project, then it is in the workspace
- if (isCreateProjectWizard()) {
- this.selectedStorageProvider = new WorkspaceNewModelStorageProvider();
- } else {
- // look for a pre-determined selection
- INewModelStorageProvider firstProvider = null;
- for (INewModelStorageProvider next : registry) {
- if (firstProvider == null) {
- firstProvider = next;
- }
-
- // don't match on empty selections because there is
- // then no context to match against
- if (!selection.isEmpty() && next.canHandle(selection)) {
- this.selectedStorageProvider = next;
- break;
- }
- }
-
- // if the choice is pre-determined, don't show the selection page
- if (this.selectedStorageProvider == null) {
- this.selectedStorageProvider = firstProvider;
-
- // don't need the selection page if only one choice
- if (registry.size() > 1) {
- this.storageProviderRegistry = registry;
- }
- }
- }
- }
-
- protected SelectStorageProviderPage createSelectStorageProviderPage() {
- SelectStorageProviderPage result = (storageProviderRegistry == null) ? null : new SelectStorageProviderPage(storageProviderRegistry);
-
- if (result != null) {
- result.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- INewModelStorageProvider provider = (INewModelStorageProvider) ((IStructuredSelection) event.getSelection()).getFirstElement();
- setSelectedStorageProvider(provider);
- }
- });
- }
-
- return result;
- }
-
- protected Iterable<? extends INewModelStorageProvider> getStorageProviders() {
- Iterable<? extends INewModelStorageProvider> result;
-
- if (storageProviderRegistry != null) {
- result = storageProviderRegistry;
- } else if (selectedStorageProvider != null) {
- result = Collections.singletonList(selectedStorageProvider);
- } else {
- result = Collections.emptyList();
- }
-
- return result;
- }
-
- protected INewModelStorageProvider getSelectedStorageProvider() {
- return selectedStorageProvider;
- }
-
- private void setSelectedStorageProvider(INewModelStorageProvider provider) {
- this.selectedStorageProvider = provider;
-
- // recompute next/previous buttons
- getContainer().updateButtons();
- }
-
- @Override
- public IWizardPage getNextPage(IWizardPage page) {
- final List<IWizardPage> allPages = Arrays.asList(getPages());
- IWizardPage result = null;
-
- INewModelStorageProvider provider = providersByPage.get(page);
- if (provider != null) {
- // it's contributed by a provider. Get the next in the list
- List<IWizardPage> pages = providerPages.get(provider);
- int index = pages.indexOf(page);
- if ((index >= 0) && (index < (pages.size() - 1))) {
- result = pages.get(index + 1);
- } else {
- // get the first page after the provider pages
- if (endProviderPageIndex < allPages.size()) {
- result = allPages.get(endProviderPageIndex);
- }
- }
- } else if (allPages.indexOf(page) == startProviderPageIndex) {
- // get the first page of the selected provider
- List<IWizardPage> pages = providerPages.get(getSelectedStorageProvider());
- if (!pages.isEmpty()) {
- result = pages.get(0);
- } else {
- // get the first page after the provider pages
- if (endProviderPageIndex < allPages.size()) {
- result = allPages.get(endProviderPageIndex);
- }
- }
- } else {
- // somewhere away from the boundary of the provider pages
- result = super.getNextPage(page);
- }
-
- return result;
- }
-
- @Override
- public IWizardPage getPreviousPage(IWizardPage page) {
- final List<IWizardPage> allPages = Arrays.asList(getPages());
- IWizardPage result = null;
-
- INewModelStorageProvider provider = providersByPage.get(page);
- if (provider != null) {
- // it's contributed by a provider. Get the previous in the list
- List<IWizardPage> pages = providerPages.get(provider);
- int index = pages.indexOf(page);
- if (index > 0) {
- result = pages.get(index - 1);
- } else {
- // get the last page before the provider pages
- if (startProviderPageIndex > 0) {
- result = allPages.get(startProviderPageIndex - 1);
- }
- }
- } else if (allPages.indexOf(page) == endProviderPageIndex) {
- // get the last page of the selected provider
- List<IWizardPage> pages = providerPages.get(getSelectedStorageProvider());
- if (!pages.isEmpty()) {
- result = pages.get(pages.size() - 1);
- } else {
- // get the last page before the provider pages
- if (startProviderPageIndex >= 0) {
- result = allPages.get(startProviderPageIndex);
- }
- }
- } else {
- // somewhere away from the boundary of the provider pages
- result = super.getPreviousPage(page);
- }
-
- return result;
- }
-
- @Override
- public boolean canFinish() {
- boolean result = true;
- final IWizardPage[] allPages = getPages();
-
- // only look at the universal pages and those contributed by the current
- // storage provider
-
- for (int i = 0; result && (i <= startProviderPageIndex); i++) {
- result = allPages[i].isPageComplete();
- }
-
- if (result) {
- for (IWizardPage next : providerPages.get(selectedStorageProvider)) {
- if (!next.isPageComplete()) {
- result = false;
- break;
- }
- }
- }
-
- for (int i = endProviderPageIndex; result && (i < allPages.length); i++) {
- result = allPages[i].isPageComplete();
- }
-
- // This takes care of the case problems when creating a model with the same name but different case
- for (IWizardPage page : allPages) {
- if (page instanceof NewModelFilePage) {
- return page.canFlipToNextPage();
- }
- if (page instanceof PapyrusProjectCreationPage) {
- return page.canFlipToNextPage();
- }
- }
-
- return result;
- }
-
- /**
- * Queries the user-presentable (translatable) name of the kind of model
- * that I create. For example, "Papyrus UML" or "Papyrus SysML".
- *
- * @return my model kind name
- */
- public String getModelKindName() {
- return "Papyrus"; //$NON-NLS-1$
- }
-
- @Deprecated
- protected void saveDiagramCategorySettings() {
-
- }
-
- public boolean isPapyrusRootWizard() {
- // this.getClass().getName().equals(anObject)
- return true;
- }
-
-
-}
+/******************************************************************************* + * Copyright (c) 2008, 2016 Obeo, CEA LIST, Christian W. Damus, and others. + * 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: + * Obeo - initial API and implementation + * Tatiana Fesenko(CEA) - [313179] Refactor CreateModelWizard + * Saadia Dhouib (CEA LIST) - Implementation of loading diagrams from template files (.uml, .di , .notation) + * Christian W. Damus (CEA) - create models by URI, not IFile (CDO) + * Christian W. Damus (CEA) - Support creating models in repositories (CDO) + * Christian W. Damus - bug 490936 + * + *******************************************************************************/ +package org.eclipse.papyrus.uml.diagram.wizards.wizards; + +import static org.eclipse.papyrus.uml.diagram.wizards.Activator.log; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.emf.common.command.Command; +import org.eclipse.emf.common.command.CommandStack; +import org.eclipse.emf.common.ui.URIEditorInput; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.papyrus.infra.core.architecture.RepresentationKind; +import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureContext; +import org.eclipse.papyrus.infra.core.architecture.merged.MergedArchitectureViewpoint; +import org.eclipse.papyrus.infra.architecture.representation.PapyrusRepresentationKind; +import org.eclipse.papyrus.infra.architecture.ArchitectureDomainManager; +import org.eclipse.papyrus.infra.architecture.ArchitectureDescriptionUtils; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModelUtils; +import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager; +import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.services.ServicesRegistry; +import org.eclipse.papyrus.infra.ui.util.EditorUtils; +import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype; +import org.eclipse.papyrus.uml.diagram.wizards.Activator; +import org.eclipse.papyrus.uml.diagram.wizards.command.InitFromTemplateCommand; +import org.eclipse.papyrus.uml.diagram.wizards.command.NewPapyrusModelCommand; +import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages; +import org.eclipse.papyrus.uml.diagram.wizards.pages.NewModelFilePage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.PapyrusProjectCreationPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectArchitectureContextPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectRepresentationKindPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectRepresentationKindPage.ViewpointProvider; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectStorageProviderPage; +import org.eclipse.papyrus.uml.diagram.wizards.providers.INewModelStorageProvider; +import org.eclipse.papyrus.uml.diagram.wizards.providers.NewModelStorageProviderRegistry; +import org.eclipse.papyrus.uml.diagram.wizards.providers.WorkspaceNewModelStorageProvider; +import org.eclipse.papyrus.uml.diagram.wizards.template.ModelTemplateDescription; +import org.eclipse.papyrus.uml.diagram.wizards.transformation.IGenerator; +import org.eclipse.papyrus.uml.tools.commands.ApplyProfileCommand; +import org.eclipse.papyrus.uml.tools.commands.RenameElementCommand; +import org.eclipse.papyrus.uml.tools.model.UmlModel; +import org.eclipse.papyrus.uml.tools.model.UmlUtils; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IURIEditorInput; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.services.IEvaluationService; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Profile; + +/** + * Create new model file and initialize a selected diagram. This wizard create + * several files : + * <li>*.di : the DI file to store Di diagrams and references all external diagrams like GMF diagrams.</li> + * <li>*.notation : the file to store pure GMF diagrams</li> + * <li>*.uml : the standard UML file to store UML semantics elements. (Model, + * Package, Class,...)</li> + * + * Those files can be used with the PapyrusEditor (see plugin.xml). + */ +public class CreateModelWizard extends Wizard implements INewWizard { + + /** The Constant WIZARD_ID. */ + public static final String WIZARD_ID = "org.eclipse.papyrus.uml.diagram.wizards.createmodel"; //$NON-NLS-1$ + + /** The Constant NEW_MODEL_SETTINGS. */ + public static final String NEW_MODEL_SETTINGS = "NewModelWizard"; //$NON-NLS-1$ + + private SelectStorageProviderPage selectStorageProviderPage; + + /** Select kind of new diagram the wizard must create. */ + private SelectRepresentationKindPage selectRepresentationKindPage; + + /** The select architecture context page. */ + protected SelectArchitectureContextPage selectArchitectureContextPage; + + /** Current workbench. */ + private IWorkbench workbench; + + private NewModelStorageProviderRegistry storageProviderRegistry; + + private INewModelStorageProvider selectedStorageProvider; + + private Map<INewModelStorageProvider, List<IWizardPage>> providerPages = new java.util.HashMap<INewModelStorageProvider, List<IWizardPage>>(); + + private Map<IWizardPage, INewModelStorageProvider> providersByPage = new java.util.HashMap<IWizardPage, INewModelStorageProvider>(); + + private int startProviderPageIndex; // index of last page before provider pages + + private int endProviderPageIndex; // index of first page after provider pages + + protected IWizardPage newProjectPage; + + protected static final String EXTENSION_POINT_ID = "org.eclipse.papyrus.uml.diagram.wizards.templates"; //$NON-NLS-1$ + + /** + * Instantiates a new creates the model wizard. + */ + public CreateModelWizard() { + super(); + setWindowTitle(Messages.CreateModelWizard_new_papyrus_model_title); + setDefaultPageImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/papyrus/PapyrusWizban_75x66.gif")); //$NON-NLS-1$ + // setHelpAvailable(true); + + } + + /** + * Adds the pages. + * + * {@inheritDoc} + */ + @Override + public void addPages() { + // ModelCreation: the selectDiagramCategoryPage exists + if (selectedStorageProvider.getArchitectureContextPage() != null) { + addPageIfNotNull(selectedStorageProvider.getArchitectureContextPage()); + } else { + addPageIfNotNull(selectArchitectureContextPage); + } + + // The selectStorageProviderPage is only set if a model is created, cf initStorageProvider(IWorkbench, IStructuredSelection) + // The storage page for a project, newProjectPage, is handled by the PapyrusProjectCreationPage + addPageIfNotNull(selectStorageProviderPage); + addPageIfNotNull(newProjectPage); + + startProviderPageIndex = getPageCount() - 1; + for (INewModelStorageProvider next : getStorageProviders()) { + List<IWizardPage> pageList = new java.util.ArrayList<IWizardPage>(3); + for (IWizardPage page : next.createPages()) { + if (page != null) { + pageList.add(page); + providersByPage.put(page, next); + if (!page.equals(selectedStorageProvider.getArchitectureContextPage())) { + addPage(page); + } + } + } + providerPages.put(next, pageList); + } + endProviderPageIndex = getPageCount(); + + addPageIfNotNull(selectRepresentationKindPage); + } + + protected void setNewProjectPage(IWizardPage page) { + this.newProjectPage = page; + } + + /** + * Adds the page if not null. + * + * @param page + * the page + */ + protected final void addPageIfNotNull(IWizardPage page) { + if (page != null) { + addPage(page); + } + } + + public boolean isInitModelWizard() { + return false; + } + + public boolean isCreateProjectWizard() { + return false; + } + + public boolean isCreateMultipleModelsWizard() { + return false; + } + + /** + * Inits the. + * + * @param workbench + * the workbench + * @param selection + * the selection {@inheritDoc} + */ + @Override + public void init(IWorkbench workbench, IStructuredSelection selection) { + this.workbench = workbench; + + initStorageProvider(workbench, selection); + + IDialogSettings workbenchSettings = Activator.getDefault().getDialogSettings(); + IDialogSettings section = workbenchSettings.getSection(NEW_MODEL_SETTINGS); + if (section == null) { + section = workbenchSettings.addNewSection(NEW_MODEL_SETTINGS); + } + setDialogSettings(section); + + selectStorageProviderPage = createSelectStorageProviderPage(); + + for (INewModelStorageProvider next : getStorageProviders()) { + next.init(this, selection); + } + + selectRepresentationKindPage = createSelectRepresentationKindPage(); + } + + /** + * Perform finish. + * + * @return true, if successful {@inheritDoc} + */ + @Override + public boolean performFinish() { + String[] contextIds = getSelectedContexts(); + if (contextIds.length == 0) { + return false; + } + + SelectArchitectureContextPage selectArchitectureContextPage = getSelectArchitectureContextPage(); + if (selectArchitectureContextPage != null) { + selectArchitectureContextPage.performFinish(); + } + + String contextId = contextIds[0]; + final URI newURI = createNewModelURI(contextId); + + String[] viewpointIds = getSelectedViewpoints(contextId); + createAndOpenPapyrusModel(newURI, contextId, viewpointIds); + + return true; + } + + protected URI createNewModelURI(String contextId) { + return getSelectedStorageProvider().createNewModelURI(contextId); + } + + /** + * Creates the and open papyrus model. + * + * @param modelSet + * the di resource set + * @param newURI + * the URI of the new model's principal resource + * @param contextId + * the architecture context id + * @param viewpointIds + * the architecture viewpoint ids + * @return true, if successful + */ + protected boolean createAndOpenPapyrusModel(URI newURI, String contextId, String[] viewpointIds) { + + if (newURI == null) { + return false; + } + + ServicesRegistry registry = createServicesRegistry(); + if (registry == null) { + return false; + } + + try { + // have to create the model set and populate it with the DI model + // before initializing other services that actually need the DI + // model, such as the SashModel Manager service + ModelSet modelSet = registry.getService(ModelSet.class); + + createPapyrusModels(modelSet, newURI); + + initServicesRegistry(registry); + + initDomainModel(modelSet, contextId, viewpointIds); + + initDiagramModel(modelSet, contextId); + + initProfile(modelSet); + + initTemplate(modelSet); + + saveDiagram(modelSet); + + openDiagram(newURI); + + } catch (ServiceException e) { + Activator.log.error(e); + this.selectRepresentationKindPage.setErrorMessage(e.getMessage()); + return false; + + } finally { + try { + registry.disposeRegistry(); + } catch (ServiceException ex) { + // Ignore + } + } + + return true; + } + + private void initProfile(ModelSet modelSet) { + boolean isToApplyProfile = selectRepresentationKindPage.getProfileURI() != null; + boolean isProfileDefined = selectRepresentationKindPage.getProfileDefinitionStatus().isOK(); + if (isToApplyProfile & isProfileDefined) { + applyProfile(modelSet); + } + } + + private void initTemplate(ModelSet modelSet) { + boolean isToInitFromTemplateTransfo = selectRepresentationKindPage.getTemplateTransfo().size() > 0; + if (isToInitFromTemplateTransfo) { + applyTemplateTransfo(modelSet); + } + } + + protected ServicesRegistry createServicesRegistry() { + ServicesRegistry result = null; + + try { + result = new ExtensionServicesRegistry(org.eclipse.papyrus.infra.core.Activator.PLUGIN_ID); + } catch (ServiceException e) { + // couldn't create the registry? Fatal problem + Activator.log.error(e); + } + + try { + // have to create the model set and populate it with the DI model + // before initializing other services that actually need the DI + // model, such as the SashModel Manager service + result.startServicesByClassKeys(ModelSet.class); + } catch (ServiceException ex) { + // Ignore this exception: some services may not have been loaded, + // which is probably normal at this point + } + + return result; + } + + protected void initServicesRegistry(ServicesRegistry registry) throws ServiceException { + try { + registry.startRegistry(); + } catch (ServiceException ex) { + // Ignore this exception: some services may not have been loaded, + // which is probably normal at this point + } + + registry.getService(IPageManager.class); + } + + /** + * Gets the selected context ids. + * + * @return the context ids + */ + protected String[] getSelectedContexts() { + SelectArchitectureContextPage page = getSelectArchitectureContextPage(); + if (page != null) { + return page.getSelectedContexts(); + } + return null; + } + + /** + * Gets the viewpoint ids. + * + * @return the viewpoint ids + */ + protected String[] getSelectedViewpoints() { + SelectArchitectureContextPage page = getSelectArchitectureContextPage(); + if (page != null) { + return page.getSelectViewpoints(); + } + return null; + } + + /** + * Gets the viewpoint ids. + * + * @return the viewpoint ids + */ + protected String[] getSelectedViewpoints(String contextId) { + ArchitectureDomainManager manager = ArchitectureDomainManager.getInstance(); + MergedArchitectureContext context = manager.getArchitectureContextById(contextId); + List<String> availableViewpoints = new ArrayList<String>(); + for (MergedArchitectureViewpoint viewpoint : context.getViewpoints()) { + availableViewpoints.add(viewpoint.getId()); + } + List<String> selectedViewpoints = Arrays.asList(getSelectedViewpoints()); + selectedViewpoints.retainAll(availableViewpoints); + return selectedViewpoints.toArray(new String[0]); + } + + private SelectArchitectureContextPage getSelectArchitectureContextPage() { + return (selectArchitectureContextPage != null) + ? selectArchitectureContextPage + : (selectedStorageProvider != null) + ? selectedStorageProvider.getArchitectureContextPage() + : null; + } + + /** + * Gets the diagram file extension. + * + * @param diagramCategoryId + * the diagram category id + * @return the diagram file extension + */ + public String getDiagramFileExtension(String contextId) { + return getDiagramFileExtension(contextId, NewModelFilePage.DEFAULT_DIAGRAM_EXTENSION); + } + + /** + * Gets the diagram file extension. + * + * @param contextId + * the context id + * @param defaultExtension + * the default extension + * @return the diagram file extension + */ + public String getDiagramFileExtension(String contextId, String defaultExtension) { + MergedArchitectureContext context = ArchitectureDomainManager.getInstance().getArchitectureContextById(contextId); + String extensionPrefix = context != null ? context.getExtensionPrefix() : null; + return (extensionPrefix != null) ? extensionPrefix + "." + defaultExtension : defaultExtension; //$NON-NLS-1$ + } + + /** + * Creates the select architecture context page. + * + * @return the select architecture context page + */ + protected SelectArchitectureContextPage createSelectArchitectureContextPage() { + return new SelectArchitectureContextPage(); + } + + /** + * Creates the select representation kind page. + * + * @return the select representation kind page + */ + protected SelectRepresentationKindPage createSelectRepresentationKindPage() { + return new SelectRepresentationKindPage(new ViewpointProvider() { + + @Override + public String[] getCurrentViewpoints() { + return getSelectedViewpoints(); + } + + }); + } + + /** + * Inits the domain model. + * + * @param modelSet + * the di resource set + * @param contextId + * the architecture context id + * @param viewpointIds + * the architecture viewpoint ids + */ + protected void initDomainModel(ModelSet modelSet, String contextId, String[] viewpointIds) { + + boolean isToInitFromTemplate = selectRepresentationKindPage.getTemplatePath() != null; + if (isToInitFromTemplate) { + initDomainModelFromTemplate(modelSet); + } else { + createEmptyDomainModel(modelSet, contextId, viewpointIds); + } + } + + protected void applyProfile(ModelSet modelSet) { + String profilePath = selectRepresentationKindPage.getProfileURI(); + Resource resource = modelSet.getResource(URI.createURI(profilePath), true); + Profile profileToApply = (Profile) resource.getContents().get(0); + + Resource myModelUMLResource = UmlUtils.getUmlResource(modelSet); + org.eclipse.uml2.uml.Package manipulatedModel = (org.eclipse.uml2.uml.Package) myModelUMLResource.getContents().get(0); + + RecordingCommand applyProfileCommand = new ApplyProfileCommand(manipulatedModel, profileToApply, modelSet.getTransactionalEditingDomain()); + getCommandStack(modelSet).execute(applyProfileCommand); + } + + protected void applyTemplateTransfo(ModelSet modelSet) { + List<ModelTemplateDescription> templateList = selectRepresentationKindPage.getTemplateTransfo(); + // // This is an example of the use of QVT Transformations + // QVToGenerator generator = new QVToGenerator(); + // + // for (final ModelTemplateDescription currentTemplate : templateList) { + // // fetches the tranformation URI encoded in the extension point, if it has that attribute + // // generator.setTransformationURI(URI.createPlatformPluginURI("org.eclipse.papyrus.uml.diagram.wizards/transforms/UMLCopyTemplateTransfo.qvto", true));//$NON-NLS-1$ + // generator.setTransformationURI(URI.createPlatformPluginURI(currentTemplate.getTransfoURI(), true)); + // generator.setModelSet(modelSet); + // generator.setTemplateModel(currentTemplate.getUml_path()); + // generator.setPluginId(currentTemplate.getPluginId()); + // generator.execute(); + // } + + // This is an example of transformations without using the QVToGenerator + // TODO make it prettier + IExtensionRegistry registry = Platform.getExtensionRegistry(); + // get all the extensions configured into the extension point corresponding to the 'templates' Point ID from the 'org.eclipse.papyrus.uml.diagram.wizards' plugin + IExtension[] extensions = registry.getExtensionPoint(EXTENSION_POINT_ID).getExtensions(); + + for (IExtension extension : extensions) { + for (IConfigurationElement configElement : extension.getConfigurationElements()) { + if ("template".equals(configElement.getName())) { //$NON-NLS-1$ + // not handled here + } else if ("transformation".equals(configElement.getName())) { //$NON-NLS-1$ + for (ModelTemplateDescription currentTemplate : templateList) { + if (currentTemplate.getName().equals(configElement.getAttribute("name"))) { //$NON-NLS-1$ + IGenerator iGenerator; + try { + iGenerator = (IGenerator) configElement.createExecutableExtension("Transformation"); //$NON-NLS-1$ + iGenerator.setModelSet(modelSet); + iGenerator.execute(); + } catch (CoreException e) { + Activator.log.error(e); + } + } + } + + } + } + } + + } + + /** + * Inits the domain model from template. + * + * @param modelSet + * the di resource set + */ + protected void initDomainModelFromTemplate(ModelSet modelSet) { + getCommandStack(modelSet).execute( + new InitFromTemplateCommand(modelSet.getTransactionalEditingDomain(), modelSet, selectRepresentationKindPage.getTemplatePluginId(), selectRepresentationKindPage.getTemplatePath(), selectRepresentationKindPage.getNotationTemplatePath(), selectRepresentationKindPage + .getDiTemplatePath())); + } + + /** + * Creates the empty domain model. + * + * @param modelSet + * the di resource set + * @param contextId + * the architecture context id + * @param viewpointIds + * the architecture viewpoint ids + */ + protected void createEmptyDomainModel(ModelSet modelSet, String contextId, String[] viewpointIds) { + try { + ArchitectureDescriptionUtils helper = new ArchitectureDescriptionUtils(modelSet); + Command command = helper.createNewModel(contextId, viewpointIds); + getCommandStack(modelSet).execute(command); + } catch (Exception e) { + log.error(e); + } + } + + /** + * Creates the papyrus models. + * + * @param modelSet + * the di resource set + * @param newURI + * the URI of the new model's principal resource + */ + protected void createPapyrusModels(ModelSet modelSet, URI newURIs) { + RecordingCommand command = new NewPapyrusModelCommand(modelSet, newURIs); + getCommandStack(modelSet).execute(command); + } + + + /** + * Open diagram. + * + * @param newURI + * the URI of the new model's principal resource + */ + protected void openDiagram(final URI newURI) { + IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage(); + if (page != null) { + try { + IEditorInput editorInput = createEditorInput(newURI); + IDE.openEditor(page, editorInput, getPreferredEditorID(editorInput), true); + } catch (PartInitException e) { + log.error(e); + } + } + } + + protected IEditorInput createEditorInput(URI uri) { + return getSelectedStorageProvider().createEditorInput(uri); + } + + protected String getPreferredEditorID(IEditorInput input) throws PartInitException { + IEditorDescriptor desc; + + if (input instanceof IFileEditorInput) { + desc = IDE.getEditorDescriptor(((IFileEditorInput) input).getFile()); + } else { + // try to get a URI + URI uri = null; + if (input instanceof IURIEditorInput) { + uri = URI.createURI(((IURIEditorInput) input).getURI().toString(), true); + } else if (input instanceof URIEditorInput) { + uri = ((URIEditorInput) input).getURI(); + } + + if (uri != null) { + desc = IDE.getEditorDescriptor(uri.lastSegment()); + } else { + // hope that the input name is the file name + desc = IDE.getEditorDescriptor(input.getName()); + } + } + + return (desc == null) ? "org.eclipse.papyrus.infra.core.papyrusEditor" : desc.getId(); //$NON-NLS-1$ + } + + /** + * Inits the diagram model. + * + * @param modelSet + * the di resource set + * @param contextId + * the architecture context id + */ + protected void initDiagramModel(ModelSet modelSet, String contextId) { + initDiagrams(modelSet, contextId); + } + + + /** + * Save diagram. + * + * @param modelSet + * the di resource set + */ + private void saveDiagram(ModelSet modelSet) { + // TODO verify that there are no conflicts with the existing files and the newly created one + try { + modelSet.save(new NullProgressMonitor()); + } catch (IOException e) { + log.error(e); + } + } + + /** + * Inits the diagrams. + * + * @param modelSet + * the di resource set + * @param contextId + * the architecture context id + */ + protected void initDiagrams(ModelSet modelSet, String contextId) { + initDiagrams(modelSet, null, contextId); + } + + /** + * Inits the diagrams. + * + * @param resourceSet + * the resource set + * @param root + * the root + * @param contextId + * the architecture context id + */ + protected void initDiagrams(ModelSet resourceSet, EObject root, String contextId) { + UmlModel model = (UmlModel) resourceSet.getModel(UmlModel.MODEL_ID); + EList<EObject> roots = model.getResource().getContents(); + if (!roots.isEmpty()) { + root = roots.get(0); + if (root instanceof NamedElement) { + getCommandStack(resourceSet).execute(new RenameElementCommand(resourceSet.getTransactionalEditingDomain(), (NamedElement) root, getRootElementName())); + + } + + } + List<RepresentationKind> creationCommands = getRepresentationKindsFor(contextId); + List<String> diagramName = selectRepresentationKindPage.getDiagramName(); + if (creationCommands.isEmpty()) { + createEmptyDiagramEditor(resourceSet); + } else { + for (int i = 0; i < creationCommands.size(); i++) { + RepresentationKind kind = creationCommands.get(i); + if (kind instanceof PapyrusRepresentationKind) { + ViewPrototype proto = ViewPrototype.get((PapyrusRepresentationKind)kind); + proto.instantiateOn(root, diagramName.get(i)); + } + } + } + } + + /** + * Gets the representation kinds for. + * + * @param contextId + * the architecture context id + * @return the repersentation kinds for + */ + protected List<RepresentationKind> getRepresentationKindsFor(String contextId) { + return selectRepresentationKindPage.getSelectedRepresentationKinds(contextId); + } + + + protected List<String> getDiagramNames() { + return selectRepresentationKindPage.getDiagramName(); + } + + protected String getRootElementName() { + return selectRepresentationKindPage.getRootElementName(); + } + + /** + * Creates the empty diagram editor. + * + * @param modelSet + * the model set + */ + private void createEmptyDiagramEditor(ModelSet modelSet) { + // Create an empty editor (no diagrams opened) + // Geting an IPageMngr is enough to initialize the + // SashSystem. + EditorUtils.getIPageMngr(DiModelUtils.getDiResource(modelSet)); + } + + /** + * Gets the command stack. + * + * @param modelSet + * the model set + * @return the command stack + */ + protected final CommandStack getCommandStack(ModelSet modelSet) { + return modelSet.getTransactionalEditingDomain().getCommandStack(); + } + + /** + * Diagram category changed. + * + * @param newCategories + * the new categories + * @return the i status + */ + public IStatus architectureContextChanged(String... newContexts) { + return getSelectedStorageProvider().validateArchitectureContexts(newContexts); + } + + protected void initStorageProvider(IWorkbench workbench, IStructuredSelection selection) { + + NewModelStorageProviderRegistry registry = new NewModelStorageProviderRegistry(workbench.getService(IEvaluationService.class)); + + // if we are creating a project, then it is in the workspace + if (isCreateProjectWizard()) { + this.selectedStorageProvider = new WorkspaceNewModelStorageProvider(); + } else { + // look for a pre-determined selection + INewModelStorageProvider firstProvider = null; + for (INewModelStorageProvider next : registry) { + if (firstProvider == null) { + firstProvider = next; + } + + // don't match on empty selections because there is + // then no context to match against + if (!selection.isEmpty() && next.canHandle(selection)) { + this.selectedStorageProvider = next; + break; + } + } + + // if the choice is pre-determined, don't show the selection page + if (this.selectedStorageProvider == null) { + this.selectedStorageProvider = firstProvider; + + // don't need the selection page if only one choice + if (registry.size() > 1) { + this.storageProviderRegistry = registry; + } + } + } + } + + protected SelectStorageProviderPage createSelectStorageProviderPage() { + SelectStorageProviderPage result = (storageProviderRegistry == null) ? null : new SelectStorageProviderPage(storageProviderRegistry); + + if (result != null) { + result.addSelectionChangedListener(new ISelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent event) { + INewModelStorageProvider provider = (INewModelStorageProvider) ((IStructuredSelection) event.getSelection()).getFirstElement(); + setSelectedStorageProvider(provider); + } + }); + } + + return result; + } + + protected Iterable<? extends INewModelStorageProvider> getStorageProviders() { + Iterable<? extends INewModelStorageProvider> result; + + if (storageProviderRegistry != null) { + result = storageProviderRegistry; + } else if (selectedStorageProvider != null) { + result = Collections.singletonList(selectedStorageProvider); + } else { + result = Collections.emptyList(); + } + + return result; + } + + protected INewModelStorageProvider getSelectedStorageProvider() { + return selectedStorageProvider; + } + + private void setSelectedStorageProvider(INewModelStorageProvider provider) { + this.selectedStorageProvider = provider; + + // recompute next/previous buttons + getContainer().updateButtons(); + } + + @Override + public IWizardPage getNextPage(IWizardPage page) { + final List<IWizardPage> allPages = Arrays.asList(getPages()); + IWizardPage result = null; + + INewModelStorageProvider provider = providersByPage.get(page); + if (provider != null) { + // it's contributed by a provider. Get the next in the list + List<IWizardPage> pages = providerPages.get(provider); + int index = pages.indexOf(page); + if ((index >= 0) && (index < (pages.size() - 1))) { + result = pages.get(index + 1); + } else { + // get the first page after the provider pages + if (endProviderPageIndex < allPages.size()) { + result = allPages.get(endProviderPageIndex); + } + } + } else if (allPages.indexOf(page) == startProviderPageIndex) { + // get the first page of the selected provider + List<IWizardPage> pages = providerPages.get(getSelectedStorageProvider()); + if (!pages.isEmpty()) { + result = pages.get(0); + } else { + // get the first page after the provider pages + if (endProviderPageIndex < allPages.size()) { + result = allPages.get(endProviderPageIndex); + } + } + } else { + // somewhere away from the boundary of the provider pages + result = super.getNextPage(page); + } + + return result; + } + + @Override + public IWizardPage getPreviousPage(IWizardPage page) { + final List<IWizardPage> allPages = Arrays.asList(getPages()); + IWizardPage result = null; + + INewModelStorageProvider provider = providersByPage.get(page); + if (provider != null) { + // it's contributed by a provider. Get the previous in the list + List<IWizardPage> pages = providerPages.get(provider); + int index = pages.indexOf(page); + if (index > 0) { + result = pages.get(index - 1); + } else { + // get the last page before the provider pages + if (startProviderPageIndex > 0) { + result = allPages.get(startProviderPageIndex - 1); + } + } + } else if (allPages.indexOf(page) == endProviderPageIndex) { + // get the last page of the selected provider + List<IWizardPage> pages = providerPages.get(getSelectedStorageProvider()); + if (!pages.isEmpty()) { + result = pages.get(pages.size() - 1); + } else { + // get the last page before the provider pages + if (startProviderPageIndex >= 0) { + result = allPages.get(startProviderPageIndex); + } + } + } else { + // somewhere away from the boundary of the provider pages + result = super.getPreviousPage(page); + } + + return result; + } + + @Override + public boolean canFinish() { + boolean result = true; + final IWizardPage[] allPages = getPages(); + + // only look at the universal pages and those contributed by the current + // storage provider + + for (int i = 0; result && (i <= startProviderPageIndex); i++) { + result = allPages[i].isPageComplete(); + } + + if (result) { + for (IWizardPage next : providerPages.get(selectedStorageProvider)) { + if (!next.isPageComplete()) { + result = false; + break; + } + } + } + + for (int i = endProviderPageIndex; result && (i < allPages.length); i++) { + result = allPages[i].isPageComplete(); + } + + // This takes care of the case problems when creating a model with the same name but different case + for (IWizardPage page : allPages) { + if (page instanceof NewModelFilePage) { + return page.canFlipToNextPage(); + } + if (page instanceof PapyrusProjectCreationPage) { + return page.canFlipToNextPage(); + } + } + + return result; + } + + /** + * Queries the user-presentable (translatable) name of the kind of model + * that I create. For example, "Papyrus UML" or "Papyrus SysML". + * + * @return my model kind name + */ + public String getModelKindName() { + return "Papyrus"; //$NON-NLS-1$ + } + + @Deprecated + protected void saveDiagramCategorySettings() { + + } + + public boolean isPapyrusRootWizard() { + // this.getClass().getName().equals(anObject) + return true; + } + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateSeveralModelsWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateSeveralModelsWizard.java index d6c489cc154..ae39013c38f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateSeveralModelsWizard.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/CreateSeveralModelsWizard.java @@ -30,8 +30,8 @@ import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.papyrus.uml.diagram.wizards.Activator; import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages; import org.eclipse.papyrus.uml.diagram.wizards.pages.NewModelFilePage; -import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage; -import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectArchitectureContextPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectRepresentationKindPage; import org.eclipse.ui.IWorkbench; /** @@ -65,7 +65,7 @@ public class CreateSeveralModelsWizard extends CreateModelWizard { } @Override - public IStatus diagramCategoryChanged(String... newCategories) { + public IStatus architectureContextChanged(String... newCategories) { // clean pages List<String> newCategoriesList = Arrays.asList(newCategories); Collection<String> keys = new HashSet<String>(myCategory2modelFilePageMap.keySet()); @@ -80,7 +80,7 @@ public class CreateSeveralModelsWizard extends CreateModelWizard { myCategory2modelFilePageMap.put(newCategory, newPage); } } - return super.diagramCategoryChanged(newCategories); + return super.architectureContextChanged(newCategories); } /** @@ -107,7 +107,7 @@ public class CreateSeveralModelsWizard extends CreateModelWizard { @Override public IWizardPage getNextPage(IWizardPage page) { String pageId = page.getName(); - if(SelectDiagramKindPage.PAGE_ID.equals(pageId)) { + if(SelectRepresentationKindPage.PAGE_ID.equals(pageId)) { String nextKey = myCategory2modelFilePageMap.keySet().iterator().next(); return myCategory2modelFilePageMap.get(nextKey); } @@ -138,14 +138,9 @@ public class CreateSeveralModelsWizard extends CreateModelWizard { return super.getPreviousPage(page); } - /* - * (non-Javadoc) - * - * @see org.eclipse.papyrus.uml.diagram.wizards.CreateModelWizard#createSelectDiagramCategoryPage() - */ @Override - protected SelectDiagramCategoryPage createSelectDiagramCategoryPage() { - return new SelectDiagramCategoryPage(true); + protected SelectArchitectureContextPage createSelectArchitectureContextPage() { + return new SelectArchitectureContextPage(true); } /** @@ -155,10 +150,11 @@ public class CreateSeveralModelsWizard extends CreateModelWizard { */ @Override public boolean performFinish() { - for(String category : getDiagramCategoryIds()) { + for(String contextId : getSelectedContexts()) { - final URI newURI = createNewModelURI(category); - createAndOpenPapyrusModel(newURI, category); + final URI newURI = createNewModelURI(contextId); + String[] viewpointIds = getSelectedViewpoints(contextId); + createAndOpenPapyrusModel(newURI, contextId, viewpointIds); } // saveDiagramCategorySettings(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/InitModelWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/InitModelWizard.java index c76211cd3bb..5f079c750ec 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/InitModelWizard.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/InitModelWizard.java @@ -1,239 +1,239 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2013 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:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- * Christian W. Damus (CEA) - Support creating models in repositories (CDO)
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.wizards.wizards;
-
-import static org.eclipse.papyrus.uml.diagram.wizards.utils.WizardsHelper.getSelectedResourceURI;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.uml.diagram.wizards.command.PapyrusModelFromExistingDomainModelCommand;
-import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.NewModelFilePage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramKindPage.CategoryProvider;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectRootElementPage;
-import org.eclipse.papyrus.uml.tools.model.UmlModel;
-import org.eclipse.ui.IWorkbench;
-
-/**
- *
- * The New Papyrus Model Wizard.
- * If being invoke on the *.uml file - initializes a new Papyrus diagram for the selected domain model.
- * If is selected is empty or in not uml - creates a new Papyrus Model.
- */
-public class InitModelWizard extends CreateModelWizard {
-
- /** Select the root element containing the new diagram. */
- private SelectRootElementPage selectRootElementPage;
-
- /** The is init from existing domain model. */
- private boolean isInitFromExistingDomainModel;
-
- @Override
- public boolean isInitModelWizard() {
- return true;
- }
-
- /**
- * Inits the.
- *
- * @param workbench
- * the workbench
- * @param selection
- * the selection {@inheritDoc}
- */
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- URI uri = getSelectedResourceURI(selection);
- isInitFromExistingDomainModel = isSupportedDomainModelResource(uri);
- super.init(workbench, selection);
- selectRootElementPage = createSelectRootElementPage(selection);
- if (isCreateFromExistingDomainModel()) {
- // Init Model not Create a new one
- setWindowTitle(Messages.InitModelWizard_init_papyrus_diagram);
- }
- }
-
- /**
- * Creates the select root element page.
- *
- * @param selection
- * the initial workbench selection
- * @return the select root element page
- */
- protected SelectRootElementPage createSelectRootElementPage(IStructuredSelection selection) {
- if (!isCreateFromExistingDomainModel()) {
- // create model - nothing to choose from
- return null;
- }
- return new SelectRootElementPage(selection);
- }
-
- /**
- * Creates the select diagram kind page.
- *
- * @return the select diagram kind page {@inheritDoc}
- */
- @Override
- protected SelectDiagramKindPage createSelectDiagramKindPage() {
- if (isCreateFromExistingDomainModel()) {
- return new SelectDiagramKindPage(false, new CategoryProvider() {
-
- @Override
- public String[] getCurrentCategories() {
- return getDiagramCategoryIds();
- }
-
- }, SelectDiagramKindPage.DEFAULT_CREATION_COMMAND_REGISTRY);
- }
- ;
- return super.createSelectDiagramKindPage();
- }
-
- /**
- * Adds the pages.
- *
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- super.addPages();
- // remove the page from the view
- // addPageIfNotNull(selectRootElementPage);
- };
-
- /**
- * Returns true is the file can be served as a model model for the diagram.
- *
- * @param file
- * the file
- * @return true, if is supported domain model file
- */
- public static boolean isSupportedDomainModelFile(IFile file) {
- // if(file != null && UmlModel.UML_FILE_EXTENSION.equals(file.getFileExtension())){System.err.println("is SupportedDomainModelFile");}
- // else {System.err.println("not SupportedDomainModelFile");}
- return file != null && isSupportedDomainModelResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true));
- }
-
- /**
- * Returns true if the resource can be served as a model model for the diagram.
- *
- * @param uri
- * the resource's URI
- * @return true, if is supported domain model resource
- */
- public static boolean isSupportedDomainModelResource(URI uri) {
- return (uri != null) && UmlModel.UML_FILE_EXTENSION.equals(uri.fileExtension());
- }
-
- /**
- * Checks if is supported domain model file.
- *
- * @param sselection
- * the sselection
- * @return true, if is supported domain model file
- */
- public static boolean isSupportedDomainModelFile(IStructuredSelection sselection) {
- URI uri = getSelectedResourceURI(sselection);
- return isSupportedDomainModelResource(uri);
- }
-
- /**
- * Creates the papyrus models.
- *
- * @param diResourceSet
- * the di resource set
- * @param newURI
- * the URI of the new model's principal resource
- */
- @Override
- protected void createPapyrusModels(ModelSet modelSet, URI newURI) {
- if (isCreateFromExistingDomainModel()) {
- RecordingCommand command = new PapyrusModelFromExistingDomainModelCommand(modelSet, newURI, getRoot());
- getCommandStack(modelSet).execute(command);
- } else {
- super.createPapyrusModels(modelSet, newURI);
- }
- }
-
- /**
- * Inits the domain model.
- *
- * @param diResourceSet
- * the di resource set
- * @param newURI
- * the URI of the new model's principal resource
- * @param diagramCategoryId
- * the diagram category id {@inheritDoc}
- */
- @Override
- protected void initDomainModel(ModelSet modelSet, final URI newURI, String diagramCategoryId) {
- if (isCreateFromExistingDomainModel()) {
- // do nothing
- } else {
- super.initDomainModel(modelSet, newURI, diagramCategoryId);
- }
- }
-
- /**
- * Inits the diagrams.
- *
- * @param diResourceSet
- * the di resource set
- * @param categoryId
- * the category id {@inheritDoc}
- */
- @Override
- protected void initDiagrams(ModelSet modelSet, String categoryId) {
- initDiagrams(modelSet, getRoot(), categoryId);
- }
-
- /**
- * Checks if is creates the from existing domain model.
- *
- * @return true, if is creates the from existing domain model
- */
- public boolean isCreateFromExistingDomainModel() {
- return isInitFromExistingDomainModel;
- }
-
- @Override
- public String getDiagramFileExtension(String diagramCategoryId) {
- if (isCreateFromExistingDomainModel()) {
- return NewModelFilePage.DEFAULT_DIAGRAM_EXTENSION;
- }
- return super.getDiagramFileExtension(diagramCategoryId);
- }
-
- /**
- * Gets the root.
- *
- * @return the root
- */
- private EObject getRoot() {
- if (selectRootElementPage != null) {
- // return selectRootElementPage.getModelElement();
- return SelectDiagramKindPage.getModelRoot();
- }
- return null;
- }
-
-
-
-}
+/***************************************************************************** + * Copyright (c) 2010, 2013 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: + * Tatiana Fesenko (CEA LIST) - Initial API and implementation + * Christian W. Damus (CEA) - Support creating models in repositories (CDO) + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.wizards.wizards; + +import static org.eclipse.papyrus.uml.diagram.wizards.utils.WizardsHelper.getSelectedResourceURI; + +import org.eclipse.core.resources.IFile; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.transaction.RecordingCommand; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.papyrus.infra.core.resource.ModelSet; +import org.eclipse.papyrus.uml.diagram.wizards.command.PapyrusModelFromExistingDomainModelCommand; +import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages; +import org.eclipse.papyrus.uml.diagram.wizards.pages.NewModelFilePage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectRepresentationKindPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectRepresentationKindPage.ViewpointProvider; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectRootElementPage; +import org.eclipse.papyrus.uml.tools.model.UmlModel; +import org.eclipse.ui.IWorkbench; + +/** + * + * The New Papyrus Model Wizard. + * If being invoke on the *.uml file - initializes a new Papyrus diagram for the selected domain model. + * If is selected is empty or in not uml - creates a new Papyrus Model. + */ +public class InitModelWizard extends CreateModelWizard { + + /** Select the root element containing the new diagram. */ + private SelectRootElementPage selectRootElementPage; + + /** The is init from existing domain model. */ + private boolean isInitFromExistingDomainModel; + + @Override + public boolean isInitModelWizard() { + return true; + } + + /** + * Inits the. + * + * @param workbench + * the workbench + * @param selection + * the selection {@inheritDoc} + */ + @Override + public void init(IWorkbench workbench, IStructuredSelection selection) { + URI uri = getSelectedResourceURI(selection); + isInitFromExistingDomainModel = isSupportedDomainModelResource(uri); + super.init(workbench, selection); + selectRootElementPage = createSelectRootElementPage(selection); + if (isCreateFromExistingDomainModel()) { + // Init Model not Create a new one + setWindowTitle(Messages.InitModelWizard_init_papyrus_diagram); + } + } + + /** + * Creates the select root element page. + * + * @param selection + * the initial workbench selection + * @return the select root element page + */ + protected SelectRootElementPage createSelectRootElementPage(IStructuredSelection selection) { + if (!isCreateFromExistingDomainModel()) { + // create model - nothing to choose from + return null; + } + return new SelectRootElementPage(selection); + } + + /** + * Creates the select diagram kind page. + * + * @return the select diagram kind page {@inheritDoc} + */ + @Override + protected SelectRepresentationKindPage createSelectRepresentationKindPage() { + if (isCreateFromExistingDomainModel()) { + return new SelectRepresentationKindPage(false, new ViewpointProvider() { + + @Override + public String[] getCurrentViewpoints() { + return getSelectedViewpoints(); + } + + }, SelectRepresentationKindPage.DEFAULT_CREATION_COMMAND_REGISTRY); + } + ; + return super.createSelectRepresentationKindPage(); + } + + /** + * Adds the pages. + * + * {@inheritDoc} + */ + @Override + public void addPages() { + super.addPages(); + // remove the page from the view + // addPageIfNotNull(selectRootElementPage); + }; + + /** + * Returns true is the file can be served as a model model for the diagram. + * + * @param file + * the file + * @return true, if is supported domain model file + */ + public static boolean isSupportedDomainModelFile(IFile file) { + // if(file != null && UmlModel.UML_FILE_EXTENSION.equals(file.getFileExtension())){System.err.println("is SupportedDomainModelFile");} + // else {System.err.println("not SupportedDomainModelFile");} + return file != null && isSupportedDomainModelResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true)); + } + + /** + * Returns true if the resource can be served as a model model for the diagram. + * + * @param uri + * the resource's URI + * @return true, if is supported domain model resource + */ + public static boolean isSupportedDomainModelResource(URI uri) { + return (uri != null) && UmlModel.UML_FILE_EXTENSION.equals(uri.fileExtension()); + } + + /** + * Checks if is supported domain model file. + * + * @param sselection + * the sselection + * @return true, if is supported domain model file + */ + public static boolean isSupportedDomainModelFile(IStructuredSelection sselection) { + URI uri = getSelectedResourceURI(sselection); + return isSupportedDomainModelResource(uri); + } + + /** + * Creates the papyrus models. + * + * @param diResourceSet + * the di resource set + * @param newURI + * the URI of the new model's principal resource + */ + @Override + protected void createPapyrusModels(ModelSet modelSet, URI newURI) { + if (isCreateFromExistingDomainModel()) { + RecordingCommand command = new PapyrusModelFromExistingDomainModelCommand(modelSet, newURI, getRoot()); + getCommandStack(modelSet).execute(command); + } else { + super.createPapyrusModels(modelSet, newURI); + } + } + + /** + * Inits the domain model. + * + * @param diResourceSet + * the di resource set + * @param contextId + * the architecture context id + * @param viewpointIds + * the architecture viewpoint ids + */ + @Override + protected void initDomainModel(ModelSet modelSet, String contextId, String[] viewpointIds) { + if (isCreateFromExistingDomainModel()) { + // do nothing + } else { + super.initDomainModel(modelSet, contextId, viewpointIds); + } + } + + /** + * Inits the diagrams. + * + * @param diResourceSet + * the di resource set + * @param contextName + * the architecture context name {@inheritDoc} + */ + @Override + protected void initDiagrams(ModelSet modelSet, String contextName) { + initDiagrams(modelSet, getRoot(), contextName); + } + + /** + * Checks if is creates the from existing domain model. + * + * @return true, if is creates the from existing domain model + */ + public boolean isCreateFromExistingDomainModel() { + return isInitFromExistingDomainModel; + } + + @Override + public String getDiagramFileExtension(String contextId) { + if (isCreateFromExistingDomainModel()) { + return NewModelFilePage.DEFAULT_DIAGRAM_EXTENSION; + } + return super.getDiagramFileExtension(contextId); + } + + /** + * Gets the root. + * + * @return the root + */ + private EObject getRoot() { + if (selectRootElementPage != null) { + // return selectRootElementPage.getModelElement(); + return SelectRepresentationKindPage.getModelRoot(); + } + return null; + } + + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/NewPapyrusProjectWithMultiModelsWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/NewPapyrusProjectWithMultiModelsWizard.java index 9320d20d279..9b0c0338a3c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/NewPapyrusProjectWithMultiModelsWizard.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/NewPapyrusProjectWithMultiModelsWizard.java @@ -1,99 +1,95 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2013 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:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- * Christian W. Damus (CEA) - Support creating models in repositories (CDO)
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.wizards.wizards;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.papyrus.uml.diagram.wizards.Activator;
-import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage;
-
-/**
- * The Wizard creates a new Project and a several Papyrus Models of different categories inside it.
- */
-public class NewPapyrusProjectWithMultiModelsWizard extends NewPapyrusProjectWizard {
-
- /** The my do not create model for no diagrams. */
- private boolean myDoNotCreateModelForNoDiagrams;
-
- /** The Constant WIZARD_ID. */
- public static final String WIZARD_ID = "org.eclipse.papyrus.uml.diagram.wizards.createproject.several"; //$NON-NLS-1$
-
-
- /**
- * Instantiates a new new papyrus project with multi models wizard.
- */
- public NewPapyrusProjectWithMultiModelsWizard() {
- this(false);
- }
-
- /**
- * Instantiates a new new papyrus project with multi models wizard.
- *
- * @param doNotCreateModelForNoDiagrams
- * the do not create model for no diagrams
- */
- public NewPapyrusProjectWithMultiModelsWizard(boolean doNotCreateModelForNoDiagrams) {
- myDoNotCreateModelForNoDiagrams = doNotCreateModelForNoDiagrams;
- }
-
- @Override
- public boolean isCreateMultipleModelsWizard() {
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.papyrus.uml.diagram.wizards.CreateModelWizard#createSelectDiagramCategoryPage()
- */
- @Override
- protected SelectDiagramCategoryPage createSelectDiagramCategoryPage() {
- return new SelectDiagramCategoryPage(true);
- }
-
- /**
- * Perform finish.
- *
- * @return true, if successful {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- IProject newProjectHandle;
- try {
- newProjectHandle = createNewProject();
- } catch (CoreException e) {
- Activator.log.error(Messages.NewPapyrusProjectWithMultiModelsWizard_exception_on_project_opening, e);
- return false;
- }
- if (newProjectHandle == null) {
- return false;
- }
- for (String category : getDiagramCategoryIds()) {
- if (myDoNotCreateModelForNoDiagrams && getPrototypesFor(category).isEmpty()) {
- // don't create model
- continue;
- }
- final URI newURI = createNewModelURI(category);
- createAndOpenPapyrusModel(newURI, category);
- }
-
- // saveDiagramCategorySettings();
- // saveDiagramKindSettings();
- return true;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2010, 2013 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: + * Tatiana Fesenko (CEA LIST) - Initial API and implementation + * Christian W. Damus (CEA) - Support creating models in repositories (CDO) + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.wizards.wizards; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.emf.common.util.URI; +import org.eclipse.papyrus.uml.diagram.wizards.Activator; +import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectArchitectureContextPage; + +/** + * The Wizard creates a new Project and a several Papyrus Models of different categories inside it. + */ +public class NewPapyrusProjectWithMultiModelsWizard extends NewPapyrusProjectWizard { + + /** The my do not create model for no diagrams. */ + private boolean myDoNotCreateModelForNoDiagrams; + + /** The Constant WIZARD_ID. */ + public static final String WIZARD_ID = "org.eclipse.papyrus.uml.diagram.wizards.createproject.several"; //$NON-NLS-1$ + + + /** + * Instantiates a new new papyrus project with multi models wizard. + */ + public NewPapyrusProjectWithMultiModelsWizard() { + this(false); + } + + /** + * Instantiates a new new papyrus project with multi models wizard. + * + * @param doNotCreateModelForNoDiagrams + * the do not create model for no diagrams + */ + public NewPapyrusProjectWithMultiModelsWizard(boolean doNotCreateModelForNoDiagrams) { + myDoNotCreateModelForNoDiagrams = doNotCreateModelForNoDiagrams; + } + + @Override + public boolean isCreateMultipleModelsWizard() { + return true; + } + + @Override + protected SelectArchitectureContextPage createSelectArchitectureContextPage() { + return new SelectArchitectureContextPage(true); + } + + /** + * Perform finish. + * + * @return true, if successful {@inheritDoc} + */ + @Override + public boolean performFinish() { + IProject newProjectHandle; + try { + newProjectHandle = createNewProject(); + } catch (CoreException e) { + Activator.log.error(Messages.NewPapyrusProjectWithMultiModelsWizard_exception_on_project_opening, e); + return false; + } + if (newProjectHandle == null) { + return false; + } + for (String contextId : getSelectedContexts()) { + if (myDoNotCreateModelForNoDiagrams && getRepresentationKindsFor(contextId).isEmpty()) { + // don't create model + continue; + } + final URI newURI = createNewModelURI(contextId); + String[] viewpointIds = getSelectedViewpoints(contextId); + createAndOpenPapyrusModel(newURI, contextId, viewpointIds); + } + + // saveDiagramCategorySettings(); + // saveDiagramKindSettings(); + return true; + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/NewPapyrusProjectWizard.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/NewPapyrusProjectWizard.java index a379796461d..9b9a980f2fd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/NewPapyrusProjectWizard.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.wizards/src/org/eclipse/papyrus/uml/diagram/wizards/wizards/NewPapyrusProjectWizard.java @@ -1,157 +1,159 @@ -/*****************************************************************************
- * Copyright (c) 2010, 2013 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:
- * Tatiana Fesenko (CEA LIST) - Initial API and implementation
- * Christian W. Damus (CEA) - Support creating models in repositories (CDO)
- *
- *****************************************************************************/
-package org.eclipse.papyrus.uml.diagram.wizards.wizards;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.uml.diagram.wizards.Activator;
-import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.PapyrusProjectCreationPage;
-import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectDiagramCategoryPage;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-/**
- * The Wizard creates a new Project and a Papyrus Model inside it.
- */
-public class NewPapyrusProjectWizard extends CreateModelWizard {
-
- /** The Constant WIZARD_ID. */
- public static final String WIZARD_ID = "org.eclipse.papyrus.uml.diagram.wizards.createproject"; //$NON-NLS-1$
-
- /** The new project page. */
- private PapyrusProjectCreationPage myProjectPage;
-
- @Override
- public boolean isCreateProjectWizard() {
- return true;
- }
-
- /**
- * Inits the.
- *
- * @param workbench
- * the workbench
- * @param selection
- * the selection {@inheritDoc}
- */
- @Override
- public void init(IWorkbench workbench, IStructuredSelection selection) {
- super.init(workbench, selection);
- setWindowTitle(Messages.NewPapyrusProjectWizard_new_papyrus_project);
- setMyProjectPage(new PapyrusProjectCreationPage(Messages.NewPapyrusProjectWizard_0));
- getMyProjectPage().setDescription(Messages.NewPapyrusProjectWizard_1);
- setDefaultPageImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/papyrus/PapyrusProjectWizban_75x66.gif")); //$NON-NLS-1$
- }
-
-
-
- /**
- * Adds the pages.
- *
- * {@inheritDoc}
- */
- @Override
- public void addPages() {
- // Gives the CreateModelWizard the newProjectPage to display it after the selectDiagramCategoryPage
- setNewProjectPage(getMyProjectPage());
-
- if (getDiagramCategoryIds() == null) {
- // If no one Overrides the id list then no specific behavior is expected
- // We therefore fall back to the original behavior: ask the user to pick a language
- selectDiagramCategoryPage = new SelectDiagramCategoryPage();
- }
-
- super.addPages();
- }
-
- /**
- * Perform finish.
- *
- * @return true, if successful {@inheritDoc}
- */
- @Override
- public boolean performFinish() {
- IProject newProjectHandle;
- try {
- newProjectHandle = createNewProject();
- } catch (CoreException e) {
- Activator.log.error(Messages.NewPapyrusProjectWizard_exception_on_opening, e);
- return false;
- }
- if (newProjectHandle == null) {
- return false;
- }
- return super.performFinish();
- }
-
- /**
- * Creates the new project.
- *
- * @return the i project
- * @throws CoreException
- * the core exception
- */
- protected IProject createNewProject() throws CoreException {
- // get a project handle
- final IProject project = getMyProjectPage().getProjectHandle();
-
- // get a project descriptor
- java.net.URI projectLocationURI = null;
- if (!getMyProjectPage().useDefaults()) {
- projectLocationURI = getMyProjectPage().getLocationURI();
- }
-
- NullProgressMonitor progressMonitor = new NullProgressMonitor();
- if (!project.exists()) {
- IProjectDescription projectDescription = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName());
- if (projectLocationURI != null) {
- projectDescription.setLocationURI(projectLocationURI);
- }
- project.create(projectDescription, new SubProgressMonitor(progressMonitor, 1));
- project.open(new SubProgressMonitor(progressMonitor, 1));
- } else {
- project.open(new SubProgressMonitor(progressMonitor, 1));
- }
-
- return project;
- }
-
- @Override
- protected URI createNewModelURI(String categoryId) {
- IPath newFilePath = getMyProjectPage().getProjectHandle().getFullPath().append(getMyProjectPage().getFileName() + "." + getDiagramFileExtension(categoryId)); //$NON-NLS-1$
- return URI.createPlatformResourceURI(newFilePath.toString(), true);
- }
-
- public PapyrusProjectCreationPage getMyProjectPage() {
- return myProjectPage;
- }
-
- public void setMyProjectPage(PapyrusProjectCreationPage myProjectPage) {
- this.myProjectPage = myProjectPage;
- }
-
- protected WizardNewProjectCreationPage createNewProjectCreationPage() {
- return this.myProjectPage;
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2010, 2013 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: + * Tatiana Fesenko (CEA LIST) - Initial API and implementation + * Christian W. Damus (CEA) - Support creating models in repositories (CDO) + * + *****************************************************************************/ +package org.eclipse.papyrus.uml.diagram.wizards.wizards; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.emf.common.util.URI; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.papyrus.uml.diagram.wizards.Activator; +import org.eclipse.papyrus.uml.diagram.wizards.messages.Messages; +import org.eclipse.papyrus.uml.diagram.wizards.pages.PapyrusProjectCreationPage; +import org.eclipse.papyrus.uml.diagram.wizards.pages.SelectArchitectureContextPage; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; + +/** + * The Wizard creates a new Project and a Papyrus Model inside it. + */ +public class NewPapyrusProjectWizard extends CreateModelWizard { + + /** The Constant WIZARD_ID. */ + public static final String WIZARD_ID = "org.eclipse.papyrus.uml.diagram.wizards.createproject"; //$NON-NLS-1$ + + /** The new project page. */ + private PapyrusProjectCreationPage myProjectPage; + + @Override + public boolean isCreateProjectWizard() { + return true; + } + + /** + * Inits the. + * + * @param workbench + * the workbench + * @param selection + * the selection {@inheritDoc} + */ + @Override + public void init(IWorkbench workbench, IStructuredSelection selection) { + super.init(workbench, selection); + setWindowTitle(Messages.NewPapyrusProjectWizard_new_papyrus_project); + setMyProjectPage(new PapyrusProjectCreationPage(Messages.NewPapyrusProjectWizard_0)); + getMyProjectPage().setDescription(Messages.NewPapyrusProjectWizard_1); + setDefaultPageImageDescriptor(Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "icons/papyrus/PapyrusProjectWizban_75x66.gif")); //$NON-NLS-1$ + } + + + + /** + * Adds the pages. + * + * {@inheritDoc} + */ + @Override + public void addPages() { + // Gives the CreateModelWizard the newProjectPage to display it after the selectDiagramCategoryPage + setNewProjectPage(getMyProjectPage()); + + if (getSelectedContexts() == null) { + // If no one Overrides the id list then no specific behavior is expected + // We therefore fall back to the original behavior: ask the user to pick a language + selectArchitectureContextPage = new SelectArchitectureContextPage(); + } + + super.addPages(); + } + + /** + * Perform finish. + * + * @return true, if successful {@inheritDoc} + */ + @Override + public boolean performFinish() { + IProject newProjectHandle; + try { + newProjectHandle = createNewProject(); + } catch (CoreException e) { + Activator.log.error(Messages.NewPapyrusProjectWizard_exception_on_opening, e); + return false; + } + if (newProjectHandle == null) { + return false; + } + return super.performFinish(); + } + + /** + * Creates the new project. + * + * @return the i project + * @throws CoreException + * the core exception + */ + protected IProject createNewProject() throws CoreException { + // get a project handle + final IProject project = getMyProjectPage().getProjectHandle(); + + // get a project descriptor + java.net.URI projectLocationURI = null; + if (!getMyProjectPage().useDefaults()) { + projectLocationURI = getMyProjectPage().getLocationURI(); + } + + IProjectDescription projectDescription = null; + NullProgressMonitor progressMonitor = new NullProgressMonitor(); + if (!project.exists()) { + projectDescription = ResourcesPlugin.getWorkspace().newProjectDescription(project.getName()); + if (projectLocationURI != null) { + projectDescription.setLocationURI(projectLocationURI); + } + project.create(projectDescription, new SubProgressMonitor(progressMonitor, 1)); + project.open(new SubProgressMonitor(progressMonitor, 1)); + } else { + // projectDescription = project.getDescription(); + project.open(new SubProgressMonitor(progressMonitor, 1)); + } + + return project; + } + + @Override + protected URI createNewModelURI(String categoryId) { + IPath newFilePath = getMyProjectPage().getProjectHandle().getFullPath().append(getMyProjectPage().getFileName() + "." + getDiagramFileExtension(categoryId)); //$NON-NLS-1$ + return URI.createPlatformResourceURI(newFilePath.toString(), true); + } + + public PapyrusProjectCreationPage getMyProjectPage() { + return myProjectPage; + } + + public void setMyProjectPage(PapyrusProjectCreationPage myProjectPage) { + this.myProjectPage = myProjectPage; + } + + protected WizardNewProjectCreationPage createNewProjectCreationPage() { + return this.myProjectPage; + } + +} diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/configs/classTreeTable.configuration b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/configs/classTreeTable.configuration deleted file mode 100644 index b7093746fd6..00000000000 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/configs/classTreeTable.configuration +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusSyncTable" xmi:id="_P3J1cEr7EeSVGbM3cmVSqQ" name="ClassTreeTable" icon="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/icons/uml_generic_table.png" implementationID="PapyrusClassTreeTable">
- <modelRules xmi:id="_vZwgkEr7EeSVGbM3cmVSqQ">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </modelRules>
- <owningRules xmi:id="_vZwgkUr7EeSVGbM3cmVSqQ">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb49xhEeOqHvRyiN87hA"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/plugin.xml index c339b24a0a4..e840e681be5 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/plugin.xml +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.clazz.config/plugin.xml @@ -1,26 +1,18 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.papyrus.infra.nattable.configuration">
- <configuration
- file="configs/class_synchronized_tree.nattableconfiguration"
- type="PapyrusClassTreeTable">
- </configuration>
- </extension>
- <extension
- point="org.eclipse.papyrus.infra.nattable.axismanager">
- <axisManager
- id="org.eclipse.papyrus.infra.uml.nattable.class.tree.axis.manager"
- manager="org.eclipse.papyrus.uml.nattable.clazz.config.manager.axis.UMLClassTreeAxisManagerForEventList">
- </axisManager>
- </extension>
- <extension
- point="org.eclipse.papyrus.infra.viewpoints.policy.custom">
- <contribution
- file="configs/classTreeTable.configuration"
- original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration">
- </contribution>
- </extension>
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + point="org.eclipse.papyrus.infra.nattable.configuration"> + <configuration + file="configs/class_synchronized_tree.nattableconfiguration" + type="PapyrusClassTreeTable"> + </configuration> + </extension> + <extension + point="org.eclipse.papyrus.infra.nattable.axismanager"> + <axisManager + id="org.eclipse.papyrus.infra.uml.nattable.class.tree.axis.manager" + manager="org.eclipse.papyrus.uml.nattable.clazz.config.manager.axis.UMLClassTreeAxisManagerForEventList"> + </axisManager> + </extension> +</plugin> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/configs/genericTable.configuration b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/configs/genericTable.configuration deleted file mode 100644 index 3937b2d8e5c..00000000000 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/configs/genericTable.configuration +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg">
- <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint">
- <modelKinds xsi:type="configuration:PapyrusSyncTable" xmi:id="_Uz8agHDuEeWh-MssWmCB_A" name="Generic Table" icon="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/icons/uml_generic_table.png" implementationID="PapyrusGenericTable">
- <modelRules xmi:id="_Uz8agXDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/>
- </modelRules>
- <owningRules xmi:id="_Uz8agnDuEeWh-MssWmCB_A">
- <element href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement"/>
- </owningRules>
- <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb5dxhEeOqHvRyiN87hA"/>
- </modelKinds>
- </viewpoints>
- <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/>
- <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/>
-</configuration:PapyrusConfiguration>
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/plugin.xml index f92f4a5e00e..87fb110cbd2 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/plugin.xml +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.generic.config/plugin.xml @@ -2,14 +2,6 @@ <?eclipse version="3.4"?> <plugin> <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="configs/genericTable.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - - <extension point="org.eclipse.papyrus.infra.nattable.configuration"> <configuration file="configs/generic.nattableconfiguration" diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/config/stereotypeDisplay.configuration b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/config/stereotypeDisplay.configuration deleted file mode 100755 index f4d6614c16a..00000000000 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/config/stereotypeDisplay.configuration +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration:PapyrusConfiguration - xmi:version="2.0" - xmlns:xmi="http://www.omg.org/XMI" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" - xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" - xmi:id="_KIq-4P4UEeSRsNBVzfUrzA"> - <viewpoints - xsi:type="configuration:PapyrusViewpoint" - xmi:id="_VGewQP4UEeSRsNBVzfUrzA" - name="Default Papyrus Viewpoint"> - <modelKinds - xsi:type="configuration:PapyrusSyncTable" - xmi:id="_WC1q0P4UEeSRsNBVzfUrzA" - name="StereotypeDisplayTreeTable" - icon="platform:/plugin/org.eclipse.papyrus.uml.nattable.generic.config/icons/uml_generic_table.png" - implementationID="PapyrusStereotypeDisplayTreeTable"> - <modelRules - xmi:id="_7k79wP4VEeSRsNBVzfUrzA"> - <element - href="http://www.eclipse.org/gmf/runtime/1.0.2/notation#//View"/> - </modelRules> - <owningRules - xmi:id="_AJmbwP4WEeSRsNBVzfUrzA"> - <element - href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </owningRules> - <categories - href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/> - </modelKinds> - </viewpoints> - <defaultStakeholder - href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/> - <metamodel - href="http://www.eclipse.org/uml2/5.0.0/UML#/"/> -</configuration:PapyrusConfiguration> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/plugin.xml index 39b1ac35e96..6b7cd7e3c5f 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/plugin.xml +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.stereotype.display/plugin.xml @@ -2,13 +2,6 @@ <?eclipse version="3.4"?> <plugin> <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="config/stereotypeDisplay.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> - <extension point="org.eclipse.papyrus.infra.nattable.configuration"> <configuration file="config/stereotype.nattableconfiguration" diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/configs/genericTreeTable.configuration b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/configs/genericTreeTable.configuration deleted file mode 100755 index 32a4b576d6c..00000000000 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/configs/genericTreeTable.configuration +++ /dev/null @@ -1,17 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg"> - <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint"> - <modelKinds xsi:type="configuration:PapyrusSyncTable" xmi:id="_P3J1cEr7EeSVGbM3cmVSqQ" name="Generic Tree Table" icon="platform:/plugin/org.eclipse.papyrus.uml.nattable/icons/uml_generic_table.png" implementationID="PapyrusUMLGenericTreeTable"> - <modelRules xmi:id="_vZwgkEr7EeSVGbM3cmVSqQ"> - <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </modelRules> - <owningRules xmi:id="_vZwgkUr7EeSVGbM3cmVSqQ"> - <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/> - </owningRules> - <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb4txhEeOqHvRyiN87hA"/> - <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb49xhEeOqHvRyiN87hA"/> - </modelKinds> - </viewpoints> - <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/> - <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/> -</configuration:PapyrusConfiguration> diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml index 63fe1aa31d1..940a0a964ae 100644 --- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml +++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable/plugin.xml @@ -283,11 +283,4 @@ type="PapyrusUMLGenericTreeTable"> </configuration> </extension> - <extension - point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> - <contribution - file="configs/genericTreeTable.configuration" - original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> - </contribution> - </extension> </plugin> diff --git a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF index a6ac84ac492..543a37226ce 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF +++ b/plugins/uml/org.eclipse.papyrus.uml.controlmode.profile/META-INF/MANIFEST.MF @@ -1,5 +1,5 @@ Manifest-Version: 1.0 -Require-Bundle: org.eclipse.papyrus.infra.services.controlmode;bundle-version="[1.3.0,2.0.0)", +Require-Bundle: org.eclipse.papyrus.infra.services.controlmode;bundle-version="[1.5.0,2.0.0)", org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.emf.readonly;bundle-version="[3.0.0,4.0.0)", org.eclipse.papyrus.infra.widgets.toolbox;bundle-version="[1.2.0,2.0.0)", diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types.ui/plugin.xml b/plugins/uml/org.eclipse.papyrus.uml.service.types.ui/plugin.xml index 00436a38341..d82325ac005 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.service.types.ui/plugin.xml +++ b/plugins/uml/org.eclipse.papyrus.uml.service.types.ui/plugin.xml @@ -1590,12 +1590,6 @@ <image commandId="org.eclipse.papyrus.uml.service.types.RefineCreateCommand" icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Abstraction.gif" > </image> </extension> - <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/uml-advice.elementtypesconfigurations"> - </elementTypeSet> - </extension> + </plugin> diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/build.properties b/plugins/uml/org.eclipse.papyrus.uml.service.types/build.properties index 8a35aec1873..06bdf27e0fe 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.service.types/build.properties +++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/build.properties @@ -1,10 +1,9 @@ -bin.includes = META-INF/,\
- .,\
- about.html,\
- plugin.properties,\
- icons/,\
- plugin.xml,\
- model/
-output..=bin/
-src.includes = about.html
-source..=src/,src-gen/
+bin.includes = META-INF/,\ + .,\ + about.html,\ + plugin.properties,\ + icons/,\ + model/ +output..=bin/ +src.includes = about.html +source..=src/,src-gen/ diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/plugin.xml b/plugins/uml/org.eclipse.papyrus.uml.service.types/plugin.xml deleted file mode 100644 index 1c55daad360..00000000000 --- a/plugins/uml/org.eclipse.papyrus.uml.service.types/plugin.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<plugin> - <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/uml.elementtypesconfigurations"> - </elementTypeSet> - </extension> - <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/uml-containments.elementtypesconfigurations"> - </elementTypeSet> - </extension> - <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/StandardProfile.elementtypesconfigurations"> - </elementTypeSet> - </extension> - <extension - point="org.eclipse.papyrus.infra.types.core.elementTypeSetConfiguration"> - <elementTypeSet - clientContextID="org.eclipse.papyrus.infra.services.edit.TypeContext" - path="model/umldi.elementtypesconfigurations"> - </elementTypeSet> - </extension> -</plugin> - diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/AbstractFeatureRelationshipReorientEditHelperAdvice.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/AbstractFeatureRelationshipReorientEditHelperAdvice.java index 90689b6ea6a..543a72b71b2 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/AbstractFeatureRelationshipReorientEditHelperAdvice.java +++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/AbstractFeatureRelationshipReorientEditHelperAdvice.java @@ -1,67 +1,67 @@ -/*****************************************************************************
- * Copyright (c) 2016 CEA LIST and others.
- *
- * 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.uml.service.types.helper.advice;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IClientContext;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-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.ReorientReferenceRelationshipRequest;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy;
-import org.eclipse.papyrus.infra.services.edit.internal.context.TypeContext;
-import org.eclipse.papyrus.infra.types.core.utils.ElementTypeRegistryUtils;
-
-public abstract class AbstractFeatureRelationshipReorientEditHelperAdvice extends AbstractEditHelperAdvice {
-
-
- @Override
- protected ICommand getBeforeReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest request) {
-
- Object value = request.getParameters().get(DefaultSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE);
-
- if (value instanceof View) {
-
- try {
- IClientContext context = TypeContext.getContext();
- List<IElementType> elementTypes = ElementTypeRegistryUtils.getElementTypesBySemanticHint(((View) value).getType(), context.getId());
-
- for (IElementType iElementType : elementTypes) {
- List<ISpecializationType> subs = Arrays.asList(ElementTypeRegistry.getInstance().getSpecializationsOf(elementTypeIDToSpecialize()));
- if (subs.contains(iElementType)) {
- return getFeatureRelationshipReorientCommand(request);
- }
- }
- } catch (ServiceException e) {
- org.eclipse.papyrus.uml.service.types.Activator.log.error(e);
- }
-
- }
-
- return null;
- }
-
- /**
- * @return
- */
- protected abstract String elementTypeIDToSpecialize();
-
- protected abstract ICommand getFeatureRelationshipReorientCommand(ReorientReferenceRelationshipRequest request);
-
-
-}
+/***************************************************************************** + * Copyright (c) 2016 CEA LIST and others. + * + * 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.uml.service.types.helper.advice; + +import java.util.Arrays; +import java.util.List; + +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry; +import org.eclipse.gmf.runtime.emf.type.core.IClientContext; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +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.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; +import org.eclipse.papyrus.infra.services.edit.context.TypeContext; +import org.eclipse.papyrus.infra.types.core.utils.ElementTypeRegistryUtils; + +public abstract class AbstractFeatureRelationshipReorientEditHelperAdvice extends AbstractEditHelperAdvice { + + + @Override + protected ICommand getBeforeReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest request) { + + Object value = request.getParameters().get(DefaultSemanticEditPolicy.GRAPHICAL_RECONNECTED_EDGE); + + if (value instanceof View) { + + try { + IClientContext context = TypeContext.getContext((View)value); + List<IElementType> elementTypes = ElementTypeRegistryUtils.getElementTypesBySemanticHint(((View) value).getType(), context.getId()); + + for (IElementType iElementType : elementTypes) { + List<ISpecializationType> subs = Arrays.asList(ElementTypeRegistry.getInstance().getSpecializationsOf(elementTypeIDToSpecialize())); + if (subs.contains(iElementType)) { + return getFeatureRelationshipReorientCommand(request); + } + } + } catch (ServiceException e) { + org.eclipse.papyrus.uml.service.types.Activator.log.error(e); + } + + } + + return null; + } + + /** + * @return + */ + protected abstract String elementTypeIDToSpecialize(); + + protected abstract ICommand getFeatureRelationshipReorientCommand(ReorientReferenceRelationshipRequest request); + + +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/AbstractReferenceDeleteRelationshipEditHelperAdvice.java b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/AbstractReferenceDeleteRelationshipEditHelperAdvice.java index 9ebd0d631f5..3d8ee57d42f 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/AbstractReferenceDeleteRelationshipEditHelperAdvice.java +++ b/plugins/uml/org.eclipse.papyrus.uml.service.types/src/org/eclipse/papyrus/uml/service/types/helper/advice/AbstractReferenceDeleteRelationshipEditHelperAdvice.java @@ -36,8 +36,6 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest; import org.eclipse.gmf.runtime.notation.Connector; import org.eclipse.gmf.runtime.notation.NotationPackage; import org.eclipse.gmf.runtime.notation.View; -import org.eclipse.papyrus.infra.core.services.ServiceException; -import org.eclipse.papyrus.infra.services.edit.internal.context.TypeContext; import org.eclipse.papyrus.infra.types.core.utils.ElementTypeRegistryUtils; import org.eclipse.papyrus.uml.service.types.utils.RequestParameterConstants; import org.eclipse.uml2.common.util.CacheAdapter; @@ -58,7 +56,7 @@ public abstract class AbstractReferenceDeleteRelationshipEditHelperAdvice extend super.configureRequest(request); if (request instanceof DestroyReferenceRequest && ((DestroyReferenceRequest) request).getContainingFeature() == null) { String visualId = (String) request.getParameter(RequestParameterConstants.VIEW_VISUAL_ID); - ((DestroyReferenceRequest) request).setContainingFeature(getFeature(visualId)); + ((DestroyReferenceRequest) request).setContainingFeature(getFeature(visualId, request.getClientContext())); } } @@ -69,23 +67,17 @@ public abstract class AbstractReferenceDeleteRelationshipEditHelperAdvice extend * @return * the EReference represented by the view with this visual id */ - protected EReference getFeature(String visualId) { - - try { - IClientContext context = TypeContext.getContext(); - List<IElementType> elementTypes = ElementTypeRegistryUtils.getElementTypesBySemanticHint(visualId, context.getId()); - - for (IElementType iElementType : elementTypes) { - Map<String, EReference> featureElementTypeToEReferenceMap = getFeatureElementTypeToEReferenceMap(); - for (String featureElementType : featureElementTypeToEReferenceMap.keySet()) { - List<ISpecializationType> subs = Arrays.asList(ElementTypeRegistry.getInstance().getSpecializationsOf(featureElementType)); - if (subs.contains(iElementType)) { - return featureElementTypeToEReferenceMap.get(featureElementType); - } + protected EReference getFeature(String visualId, IClientContext context) { + List<IElementType> elementTypes = ElementTypeRegistryUtils.getElementTypesBySemanticHint(visualId, context.getId()); + + for (IElementType iElementType : elementTypes) { + Map<String, EReference> featureElementTypeToEReferenceMap = getFeatureElementTypeToEReferenceMap(); + for (String featureElementType : featureElementTypeToEReferenceMap.keySet()) { + List<ISpecializationType> subs = Arrays.asList(ElementTypeRegistry.getInstance().getSpecializationsOf(featureElementType)); + if (subs.contains(iElementType)) { + return featureElementTypeToEReferenceMap.get(featureElementType); } } - } catch (ServiceException e) { - org.eclipse.papyrus.uml.service.types.Activator.log.error(e); } return null; diff --git a/plugins/uml/pom.xml b/plugins/uml/pom.xml index 99ec962cd5f..15b1594fe3a 100644 --- a/plugins/uml/pom.xml +++ b/plugins/uml/pom.xml @@ -37,6 +37,7 @@ <module>org.eclipse.papyrus.uml.templaterepository</module> <module>org.eclipse.papyrus.uml.ui</module> <module>alf</module> + <module>architecture</module> <module>assistants</module> <module>decoratormodel</module> <module>diagram</module> diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/PapyrusObservableValue.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/PapyrusObservableValue.java index afc9aef647e..c68e72eb81a 100644 --- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/PapyrusObservableValue.java +++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools/src/org/eclipse/papyrus/uml/tools/databinding/PapyrusObservableValue.java @@ -106,7 +106,7 @@ public class PapyrusObservableValue extends EMFObservableValue implements Aggreg Object oldValue = getValue(); try { - IElementEditService provider = ElementEditServiceUtils.getCommandProvider(getObserved()); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider((EObject)getObserved()); if (provider != null) { CompositeCommand cc = new CompositeCommand("Edit value"); |