diff options
author | ashatilov | 2015-08-27 15:12:05 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-09-11 09:39:15 +0000 |
commit | dd2d53ad77fbde6e1d6b3fcffa44ca07cf68072a (patch) | |
tree | 70f84e380b7e31c1e68297e9c86fdcc6d3e46afe /plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment | |
parent | 810498dbe6750ece31e8d09c8f15c09a948f8002 (diff) | |
download | org.eclipse.papyrus-dd2d53ad77fbde6e1d6b3fcffa44ca07cf68072a.tar.gz org.eclipse.papyrus-dd2d53ad77fbde6e1d6b3fcffa44ca07cf68072a.tar.xz org.eclipse.papyrus-dd2d53ad77fbde6e1d6b3fcffa44ca07cf68072a.zip |
Bug 475948 - deployment specification is missing in deployment diagram
Change-Id: Ic56fb91ba4fed47d310b2fe9ba1543739028e6db
Signed-off-by: ashatilov <shatilov@montages.com>
Diffstat (limited to 'plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment')
29 files changed, 9568 insertions, 117 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/.settings/org.eclipse.jdt.ui.prefs b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/.settings/org.eclipse.jdt.ui.prefs index 954281dbc31..71e45e18e0c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/.settings/org.eclipse.jdt.ui.prefs +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/.settings/org.eclipse.jdt.ui.prefs @@ -58,7 +58,6 @@ cleanup.use_type_arguments=false cleanup_profile=_Papyrus cleanup_settings_version=2 eclipse.preferences.version=1 -formatter_profile=_Papyrus formatter_settings_version=12 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=java;javax;org;com; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF index efa6591995f..a901b8240d1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/META-INF/MANIFEST.MF @@ -1,78 +1,77 @@ -Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.uml.diagram.deployment,
- org.eclipse.papyrus.uml.diagram.deployment.custom.actions,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies,
- org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic,
- org.eclipse.papyrus.uml.diagram.deployment.custom.factory,
- org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes,
- org.eclipse.papyrus.uml.diagram.deployment.custom.messages,
- org.eclipse.papyrus.uml.diagram.deployment.custom.providers,
- org.eclipse.papyrus.uml.diagram.deployment.edit.helpers,
- org.eclipse.papyrus.uml.diagram.deployment.edit.parts,
- org.eclipse.papyrus.uml.diagram.deployment.edit.policies,
- org.eclipse.papyrus.uml.diagram.deployment.expressions,
- org.eclipse.papyrus.uml.diagram.deployment.parsers,
- org.eclipse.papyrus.uml.diagram.deployment.part,
- org.eclipse.papyrus.uml.diagram.deployment.preferences,
- org.eclipse.papyrus.uml.diagram.deployment.providers,
- org.eclipse.papyrus.uml.diagram.deployment.sheet
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
-Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
- org.eclipse.ocl.ecore,
- org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0",
- org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0",
- org.eclipse.uml2.uml.edit;bundle-version="4.0.0",
- org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,
- 4.0.0)",
- org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.7.0",
- org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.jface,
- org.eclipse.ui.views,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.xmi,
- org.eclipse.emf.edit.ui,
- org.eclipse.gmf.runtime.emf.core,
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.emf.ui.properties,
- org.eclipse.gmf.runtime.diagram.ui,
- org.eclipse.papyrus.uml.service.types;bundle-version="1.2.0",
- org.eclipse.gmf.runtime.diagram.ui.providers.ide,
- org.eclipse.gmf.runtime.diagram.ui.render,
- org.eclipse.gmf.runtime.diagram.ui.resources.editor,
- org.eclipse.draw2d,
- org.eclipse.gmf.runtime.draw2d.ui,
- org.eclipse.uml2.uml,
- org.eclipse.emf.ecore,
- org.eclipse.emf.ecore.edit,
- org.eclipse.emf.validation,
- org.eclipse.gef,
- org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0",
- org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
- org.eclipse.core.databinding.observable
-Bundle-Vendor: %providerName
-Eclipse-LazyStart: true
-Bundle-Version: 1.2.0.qualifier
-Bundle-Activator: org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.deployment; singleton:=true
+Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.uml.diagram.deployment, + org.eclipse.papyrus.uml.diagram.deployment.custom.actions, + org.eclipse.papyrus.uml.diagram.deployment.custom.edit.command, + org.eclipse.papyrus.uml.diagram.deployment.custom.edit.helpers, + org.eclipse.papyrus.uml.diagram.deployment.custom.edit.part, + org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies, + org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.itemsemantic, + org.eclipse.papyrus.uml.diagram.deployment.custom.factory, + org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes, + org.eclipse.papyrus.uml.diagram.deployment.custom.messages, + org.eclipse.papyrus.uml.diagram.deployment.custom.providers, + org.eclipse.papyrus.uml.diagram.deployment.edit.helpers, + org.eclipse.papyrus.uml.diagram.deployment.edit.parts, + org.eclipse.papyrus.uml.diagram.deployment.edit.policies, + org.eclipse.papyrus.uml.diagram.deployment.expressions, + org.eclipse.papyrus.uml.diagram.deployment.parsers, + org.eclipse.papyrus.uml.diagram.deployment.part, + org.eclipse.papyrus.uml.diagram.deployment.preferences, + org.eclipse.papyrus.uml.diagram.deployment.providers, + org.eclipse.papyrus.uml.diagram.deployment.sheet +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Name: %pluginName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Require-Bundle: org.eclipse.gmf.runtime.diagram.ui.properties, + org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide, + org.eclipse.ocl.ecore, + org.eclipse.papyrus.infra.gmfdiag.preferences;bundle-version="1.2.0", + org.eclipse.papyrus.extensionpoints.editors;bundle-version="1.2.0", + org.eclipse.papyrus.infra.services.edit;bundle-version="1.2.0", + org.eclipse.papyrus.uml.diagram.common;bundle-version="1.2.0", + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.2.0", + org.eclipse.papyrus.infra.gmfdiag.navigation;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core;bundle-version="1.2.0", + org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="1.2.0", + org.eclipse.ui.ide;bundle-version="3.8.0", + org.eclipse.papyrus.infra.extendedtypes;bundle-version="1.2.0", + org.eclipse.uml2.uml.edit;bundle-version="4.0.0", + org.eclipse.gmf.tooling.runtime;bundle-version="[3.3.0,4.0.0)", + org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0", + org.eclipse.gmf.runtime.diagram.ui.providers;bundle-version="1.7.0", + org.eclipse.core.runtime, + org.eclipse.core.resources, + org.eclipse.jface, + org.eclipse.ui.views, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore.xmi, + org.eclipse.emf.edit.ui, + org.eclipse.gmf.runtime.emf.core, + org.eclipse.gmf.runtime.emf.commands.core, + org.eclipse.gmf.runtime.emf.ui.properties, + org.eclipse.gmf.runtime.diagram.ui, + org.eclipse.papyrus.uml.service.types;bundle-version="1.2.0", + org.eclipse.gmf.runtime.diagram.ui.providers.ide, + org.eclipse.gmf.runtime.diagram.ui.render, + org.eclipse.gmf.runtime.diagram.ui.resources.editor, + org.eclipse.draw2d, + org.eclipse.gmf.runtime.draw2d.ui, + org.eclipse.uml2.uml, + org.eclipse.emf.ecore, + org.eclipse.emf.ecore.edit, + org.eclipse.emf.validation, + org.eclipse.gef, + org.eclipse.papyrus.infra.emf.appearance;bundle-version="1.2.0", + org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.2.0", + org.eclipse.papyrus.infra.viewpoints.configuration;bundle-version="1.2.0", + org.eclipse.papyrus.uml.tools.utils;bundle-version="1.2.0", + org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0", + org.eclipse.core.databinding.observable +Bundle-Vendor: %providerName +Eclipse-LazyStart: true +Bundle-Version: 1.2.0.qualifier +Bundle-Activator: org.eclipse.papyrus.uml.diagram.deployment.part.UMLDiagramEditorPlugin +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.uml.diagram.deployment; singleton:=true diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/figure/nodes/DeploymentSpecificationFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/figure/nodes/DeploymentSpecificationFigure.java new file mode 100644 index 00000000000..06949078486 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/custom-src/org/eclipse/papyrus/uml/diagram/deployment/custom/figure/nodes/DeploymentSpecificationFigure.java @@ -0,0 +1,21 @@ +/***************************************************************************** + * Copyright (c) 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: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes; + +public class DeploymentSpecificationFigure extends ArtifactFigure { + + public DeploymentSpecificationFigure() { + super("deployment spec"); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/messages.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/messages.properties index 08cd73c4ccd..363bc36c46d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/messages.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/messages.properties @@ -94,3 +94,5 @@ MessageFormatParser_InvalidInputError=Invalid input at {0} UMLModelingAssistantProviderTitle=Select domain model element UMLModelingAssistantProviderMessage=Available domain model elements: CommunicationPath1CreationTool_title=CommunicationPath +DeploymentSpecification5CreationTool_title=DeploymentSpecification +DeploymentSpecification5CreationTool_desc=Create new DeploymentSpecification diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations index 6b03038a33e..0dee258c1d5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.elementtypesconfigurations @@ -193,6 +193,54 @@ </elementTypeConfigurations> <elementTypeConfigurations xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration" + xmi:id="_H3PAAEvtEeWDlLIkRlZnAA" + name="DeploymentSpecification" + identifier="org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2013" + hint="2013"> + <iconEntry + xmi:id="_NrvVQEvtEeWDlLIkRlZnAA" + iconPath="/icons/full/obj16/DeploymentSpecification.gif" + bundleId="org.eclipse.uml2.uml.edit"/> + <specializedTypesID>org.eclipse.papyrus.uml.DeploymentSpecification</specializedTypesID> + </elementTypeConfigurations> + <elementTypeConfigurations + xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration" + xmi:id="_CafvEEwwEeWwb_6uOhatZA" + name="DeploymentSpecification" + identifier="org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2014" + hint="2014"> + <iconEntry + xmi:id="_bp_zEEyhEeW-zLOt2X96xQ" + iconPath="/icons/full/obj16/DeploymentSpecification.gif" + bundleId="org.eclipse.uml2.uml.edit"/> + <specializedTypesID>org.eclipse.papyrus.uml.DeploymentSpecification</specializedTypesID> + </elementTypeConfigurations> + <elementTypeConfigurations + xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration" + xmi:id="_dGBFIEyhEeW-zLOt2X96xQ" + name="DeploymentSpecification" + identifier="org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2015" + hint="2015"> + <iconEntry + xmi:id="_dGBFIUyhEeW-zLOt2X96xQ" + iconPath="/icons/full/obj16/DeploymentSpecification.gif" + bundleId="org.eclipse.uml2.uml.edit"/> + <specializedTypesID>org.eclipse.papyrus.uml.DeploymentSpecification</specializedTypesID> + </elementTypeConfigurations> + <elementTypeConfigurations + xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration" + xmi:id="_GKvkwEy4EeWcB5wRNPiyyQ" + name="DeploymentSpecification" + identifier="org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2016" + hint="2016"> + <iconEntry + xmi:id="_GKwL0Ey4EeWcB5wRNPiyyQ" + iconPath="/icons/full/obj16/DeploymentSpecification.gif" + bundleId="org.eclipse.uml2.uml.edit"/> + <specializedTypesID>org.eclipse.papyrus.uml.DeploymentSpecification</specializedTypesID> + </elementTypeConfigurations> + <elementTypeConfigurations + xsi:type="elementtypesconfigurations:SpecializationTypeConfiguration" xmi:id="_gv-d4P8PEeS2nvlxgM4H8g" name="Device" identifier="org.eclipse.papyrus.uml.diagram.deployment.Device_16" diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen index d3e0b9c661c..c142f308a9a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/model/DeploymentDiagram.gmfgen @@ -805,7 +805,8 @@ xsi:type="gmfgen:CustomBehaviour" key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/> - <modelFacet> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.2"> <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/> <containmentMetaFeature @@ -926,7 +927,8 @@ xsi:type="gmfgen:CustomBehaviour" key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/> - <modelFacet> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.2"> <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/> <containmentMetaFeature @@ -1040,7 +1042,8 @@ xsi:type="gmfgen:CustomBehaviour" key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE" editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/> - <modelFacet> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.2"> <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/> <containmentMetaFeature @@ -1239,6 +1242,316 @@ </modelFacet> </labels> </childNodes> + <childNodes + visualID="2014" + editPartClassName="DeploymentSpecAsClassifierEditPart" + containers="/0/@diagram/@compartments.2 /0/@diagram/@compartments.3 /0/@diagram/@compartments.4 /0/@diagram/@compartments.9 /0/@diagram/@compartments.8 /0/@diagram/@compartments.10"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:MetamodelType" + definedExternally="true"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="150" + height="70"/> + </viewmap> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key=""REMOVE_ORPHAN_VIEW"" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/> + <modelFacet> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DeploymentSpecification"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Class/nestedClassifier"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Class/nestedClassifier"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.1/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + visualID="64" + editPartClassName="DeploymentSpecAsClassifierNameEditPart"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:ParentAssignedViewmap" + getterName="getNameLabel" + figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0"> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="65" + editPartClassName="DeploymentSpecAsClassifierFloatingLabelEditPart"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"> + <attributes + xsi:type="gmfgen:LabelOffsetAttributes" + x="25"/> + </viewmap> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0" + viewPattern="" + editorPattern="" + editPattern=""> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + </childNodes> + <childNodes + visualID="2015" + editPartClassName="DeploymentSpecAsPackageableElEditPart" + containers="/0/@diagram/@compartments.0 /0/@diagram/@compartments.1 /0/@diagram/@compartments.6 /0/@diagram/@compartments.7"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:MetamodelType" + definedExternally="true"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="150" + height="70"/> + </viewmap> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key=""REMOVE_ORPHAN_VIEW"" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/> + <modelFacet> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DeploymentSpecification"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.1/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + visualID="66" + editPartClassName="DeploymentSpecAsPackageableElNameEditPart"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:ParentAssignedViewmap" + getterName="getNameLabel" + figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0"> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="67" + editPartClassName="DeploymentSpecAsPackageableElFloatingLabelEditPart"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"> + <attributes + xsi:type="gmfgen:LabelOffsetAttributes" + x="25"/> + </viewmap> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0" + viewPattern="" + editorPattern="" + editPattern=""> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + </childNodes> + <childNodes + visualID="2016" + editPartClassName="DeploymentSpecAsNestedArtifactEditPart" + containers="/0/@diagram/@compartments.5 /0/@diagram/@compartments.11 /0/@diagram/@compartments.12"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:MetamodelType" + definedExternally="true"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="150" + height="70"/> + </viewmap> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key=""REMOVE_ORPHAN_VIEW"" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/> + <modelFacet> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DeploymentSpecification"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/nestedArtifact"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.1/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + visualID="68" + editPartClassName="DeploymentSpecAsNestedArtifactNameEditPart"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:ParentAssignedViewmap" + getterName="getNameLabel" + figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0"> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="69" + editPartClassName="DeploymentSpecAsNestedArtifactFloatingLabelEditPart"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"> + <attributes + xsi:type="gmfgen:LabelOffsetAttributes" + x="25"/> + </viewmap> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0" + viewPattern="" + editorPattern="" + editPattern=""> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + </childNodes> <topLevelNodes visualID="2011" editPartClassName="DependencyNodeEditPart" @@ -1834,7 +2147,8 @@ xsi:type="gmfgen:CustomBehaviour" key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/> - <modelFacet> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.0/@expressions.2"> <metaClass href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact"/> <containmentMetaFeature @@ -2055,6 +2369,107 @@ </modelFacet> </labels> </topLevelNodes> + <topLevelNodes + visualID="2013"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:MetamodelType" + definedExternally="true"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="150" + height="70"/> + </viewmap> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key=""REMOVE_ORPHAN_VIEW"" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy"/> + <modelFacet> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/DeploymentSpecification"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Package/packagedElement"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.1/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Artifact/fileName"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + visualID="62"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:ParentAssignedViewmap" + getterName="getNameLabel" + figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0"> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="63" + editPartClassName="DeploymentSpecificationFloatingLabelEditPart"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"> + <attributes + xsi:type="gmfgen:LabelOffsetAttributes" + x="25"/> + </viewmap> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="/0/@labelParsers/@implementations.0" + viewPattern="" + editorPattern="" + editPattern=""> + <metaFeatures + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </modelFacet> + </labels> + </topLevelNodes> <links visualID="4005" editPartClassName="LinkDescriptorEditPart" @@ -2588,7 +3003,7 @@ editPartClassName="ModelPackageableElementCompartmentEditPart" itemSemanticEditPolicyClassName="ModelPackageableElementCompartmentItemSemanticEditPolicy" canonicalEditPolicyClassName="ModelPackageableElementCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12" + childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.14" title="ModelCompartment" canCollapse="false" node="/0/@diagram/@topLevelNodes.1" @@ -2613,7 +3028,7 @@ editPartClassName="PackagePackageableElementCompartmentEditPart" itemSemanticEditPolicyClassName="PackagePackageableElementCompartmentItemSemanticEditPolicy" canonicalEditPolicyClassName="PackagePackageableElementCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12" + childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.14" title="PackageableElementCompartment" canCollapse="false" node="/0/@diagram/@topLevelNodes.2" @@ -2638,7 +3053,7 @@ editPartClassName="DeviceCompositeCompartmentEditPart" itemSemanticEditPolicyClassName="DeviceCompositeCompartmentItemSemanticEditPolicy" canonicalEditPolicyClassName="DeviceCompositeCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.6" + childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.13" title="DeviceCompositeCompartment" canCollapse="false" node="/0/@diagram/@topLevelNodes.6" @@ -2663,7 +3078,7 @@ editPartClassName="ExecutionEnvironmentCompositeCompartmentEditPart" itemSemanticEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicy" canonicalEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.8" + childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.13" title="ExecutionEnvironmentCompositeCompartment" canCollapse="false" node="/0/@diagram/@topLevelNodes.5" @@ -2688,7 +3103,7 @@ editPartClassName="NodeCompositeCompartmentEditPart" itemSemanticEditPolicyClassName="NodeCompositeCompartmentItemSemanticEditPolicy" canonicalEditPolicyClassName="NodeCompositeCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.2 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.6" + childNodes="/0/@diagram/@childNodes.2 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.13" title="CompositeCompartment" canCollapse="false" node="/0/@diagram/@topLevelNodes.8" @@ -2713,7 +3128,7 @@ editPartClassName="ArtifactCompositeCompartmentEditPart" itemSemanticEditPolicyClassName="ArtifactCompositeCompartmentItemSemanticEditPolicy" canonicalEditPolicyClassName="ArtifactCompositeCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.9" + childNodes="/0/@diagram/@childNodes.9 /0/@diagram/@childNodes.15" title="ArtifactCompositeCompartment" node="/0/@diagram/@topLevelNodes.7" listLayout="false"> @@ -2741,7 +3156,7 @@ editPartClassName="ModelPackageableElementCompartmentEditPartCN" itemSemanticEditPolicyClassName="ModelPackageableElementCompartmentItemSemanticEditPolicyCN" canonicalEditPolicyClassName="ModelPackageableElementCompartmentCanonicalEditPolicyCN" - childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12" + childNodes="/0/@diagram/@childNodes.0 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.14" title="ModelCompartment" canCollapse="false" node="/0/@diagram/@childNodes.0" @@ -2766,7 +3181,7 @@ editPartClassName="PackagePackageableElementCompartmentEditPartCN" itemSemanticEditPolicyClassName="PackagePackageableElementCompartmentItemSemanticEditPolicyCN" canonicalEditPolicyClassName="PackagePackageableElementCompartmentCanonicalEditPolicyCN" - childNodes="/0/@diagram/@childNodes.1 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12" + childNodes="/0/@diagram/@childNodes.1 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.14" title="PackageableElementCompartment" canCollapse="false" node="/0/@diagram/@childNodes.1" @@ -2791,7 +3206,7 @@ editPartClassName="DeviceCompositeCompartmentEditPartCN" itemSemanticEditPolicyClassName="DeviceCompositeCompartmentItemSemanticEditPolicyCN" canonicalEditPolicyClassName="DeviceCompositeCompartmentCanonicalEditPolicyCN" - childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.6" + childNodes="/0/@diagram/@childNodes.4 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.13" title="DeviceCompositeCompartment" node="/0/@diagram/@childNodes.3" listLayout="false"> @@ -2815,7 +3230,7 @@ editPartClassName="ExecutionEnvironmentCompositeCompartmentEditPartCN" itemSemanticEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentItemSemanticEditPolicyCN" canonicalEditPolicyClassName="ExecutionEnvironmentCompositeCompartmentCanonicalEditPolicyCN" - childNodes="/0/@diagram/@childNodes.8 /0/@diagram/@childNodes.4" + childNodes="/0/@diagram/@childNodes.8 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.13" title="ExecutionEnvironmentCompositeCompartment" node="/0/@diagram/@childNodes.5" listLayout="false"> @@ -2839,7 +3254,7 @@ editPartClassName="NodeCompositeCompartmentEditPartCN" itemSemanticEditPolicyClassName="NodeCompositeCompartmentItemSemanticEditPolicyCN" canonicalEditPolicyClassName="NodeCompositeCompartmentCanonicalEditPolicyCN" - childNodes="/0/@diagram/@childNodes.2 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.8" + childNodes="/0/@diagram/@childNodes.2 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.13" title="CompositeCompartment" node="/0/@diagram/@childNodes.7" listLayout="false"> @@ -2863,7 +3278,7 @@ editPartClassName="ArtifactCompositeCompartmentEditPartCN" itemSemanticEditPolicyClassName="ArtifactCompositeCompartmentItemSemanticEditPolicyCN" canonicalEditPolicyClassName="ArtifactCompositeCompartmentCanonicalEditPolicyCN" - childNodes="/0/@diagram/@childNodes.9" + childNodes="/0/@diagram/@childNodes.9 /0/@diagram/@childNodes.15" title="ArtifactCompositeCompartment" node="/0/@diagram/@childNodes.8" listLayout="false"> @@ -2891,7 +3306,7 @@ editPartClassName="ArtifactCompositeCompartmentEditPartACN" itemSemanticEditPolicyClassName="ArtifactCompositeCompartmentItemSemanticEditPolicyACN" canonicalEditPolicyClassName="ArtifactCompositeCompartmentCanonicalEditPolicyACN" - childNodes="/0/@diagram/@childNodes.9" + childNodes="/0/@diagram/@childNodes.9 /0/@diagram/@childNodes.15" title="ArtifactCompositeCompartment" node="/0/@diagram/@childNodes.9" listLayout="false"> @@ -2961,6 +3376,14 @@ genNodes="/0/@diagram/@topLevelNodes.6 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.3"/> <entries xsi:type="gmfgen:ToolEntry" + title="DeploymentSpecification" + description="Create new DeploymentSpecification" + largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DeploymentSpecification.gif" + smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DeploymentSpecification.gif" + id=""deployment.tool.deploymentspecification"" + genNodes="/0/@diagram/@topLevelNodes.10 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.15"/> + <entries + xsi:type="gmfgen:ToolEntry" title="Execution Environment" description="Create new ExecutionEnvironment" largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ExecutionEnvironment.gif" @@ -3132,6 +3555,9 @@ <expressions xsi:type="gmfgen:GenConstraint" body="self.oclIsKindOf(DeploymentTarget)"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="self.oclIsTypeOf(Artifact)"/> </providers> <providers xsi:type="gmfgen:GenJavaExpressionProvider" @@ -3151,7 +3577,7 @@ extensibleViaService="true"> <implementations xsi:type="gmfgen:PredefinedParser" - uses="/0/@diagram/@topLevelNodes.3/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.5/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.6/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.7/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.8/@labels.0/@modelFacet /0/@diagram/@links.4/@labels.0/@modelFacet /0/@diagram/@links.6/@labels.0/@modelFacet /0/@diagram/@links.3/@labels.0/@modelFacet /0/@diagram/@childNodes.2/@labels.0/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.6/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.2/@labels.0/@modelFacet /0/@diagram/@childNodes.1/@labels.0/@modelFacet /0/@diagram/@childNodes.10/@labels.0/@modelFacet /0/@diagram/@childNodes.7/@labels.0/@modelFacet /0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.5/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.1/@labels.0/@modelFacet /0/@diagram/@childNodes.0/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.9/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.1/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@topLevelNodes.7/@labels.1/@modelFacet /0/@diagram/@links.8/@labels.0/@modelFacet"/> + uses="/0/@diagram/@topLevelNodes.3/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.5/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.6/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.7/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.8/@labels.0/@modelFacet /0/@diagram/@links.4/@labels.0/@modelFacet /0/@diagram/@links.6/@labels.0/@modelFacet /0/@diagram/@links.3/@labels.0/@modelFacet /0/@diagram/@childNodes.2/@labels.0/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.6/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.2/@labels.0/@modelFacet /0/@diagram/@childNodes.1/@labels.0/@modelFacet /0/@diagram/@childNodes.10/@labels.0/@modelFacet /0/@diagram/@childNodes.7/@labels.0/@modelFacet /0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.5/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.1/@labels.0/@modelFacet /0/@diagram/@childNodes.0/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.9/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.1/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@topLevelNodes.7/@labels.1/@modelFacet /0/@diagram/@links.8/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.10/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.10/@labels.1/@modelFacet /0/@diagram/@childNodes.14/@labels.0/@modelFacet /0/@diagram/@childNodes.14/@labels.1/@modelFacet /0/@diagram/@childNodes.13/@labels.0/@modelFacet /0/@diagram/@childNodes.13/@labels.1/@modelFacet /0/@diagram/@childNodes.15/@labels.0/@modelFacet /0/@diagram/@childNodes.15/@labels.1/@modelFacet"/> <implementations xsi:type="gmfgen:CustomParser" uses="/0/@diagram/@topLevelNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.11/@labels.0/@modelFacet" @@ -3206,7 +3632,7 @@ <extensionNodes xsi:type="papyrusgmfgenextension:GenNodeConstraint" comment="Creation constraint for TopLevelNode in virtual canvas" - genNode="/0/@diagram/@topLevelNodes.2 /0/@diagram/@topLevelNodes.4 /0/@diagram/@topLevelNodes.3 /0/@diagram/@topLevelNodes.5 /0/@diagram/@topLevelNodes.6 /0/@diagram/@topLevelNodes.7 /0/@diagram/@topLevelNodes.8" + genNode="/0/@diagram/@topLevelNodes.2 /0/@diagram/@topLevelNodes.4 /0/@diagram/@topLevelNodes.3 /0/@diagram/@topLevelNodes.5 /0/@diagram/@topLevelNodes.6 /0/@diagram/@topLevelNodes.7 /0/@diagram/@topLevelNodes.8 /0/@diagram/@topLevelNodes.10" genConstraint="/0/@expressionProviders/@providers.1/@expressions.3"/> <extensionNodes xsi:type="papyrusgmfgenextension:AdditionalEditPartCandies" @@ -3245,20 +3671,20 @@ <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="add superclass for floating Label" - genView="/0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@topLevelNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.1" + genView="/0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@topLevelNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@topLevelNodes.10/@labels.1 /0/@diagram/@childNodes.13/@labels.1 /0/@diagram/@childNodes.14/@labels.1 /0/@diagram/@childNodes.15/@labels.1" name="FloatingLabelEditPart" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="" - genView="/0/@diagram/@topLevelNodes.7 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.8" + genView="/0/@diagram/@topLevelNodes.7 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.8 /0/@diagram/@topLevelNodes.10 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.15" name="RoundedCompartmentEditPart" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"/> <extensionNodes xsi:type="papyrusgmfgenextension:SpecificLocatorExternalLabel" comment="Locator for external Floating label of RoundedCompartment EP" classpath="org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator" - genExternalNodeLabel="/0/@diagram/@topLevelNodes.7/@labels.1 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.8/@labels.1"/> + genExternalNodeLabel="/0/@diagram/@topLevelNodes.7/@labels.1 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@topLevelNodes.10/@labels.1"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" genView="/0/@diagram/@childNodes.1 /0/@diagram/@topLevelNodes.2 /0/@diagram/@childNodes.0 /0/@diagram/@topLevelNodes.1" 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 2b0c5f1ec1c..c5d65221b84 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 @@ -188,6 +188,16 @@ </entry> <entry defineOnly="true" + description="Create new DeploymentSpecification" + id="deployment.tool.deploymentspecification" + kind="tool" + label="DeploymentSpecification" + large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DeploymentSpecification.gif" + path="" + small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/DeploymentSpecification.gif"> + </entry> + <entry + defineOnly="true" description="Create new ExecutionEnvironment" id="deployment.tool.executionEnvironment" kind="tool" @@ -345,6 +355,10 @@ path="/deployment.group.nodes"> </predefinedEntry> <predefinedEntry + id="deployment.tool.deploymentspecification" + path="/deployment.group.nodes"> + </predefinedEntry> + <predefinedEntry id="deployment.tool.executionEnvironment" path="/deployment.group.nodes"> </predefinedEntry> @@ -507,7 +521,7 @@ <viewProvider class="org.eclipse.papyrus.uml.diagram.deployment.providers.UMLViewProvider"> <Priority name="Lowest"/> <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="PapyrusUMLDeploymentDiagram"/> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2011,2010,2009,2005,2001,2002,2003,2006,2008,2012,49,36,16,44,21,46,23,42,25,28,40,54,56"/> + <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2011,2010,2009,2005,2001,2002,2003,2006,2008,2012,2013,49,36,16,44,21,46,23,42,25,28,40,54,56,2014,2015,2016"/> <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="4005,4008,4009,4001,4002,4003,4004,4010,4011"/> </viewProvider> </extension> @@ -520,13 +534,13 @@ <method name="getType()" value="PapyrusUMLDeploymentDiagram"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes"> - <method name="getType()" value="2011,2010,2009,2005,2001,2002,2003,2006,2008,2012,49,36,16,44,21,46,23,42,25,28,40,54,56"/> + <method name="getType()" value="2011,2010,2009,2005,2001,2002,2003,2006,2008,2012,2013,49,36,16,44,21,46,23,42,25,28,40,54,56,2014,2015,2016"/> </object> <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links"> <method name="getType()" value="4005,4008,4009,4001,4002,4003,4004,4010,4011"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels"> - <method name="getType()" value="7,48,35,2,3,1,5,6,8,61,9,53,50,37,20,45,22,47,24,43,27,59,29,60,41,55,57,58"/> + <method name="getType()" value="7,48,35,2,3,1,5,6,8,61,9,53,62,63,50,37,20,45,22,47,24,43,27,59,29,60,41,55,57,58,64,65,66,67,68,69"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments"> <method name="getType()" value="51,38,17,18,19,26,52,39,30,31,32,33,34"/> @@ -678,8 +692,24 @@ </mapping> <mapping humanReadableType="Floating Label" + type="65"> + </mapping> + <mapping + humanReadableType="Floating Label" + type="67"> + </mapping> + <mapping + humanReadableType="Floating Label" + type="69"> + </mapping> + <mapping + humanReadableType="Floating Label" type="61"> </mapping> + <mapping + humanReadableType="Floating Label" + type="63"> + </mapping> </diagramMappings> </extension> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierEditPart.java new file mode 100644 index 00000000000..d669248fcc2 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierEditPart.java @@ -0,0 +1,333 @@ +/** + * 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.deployment.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator; +import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; +import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; +import org.eclipse.gmf.runtime.notation.BasicCompartment; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; +import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class DeploymentSpecAsClassifierEditPart extends RoundedCompartmentEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 2014; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public DeploymentSpecAsClassifierEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ + installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + + /** + *Papyrus codeGen + *@generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge + && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + + } + + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new DeploymentSpecificationFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure + * @generated + */ + public DeploymentSpecificationFigure getPrimaryShape() { + return (DeploymentSpecificationFigure) primaryShape; + } + + /** + * @generated + */ + protected boolean addFixedChild(EditPart childEditPart) { + if (childEditPart instanceof DeploymentSpecAsClassifierNameEditPart) { + ((DeploymentSpecAsClassifierNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); + return true; + } + + + return false; + } + + /** + * @generated + */ + protected boolean removeFixedChild(EditPart childEditPart) { + if (childEditPart instanceof DeploymentSpecAsClassifierNameEditPart) { + return true; + } + return false; + } + + /** + * @generated + */ + protected void addChildVisual(EditPart childEditPart, int index) { + if (addFixedChild(childEditPart)) { + return; + } + super.addChildVisual(childEditPart, -1); + } + + /** + * @generated + */ + protected void removeChildVisual(EditPart childEditPart) { + if (removeFixedChild(childEditPart)) { + return; + } + super.removeChildVisual(childEditPart); + } + + /** + * @generated + */ + protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { + if (editPart instanceof IBorderItemEditPart) { + return getBorderedFigure().getBorderItemContainer(); + } + return getContentPane(); + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof DeploymentSpecAsClassifierFloatingLabelEditPart) { + BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); + locator.setBorderItemOffset(new Dimension(-20, -20)); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70); + return result; + } + + + /** + * Creates figure for this edit part. + * + * Body of this method does not depend on settings in generation model + * so you may safely remove <i>generated</i> tag and modify it. + * + * @generated + */ + protected NodeFigure createMainFigure() { + return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + + } + + /** + * Default implementation treats passed figure as content pane. + * Respects layout one may have set for generated figure. + * @param nodeShape instance of generated figure class + * @generated + */ + protected IFigure setupContentPane(IFigure nodeShape) { + if (nodeShape.getLayoutManager() == null) { + ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); + layout.setSpacing(5); + nodeShape.setLayoutManager(layout); + } + return nodeShape; // use nodeShape itself as contentPane + } + + /** + * @generated + */ + public IFigure getContentPane() { + if (contentPane != null) { + return contentPane; + } + return super.getContentPane(); + } + + /** + * @generated + */ + protected void setForegroundColor(Color color) { + if (primaryShape != null) { + primaryShape.setForegroundColor(color); + } + } + + + /** + * @generated + */ + protected void setLineWidth(int width) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(DeploymentSpecAsClassifierNameEditPart.VISUAL_ID)); + } + + + + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierFloatingLabelEditPart.java new file mode 100644 index 00000000000..c40cf9c3310 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierFloatingLabelEditPart.java @@ -0,0 +1,822 @@ +/** + * 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.deployment.edit.parts; + +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.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +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.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.diagram.ui.editparts.IBorderItemEditPart; +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.figures.IBorderItemLocator; +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.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +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.editparts.FloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider; +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; + +/** + * @generated + */ +public class DeploymentSpecAsClassifierFloatingLabelEditPart extends + FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 65; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * @generated + */ + protected IDirectEditorConfiguration configuration; + + + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public DeploymentSpecAsClassifierFloatingLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @generated + */ + public IBorderItemLocator getBorderItemLocator() { + IFigure parentFigure = getFigure().getParent(); + if (parentFigure != null && parentFigure.getLayoutManager() != null) { + Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); + return (IBorderItemLocator) constraint; + } + return null; + } + + /** + * @generated + */ + public void refreshBounds() { + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); + } + + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + 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; + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + public String getEditText() { + if (getParserElement() == null || getParser() == null) { + return ""; //$NON-NLS-1$ + } + return getParser().getEditString( + new EObjectAdapter(getParserElement()), + getParserOptions().intValue()); + } + + /** + * @generated + */ + protected boolean isEditable() { + return getParser() != null; + } + + /** + * @generated + */ + 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; + } + }; + } + + /** + * @generated + */ + public IContentAssistProcessor getCompletionProcessor() { + if (getParserElement() == null || getParser() == null) { + return null; + } + return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + } + + /** + * @generated + */ + public ParserOptions getParserOptions() { + return ParserOptions.NONE; + } + + /** + * @generated + */ + public IParser getParser() { + if (parser == null) { + parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2014, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + 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), + UMLEditPartFactory.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; + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + protected void setFontColor(Color color) { + getFigure().setForegroundColor(color); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void removeSemanticListeners() { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { + removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ + } + } else { + super.removeSemanticListeners(); + } + } + + /** + * @generated + */ + protected AccessibleEditPart getAccessibleEditPart() { + if (accessibleEP == null) { + accessibleEP = new AccessibleGraphicalEditPart() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + 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 + * @generated + */ + 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. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * @generated + */ + 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(), this); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + } + } + } + + /** + * Updates the preference configuration + * @generated + */ + 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(), this); + } 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 + * @generated + */ + 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(); + } + } + + + /** + * @generated + */ + protected void handleNotificationEvent(Notification event) { + 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(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + IFigure label = createFigurePrim(); + defaultText = getLabelTextHelper(label); + return label; + } + + /** + * @generated + */ + protected IFigure createFigurePrim() { + return new PapyrusWrappingLabel(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierNameEditPart.java new file mode 100644 index 00000000000..81b0057f093 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsClassifierNameEditPart.java @@ -0,0 +1,838 @@ +/** + * 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.deployment.edit.parts; + +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.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.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.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.gmf.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.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.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider; +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; + +/** + * @generated + */ +public class DeploymentSpecAsClassifierNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { + + /** + * @generated + */ + public static final int VISUAL_ID = 64; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * @generated + */ + protected IDirectEditorConfiguration configuration; + + + /** + * @generated + */ + public DeploymentSpecAsClassifierNameEditPart(View view) { + super(view); + } + + /** + * @generated + */ + 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()); + } + + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + 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; + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + public String getEditText() { + if (getParserElement() == null || getParser() == null) { + return ""; //$NON-NLS-1$ + } + return getParser().getEditString( + new EObjectAdapter(getParserElement()), + getParserOptions().intValue()); + } + + /** + * @generated + */ + protected boolean isEditable() { + return getParser() != null; + } + + /** + * @generated + */ + 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; + } + }; + } + + /** + * @generated + */ + public IContentAssistProcessor getCompletionProcessor() { + if (getParserElement() == null || getParser() == null) { + return null; + } + return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + } + + /** + * @generated + */ + public ParserOptions getParserOptions() { + return ParserOptions.NONE; + } + + /** + * @generated + */ + public IParser getParser() { + if (parser == null) { + parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2014, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierNameEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + 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), + UMLEditPartFactory.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; + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + protected void setFontColor(Color color) { + getFigure().setForegroundColor(color); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void removeSemanticListeners() { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { + removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ + } + } else { + super.removeSemanticListeners(); + } + } + + /** + * @generated + */ + protected AccessibleEditPart getAccessibleEditPart() { + if (accessibleEP == null) { + accessibleEP = new AccessibleGraphicalEditPart() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + 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 + * @generated + */ + 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. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * @generated + */ + 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(), this); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + } + } + } + + /** + * Updates the preference configuration + * @generated + */ + 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(), this); + } 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 + * @generated + */ + 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(); + } + } + + + /** + * @generated + */ + protected void addNotationalListeners() { + super.addNotationalListeners(); + addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ + } + + /** + * @generated + */ + protected void removeNotationalListeners() { + super.removeNotationalListeners(); + removeListenerFilter("PrimaryView"); //$NON-NLS-1$ + } + + + /** + * @generated + */ + 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(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + // Parent should assign one using setLabel() method + return null; + } + + + /** + * @generated + */ + private static final String ADD_PARENT_MODEL = "AddParentModel"; + + + /** + * @generated + */ + public void activate() { + super.activate(); + addOwnerElementListeners(); + } + + /** + * @generated + */ + protected void addOwnerElementListeners() { + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + + } + + /** + * @generated + */ + public void deactivate() { + removeOwnerElementListeners(); + super.deactivate(); + + } + + + /** + * @generated + */ + protected void removeOwnerElementListeners() { + removeListenerFilter(ADD_PARENT_MODEL); + + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactEditPart.java new file mode 100644 index 00000000000..170f9e5f06f --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactEditPart.java @@ -0,0 +1,333 @@ +/** + * 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.deployment.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator; +import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; +import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; +import org.eclipse.gmf.runtime.notation.BasicCompartment; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; +import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class DeploymentSpecAsNestedArtifactEditPart extends RoundedCompartmentEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 2016; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public DeploymentSpecAsNestedArtifactEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ + installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + + /** + *Papyrus codeGen + *@generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge + && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + + } + + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new DeploymentSpecificationFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure + * @generated + */ + public DeploymentSpecificationFigure getPrimaryShape() { + return (DeploymentSpecificationFigure) primaryShape; + } + + /** + * @generated + */ + protected boolean addFixedChild(EditPart childEditPart) { + if (childEditPart instanceof DeploymentSpecAsNestedArtifactNameEditPart) { + ((DeploymentSpecAsNestedArtifactNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); + return true; + } + + + return false; + } + + /** + * @generated + */ + protected boolean removeFixedChild(EditPart childEditPart) { + if (childEditPart instanceof DeploymentSpecAsNestedArtifactNameEditPart) { + return true; + } + return false; + } + + /** + * @generated + */ + protected void addChildVisual(EditPart childEditPart, int index) { + if (addFixedChild(childEditPart)) { + return; + } + super.addChildVisual(childEditPart, -1); + } + + /** + * @generated + */ + protected void removeChildVisual(EditPart childEditPart) { + if (removeFixedChild(childEditPart)) { + return; + } + super.removeChildVisual(childEditPart); + } + + /** + * @generated + */ + protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { + if (editPart instanceof IBorderItemEditPart) { + return getBorderedFigure().getBorderItemContainer(); + } + return getContentPane(); + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof DeploymentSpecAsNestedArtifactFloatingLabelEditPart) { + BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); + locator.setBorderItemOffset(new Dimension(-20, -20)); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70); + return result; + } + + + /** + * Creates figure for this edit part. + * + * Body of this method does not depend on settings in generation model + * so you may safely remove <i>generated</i> tag and modify it. + * + * @generated + */ + protected NodeFigure createMainFigure() { + return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + + } + + /** + * Default implementation treats passed figure as content pane. + * Respects layout one may have set for generated figure. + * @param nodeShape instance of generated figure class + * @generated + */ + protected IFigure setupContentPane(IFigure nodeShape) { + if (nodeShape.getLayoutManager() == null) { + ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); + layout.setSpacing(5); + nodeShape.setLayoutManager(layout); + } + return nodeShape; // use nodeShape itself as contentPane + } + + /** + * @generated + */ + public IFigure getContentPane() { + if (contentPane != null) { + return contentPane; + } + return super.getContentPane(); + } + + /** + * @generated + */ + protected void setForegroundColor(Color color) { + if (primaryShape != null) { + primaryShape.setForegroundColor(color); + } + } + + + /** + * @generated + */ + protected void setLineWidth(int width) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID)); + } + + + + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactFloatingLabelEditPart.java new file mode 100644 index 00000000000..0da3dca35cd --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactFloatingLabelEditPart.java @@ -0,0 +1,823 @@ +/** + * 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.deployment.edit.parts; + +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.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +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.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.diagram.ui.editparts.IBorderItemEditPart; +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.figures.IBorderItemLocator; +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.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +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.editparts.FloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider; +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; + +/** + * @generated + */ +public class DeploymentSpecAsNestedArtifactFloatingLabelEditPart extends + FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 69; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * @generated + */ + protected IDirectEditorConfiguration configuration; + + + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public DeploymentSpecAsNestedArtifactFloatingLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @generated + */ + public IBorderItemLocator getBorderItemLocator() { + IFigure parentFigure = getFigure().getParent(); + if (parentFigure != null && parentFigure.getLayoutManager() != null) { + Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); + return (IBorderItemLocator) constraint; + } + return null; + } + + /** + * @generated + */ + public void refreshBounds() { + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); + } + + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + 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; + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + public String getEditText() { + if (getParserElement() == null || getParser() == null) { + return ""; //$NON-NLS-1$ + } + return getParser().getEditString( + new EObjectAdapter(getParserElement()), + getParserOptions().intValue()); + } + + /** + * @generated + */ + protected boolean isEditable() { + return getParser() != null; + } + + /** + * @generated + */ + 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; + } + }; + } + + /** + * @generated + */ + public IContentAssistProcessor getCompletionProcessor() { + if (getParserElement() == null || getParser() == null) { + return null; + } + return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + } + + /** + * @generated + */ + public ParserOptions getParserOptions() { + return ParserOptions.NONE; + } + + /** + * @generated + */ + public IParser getParser() { + if (parser == null) { + parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2016, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + 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), + UMLEditPartFactory.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; + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + protected void setFontColor(Color color) { + getFigure().setForegroundColor(color); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void removeSemanticListeners() { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { + removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ + } + } else { + super.removeSemanticListeners(); + } + } + + /** + * @generated + */ + protected AccessibleEditPart getAccessibleEditPart() { + if (accessibleEP == null) { + accessibleEP = new AccessibleGraphicalEditPart() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + 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 + * @generated + */ + 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. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * @generated + */ + 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(), this); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + } + } + } + + /** + * Updates the preference configuration + * @generated + */ + 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(), this); + } 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 + * @generated + */ + 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(); + } + } + + + /** + * @generated + */ + protected void handleNotificationEvent(Notification event) { + 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(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + IFigure label = createFigurePrim(); + defaultText = getLabelTextHelper(label); + return label; + } + + /** + * @generated + */ + protected IFigure createFigurePrim() { + return new PapyrusWrappingLabel(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactNameEditPart.java new file mode 100644 index 00000000000..02350ac03cd --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsNestedArtifactNameEditPart.java @@ -0,0 +1,838 @@ +/** + * 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.deployment.edit.parts; + +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.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.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.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.gmf.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.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.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider; +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; + +/** + * @generated + */ +public class DeploymentSpecAsNestedArtifactNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { + + /** + * @generated + */ + public static final int VISUAL_ID = 68; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * @generated + */ + protected IDirectEditorConfiguration configuration; + + + /** + * @generated + */ + public DeploymentSpecAsNestedArtifactNameEditPart(View view) { + super(view); + } + + /** + * @generated + */ + 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()); + } + + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + 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; + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + public String getEditText() { + if (getParserElement() == null || getParser() == null) { + return ""; //$NON-NLS-1$ + } + return getParser().getEditString( + new EObjectAdapter(getParserElement()), + getParserOptions().intValue()); + } + + /** + * @generated + */ + protected boolean isEditable() { + return getParser() != null; + } + + /** + * @generated + */ + 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; + } + }; + } + + /** + * @generated + */ + public IContentAssistProcessor getCompletionProcessor() { + if (getParserElement() == null || getParser() == null) { + return null; + } + return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + } + + /** + * @generated + */ + public ParserOptions getParserOptions() { + return ParserOptions.NONE; + } + + /** + * @generated + */ + public IParser getParser() { + if (parser == null) { + parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2016, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + 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), + UMLEditPartFactory.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; + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + protected void setFontColor(Color color) { + getFigure().setForegroundColor(color); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void removeSemanticListeners() { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { + removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ + } + } else { + super.removeSemanticListeners(); + } + } + + /** + * @generated + */ + protected AccessibleEditPart getAccessibleEditPart() { + if (accessibleEP == null) { + accessibleEP = new AccessibleGraphicalEditPart() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + 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 + * @generated + */ + 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. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * @generated + */ + 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(), this); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + } + } + } + + /** + * Updates the preference configuration + * @generated + */ + 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(), this); + } 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 + * @generated + */ + 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(); + } + } + + + /** + * @generated + */ + protected void addNotationalListeners() { + super.addNotationalListeners(); + addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ + } + + /** + * @generated + */ + protected void removeNotationalListeners() { + super.removeNotationalListeners(); + removeListenerFilter("PrimaryView"); //$NON-NLS-1$ + } + + + /** + * @generated + */ + 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(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + // Parent should assign one using setLabel() method + return null; + } + + + /** + * @generated + */ + private static final String ADD_PARENT_MODEL = "AddParentModel"; + + + /** + * @generated + */ + public void activate() { + super.activate(); + addOwnerElementListeners(); + } + + /** + * @generated + */ + protected void addOwnerElementListeners() { + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + + } + + /** + * @generated + */ + public void deactivate() { + removeOwnerElementListeners(); + super.deactivate(); + + } + + + /** + * @generated + */ + protected void removeOwnerElementListeners() { + removeListenerFilter(ADD_PARENT_MODEL); + + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElEditPart.java new file mode 100644 index 00000000000..1ee663f3b5c --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElEditPart.java @@ -0,0 +1,333 @@ +/** + * 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.deployment.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.PositionConstants; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator; +import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; +import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; +import org.eclipse.gmf.runtime.notation.BasicCompartment; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; +import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class DeploymentSpecAsPackageableElEditPart extends RoundedCompartmentEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 2015; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public DeploymentSpecAsPackageableElEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ + installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + + /** + *Papyrus codeGen + *@generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge + && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + + } + + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new DeploymentSpecificationFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure + * @generated + */ + public DeploymentSpecificationFigure getPrimaryShape() { + return (DeploymentSpecificationFigure) primaryShape; + } + + /** + * @generated + */ + protected boolean addFixedChild(EditPart childEditPart) { + if (childEditPart instanceof DeploymentSpecAsPackageableElNameEditPart) { + ((DeploymentSpecAsPackageableElNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); + return true; + } + + + return false; + } + + /** + * @generated + */ + protected boolean removeFixedChild(EditPart childEditPart) { + if (childEditPart instanceof DeploymentSpecAsPackageableElNameEditPart) { + return true; + } + return false; + } + + /** + * @generated + */ + protected void addChildVisual(EditPart childEditPart, int index) { + if (addFixedChild(childEditPart)) { + return; + } + super.addChildVisual(childEditPart, -1); + } + + /** + * @generated + */ + protected void removeChildVisual(EditPart childEditPart) { + if (removeFixedChild(childEditPart)) { + return; + } + super.removeChildVisual(childEditPart); + } + + /** + * @generated + */ + protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { + if (editPart instanceof IBorderItemEditPart) { + return getBorderedFigure().getBorderItemContainer(); + } + return getContentPane(); + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof DeploymentSpecAsPackageableElFloatingLabelEditPart) { + BorderItemLocator locator = new BorderItemLocator(getMainFigure(), PositionConstants.SOUTH); + locator.setBorderItemOffset(new Dimension(-20, -20)); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70); + return result; + } + + + /** + * Creates figure for this edit part. + * + * Body of this method does not depend on settings in generation model + * so you may safely remove <i>generated</i> tag and modify it. + * + * @generated + */ + protected NodeFigure createMainFigure() { + return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + + } + + /** + * Default implementation treats passed figure as content pane. + * Respects layout one may have set for generated figure. + * @param nodeShape instance of generated figure class + * @generated + */ + protected IFigure setupContentPane(IFigure nodeShape) { + if (nodeShape.getLayoutManager() == null) { + ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); + layout.setSpacing(5); + nodeShape.setLayoutManager(layout); + } + return nodeShape; // use nodeShape itself as contentPane + } + + /** + * @generated + */ + public IFigure getContentPane() { + if (contentPane != null) { + return contentPane; + } + return super.getContentPane(); + } + + /** + * @generated + */ + protected void setForegroundColor(Color color) { + if (primaryShape != null) { + primaryShape.setForegroundColor(color); + } + } + + + /** + * @generated + */ + protected void setLineWidth(int width) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID)); + } + + + + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElFloatingLabelEditPart.java new file mode 100644 index 00000000000..fea189ab8df --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElFloatingLabelEditPart.java @@ -0,0 +1,822 @@ +/** + * 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.deployment.edit.parts; + +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.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +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.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.diagram.ui.editparts.IBorderItemEditPart; +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.figures.IBorderItemLocator; +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.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +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.editparts.FloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider; +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; + +/** + * @generated + */ +public class DeploymentSpecAsPackageableElFloatingLabelEditPart extends + FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 67; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * @generated + */ + protected IDirectEditorConfiguration configuration; + + + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public DeploymentSpecAsPackageableElFloatingLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @generated + */ + public IBorderItemLocator getBorderItemLocator() { + IFigure parentFigure = getFigure().getParent(); + if (parentFigure != null && parentFigure.getLayoutManager() != null) { + Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); + return (IBorderItemLocator) constraint; + } + return null; + } + + /** + * @generated + */ + public void refreshBounds() { + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); + } + + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + 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; + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + public String getEditText() { + if (getParserElement() == null || getParser() == null) { + return ""; //$NON-NLS-1$ + } + return getParser().getEditString( + new EObjectAdapter(getParserElement()), + getParserOptions().intValue()); + } + + /** + * @generated + */ + protected boolean isEditable() { + return getParser() != null; + } + + /** + * @generated + */ + 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; + } + }; + } + + /** + * @generated + */ + public IContentAssistProcessor getCompletionProcessor() { + if (getParserElement() == null || getParser() == null) { + return null; + } + return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + } + + /** + * @generated + */ + public ParserOptions getParserOptions() { + return ParserOptions.NONE; + } + + /** + * @generated + */ + public IParser getParser() { + if (parser == null) { + parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2015, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + 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), + UMLEditPartFactory.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; + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + protected void setFontColor(Color color) { + getFigure().setForegroundColor(color); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void removeSemanticListeners() { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { + removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ + } + } else { + super.removeSemanticListeners(); + } + } + + /** + * @generated + */ + protected AccessibleEditPart getAccessibleEditPart() { + if (accessibleEP == null) { + accessibleEP = new AccessibleGraphicalEditPart() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + 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 + * @generated + */ + 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. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * @generated + */ + 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(), this); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + } + } + } + + /** + * Updates the preference configuration + * @generated + */ + 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(), this); + } 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 + * @generated + */ + 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(); + } + } + + + /** + * @generated + */ + protected void handleNotificationEvent(Notification event) { + 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(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + IFigure label = createFigurePrim(); + defaultText = getLabelTextHelper(label); + return label; + } + + /** + * @generated + */ + protected IFigure createFigurePrim() { + return new PapyrusWrappingLabel(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElNameEditPart.java new file mode 100644 index 00000000000..dc915de85af --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecAsPackageableElNameEditPart.java @@ -0,0 +1,838 @@ +/** + * 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.deployment.edit.parts; + +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.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.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.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.gmf.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.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.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider; +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; + +/** + * @generated + */ +public class DeploymentSpecAsPackageableElNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { + + /** + * @generated + */ + public static final int VISUAL_ID = 66; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * @generated + */ + protected IDirectEditorConfiguration configuration; + + + /** + * @generated + */ + public DeploymentSpecAsPackageableElNameEditPart(View view) { + super(view); + } + + /** + * @generated + */ + 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()); + } + + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + 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; + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + public String getEditText() { + if (getParserElement() == null || getParser() == null) { + return ""; //$NON-NLS-1$ + } + return getParser().getEditString( + new EObjectAdapter(getParserElement()), + getParserOptions().intValue()); + } + + /** + * @generated + */ + protected boolean isEditable() { + return getParser() != null; + } + + /** + * @generated + */ + 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; + } + }; + } + + /** + * @generated + */ + public IContentAssistProcessor getCompletionProcessor() { + if (getParserElement() == null || getParser() == null) { + return null; + } + return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + } + + /** + * @generated + */ + public ParserOptions getParserOptions() { + return ParserOptions.NONE; + } + + /** + * @generated + */ + public IParser getParser() { + if (parser == null) { + parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2015, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + 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), + UMLEditPartFactory.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; + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + protected void setFontColor(Color color) { + getFigure().setForegroundColor(color); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void removeSemanticListeners() { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { + removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ + } + } else { + super.removeSemanticListeners(); + } + } + + /** + * @generated + */ + protected AccessibleEditPart getAccessibleEditPart() { + if (accessibleEP == null) { + accessibleEP = new AccessibleGraphicalEditPart() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + 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 + * @generated + */ + 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. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * @generated + */ + 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(), this); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + } + } + } + + /** + * Updates the preference configuration + * @generated + */ + 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(), this); + } 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 + * @generated + */ + 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(); + } + } + + + /** + * @generated + */ + protected void addNotationalListeners() { + super.addNotationalListeners(); + addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ + } + + /** + * @generated + */ + protected void removeNotationalListeners() { + super.removeNotationalListeners(); + removeListenerFilter("PrimaryView"); //$NON-NLS-1$ + } + + + /** + * @generated + */ + 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(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + // Parent should assign one using setLabel() method + return null; + } + + + /** + * @generated + */ + private static final String ADD_PARENT_MODEL = "AddParentModel"; + + + /** + * @generated + */ + public void activate() { + super.activate(); + addOwnerElementListeners(); + } + + /** + * @generated + */ + protected void addOwnerElementListeners() { + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + + } + + /** + * @generated + */ + public void deactivate() { + removeOwnerElementListeners(); + super.deactivate(); + + } + + + /** + * @generated + */ + protected void removeOwnerElementListeners() { + removeListenerFilter(ADD_PARENT_MODEL); + + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationEditPart.java new file mode 100644 index 00000000000..57bc2f956c5 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationEditPart.java @@ -0,0 +1,331 @@ +/** + * 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.deployment.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.EditPolicy; +import org.eclipse.gef.GraphicalEditPart; +import org.eclipse.gef.Request; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.editpolicies.LayoutEditPolicy; +import org.eclipse.gef.editpolicies.NonResizableEditPolicy; +import org.eclipse.gef.handles.MoveHandle; +import org.eclipse.gef.requests.CreateRequest; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator; +import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; +import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure; +import org.eclipse.gmf.runtime.notation.BasicCompartment; +import org.eclipse.gmf.runtime.notation.Edge; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultGraphicalNodeEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.DefaultSemanticEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.GetChildLayoutEditPolicy; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.SelectableBorderedNodeFigure; +import org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeNodeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.QualifiedNameDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.locator.RoundedRectangleLabelPositionLocator; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomDiagramDragDropEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.CustomGraphicalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.edit.policies.RemoveOrphanViewPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class DeploymentSpecificationEditPart extends RoundedCompartmentEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 2013; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public DeploymentSpecificationEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DefaultSemanticEditPolicy()); + + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new DefaultGraphicalNodeEditPolicy()); + + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(QualifiedNameDisplayEditPolicy.QUALIFIED_NAME_POLICY, new QualifiedNameDisplayEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy("REMOVE_ORPHAN_VIEW", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ + installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); + installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new GetChildLayoutEditPolicy()); + // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies + // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE); + } + + /** + * @generated + */ + protected LayoutEditPolicy createLayoutEditPolicy() { + org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LayoutEditPolicy() { + + @Override + protected EditPolicy createChildEditPolicy(EditPart child) { + View childView = (View) child.getModel(); + switch (UMLVisualIDRegistry.getVisualID(childView)) { + case DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + } + EditPolicy result = child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE); + if (result == null) { + result = new NonResizableEditPolicy(); + } + return result; + } + + @Override + protected Command getMoveChildrenCommand(Request request) { + return null; + } + + @Override + protected Command getCreateCommand(CreateRequest request) { + return null; + } + }; + return lep; + } + + + /** + *Papyrus codeGen + *@generated + **/ + protected void handleNotificationEvent(Notification event) { + /* + * when a node have external node labels, the methods refreshChildren() remove the EditPart corresponding to the Label from the EditPart + * Registry. After that, we can't reset the visibility to true (using the Show/Hide Label Action)! + */ + if (NotationPackage.eINSTANCE.getView_Visible().equals(event.getFeature())) { + Object notifier = event.getNotifier(); + List<?> modelChildren = ((View) getModel()).getChildren(); + if (false == notifier instanceof Edge + && false == notifier instanceof BasicCompartment) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + + } + + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new DeploymentSpecificationFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.deployment.custom.figure.nodes.DeploymentSpecificationFigure + * @generated + */ + public DeploymentSpecificationFigure getPrimaryShape() { + return (DeploymentSpecificationFigure) primaryShape; + } + + /** + * @generated + */ + protected boolean addFixedChild(EditPart childEditPart) { + if (childEditPart instanceof DeploymentSpecificationNameEditPart) { + ((DeploymentSpecificationNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); + return true; + } + + + return false; + } + + /** + * @generated + */ + protected boolean removeFixedChild(EditPart childEditPart) { + if (childEditPart instanceof DeploymentSpecificationNameEditPart) { + return true; + } + return false; + } + + /** + * @generated + */ + protected void addChildVisual(EditPart childEditPart, int index) { + if (addFixedChild(childEditPart)) { + return; + } + super.addChildVisual(childEditPart, -1); + } + + /** + * @generated + */ + protected void removeChildVisual(EditPart childEditPart) { + if (removeFixedChild(childEditPart)) { + return; + } + super.removeChildVisual(childEditPart); + } + + /** + * @generated + */ + protected IFigure getContentPaneFor(IGraphicalEditPart editPart) { + if (editPart instanceof IBorderItemEditPart) { + return getBorderedFigure().getBorderItemContainer(); + } + return getContentPane(); + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof DeploymentSpecificationFloatingLabelEditPart) { + IBorderItemLocator locator = new RoundedRectangleLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(150, 70); + return result; + } + + + /** + * Creates figure for this edit part. + * + * Body of this method does not depend on settings in generation model + * so you may safely remove <i>generated</i> tag and modify it. + * + * @generated + */ + protected NodeFigure createMainFigure() { + return new SelectableBorderedNodeFigure(createMainFigureWithSVG()); + + } + + /** + * Default implementation treats passed figure as content pane. + * Respects layout one may have set for generated figure. + * @param nodeShape instance of generated figure class + * @generated + */ + protected IFigure setupContentPane(IFigure nodeShape) { + if (nodeShape.getLayoutManager() == null) { + ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); + layout.setSpacing(5); + nodeShape.setLayoutManager(layout); + } + return nodeShape; // use nodeShape itself as contentPane + } + + /** + * @generated + */ + public IFigure getContentPane() { + if (contentPane != null) { + return contentPane; + } + return super.getContentPane(); + } + + /** + * @generated + */ + protected void setForegroundColor(Color color) { + if (primaryShape != null) { + primaryShape.setForegroundColor(color); + } + } + + + /** + * @generated + */ + protected void setLineWidth(int width) { + super.setLineWidth(width); + } + + /** + * @generated + */ + protected void setLineType(int style) { + if (primaryShape instanceof IPapyrusNodeFigure) { + ((IPapyrusNodeFigure) primaryShape).setLineStyle(style); + } + } + + /** + * @generated + */ + public EditPart getPrimaryChildEditPart() { + return getChildBySemanticHint(UMLVisualIDRegistry.getType(DeploymentSpecificationNameEditPart.VISUAL_ID)); + } + + + + + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationFloatingLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationFloatingLabelEditPart.java new file mode 100644 index 00000000000..faa6301724b --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationFloatingLabelEditPart.java @@ -0,0 +1,822 @@ +/** + * 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.deployment.edit.parts; + +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.draw2d.geometry.Rectangle; +import org.eclipse.emf.common.notify.Notification; +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.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.diagram.ui.editparts.IBorderItemEditPart; +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.figures.IBorderItemLocator; +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.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy; +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.editparts.FloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider; +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; + +/** + * @generated + */ +public class DeploymentSpecificationFloatingLabelEditPart extends + FloatingLabelEditPart + implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 63; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * @generated + */ + protected IDirectEditorConfiguration configuration; + + + /** + * @generated + */ + static { + registerSnapBackPosition(UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public DeploymentSpecificationFloatingLabelEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy()); + installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy()); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ExternalLabelPrimaryDragRoleEditPolicy()); + } + + /** + * @generated + */ + public IBorderItemLocator getBorderItemLocator() { + IFigure parentFigure = getFigure().getParent(); + if (parentFigure != null && parentFigure.getLayoutManager() != null) { + Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); + return (IBorderItemLocator) constraint; + } + return null; + } + + /** + * @generated + */ + public void refreshBounds() { + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + getBorderItemLocator().setConstraint(new Rectangle(x, y, width, height)); + } + + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + 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; + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + public String getEditText() { + if (getParserElement() == null || getParser() == null) { + return ""; //$NON-NLS-1$ + } + return getParser().getEditString( + new EObjectAdapter(getParserElement()), + getParserOptions().intValue()); + } + + /** + * @generated + */ + protected boolean isEditable() { + return getParser() != null; + } + + /** + * @generated + */ + 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; + } + }; + } + + /** + * @generated + */ + public IContentAssistProcessor getCompletionProcessor() { + if (getParserElement() == null || getParser() == null) { + return null; + } + return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + } + + /** + * @generated + */ + public ParserOptions getParserOptions() { + return ParserOptions.NONE; + } + + /** + * @generated + */ + public IParser getParser() { + if (parser == null) { + parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + 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), + UMLEditPartFactory.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; + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + protected void setFontColor(Color color) { + getFigure().setForegroundColor(color); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void removeSemanticListeners() { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { + removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ + } + } else { + super.removeSemanticListeners(); + } + } + + /** + * @generated + */ + protected AccessibleEditPart getAccessibleEditPart() { + if (accessibleEP == null) { + accessibleEP = new AccessibleGraphicalEditPart() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + 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 + * @generated + */ + 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. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * @generated + */ + 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(), this); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + } + } + } + + /** + * Updates the preference configuration + * @generated + */ + 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(), this); + } 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 + * @generated + */ + 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(); + } + } + + + /** + * @generated + */ + protected void handleNotificationEvent(Notification event) { + 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(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + IFigure label = createFigurePrim(); + defaultText = getLabelTextHelper(label); + return label; + } + + /** + * @generated + */ + protected IFigure createFigurePrim() { + return new PapyrusWrappingLabel(); + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationNameEditPart.java new file mode 100644 index 00000000000..5cd5929dae4 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/DeploymentSpecificationNameEditPart.java @@ -0,0 +1,838 @@ +/** + * 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.deployment.edit.parts; + +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.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.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.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.gmf.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.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.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +import org.eclipse.papyrus.uml.diagram.deployment.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.deployment.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.deployment.providers.UMLParserProvider; +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; + +/** + * @generated + */ +public class DeploymentSpecificationNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { + + /** + * @generated + */ + public static final int VISUAL_ID = 62; + + /** + * @generated + */ + private DirectEditManager manager; + + /** + * @generated + */ + private IParser parser; + + /** + * @generated + */ + private List<?> parserElements; + + /** + * @generated + */ + private String defaultText; + + /** + * direct edition mode (default, undefined, registered editor, etc.) + * @generated + */ + protected int directEditionMode = IDirectEdition.UNDEFINED_DIRECT_EDITOR; + + /** + * configuration from a registered edit dialog + * @generated + */ + protected IDirectEditorConfiguration configuration; + + + /** + * @generated + */ + public DeploymentSpecificationNameEditPart(View view) { + super(view); + } + + /** + * @generated + */ + 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()); + } + + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + public void setLabel(IFigure figure) { + unregisterVisuals(); + setFigure(figure); + defaultText = getLabelTextHelper(figure); + registerVisuals(); + refreshVisuals(); + } + + /** + * @generated + */ + protected List<?> getModelChildren() { + return Collections.EMPTY_LIST; + } + + /** + * @generated + */ + public IGraphicalEditPart getChildBySemanticHint(String semanticHint) { + return null; + } + + /** + * @generated + */ + public void setParser(IParser parser) { + this.parser = parser; + } + + /** + * @generated + */ + protected EObject getParserElement() { + return resolveSemanticElement(); + } + + /** + * @generated + */ + protected Image getLabelIcon() { + return null; + } + + /** + * @generated + */ + 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; + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + public String getEditText() { + if (getParserElement() == null || getParser() == null) { + return ""; //$NON-NLS-1$ + } + return getParser().getEditString( + new EObjectAdapter(getParserElement()), + getParserOptions().intValue()); + } + + /** + * @generated + */ + protected boolean isEditable() { + return getParser() != null; + } + + /** + * @generated + */ + 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; + } + }; + } + + /** + * @generated + */ + public IContentAssistProcessor getCompletionProcessor() { + if (getParserElement() == null || getParser() == null) { + return null; + } + return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement())); + } + + /** + * @generated + */ + public ParserOptions getParserOptions() { + return ParserOptions.NONE; + } + + /** + * @generated + */ + public IParser getParser() { + if (parser == null) { + parser = UMLParserProvider.getParser(UMLElementTypes.DeploymentSpecification_2013, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationNameEditPart.VISUAL_ID)); + } + return parser; + } + + /** + * @generated + */ + protected DirectEditManager getManager() { + if (manager == null) { + setManager(new MultilineLabelDirectEditManager(this, + MultilineLabelDirectEditManager.getTextCellEditorClass(this), + UMLEditPartFactory.getTextCellEditorLocator(this))); + } + return manager; + } + + /** + * @generated + */ + protected void setManager(DirectEditManager manager) { + this.manager = manager; + } + + /** + * @generated + */ + protected void performDirectEdit() { + BusyIndicator.showWhile(Display.getDefault(), new java.lang.Runnable() { + + @Override + public void run() { + getManager().show(); + } + }); + } + + /** + * @generated + */ + protected void performDirectEdit(Point eventLocation) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint()); + } + } + + /** + * @generated + */ + private void performDirectEdit(char initialCharacter) { + if (getManager() instanceof TextDirectEditManager) { + ((TextDirectEditManager) getManager()).show(initialCharacter); + } else { + performDirectEdit(); + } + } + + /** + * @generated + */ + 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), + UMLEditPartFactory.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; + } + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void refreshVisuals() { + super.refreshVisuals(); + refreshLabel(); + refreshFont(); + refreshFontColor(); + refreshUnderline(); + refreshStrikeThrough(); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + 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); + } + } + } + + /** + * @generated + */ + protected void refreshStrikeThrough() { + FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle( + NotationPackage.eINSTANCE.getFontStyle()); + if (style != null && getFigure() instanceof WrappingLabel) { + ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough()); + } + } + + /** + * @generated + */ + 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); + } + } + + /** + * @generated + */ + protected void setFontColor(Color color) { + getFigure().setForegroundColor(color); + } + + /** + * @generated + */ + 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(); + } + } + + /** + * @generated + */ + protected void removeSemanticListeners() { + if (parserElements != null) { + for (int i = 0; i < parserElements.size(); i++) { + removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$ + } + } else { + super.removeSemanticListeners(); + } + } + + /** + * @generated + */ + protected AccessibleEditPart getAccessibleEditPart() { + if (accessibleEP == null) { + accessibleEP = new AccessibleGraphicalEditPart() { + + @Override + public void getName(AccessibleEvent e) { + e.result = getLabelTextHelper(getFigure()); + } + }; + } + return accessibleEP; + } + + /** + * @generated + */ + 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 + * @generated + */ + 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. + * @generated + */ + protected boolean checkExtendedEditor() { + if (resolveSemanticElement() != null) { + return DirectEditorsUtil.hasSpecificEditorConfiguration(resolveSemanticElement(), this); + } + return false; + } + + /** + * Checks if a default direct edition is available + * + * @return <code>true</code> if a default direct edition is available + * @generated + */ + protected boolean checkDefaultEdition() { + return (getParser() != null); + } + + /** + * Initializes the extended editor configuration + * @generated + */ + 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(), this); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement(), this); + } + } + } + + /** + * Updates the preference configuration + * @generated + */ + 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(), this); + } 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 + * @generated + */ + 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(); + } + } + + + /** + * @generated + */ + protected void addNotationalListeners() { + super.addNotationalListeners(); + addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$ + } + + /** + * @generated + */ + protected void removeNotationalListeners() { + super.removeNotationalListeners(); + removeListenerFilter("PrimaryView"); //$NON-NLS-1$ + } + + + /** + * @generated + */ + 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(); + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createFigure() { + // Parent should assign one using setLabel() method + return null; + } + + + /** + * @generated + */ + private static final String ADD_PARENT_MODEL = "AddParentModel"; + + + /** + * @generated + */ + public void activate() { + super.activate(); + addOwnerElementListeners(); + } + + /** + * @generated + */ + protected void addOwnerElementListeners() { + addListenerFilter(ADD_PARENT_MODEL, this, ((View) getParent().getModel())); + + } + + /** + * @generated + */ + public void deactivate() { + removeOwnerElementListeners(); + super.deactivate(); + + } + + + /** + * @generated + */ + protected void removeOwnerElementListeners() { + removeListenerFilter(ADD_PARENT_MODEL); + + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java index 60993a52d6c..0fcf8740c98 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/edit/parts/UMLEditPartFactory.java @@ -108,6 +108,15 @@ public class UMLEditPartFactory implements EditPartFactory { case DefaultNamedElementNameEditPart.VISUAL_ID: return new DefaultNamedElementNameEditPart(view); + case DeploymentSpecificationEditPart.VISUAL_ID: + return new DeploymentSpecificationEditPart(view); + + case DeploymentSpecificationNameEditPart.VISUAL_ID: + return new DeploymentSpecificationNameEditPart(view); + + case DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID: + return new DeploymentSpecificationFloatingLabelEditPart(view); + case ModelEditPartCN.VISUAL_ID: return new ModelEditPartCN(view); @@ -195,6 +204,33 @@ public class UMLEditPartFactory implements EditPartFactory { case ConstraintSpecificationEditPartCN.VISUAL_ID: return new ConstraintSpecificationEditPartCN(view); + case DeploymentSpecAsClassifierEditPart.VISUAL_ID: + return new DeploymentSpecAsClassifierEditPart(view); + + case DeploymentSpecAsClassifierNameEditPart.VISUAL_ID: + return new DeploymentSpecAsClassifierNameEditPart(view); + + case DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID: + return new DeploymentSpecAsClassifierFloatingLabelEditPart(view); + + case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: + return new DeploymentSpecAsPackageableElEditPart(view); + + case DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID: + return new DeploymentSpecAsPackageableElNameEditPart(view); + + case DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID: + return new DeploymentSpecAsPackageableElFloatingLabelEditPart(view); + + case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: + return new DeploymentSpecAsNestedArtifactEditPart(view); + + case DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID: + return new DeploymentSpecAsNestedArtifactNameEditPart(view); + + case DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID: + return new DeploymentSpecAsNestedArtifactFloatingLabelEditPart(view); + case ModelPackageableElementCompartmentEditPart.VISUAL_ID: return new ModelPackageableElementCompartmentEditPart(view); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java index 36bbea1bea8..f2eb6715c0d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/expressions/UMLOCLFactory.java @@ -47,10 +47,11 @@ public class UMLOCLFactory { * @generated */ protected UMLOCLFactory() { - this.expressions = new UMLAbstractExpression[2]; + this.expressions = new UMLAbstractExpression[3]; this.expressionBodies = new String[] { "self.name.concat(\'.file\') ", //$NON-NLS-1$ "self.oclIsKindOf(DeploymentTarget)", //$NON-NLS-1$ + "self.oclIsTypeOf(Artifact)", //$NON-NLS-1$ }; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/Messages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/Messages.java index 0305e11690e..629f55b4db5 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/Messages.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/Messages.java @@ -317,6 +317,16 @@ public class Messages extends NLS { public static String DeviceCreationTool_desc; /** + * @generated + */ + public static String DeploymentSpecification5CreationTool_title; + + /** + * @generated + */ + public static String DeploymentSpecification5CreationTool_desc; + + /** * @generated */ public static String ExecutionEnvironmentCreationTool_title; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java index 24587c0bb7f..e0c5df62f1b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLDiagramUpdater.java @@ -41,6 +41,10 @@ import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart; @@ -75,6 +79,7 @@ import org.eclipse.uml2.uml.CommunicationPath; import org.eclipse.uml2.uml.Constraint; import org.eclipse.uml2.uml.Dependency; import org.eclipse.uml2.uml.Deployment; +import org.eclipse.uml2.uml.DeploymentSpecification; import org.eclipse.uml2.uml.DeploymentTarget; import org.eclipse.uml2.uml.Device; import org.eclipse.uml2.uml.Element; @@ -189,6 +194,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecificationEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } for (Iterator<?> it = modelElement.getOwnedRules() .iterator(); it.hasNext();) { @@ -252,6 +261,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsPackageableElEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } for (Iterator<?> it = modelElement.getOwnedComments() .iterator(); it.hasNext();) { @@ -315,6 +328,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsPackageableElEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } for (Iterator<?> it = modelElement.getOwnedComments() .iterator(); it.hasNext();) { @@ -367,6 +384,15 @@ public class UMLDiagramUpdater implements DiagramUpdater { continue; } } + for (Iterator<?> it = modelElement.getNestedClassifiers() + .iterator(); it.hasNext();) { + Classifier childElement = (Classifier) it.next(); + int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); + if (visualID == DeploymentSpecAsClassifierEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } + } return result; } @@ -400,6 +426,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsClassifierEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } return result; } @@ -442,6 +472,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsClassifierEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } return result; } @@ -467,6 +501,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } return result; } @@ -512,6 +550,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsPackageableElEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } for (Iterator<?> it = modelElement.getOwnedComments() .iterator(); it.hasNext();) { @@ -571,6 +613,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsPackageableElEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } for (Iterator<?> it = modelElement.getOwnedComments() .iterator(); it.hasNext();) { @@ -623,6 +669,15 @@ public class UMLDiagramUpdater implements DiagramUpdater { continue; } } + for (Iterator<?> it = modelElement.getNestedClassifiers() + .iterator(); it.hasNext();) { + Classifier childElement = (Classifier) it.next(); + int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); + if (visualID == DeploymentSpecAsClassifierEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } + } return result; } @@ -647,6 +702,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsClassifierEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } for (Iterator<?> it = modelElement.getNestedNodes() .iterator(); it.hasNext();) { @@ -698,6 +757,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsClassifierEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } return result; } @@ -723,6 +786,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } return result; } @@ -748,6 +815,10 @@ public class UMLDiagramUpdater implements DiagramUpdater { result.add(new UMLNodeDescriptor(childElement, visualID)); continue; } + if (visualID == DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } } return result; } @@ -780,6 +851,8 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getNode_2008ContainedLinks(view); case DefaultNamedElementEditPart.VISUAL_ID: return getNamedElement_2012ContainedLinks(view); + case DeploymentSpecificationEditPart.VISUAL_ID: + return getDeploymentSpecification_2013ContainedLinks(view); case ModelEditPartCN.VISUAL_ID: return getModel_49ContainedLinks(view); case PackageEditPartCN.VISUAL_ID: @@ -806,6 +879,12 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getComment_54ContainedLinks(view); case ConstraintEditPartCN.VISUAL_ID: return getConstraint_56ContainedLinks(view); + case DeploymentSpecAsClassifierEditPart.VISUAL_ID: + return getDeploymentSpecification_2014ContainedLinks(view); + case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: + return getDeploymentSpecification_2015ContainedLinks(view); + case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: + return getDeploymentSpecification_2016ContainedLinks(view); case DeploymentEditPart.VISUAL_ID: return getDeployment_4001ContainedLinks(view); case ManifestationEditPart.VISUAL_ID: @@ -848,6 +927,8 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getNode_2008IncomingLinks(view); case DefaultNamedElementEditPart.VISUAL_ID: return getNamedElement_2012IncomingLinks(view); + case DeploymentSpecificationEditPart.VISUAL_ID: + return getDeploymentSpecification_2013IncomingLinks(view); case ModelEditPartCN.VISUAL_ID: return getModel_49IncomingLinks(view); case PackageEditPartCN.VISUAL_ID: @@ -874,6 +955,12 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getComment_54IncomingLinks(view); case ConstraintEditPartCN.VISUAL_ID: return getConstraint_56IncomingLinks(view); + case DeploymentSpecAsClassifierEditPart.VISUAL_ID: + return getDeploymentSpecification_2014IncomingLinks(view); + case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: + return getDeploymentSpecification_2015IncomingLinks(view); + case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: + return getDeploymentSpecification_2016IncomingLinks(view); case DeploymentEditPart.VISUAL_ID: return getDeployment_4001IncomingLinks(view); case ManifestationEditPart.VISUAL_ID: @@ -916,6 +1003,8 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getNode_2008OutgoingLinks(view); case DefaultNamedElementEditPart.VISUAL_ID: return getNamedElement_2012OutgoingLinks(view); + case DeploymentSpecificationEditPart.VISUAL_ID: + return getDeploymentSpecification_2013OutgoingLinks(view); case ModelEditPartCN.VISUAL_ID: return getModel_49OutgoingLinks(view); case PackageEditPartCN.VISUAL_ID: @@ -942,6 +1031,12 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getComment_54OutgoingLinks(view); case ConstraintEditPartCN.VISUAL_ID: return getConstraint_56OutgoingLinks(view); + case DeploymentSpecAsClassifierEditPart.VISUAL_ID: + return getDeploymentSpecification_2014OutgoingLinks(view); + case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: + return getDeploymentSpecification_2015OutgoingLinks(view); + case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: + return getDeploymentSpecification_2016OutgoingLinks(view); case DeploymentEditPart.VISUAL_ID: return getDeployment_4001OutgoingLinks(view); case ManifestationEditPart.VISUAL_ID: @@ -1073,6 +1168,17 @@ public class UMLDiagramUpdater implements DiagramUpdater { } /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2013ContainedLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + return result; + } + + /** * @generated */ public List<UMLLinkDescriptor> getModel_49ContainedLinks(View view) { @@ -1216,6 +1322,39 @@ public class UMLDiagramUpdater implements DiagramUpdater { } /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2014ContainedLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2015ContainedLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2016ContainedLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getContainedTypeModelFacetLinks_Manifestation_4002(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_Generalization_4003(modelElement)); + return result; + } + + /** * @generated */ public List<UMLLinkDescriptor> getDeployment_4001ContainedLinks(View view) { @@ -1425,6 +1564,24 @@ public class UMLDiagramUpdater implements DiagramUpdater { } /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2013IncomingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + return result; + } + + /** * @generated */ public List<UMLLinkDescriptor> getModel_49IncomingLinks(View view) { @@ -1647,6 +1804,60 @@ public class UMLDiagramUpdater implements DiagramUpdater { } /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2014IncomingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2015IncomingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2016IncomingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4008(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4009(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Deployment_4001(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Manifestation_4002(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Generalization_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_Dependency_4010(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_CommunicationPath_4011(modelElement, crossReferencer)); + return result; + } + + /** * @generated */ public List<UMLLinkDescriptor> getDeployment_4001IncomingLinks(View view) { @@ -1877,6 +2088,21 @@ public class UMLDiagramUpdater implements DiagramUpdater { } /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2013OutgoingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + return result; + } + + /** * @generated */ public List<UMLLinkDescriptor> getModel_49OutgoingLinks(View view) { @@ -2062,6 +2288,51 @@ public class UMLDiagramUpdater implements DiagramUpdater { } /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2014OutgoingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2015OutgoingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getDeploymentSpecification_2016OutgoingLinks(View view) { + DeploymentSpecification modelElement = (DeploymentSpecification) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_Deployment_4001(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Manifestation_4002(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Generalization_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4004(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_Dependency_4010(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_CommunicationPath_4011(modelElement)); + return result; + } + + /** * @generated */ public List<UMLLinkDescriptor> getDeployment_4001OutgoingLinks(View view) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java index c225dd7ceb7..611c461a8cc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLPaletteFactory.java @@ -50,6 +50,11 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { private final static String DEPLOYMENT_TOOL_DEVICE = "deployment.tool.device";//$NON-NLS-1$ /** + * @generated + */ + private final static String DEPLOYMENT_TOOL_DEPLOYMENTSPECIFICATION = "deployment.tool.deploymentspecification";//$NON-NLS-1$ + + /** * @generated */ private final static String DEPLOYMENT_TOOL_EXECUTIONENVIRONMENT = "deployment.tool.executionEnvironment";//$NON-NLS-1$ @@ -128,6 +133,9 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { if (toolId.equals(DEPLOYMENT_TOOL_DEVICE)) { return createDeviceCreationTool(); } + if (toolId.equals(DEPLOYMENT_TOOL_DEPLOYMENTSPECIFICATION)) { + return createDeploymentSpecification5CreationTool(); + } if (toolId.equals(DEPLOYMENT_TOOL_EXECUTIONENVIRONMENT)) { return createExecutionEnvironmentCreationTool(); } @@ -232,6 +240,19 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { } /** + * @generated + */ + private Tool createDeploymentSpecification5CreationTool() { + List<IElementType> types = new ArrayList<IElementType>(4); + types.add(UMLElementTypes.DeploymentSpecification_2013); + types.add(UMLElementTypes.DeploymentSpecification_2014); + types.add(UMLElementTypes.DeploymentSpecification_2015); + types.add(UMLElementTypes.DeploymentSpecification_2016); + Tool tool = new AspectUnspecifiedTypeCreationTool(types); + return tool; + } + + /** * @generated */ private Tool createExecutionEnvironmentCreationTool() { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java index 0a0730c3244..f4c612e147a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/part/UMLVisualIDRegistry.java @@ -53,6 +53,18 @@ import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedSt import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationNameEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart; @@ -97,6 +109,8 @@ import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPart import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackageNameEditPartCN; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.PackagePackageableElementCompartmentEditPartCN; +import org.eclipse.papyrus.uml.diagram.deployment.expressions.UMLOCLFactory; +import org.eclipse.uml2.uml.Artifact; import org.eclipse.uml2.uml.Package; import org.eclipse.uml2.uml.UMLPackage; @@ -218,7 +232,7 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { return DeviceEditPart.VISUAL_ID; } - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_2006((Artifact) domainElement)) { return ArtifactEditPart.VISUAL_ID; } if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { @@ -227,6 +241,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getNamedElement().isSuperTypeOf(domainElement.eClass())) { return DefaultNamedElementEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecificationEditPart.VISUAL_ID; + } break; case ModelPackageableElementCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { @@ -244,7 +261,7 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NestedNodeEditPartCN.VISUAL_ID; } - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_40((Artifact) domainElement)) { return NestedArtifactNodeEditPartCN.VISUAL_ID; } if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { @@ -253,6 +270,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsPackageableElEditPart.VISUAL_ID; + } break; case PackagePackageableElementCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { @@ -261,7 +281,7 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { return PackageEditPartCN.VISUAL_ID; } - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_40((Artifact) domainElement)) { return NestedArtifactNodeEditPartCN.VISUAL_ID; } if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { @@ -279,6 +299,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsPackageableElEditPart.VISUAL_ID; + } break; case DeviceCompositeCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { @@ -290,14 +313,20 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NodeEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsClassifierEditPart.VISUAL_ID; + } break; case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return ExecutionEnvironmentEditPartCN.VISUAL_ID; } - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_25((Artifact) domainElement)) { return ArtifactEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsClassifierEditPart.VISUAL_ID; + } break; case NodeCompositeCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { @@ -306,17 +335,23 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return ExecutionEnvironmentEditPartCN.VISUAL_ID; } - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_25((Artifact) domainElement)) { return ArtifactEditPartCN.VISUAL_ID; } if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NodeEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsClassifierEditPart.VISUAL_ID; + } break; case ArtifactCompositeCompartmentEditPart.VISUAL_ID: - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_28((Artifact) domainElement)) { return ArtifactEditPartACN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID; + } break; case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID: if (UMLPackage.eINSTANCE.getModel().isSuperTypeOf(domainElement.eClass())) { @@ -334,7 +369,7 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NestedNodeEditPartCN.VISUAL_ID; } - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_40((Artifact) domainElement)) { return NestedArtifactNodeEditPartCN.VISUAL_ID; } if (UMLPackage.eINSTANCE.getComment().isSuperTypeOf(domainElement.eClass())) { @@ -343,12 +378,15 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsPackageableElEditPart.VISUAL_ID; + } break; case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID: if (UMLPackage.eINSTANCE.getPackage().isSuperTypeOf(domainElement.eClass())) { return PackageEditPartCN.VISUAL_ID; } - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_40((Artifact) domainElement)) { return NestedArtifactNodeEditPartCN.VISUAL_ID; } if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { @@ -366,6 +404,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsPackageableElEditPart.VISUAL_ID; + } break; case DeviceCompositeCompartmentEditPartCN.VISUAL_ID: if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { @@ -377,14 +418,20 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NodeEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsClassifierEditPart.VISUAL_ID; + } break; case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID: - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_25((Artifact) domainElement)) { return ArtifactEditPartCN.VISUAL_ID; } if (UMLPackage.eINSTANCE.getExecutionEnvironment().isSuperTypeOf(domainElement.eClass())) { return ExecutionEnvironmentEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsClassifierEditPart.VISUAL_ID; + } break; case NodeCompositeCompartmentEditPartCN.VISUAL_ID: if (UMLPackage.eINSTANCE.getDevice().isSuperTypeOf(domainElement.eClass())) { @@ -396,19 +443,28 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getNode().isSuperTypeOf(domainElement.eClass())) { return NodeEditPartCN.VISUAL_ID; } - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_25((Artifact) domainElement)) { return ArtifactEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsClassifierEditPart.VISUAL_ID; + } break; case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID: - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_28((Artifact) domainElement)) { return ArtifactEditPartACN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID; + } break; case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID: - if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass())) { + if (UMLPackage.eINSTANCE.getArtifact().isSuperTypeOf(domainElement.eClass()) && isArtifact_28((Artifact) domainElement)) { return ArtifactEditPartACN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getDeploymentSpecification().isSuperTypeOf(domainElement.eClass())) { + return DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID; + } break; } return -1; @@ -464,6 +520,9 @@ public class UMLVisualIDRegistry { if (DefaultNamedElementEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecificationEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case DependencyNodeEditPart.VISUAL_ID: if (MultiDependencyLabelEditPart.VISUAL_ID == nodeVisualID) { @@ -539,6 +598,14 @@ public class UMLVisualIDRegistry { return true; } break; + case DeploymentSpecificationEditPart.VISUAL_ID: + if (DeploymentSpecificationNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; case ModelEditPartCN.VISUAL_ID: if (ModelNameEditPartCN.VISUAL_ID == nodeVisualID) { return true; @@ -634,6 +701,30 @@ public class UMLVisualIDRegistry { return true; } break; + case DeploymentSpecAsClassifierEditPart.VISUAL_ID: + if (DeploymentSpecAsClassifierNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: + if (DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: + if (DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; case ModelPackageableElementCompartmentEditPart.VISUAL_ID: if (ModelEditPartCN.VISUAL_ID == nodeVisualID) { return true; @@ -659,6 +750,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case PackagePackageableElementCompartmentEditPart.VISUAL_ID: if (ModelEditPartCN.VISUAL_ID == nodeVisualID) { @@ -685,6 +779,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case DeviceCompositeCompartmentEditPart.VISUAL_ID: if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) { @@ -696,6 +793,9 @@ public class UMLVisualIDRegistry { if (NodeEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ExecutionEnvironmentCompositeCompartmentEditPart.VISUAL_ID: if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) { @@ -704,6 +804,9 @@ public class UMLVisualIDRegistry { if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case NodeCompositeCompartmentEditPart.VISUAL_ID: if (DeviceEditPartCN.VISUAL_ID == nodeVisualID) { @@ -718,11 +821,17 @@ public class UMLVisualIDRegistry { if (NodeEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ArtifactCompositeCompartmentEditPart.VISUAL_ID: if (ArtifactEditPartACN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ModelPackageableElementCompartmentEditPartCN.VISUAL_ID: if (ModelEditPartCN.VISUAL_ID == nodeVisualID) { @@ -749,6 +858,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case PackagePackageableElementCompartmentEditPartCN.VISUAL_ID: if (PackageEditPartCN.VISUAL_ID == nodeVisualID) { @@ -772,6 +884,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsPackageableElEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case DeviceCompositeCompartmentEditPartCN.VISUAL_ID: if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) { @@ -783,6 +898,9 @@ public class UMLVisualIDRegistry { if (NodeEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ExecutionEnvironmentCompositeCompartmentEditPartCN.VISUAL_ID: if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) { @@ -791,6 +909,9 @@ public class UMLVisualIDRegistry { if (ExecutionEnvironmentEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case NodeCompositeCompartmentEditPartCN.VISUAL_ID: if (DeviceEditPartCN.VISUAL_ID == nodeVisualID) { @@ -805,16 +926,25 @@ public class UMLVisualIDRegistry { if (ArtifactEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsClassifierEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ArtifactCompositeCompartmentEditPartCN.VISUAL_ID: if (ArtifactEditPartACN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ArtifactCompositeCompartmentEditPartACN.VISUAL_ID: if (ArtifactEditPartACN.VISUAL_ID == nodeVisualID) { return true; } + if (DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case DeploymentEditPart.VISUAL_ID: if (DeploymentNameEditPart.VISUAL_ID == nodeVisualID) { @@ -896,6 +1026,38 @@ public class UMLVisualIDRegistry { } /** + * @generated + */ + private static boolean isArtifact_2006(Artifact domainElement) { + Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isArtifact_25(Artifact domainElement) { + Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isArtifact_28(Artifact domainElement) { + Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isArtifact_40(Artifact domainElement) { + Object result = UMLOCLFactory.getExpression(2, UMLPackage.eINSTANCE.getArtifact(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** * @generated */ public static boolean checkNodeVisualID(View containerView, EObject domainElement, int candidate) { @@ -949,6 +1111,10 @@ public class UMLVisualIDRegistry { case ConstraintEditPart.VISUAL_ID: case DependencyNodeEditPart.VISUAL_ID: case DefaultNamedElementEditPart.VISUAL_ID: + case DeploymentSpecificationEditPart.VISUAL_ID: + case DeploymentSpecAsClassifierEditPart.VISUAL_ID: + case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: + case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: return true; default: break; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java index 3b03ed17c79..1b4e87ad593 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/ElementInitializers.java @@ -20,6 +20,7 @@ import org.eclipse.uml2.uml.CommunicationPath; import org.eclipse.uml2.uml.Constraint; import org.eclipse.uml2.uml.Dependency; import org.eclipse.uml2.uml.Deployment; +import org.eclipse.uml2.uml.DeploymentSpecification; import org.eclipse.uml2.uml.Device; import org.eclipse.uml2.uml.ExecutionEnvironment; import org.eclipse.uml2.uml.LiteralString; @@ -171,6 +172,26 @@ public class ElementInitializers { } /** + * @generated + */ + public void init_DeploymentSpecification_2013(DeploymentSpecification instance) { + try { + Object value_0 = name_DeploymentSpecification_2013(instance); + if (value_0 != null) { + instance.setName( + (String) value_0); + } + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null).evaluate(instance); + if (value_1 != null) { + instance.setFileName( + (String) value_1); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** * @generated */ public void init_Model_49(Model instance) { @@ -386,6 +407,66 @@ public class ElementInitializers { } /** + * @generated + */ + public void init_DeploymentSpecification_2014(DeploymentSpecification instance) { + try { + Object value_0 = name_DeploymentSpecification_2014(instance); + if (value_0 != null) { + instance.setName( + (String) value_0); + } + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null).evaluate(instance); + if (value_1 != null) { + instance.setFileName( + (String) value_1); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_DeploymentSpecification_2015(DeploymentSpecification instance) { + try { + Object value_0 = name_DeploymentSpecification_2015(instance); + if (value_0 != null) { + instance.setName( + (String) value_0); + } + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null).evaluate(instance); + if (value_1 != null) { + instance.setFileName( + (String) value_1); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_DeploymentSpecification_2016(DeploymentSpecification instance) { + try { + Object value_0 = name_DeploymentSpecification_2016(instance); + if (value_0 != null) { + instance.setName( + (String) value_0); + } + Object value_1 = UMLOCLFactory.getExpression(0, UMLPackage.eINSTANCE.getDeploymentSpecification(), null).evaluate(instance); + if (value_1 != null) { + instance.setFileName( + (String) value_1); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** * @generated */ public void init_Deployment_4001(Deployment instance) { @@ -528,6 +609,13 @@ public class ElementInitializers { } /** + * @generated + */ + private String name_DeploymentSpecification_2013(DeploymentSpecification it) { + return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); + } + + /** * @generated */ private String name_Model_49(Model it) { @@ -630,6 +718,27 @@ public class ElementInitializers { } /** + * @generated + */ + private String name_DeploymentSpecification_2014(DeploymentSpecification it) { + return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); + } + + /** + * @generated + */ + private String name_DeploymentSpecification_2015(DeploymentSpecification it) { + return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); + } + + /** + * @generated + */ + private String name_DeploymentSpecification_2016(DeploymentSpecification it) { + return NamedElementUtil.getDefaultNameWithIncrement(it, it.getOwner().eContents()); + } + + /** * @generated */ private String name_Deployment_4001(Deployment it) { diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java index de5e18e5976..5f96ac814c1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLElementTypes.java @@ -39,6 +39,10 @@ import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNodeEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPartCN; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentEditPart; @@ -142,6 +146,11 @@ public class UMLElementTypes { public static final IElementType NamedElement_2012 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.NamedElement_2012"); //$NON-NLS-1$ /** + * @generated + */ + public static final IElementType DeploymentSpecification_2013 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2013"); //$NON-NLS-1$ + + /** * @generated */ public static final IElementType Model_49 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Model_49"); //$NON-NLS-1$ @@ -207,6 +216,21 @@ public class UMLElementTypes { public static final IElementType Constraint_56 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Constraint_56"); //$NON-NLS-1$ /** + * @generated + */ + public static final IElementType DeploymentSpecification_2014 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2014"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType DeploymentSpecification_2015 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2015"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType DeploymentSpecification_2016 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.DeploymentSpecification_2016"); //$NON-NLS-1$ + + /** * @generated */ public static final IElementType Link_4005 = getElementType("org.eclipse.papyrus.uml.diagram.deployment.Link_4005"); //$NON-NLS-1$ @@ -322,6 +346,9 @@ public class UMLElementTypes { elements.put(NamedElement_2012, UMLPackage.eINSTANCE.getNamedElement()); + elements.put(DeploymentSpecification_2013, UMLPackage.eINSTANCE.getDeploymentSpecification()); + + elements.put(Model_49, UMLPackage.eINSTANCE.getModel()); @@ -360,6 +387,15 @@ public class UMLElementTypes { elements.put(Constraint_56, UMLPackage.eINSTANCE.getConstraint()); + + elements.put(DeploymentSpecification_2014, UMLPackage.eINSTANCE.getDeploymentSpecification()); + + + elements.put(DeploymentSpecification_2015, UMLPackage.eINSTANCE.getDeploymentSpecification()); + + + elements.put(DeploymentSpecification_2016, UMLPackage.eINSTANCE.getDeploymentSpecification()); + elements.put(CommentAnnotatedElement_4008, UMLPackage.eINSTANCE.getComment_AnnotatedElement()); elements.put(ConstraintConstrainedElement_4009, UMLPackage.eINSTANCE.getConstraint_ConstrainedElement()); @@ -409,6 +445,7 @@ public class UMLElementTypes { KNOWN_ELEMENT_TYPES.add(Artifact_2006); KNOWN_ELEMENT_TYPES.add(Node_2008); KNOWN_ELEMENT_TYPES.add(NamedElement_2012); + KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_2013); KNOWN_ELEMENT_TYPES.add(Model_49); KNOWN_ELEMENT_TYPES.add(Package_36); KNOWN_ELEMENT_TYPES.add(Device_16); @@ -422,6 +459,9 @@ public class UMLElementTypes { KNOWN_ELEMENT_TYPES.add(Artifact_40); KNOWN_ELEMENT_TYPES.add(Comment_54); KNOWN_ELEMENT_TYPES.add(Constraint_56); + KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_2014); + KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_2015); + KNOWN_ELEMENT_TYPES.add(DeploymentSpecification_2016); KNOWN_ELEMENT_TYPES.add(Link_4005); KNOWN_ELEMENT_TYPES.add(CommentAnnotatedElement_4008); KNOWN_ELEMENT_TYPES.add(ConstraintConstrainedElement_4009); @@ -472,6 +512,8 @@ public class UMLElementTypes { return Node_2008; case DefaultNamedElementEditPart.VISUAL_ID: return NamedElement_2012; + case DeploymentSpecificationEditPart.VISUAL_ID: + return DeploymentSpecification_2013; case ModelEditPartCN.VISUAL_ID: return Model_49; case PackageEditPartCN.VISUAL_ID: @@ -498,6 +540,12 @@ public class UMLElementTypes { return Comment_54; case ConstraintEditPartCN.VISUAL_ID: return Constraint_56; + case DeploymentSpecAsClassifierEditPart.VISUAL_ID: + return DeploymentSpecification_2014; + case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: + return DeploymentSpecification_2015; + case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: + return DeploymentSpecification_2016; case LinkDescriptorEditPart.VISUAL_ID: return Link_4005; case CommentAnnotatedElementEditPart.VISUAL_ID: diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java index 253497b4960..59b618ac008 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLParserProvider.java @@ -45,6 +45,14 @@ import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyAppliedSt import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DependencyNameEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedStereotypeEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationNameEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceNameEditPartCN; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.ExecutionEnvironmentNameEditPart; @@ -293,6 +301,44 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid } /** + * @generated + */ + private IParser deploymentSpecificationName_62Parser; + + /** + * @generated + */ + private IParser getDeploymentSpecificationName_62Parser() { + if (deploymentSpecificationName_62Parser == null) { + EAttribute[] features = new EAttribute[] { + UMLPackage.eINSTANCE.getNamedElement_Name() + }; + MessageFormatParser parser = new MessageFormatParser(features); + deploymentSpecificationName_62Parser = parser; + } + return deploymentSpecificationName_62Parser; + } + + /** + * @generated + */ + private IParser deploymentSpecificationName_63Parser; + + /** + * @generated + */ + private IParser getDeploymentSpecificationName_63Parser() { + if (deploymentSpecificationName_63Parser == null) { + EAttribute[] features = new EAttribute[] { + UMLPackage.eINSTANCE.getNamedElement_Name() + }; + MessageFormatParser parser = new MessageFormatParser(features); + deploymentSpecificationName_63Parser = parser; + } + return deploymentSpecificationName_63Parser; + } + + /** * @generated */ private IParser modelName_50Parser; @@ -589,6 +635,120 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid } /** + * @generated + */ + private IParser deploymentSpecificationName_64Parser; + + /** + * @generated + */ + private IParser getDeploymentSpecificationName_64Parser() { + if (deploymentSpecificationName_64Parser == null) { + EAttribute[] features = new EAttribute[] { + UMLPackage.eINSTANCE.getNamedElement_Name() + }; + MessageFormatParser parser = new MessageFormatParser(features); + deploymentSpecificationName_64Parser = parser; + } + return deploymentSpecificationName_64Parser; + } + + /** + * @generated + */ + private IParser deploymentSpecificationName_65Parser; + + /** + * @generated + */ + private IParser getDeploymentSpecificationName_65Parser() { + if (deploymentSpecificationName_65Parser == null) { + EAttribute[] features = new EAttribute[] { + UMLPackage.eINSTANCE.getNamedElement_Name() + }; + MessageFormatParser parser = new MessageFormatParser(features); + deploymentSpecificationName_65Parser = parser; + } + return deploymentSpecificationName_65Parser; + } + + /** + * @generated + */ + private IParser deploymentSpecificationName_66Parser; + + /** + * @generated + */ + private IParser getDeploymentSpecificationName_66Parser() { + if (deploymentSpecificationName_66Parser == null) { + EAttribute[] features = new EAttribute[] { + UMLPackage.eINSTANCE.getNamedElement_Name() + }; + MessageFormatParser parser = new MessageFormatParser(features); + deploymentSpecificationName_66Parser = parser; + } + return deploymentSpecificationName_66Parser; + } + + /** + * @generated + */ + private IParser deploymentSpecificationName_67Parser; + + /** + * @generated + */ + private IParser getDeploymentSpecificationName_67Parser() { + if (deploymentSpecificationName_67Parser == null) { + EAttribute[] features = new EAttribute[] { + UMLPackage.eINSTANCE.getNamedElement_Name() + }; + MessageFormatParser parser = new MessageFormatParser(features); + deploymentSpecificationName_67Parser = parser; + } + return deploymentSpecificationName_67Parser; + } + + /** + * @generated + */ + private IParser deploymentSpecificationName_68Parser; + + /** + * @generated + */ + private IParser getDeploymentSpecificationName_68Parser() { + if (deploymentSpecificationName_68Parser == null) { + EAttribute[] features = new EAttribute[] { + UMLPackage.eINSTANCE.getNamedElement_Name() + }; + MessageFormatParser parser = new MessageFormatParser(features); + deploymentSpecificationName_68Parser = parser; + } + return deploymentSpecificationName_68Parser; + } + + /** + * @generated + */ + private IParser deploymentSpecificationName_69Parser; + + /** + * @generated + */ + private IParser getDeploymentSpecificationName_69Parser() { + if (deploymentSpecificationName_69Parser == null) { + EAttribute[] features = new EAttribute[] { + UMLPackage.eINSTANCE.getNamedElement_Name() + }; + MessageFormatParser parser = new MessageFormatParser(features); + deploymentSpecificationName_69Parser = parser; + } + return deploymentSpecificationName_69Parser; + } + + /** * @generated */ private IParser deploymentName_13Parser; @@ -778,6 +938,11 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid case DefaultNamedElementNameEditPart.VISUAL_ID: return getNamedElementName_53Parser(); + case DeploymentSpecificationNameEditPart.VISUAL_ID: + return getDeploymentSpecificationName_62Parser(); + case DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID: + return getDeploymentSpecificationName_63Parser(); + case ModelNameEditPartCN.VISUAL_ID: return getModelName_50Parser(); @@ -823,6 +988,21 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid case ConstraintSpecificationEditPartCN.VISUAL_ID: return getConstraintSpecification_58Parser(); + case DeploymentSpecAsClassifierNameEditPart.VISUAL_ID: + return getDeploymentSpecificationName_64Parser(); + case DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID: + return getDeploymentSpecificationName_65Parser(); + + case DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID: + return getDeploymentSpecificationName_66Parser(); + case DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID: + return getDeploymentSpecificationName_67Parser(); + + case DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID: + return getDeploymentSpecificationName_68Parser(); + case DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID: + return getDeploymentSpecificationName_69Parser(); + diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java index cfb4eac44dd..98d01ac692f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.deployment/src/org/eclipse/papyrus/uml/diagram/deployment/providers/UMLViewProvider.java @@ -95,6 +95,18 @@ import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentAppliedSt import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentDiagramEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsClassifierNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsNestedArtifactNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecAsPackageableElNameEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationFloatingLabelEditPart; +import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeploymentSpecificationNameEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPart; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceCompositeCompartmentEditPartCN; import org.eclipse.papyrus.uml.diagram.deployment.edit.parts.DeviceEditPart; @@ -261,8 +273,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { case ArtifactEditPart.VISUAL_ID: case NodeEditPart.VISUAL_ID: case DefaultNamedElementEditPart.VISUAL_ID: + case DeploymentSpecificationEditPart.VISUAL_ID: case CommentEditPartCN.VISUAL_ID: case ConstraintEditPartCN.VISUAL_ID: + case DeploymentSpecAsClassifierEditPart.VISUAL_ID: + case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: + case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: case ModelEditPart.VISUAL_ID: case PackageEditPart.VISUAL_ID: case ModelEditPartCN.VISUAL_ID: @@ -369,6 +385,8 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { return createNode_2008(domainElement, containerView, index, persisted, preferencesHint); case DefaultNamedElementEditPart.VISUAL_ID: return createNamedElement_2012(domainElement, containerView, index, persisted, preferencesHint); + case DeploymentSpecificationEditPart.VISUAL_ID: + return createDeploymentSpecification_2013(domainElement, containerView, index, persisted, preferencesHint); case ModelEditPartCN.VISUAL_ID: return createModel_49(domainElement, containerView, index, persisted, preferencesHint); case PackageEditPartCN.VISUAL_ID: @@ -395,6 +413,12 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { return createComment_54(domainElement, containerView, index, persisted, preferencesHint); case ConstraintEditPartCN.VISUAL_ID: return createConstraint_56(domainElement, containerView, index, persisted, preferencesHint); + case DeploymentSpecAsClassifierEditPart.VISUAL_ID: + return createDeploymentSpecification_2014(domainElement, containerView, index, persisted, preferencesHint); + case DeploymentSpecAsPackageableElEditPart.VISUAL_ID: + return createDeploymentSpecification_2015(domainElement, containerView, index, persisted, preferencesHint); + case DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID: + return createDeploymentSpecification_2016(domainElement, containerView, index, persisted, preferencesHint); } // can't happen, provided #provides(CreateNodeViewOperation) is correct return null; @@ -636,6 +660,29 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ + public Node createDeploymentSpecification_2013(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(DeploymentSpecificationEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + stampShortcut(containerView, node); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DeploymentSpecification"); + Node label62 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecificationNameEditPart.VISUAL_ID)); + Node label63 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecificationFloatingLabelEditPart.VISUAL_ID)); + label63.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location63 = (Location) label63.getLayoutConstraint(); + location63.setX(25); + location63.setY(0); + return node; + } + + /** + * @generated + */ public Node createModel_49(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); @@ -882,6 +929,72 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ + public Node createDeploymentSpecification_2014(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(DeploymentSpecAsClassifierEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DeploymentSpecification"); + Node label64 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsClassifierNameEditPart.VISUAL_ID)); + Node label65 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsClassifierFloatingLabelEditPart.VISUAL_ID)); + label65.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location65 = (Location) label65.getLayoutConstraint(); + location65.setX(25); + location65.setY(0); + return node; + } + + /** + * @generated + */ + public Node createDeploymentSpecification_2015(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(DeploymentSpecAsPackageableElEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DeploymentSpecification"); + Node label66 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsPackageableElNameEditPart.VISUAL_ID)); + Node label67 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsPackageableElFloatingLabelEditPart.VISUAL_ID)); + label67.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location67 = (Location) label67.getLayoutConstraint(); + location67.setX(25); + location67.setY(0); + return node; + } + + /** + * @generated + */ + public Node createDeploymentSpecification_2016(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "DeploymentSpecification"); + Node label68 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactNameEditPart.VISUAL_ID)); + Node label69 = createLabel(node, UMLVisualIDRegistry.getType(DeploymentSpecAsNestedArtifactFloatingLabelEditPart.VISUAL_ID)); + label69.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location69 = (Location) label69.getLayoutConstraint(); + location69.setX(25); + location69.setY(0); + return node; + } + + /** + * @generated + */ public Edge createLink_4005(View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Connector edge = NotationFactory.eINSTANCE.createConnector(); edge.getStyles().add(NotationFactory.eINSTANCE.createFontStyle()); |