diff options
author | ptessier | 2015-01-22 12:54:00 +0000 |
---|---|---|
committer | ptessier | 2015-01-22 12:54:00 +0000 |
commit | 237cb0265bc39d65635ba071d99aa220ff7bf7cc (patch) | |
tree | d909cfba1fb5f4804da4f653bfc5d47ebd52eef9 | |
parent | 010f76be4f0b0f9f91a737ecb7f6af22061be6c1 (diff) | |
parent | 9a96db94220fa3ef906497cf96d0f6bcfb244011 (diff) | |
download | org.eclipse.papyrus-237cb0265bc39d65635ba071d99aa220ff7bf7cc.tar.gz org.eclipse.papyrus-237cb0265bc39d65635ba071d99aa220ff7bf7cc.tar.xz org.eclipse.papyrus-237cb0265bc39d65635ba071d99aa220ff7bf7cc.zip |
Merge branch 'master' of ssh://ptessier@git.eclipse.org:29418/papyrus/org.eclipse.papyrus
134 files changed, 24823 insertions, 934 deletions
diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.dev.ui/META-INF/MANIFEST.MF b/extraplugins/layers/org.eclipse.papyrus.layers.dev.ui/META-INF/MANIFEST.MF index 83339f8a482..f7e705712b9 100644 --- a/extraplugins/layers/org.eclipse.papyrus.layers.dev.ui/META-INF/MANIFEST.MF +++ b/extraplugins/layers/org.eclipse.papyrus.layers.dev.ui/META-INF/MANIFEST.MF @@ -1,12 +1,13 @@ -Manifest-Version: 1.0
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.ui
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.1.0.qualifier
-Bundle-Name: %pluginName
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.layers.dev.ui.Activator
-Bundle-SymbolicName: org.eclipse.papyrus.layers.dev.ui;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-
+Manifest-Version: 1.0 +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.ui +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-Version: 1.1.0.qualifier +Bundle-Name: %pluginName +Bundle-ManifestVersion: 2 +Bundle-Activator: org.eclipse.papyrus.layers.dev.ui.Activator +Bundle-SymbolicName: org.eclipse.papyrus.layers.dev.ui;singleton:=true +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-Localization: plugin + diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/META-INF/MANIFEST.MF b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/META-INF/MANIFEST.MF index a5a2014cebf..c3d65b42eb5 100644 --- a/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/META-INF/MANIFEST.MF +++ b/extraplugins/layers/org.eclipse.papyrus.layers.integrationtests/META-INF/MANIFEST.MF @@ -1,18 +1,19 @@ -Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.layers.integrationtests
-Require-Bundle: org.eclipse.papyrus.layers.runtime;bundle-version="1.1.0",
- org.eclipse.papyrus.layers.stackmodel;bundle-version="1.1.0",
- org.junit,
- org.eclipse.emf;bundle-version="2.6.0",
- org.eclipse.emf.common;bundle-version="2.9.1",
- org.eclipse.papyrus.integrationtests.editor;bundle-version="1.1.0",
- org.eclipse.emf.ecore;bundle-version="2.10.0",
- org.eclipse.papyrus.infra.core;bundle-version="1.1.0",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0"
-Bundle-Vendor: %providerName
-Bundle-Version: 1.1.0.qualifier
-Bundle-Name: %pluginName
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.layers.integrationtests
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-
+Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.layers.integrationtests +Require-Bundle: org.eclipse.papyrus.layers.runtime;bundle-version="1.1.0", + org.eclipse.papyrus.layers.stackmodel;bundle-version="1.1.0", + org.junit, + org.eclipse.emf;bundle-version="2.6.0", + org.eclipse.emf.common;bundle-version="2.9.1", + org.eclipse.papyrus.integrationtests.editor;bundle-version="1.1.0", + org.eclipse.emf.ecore;bundle-version="2.10.0", + org.eclipse.papyrus.infra.core;bundle-version="1.1.0", + org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0" +Bundle-Vendor: %providerName +Bundle-Version: 1.1.0.qualifier +Bundle-Name: %pluginName +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.layers.integrationtests +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-Localization: plugin + diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.tests/META-INF/MANIFEST.MF b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.tests/META-INF/MANIFEST.MF index e4e9a386eee..1392507eb0c 100644 --- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.tests/META-INF/MANIFEST.MF +++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.tests/META-INF/MANIFEST.MF @@ -1,19 +1,18 @@ -Manifest-Version: 1.0
-Export-Package: org.eclipse.papyrus.layers.stackmodel.layers.tests
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.papyrus.layers.stackmodel;bundle-version="1.1.0";visibility:=reexport,
- org.eclipse.emf.ecore;visibility:=reexport,
- org.eclipse.gmf.runtime.notation;visibility:=reexport,
- org.eclipse.emf.ecore.xmi;visibility:=reexport,
- org.junit;visibility:=reexport
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-ClassPath: .
-Bundle-Version: 1.1.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-SymbolicName: org.eclipse.papyrus.layers.stackmodel.tests;singl
- eton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-
+Manifest-Version: 1.0 +Export-Package: org.eclipse.papyrus.layers.stackmodel.layers.tests +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.papyrus.layers.stackmodel;bundle-version="1.1.0";visibility:=reexport, + org.eclipse.emf.ecore;visibility:=reexport, + org.eclipse.gmf.runtime.notation;visibility:=reexport, + org.eclipse.emf.ecore.xmi;visibility:=reexport, + org.junit;visibility:=reexport +Bundle-Vendor: %providerName +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: . +Bundle-Version: 1.1.0.qualifier +Bundle-Name: %pluginName +Bundle-Localization: plugin +Bundle-ManifestVersion: 2 +Bundle-SymbolicName: org.eclipse.papyrus.layers.stackmodel.tests;singl + eton:=true +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.tests/plugin.properties b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.tests/plugin.properties index d150de6fe56..48137fac09a 100644 --- a/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.tests/plugin.properties +++ b/extraplugins/layers/org.eclipse.papyrus.layers.stackmodel.tests/plugin.properties @@ -1,4 +1,4 @@ -#
-
-pluginName = Layers Tests
-providerName = www.example.org
+# + +pluginName =Papyrus Layers Tests +providerName=Eclipse Modeling Project diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/handler/ImportHandler.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/handler/ImportHandler.java index 13cc300ba03..8c47f03f2c9 100644 --- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/handler/ImportHandler.java +++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/handler/ImportHandler.java @@ -28,7 +28,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.migration.rsa.Activator; import org.eclipse.papyrus.migration.rsa.RSAToPapyrusParameters.Config; -import org.eclipse.papyrus.migration.rsa.transformation.ConfigHelper; +import org.eclipse.papyrus.migration.rsa.RSAToPapyrusParameters.RSAToPapyrusParametersFactory; import org.eclipse.papyrus.migration.rsa.transformation.ImportTransformationLauncher; import org.eclipse.papyrus.views.properties.creation.PropertyEditorFactory; import org.eclipse.swt.widgets.Control; @@ -109,9 +109,7 @@ public class ImportHandler extends AbstractHandler { } public Config getTransformationParameters(ExecutionEvent event) { - ConfigHelper helper = new ConfigHelper(); - - Config config = helper.getConfig(); + Config config = RSAToPapyrusParametersFactory.eINSTANCE.createConfig(); Shell activeShell = HandlerUtil.getActiveShell(event); diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ConfigHelper.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/DependencyAnalysisHelper.java index cb9b42f6c1f..a6638c6e7a5 100644 --- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ConfigHelper.java +++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/DependencyAnalysisHelper.java @@ -1,343 +1,392 @@ -/*****************************************************************************
- * 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:
- * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
- *****************************************************************************/
-package org.eclipse.papyrus.migration.rsa.transformation;
-
-import java.util.Collection;
-import java.util.Set;
-
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xmi.XMLResource;
-import org.eclipse.emf.ecore.xml.type.AnyType;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.migration.rsa.RSAToPapyrusParameters.Config;
-import org.eclipse.papyrus.migration.rsa.RSAToPapyrusParameters.RSAToPapyrusParametersFactory;
-import org.eclipse.papyrus.migration.rsa.RSAToPapyrusParameters.URIMapping;
-import org.eclipse.papyrus.uml.extensionpoints.library.IRegisteredLibrary;
-import org.eclipse.papyrus.uml.extensionpoints.library.RegisteredLibrary;
-import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile;
-import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile;
-import org.eclipse.uml2.uml.Element;
-
-import com.google.common.collect.Sets;
-
-/**
- * Helper class to instantiate and manipulate a Parameters Configuration
- *
- * @author Camille Letavernier
- *
- */
-public class ConfigHelper {
-
- protected final Config config;
-
- protected final static Set<String> rsaExtensions = Sets.newHashSet("emx", "efx"); //$NON-NLS-1$ //$NON-NLS-2$
-
- protected final static String rsaProfileExtension = "epx"; //$NON-NLS-1$
-
- // ResourceSet used to load and explore Static Libraries
- protected final ResourceSet localResourceSet = new ResourceSetImpl();
-
- public ConfigHelper(Config config) {
- this.config = config;
- synchronized (config) {
- if (config.getMappingParameters() == null) {
- config.setMappingParameters(RSAToPapyrusParametersFactory.eINSTANCE.createMappingParameters());
- }
- }
-
- configureResourceSet();
- }
-
- protected void configureResourceSet() {
- localResourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_ATTACHMENT, true);
- localResourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true);
- localResourceSet.getLoadOptions().put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
- localResourceSet.getLoadOptions().put(XMLResource.OPTION_USE_PACKAGE_NS_URI_AS_LOCATION, Boolean.FALSE);
- }
-
- protected void unloadResourceSet() {
- EMFHelper.unload(localResourceSet);
- }
-
- public ConfigHelper() {
- this(RSAToPapyrusParametersFactory.eINSTANCE.createConfig());
- }
-
- public Config getConfig() {
- return config;
- }
-
- public void computeURIMappings(Collection<Resource> sourceModels) {
- try {
- for (Resource sourceModel : sourceModels) {
- doComputeURIMappings(sourceModel);
- }
- } finally {
- unloadResourceSet();
- }
- }
-
- protected void doComputeURIMappings(Resource sourceModel) {
- doComputeProfileURIMappings(sourceModel);
-
- TreeIterator<EObject> resourceContents = sourceModel.getAllContents();
- ResourceSet resourceSet = sourceModel.getResourceSet();
-
- while (resourceContents.hasNext()) {
- EObject next = resourceContents.next();
- for (EReference reference : next.eClass().getEAllReferences()) {
- if (reference.isContainer() || reference.isContainment() || reference.isDerived() || reference.isTransient()) {
- continue;
- }
-
- Object value = next.eGet(reference);
- if (value instanceof EObject) {
- handleURIMapping((EObject) value, resourceSet);
- } else if (value instanceof Collection<?>) {
- for (Object element : (Collection<?>) value) {
- if (element instanceof EObject) {
- handleURIMapping((EObject) element, resourceSet);
- }
- }
- }
- }
- }
- }
-
- protected void doComputeProfileURIMappings(Resource sourceModel) {
- ResourceSet resourceSet = sourceModel.getResourceSet();
-
- for (EObject rootObject : sourceModel.getContents()) {
- if (isInvalidStereotypeApplication(rootObject)) {
- handleProfileURIMapping(rootObject, resourceSet);
- }
- }
- }
-
- protected boolean isInvalidStereotypeApplication(EObject eObject) {
- if (eObject instanceof Element) {
- return false;
- }
-
- // The package is not resolved: probably a missing profile
- if (eObject instanceof AnyType) {
- return true;
- }
-
- // If the package is resolved but is contained in an EPX resource, it needs to be mapped to the Papyrus equivalent
- EPackage ePackage = eObject.eClass().getEPackage();
- if ("epx".equals(ePackage.eResource().getURI().fileExtension())) {
- return true;
- }
-
- return false;
- }
-
- protected void handleProfileURIMapping(EObject stereotypeApplication, ResourceSet resourceSet) {
- Collection<URIMapping> mappings = config.getMappingParameters().getProfileUriMappings();
-
- URIMapping existingMapping = findExistingProfileMapping(stereotypeApplication, resourceSet);
- if (existingMapping == null) {
- URI packageURI = EcoreUtil.getURI(stereotypeApplication.eClass().getEPackage());
-
- URIMapping mapping = RSAToPapyrusParametersFactory.eINSTANCE.createURIMapping();
-
- mapping.setSourceURI(packageURI.trimFragment().trimQuery().toString());
- mapping.setTargetURI(packageURI.trimFragment().trimQuery().toString());
-
- synchronized (config) {
- mappings.add(mapping);
- }
- } else {
- synchronized (config) {
- mappings.add(existingMapping);
- }
- }
- }
-
- protected void handleURIMapping(EObject eObject, ResourceSet resourceSet) {
-
- Collection<URIMapping> mappings = config.getMappingParameters().getUriMappings();
-
- if (eObject.eIsProxy() || isRSAModelElement(eObject)) { // Not yet resolved, or still a reference to an RSA Model Element
- eObject = EcoreUtil.resolve(eObject, resourceSet);
- if (eObject.eIsProxy() || isRSAModelElement(eObject)) { // Can't be resolved
-
- URIMapping existingMapping = findExistingMapping(eObject, resourceSet);
- if (existingMapping == null) {
- URIMapping mapping = RSAToPapyrusParametersFactory.eINSTANCE.createURIMapping();
- URI sourceURI = EcoreUtil.getURI(eObject);
-
- mapping.setSourceURI(sourceURI.trimFragment().trimQuery().toString());
- mapping.setTargetURI(sourceURI.trimFragment().trimQuery().toString()); // By default, don't change anything
-
- synchronized (config) {
- mappings.add(mapping);
- }
- } else {
- synchronized (config) {
- mappings.add(existingMapping);
- }
- }
- }
- }
- }
-
- protected boolean isRSAModelElement(EObject eObject) {
- return isRSAModelElement(EcoreUtil.getURI(eObject));
- }
-
- protected boolean isRSAModelElement(URI objectURI) {
- String fileExtension = objectURI.fileExtension();
- return rsaExtensions.contains(fileExtension) || rsaProfileExtension.equals(fileExtension);
- }
-
- protected URIMapping findExistingProfileMapping(EObject stereotypeApplication, ResourceSet resourceSet) {
- URI proxyURI = EcoreUtil.getURI(stereotypeApplication.eClass().getEPackage());
- String fileExtension = proxyURI.fileExtension();
-
- URIMapping mapping = RSAToPapyrusParametersFactory.eINSTANCE.createURIMapping();
- URI sourceURI = proxyURI.trimFragment().trimQuery();
- mapping.setSourceURI(sourceURI.toString());
-
- URI targetURI = null;
-
- if ("epx".equals(fileExtension)) {
- targetURI = sourceURI.trimFileExtension().appendFileExtension("profile").appendFileExtension("uml");
- try {
- Resource resource = resourceSet.getResource(targetURI, true);
- if (resource != null && !resource.getContents().isEmpty()) {
- mapping.setTargetURI(targetURI.toString());
- return mapping;
- }
- } catch (Exception ex) {
- // Ignore: we can't find the target resource
- }
- }
-
- return findExistingMapping(proxyURI, resourceSet);
- }
-
- protected URIMapping findExistingMapping(URI proxyURI, ResourceSet resourceSet) {
- String fileExtension = proxyURI.fileExtension();
-
- URIMapping mapping = RSAToPapyrusParametersFactory.eINSTANCE.createURIMapping();
- mapping.setSourceURI(proxyURI.trimFragment().trimQuery().toString());
-
- URI targetURI = null;
- // Maybe the element has been migrated locally
- if (rsaExtensions.contains(fileExtension)) {
- targetURI = proxyURI.trimFileExtension().appendFileExtension("uml");
- } else if (rsaProfileExtension.equals(fileExtension)) {
- targetURI = proxyURI.trimFileExtension().appendFileExtension("profile.uml");
- }
-
- if (targetURI != null) {
- try {
- EObject targetElement = resourceSet.getEObject(targetURI, true);
- if (targetElement != null) {
-
- targetURI = EcoreUtil.getURI(targetElement);
-
- mapping.setTargetURI(targetURI.trimFragment().trimQuery().toString());
-
- return mapping;
- }
- } catch (Exception ex) {
- // Ignore: we can't find a target element for the given proxy
- }
- }
-
-
- if (!isRSAModelElement(proxyURI)) {
- // Maybe the resource exists, but doesn't contain this specific element
- URI resourceURI = proxyURI.trimFragment().trimQuery();
- try {
- Resource resource = resourceSet.getResource(resourceURI, true);
- if (resource != null && !resource.getContents().isEmpty()) {
-
- mapping.setTargetURI(resourceURI.toString());
-
- return mapping;
- }
- } catch (Exception ex) {
- // Ignore: we can't find the target resource
- }
- }
-
- // If the URI fragment is a path, don't explore registered libraries/profiles: almost all libraries will
- // have a matching element, although there is no specific correspondence
- if (isPathFragment(proxyURI)) {
- return null;
- }
-
- // Otherwise, we have an ID fragment
-
- // Maybe the resource has already been migrated, then deployed as a static library. Browse all registered libraries and try to find a matching XMI ID
- for (IRegisteredLibrary library : RegisteredLibrary.getRegisteredLibraries()) {
- URI libraryURI = library.getUri();
- try {
- Resource libraryResource = localResourceSet.getResource(libraryURI, true);
- if (libraryResource != null) {
- EObject resolvedElement = libraryResource.getEObject(proxyURI.fragment());
- if (resolvedElement != null && !resolvedElement.eIsProxy()) {
- mapping.setTargetURI(libraryURI.toString());
-
- return mapping;
- }
- }
- } catch (Exception ex) {
- // Ignore
- }
- }
-
- // Maybe the object is a Profile, so let's browse registered profiles as well
- for (IRegisteredProfile profile : RegisteredProfile.getRegisteredProfiles()) {
- URI profileURI = profile.getUri();
- try {
- Resource profileResource = localResourceSet.getResource(profileURI, true);
- if (profileResource != null) {
- EObject resolvedElement = profileResource.getEObject(proxyURI.fragment());
- if (resolvedElement != null && !resolvedElement.eIsProxy()) {
- mapping.setTargetURI(profileURI.toString());
-
- return mapping;
- }
- }
- } catch (Exception ex) {
- // Ignore
- }
- }
-
- return null;
- }
-
- protected boolean isPathFragment(URI proxyURI) {
- String uriFragment = proxyURI.fragment();
-
- return uriFragment.charAt(0) == '/';
- }
-
- protected URIMapping findExistingMapping(EObject proxy, ResourceSet resourceSet) {
- URI proxyURI = EcoreUtil.getURI(proxy);
- return findExistingMapping(proxyURI, resourceSet);
- }
-
-}
+/***************************************************************************** + * Copyright (c) 2015 CEA LIST. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.migration.rsa.transformation; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.eclipse.emf.common.util.TreeIterator; +import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.resource.Resource; +import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.emf.ecore.xml.type.AnyType; +import org.eclipse.papyrus.infra.emf.utils.EMFHelper; +import org.eclipse.papyrus.migration.rsa.RSAToPapyrusParameters.Config; +import org.eclipse.papyrus.migration.rsa.RSAToPapyrusParameters.RSAToPapyrusParametersFactory; +import org.eclipse.papyrus.migration.rsa.RSAToPapyrusParameters.URIMapping; +import org.eclipse.papyrus.uml.extensionpoints.library.IRegisteredLibrary; +import org.eclipse.papyrus.uml.extensionpoints.library.RegisteredLibrary; +import org.eclipse.papyrus.uml.extensionpoints.profile.IRegisteredProfile; +import org.eclipse.papyrus.uml.extensionpoints.profile.RegisteredProfile; +import org.eclipse.uml2.uml.Element; + +import com.google.common.collect.Sets; + +public class DependencyAnalysisHelper { + + protected final Config config; + + protected final static Set<String> rsaExtensions = Sets.newHashSet("emx", "efx"); //$NON-NLS-1$ //$NON-NLS-2$ + + protected final static String rsaProfileExtension = "epx"; //$NON-NLS-1$ + + // ResourceSet used to load and explore Static Libraries + protected final ResourceSet localResourceSet = new ResourceSetImpl(); + + // Store the broken URIs without trying to resolve them. We don't have enough information to resolve them during the first phase of the model import + // The Key is the resource URI, the value is the Set of each individual EObject Fragment (We need the EObject fragments to find potential matches) + protected final Map<URI, Set<String>> brokenUris = new HashMap<URI, Set<String>>(); + + protected final Set<URI> brokenProfiles = new HashSet<URI>(); + + public DependencyAnalysisHelper(Config config) { + this.config = config; + + configureResourceSet(); + } + + protected void configureResourceSet() { + localResourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_ATTACHMENT, true); + localResourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true); + localResourceSet.getLoadOptions().put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE); + localResourceSet.getLoadOptions().put(XMLResource.OPTION_USE_PACKAGE_NS_URI_AS_LOCATION, Boolean.FALSE); + } + + protected void unloadResourceSet() { + EMFHelper.unload(localResourceSet); + } + + public void computeURIMappings(Collection<Resource> sourceModels) { + for (Resource sourceModel : sourceModels) { + doComputeURIMappings(sourceModel); + } + } + + public synchronized void resolveAllMappings(Map<URI, URI> urisToReplace, Map<URI, URI> profileUrisToReplace) { + if (config.getMappingParameters() == null) { + config.setMappingParameters(RSAToPapyrusParametersFactory.eINSTANCE.createMappingParameters()); + } + + try { + for (Entry<URI, Set<String>> resourceToRepair : brokenUris.entrySet()) { + + // Already known mapping + if (urisToReplace.containsKey(resourceToRepair.getKey())) { + continue; + } + findMatch(resourceToRepair.getKey(), resourceToRepair.getValue()); + } + + for (URI profileDefinition : brokenProfiles) { + + // Already known mapping + if (profileUrisToReplace.containsKey(profileDefinition.trimFragment().trimQuery())) { + continue; + } + findMatch(profileDefinition); + } + } finally { + unloadResourceSet(); + brokenUris.clear(); + brokenProfiles.clear(); + } + } + + protected void findMatch(URI resourceURI, Set<String> fragments) { + URIMapping mapping = null; + + for (String fragment : fragments) { + URI eObjectURI = resourceURI.appendFragment(fragment); + mapping = findExistingMapping(eObjectURI, localResourceSet); + + if (mapping != null) { + break; + } + } + + if (mapping == null) { + mapping = RSAToPapyrusParametersFactory.eINSTANCE.createURIMapping(); + mapping.setSourceURI(resourceURI.toString()); + mapping.setTargetURI(mapping.getSourceURI()); + } + + config.getMappingParameters().getUriMappings().add(mapping); + } + + protected void findMatch(URI profileDefinitionURI) { + URIMapping match = findExistingProfileMapping(profileDefinitionURI, localResourceSet); + + if (match == null) { + match = RSAToPapyrusParametersFactory.eINSTANCE.createURIMapping(); + match.setSourceURI(profileDefinitionURI.trimFragment().trimQuery().toString()); + match.setTargetURI(match.getSourceURI()); + } + + config.getMappingParameters().getProfileUriMappings().add(match); + } + + protected void doComputeURIMappings(Resource sourceModel) { + doComputeProfileURIMappings(sourceModel); + + TreeIterator<EObject> resourceContents = sourceModel.getAllContents(); + ResourceSet resourceSet = sourceModel.getResourceSet(); + + while (resourceContents.hasNext()) { + EObject next = resourceContents.next(); + for (EReference reference : next.eClass().getEAllReferences()) { + if (reference.isContainer() || reference.isContainment() || reference.isDerived() || reference.isTransient()) { + continue; + } + + Object value = next.eGet(reference); + if (value instanceof EObject) { + handleURIMapping((EObject) value, resourceSet); + } else if (value instanceof Collection<?>) { + for (Object element : (Collection<?>) value) { + if (element instanceof EObject) { + handleURIMapping((EObject) element, resourceSet); + } + } + } + } + } + } + + protected void doComputeProfileURIMappings(Resource sourceModel) { + ResourceSet resourceSet = sourceModel.getResourceSet(); + + for (EObject rootObject : sourceModel.getContents()) { + if (isInvalidStereotypeApplication(rootObject)) { + handleProfileURIMapping(rootObject, resourceSet); + } + } + } + + protected boolean isInvalidStereotypeApplication(EObject eObject) { + if (eObject instanceof Element) { + return false; + } + + // The package is not resolved: probably a missing profile + if (eObject instanceof AnyType) { + return true; + } + + // If the package is resolved but is contained in an EPX resource, it needs to be mapped to the Papyrus equivalent + EPackage ePackage = eObject.eClass().getEPackage(); + if ("epx".equals(ePackage.eResource().getURI().fileExtension())) { + return true; + } + + return false; + } + + protected boolean isRSAModelElement(EObject eObject) { + return isRSAModelElement(EcoreUtil.getURI(eObject)); + } + + protected boolean isRSAModelElement(URI objectURI) { + String fileExtension = objectURI.fileExtension(); + return rsaExtensions.contains(fileExtension) || rsaProfileExtension.equals(fileExtension); + } + + protected synchronized Set<String> getFragments(URI resourceURI) { + if (!brokenUris.containsKey(resourceURI)) { + brokenUris.put(resourceURI, new HashSet<String>()); + } + + return brokenUris.get(resourceURI); + } + + protected synchronized void handleBrokenReference(EObject proxy) { + URI proxyURI = EcoreUtil.getURI(proxy); + URI resourceURI = proxyURI.trimFragment().trimQuery(); + + String fragment = proxyURI.fragment(); + Set<String> fragments = getFragments(resourceURI); + fragments.add(fragment); + } + + protected synchronized void addBrokenProfileDefinition(URI packageURI) { + brokenProfiles.add(packageURI); + } + + + protected void handleProfileURIMapping(EObject stereotypeApplication, ResourceSet resourceSet) { + + EPackage profileDefinition = stereotypeApplication.eClass().getEPackage(); + URI packageURI = EcoreUtil.getURI(profileDefinition); + if (packageURI.trimFragment().isEmpty()) { + packageURI = URI.createURI(profileDefinition.getNsURI()); + } + addBrokenProfileDefinition(packageURI); + + } + + protected void handleURIMapping(EObject eObject, ResourceSet resourceSet) { + + if (isRSAModelElement(eObject)) { + handleBrokenReference(eObject); + return; + } + + if (eObject.eIsProxy()) { + eObject = EcoreUtil.resolve(eObject, resourceSet); + if (eObject.eIsProxy()) { + handleBrokenReference(eObject); + return; + } + } + + } + + protected URIMapping findExistingProfileMapping(URI profileDefinitionURI, ResourceSet resourceSet) { + + String fileExtension = profileDefinitionURI.fileExtension(); + + URIMapping mapping = RSAToPapyrusParametersFactory.eINSTANCE.createURIMapping(); + URI sourceURI = profileDefinitionURI.trimFragment().trimQuery(); + mapping.setSourceURI(sourceURI.toString()); + + URI targetURI = null; + + if ("epx".equals(fileExtension)) { + targetURI = sourceURI.trimFileExtension().appendFileExtension("profile").appendFileExtension("uml"); + try { + Resource resource = resourceSet.getResource(targetURI, true); + if (resource != null && !resource.getContents().isEmpty()) { + mapping.setTargetURI(targetURI.toString()); + return mapping; + } + } catch (Exception ex) { + // Ignore: we can't find the target resource + } + } + + return findExistingMapping(profileDefinitionURI, resourceSet); + } + + protected URIMapping findExistingMapping(URI proxyURI, ResourceSet resourceSet) { + String fileExtension = proxyURI.fileExtension(); + + URIMapping mapping = RSAToPapyrusParametersFactory.eINSTANCE.createURIMapping(); + mapping.setSourceURI(proxyURI.trimFragment().trimQuery().toString()); + + URI targetURI = null; + // Maybe the element has been migrated locally + if (rsaExtensions.contains(fileExtension)) { + targetURI = proxyURI.trimFileExtension().appendFileExtension("uml"); + } else if (rsaProfileExtension.equals(fileExtension)) { + targetURI = proxyURI.trimFileExtension().appendFileExtension("profile.uml"); + } + + if (targetURI != null) { + try { + EObject targetElement = resourceSet.getEObject(targetURI, true); + if (targetElement != null) { + + targetURI = EcoreUtil.getURI(targetElement); + + mapping.setTargetURI(targetURI.trimFragment().trimQuery().toString()); + + return mapping; + } + } catch (Exception ex) { + // Ignore: we can't find a target element for the given proxy + } + } + + + if (!isRSAModelElement(proxyURI)) { + // Maybe the resource exists, but doesn't contain this specific element + URI resourceURI = proxyURI.trimFragment().trimQuery(); + try { + Resource resource = resourceSet.getResource(resourceURI, true); + if (resource != null && !resource.getContents().isEmpty()) { + + mapping.setTargetURI(resourceURI.toString()); + + return mapping; + } + } catch (Exception ex) { + // Ignore: we can't find the target resource + } + } + + // If the URI fragment is a path, don't explore registered libraries/profiles: almost all libraries will + // have a matching element, although there is no specific correspondence + if (isPathFragment(proxyURI)) { + return null; + } + + // Otherwise, we have an ID fragment + + // Maybe the resource has already been migrated, then deployed as a static library. Browse all registered libraries and try to find a matching XMI ID + for (IRegisteredLibrary library : RegisteredLibrary.getRegisteredLibraries()) { + URI libraryURI = library.getUri(); + try { + Resource libraryResource = localResourceSet.getResource(libraryURI, true); + if (libraryResource != null) { + EObject resolvedElement = libraryResource.getEObject(proxyURI.fragment()); + if (resolvedElement != null && !resolvedElement.eIsProxy()) { + mapping.setTargetURI(libraryURI.toString()); + + return mapping; + } + } + } catch (Exception ex) { + // Ignore + } + } + + // Maybe the object is a Profile, so let's browse registered profiles as well + for (IRegisteredProfile profile : RegisteredProfile.getRegisteredProfiles()) { + URI profileURI = profile.getUri(); + try { + Resource profileResource = localResourceSet.getResource(profileURI, true); + if (profileResource != null) { + EObject resolvedElement = profileResource.getEObject(proxyURI.fragment()); + if (resolvedElement != null && !resolvedElement.eIsProxy()) { + mapping.setTargetURI(profileURI.toString()); + + return mapping; + } + } + } catch (Exception ex) { + // Ignore + } + } + + return null; + } + + protected boolean isPathFragment(URI proxyURI) { + String uriFragment = proxyURI.fragment(); + + return uriFragment != null && uriFragment.charAt(0) == '/'; + } + + protected URIMapping findExistingMapping(EObject proxy, ResourceSet resourceSet) { + URI proxyURI = EcoreUtil.getURI(proxy); + return findExistingMapping(proxyURI, resourceSet); + } +} diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java index e23e93e1a09..b0c1f46b6ff 100644 --- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java +++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformation.java @@ -120,9 +120,15 @@ public class ImportTransformation { /** Execution time, in nano-seconds */ protected long executionTime = 0L; - /** Execution time of the initial model loading */ + /** Execution time of the initial model loading / ns */ protected long loadingTime = 0L; + /** Execution time for handling dangling references / ns */ + protected long danglingRefTime = 0L; + + /** Execution time for executing the UML-RT transformation / ns */ + protected long importRTTime = 0L; + /** Source URI to Target URI map (For Models/Libraries/Fragments) */ protected final Map<URI, URI> uriMappings = new HashMap<URI, URI>(); @@ -136,6 +142,7 @@ public class ImportTransformation { /** EPackages corresponding to source native profiles with specific support in the transformation */ protected static final Set<EPackage> sourceEPackages = new HashSet<EPackage>(); + protected final DependencyAnalysisHelper analysisHelper; static { sourceEPackages.add(org.eclipse.papyrus.migration.rsa.default_.DefaultPackage.eINSTANCE); @@ -144,13 +151,14 @@ public class ImportTransformation { } public ImportTransformation(URI sourceURI) { - this(sourceURI, RSAToPapyrusParametersFactory.eINSTANCE.createConfig()); + this(sourceURI, RSAToPapyrusParametersFactory.eINSTANCE.createConfig(), null); } - public ImportTransformation(URI sourceURI, Config config) { + public ImportTransformation(URI sourceURI, Config config, DependencyAnalysisHelper analysisHelper) { Assert.isNotNull(sourceURI); this.sourceURI = sourceURI; this.parameters = config; + this.analysisHelper = analysisHelper; } public void run() { @@ -239,6 +247,14 @@ public class ImportTransformation { return loadingTime; } + public long getHandleDanglingRefTime() { + return danglingRefTime; + } + + public long getImportRTTime() { + return importRTTime; + } + public Map<URI, URI> getURIMappings() { return uriMappings; } @@ -269,8 +285,6 @@ public class ImportTransformation { } catch (Exception ex) { Activator.log.error("An error occurred while loading " + getModelName(), ex); } - - monitor.subTask("Resolving all dependencies..."); } /** @@ -342,7 +356,7 @@ public class ImportTransformation { // Preloads all required transformations (Either locally or statically, depending on the cache parameter) protected IStatus loadTransformations(IProgressMonitor monitor) { for (URI transformationURI : getAllTransformationURIs()) { - IStatus status = executorsPool.preLoad(transformationURI); + executorsPool.preLoad(transformationURI); monitor.worked(1); } @@ -400,9 +414,10 @@ public class ImportTransformation { IStatus result; // Result of an individual transformation (Will be aggregated to the complete GenerationStatus) - // UML RT (First operation, because it can transform Collaborations to Classes, which has some consequences on the diagram transformation) - // TODO: Restore the UML RT transformation (Update to UML RT v3) + long startRT = System.nanoTime(); result = importRTProfile(context, monitor); + long endRT = System.nanoTime(); + this.importRTTime = endRT - startRT; generationStatus.add(result); // Diagrams @@ -535,7 +550,10 @@ public class ImportTransformation { monitor.subTask("Analyzing dangling references..."); + long startDangling = System.nanoTime(); handleDanglingURIs(resourcesToSave); + long endDangling = System.nanoTime(); + this.danglingRefTime = endDangling - startDangling; monitor.subTask("Saving models..."); @@ -562,8 +580,9 @@ public class ImportTransformation { } protected void handleDanglingURIs(Collection<Resource> resourcesToSave) { - ConfigHelper helper = new ConfigHelper(parameters); - helper.computeURIMappings(resourcesToSave); + if (analysisHelper != null) { + analysisHelper.computeURIMappings(resourcesToSave); + } } protected void unloadResourceSet(ResourceSet resourceSet) { diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformationLauncher.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformationLauncher.java index 6622c2c0535..5d42fd71ca8 100644 --- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformationLauncher.java +++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/ImportTransformationLauncher.java @@ -79,6 +79,9 @@ public class ImportTransformationLauncher { // Nano to Second
protected final static long SECOND = 1000 * 1000 * 1000;
+ // Nano to Milliseconds
+ protected final static long MILLIS = 1000 * 1000;
+
protected final Config config;
protected final Control baseControl;
@@ -95,6 +98,21 @@ public class ImportTransformationLauncher { protected long ownLoadingTime;
/**
+ * Own cumulated execution time for repairing stereotypes
+ */
+ protected long ownRepairStereotypesTime;
+
+ /**
+ * Own cumulated execution time for repairing libraries
+ */
+ protected long ownRepairLibrariesTime;
+
+ /**
+ * Own execution time for resolving all matches for broken profiles/libraries
+ */
+ protected long resolveAllDependencies;
+
+ /**
* The top-level job for this transformation
*/
protected Job importDependenciesJob;
@@ -105,6 +123,8 @@ public class ImportTransformationLauncher { */
protected long transformationsExecutionTime = 0L;
+ protected DependencyAnalysisHelper analysisHelper;
+
public ImportTransformationLauncher(Config config) {
this(config, null);
}
@@ -122,8 +142,10 @@ public class ImportTransformationLauncher { public void run(List<URI> urisToImport) {
List<ImportTransformation> transformations = new LinkedList<ImportTransformation>();
+ analysisHelper = new DependencyAnalysisHelper(config);
+
for (URI uri : urisToImport) {
- ImportTransformation transformation = new ImportTransformation(uri, config);
+ ImportTransformation transformation = new ImportTransformation(uri, config, analysisHelper);
transformations.add(transformation);
}
@@ -143,21 +165,57 @@ public class ImportTransformationLauncher { protected IStatus run(IProgressMonitor monitor) {
IStatus result = ImportTransformationLauncher.this.importModels(monitor, transformations);
- long totalLoadingTime = 0L;
+ if (monitor.isCanceled()) {
+ return new Status(IStatus.CANCEL, Activator.PLUGIN_ID, "Operation Canceled");
+ }
+
+ long cumulatedLoadingTime = 0L;
long cumulatedTransformationTime = 0L;
+ long cumulatedHandleDanglingTime = 0L;
+ long cumulatedImportRTTime = 0L;
for (ImportTransformation transformation : transformations) {
+ cumulatedLoadingTime += transformation.getLoadingTime();
+ cumulatedImportRTTime += transformation.getImportRTTime();
+ cumulatedHandleDanglingTime += transformation.getHandleDanglingRefTime();
+
cumulatedTransformationTime += transformation.getExecutionTime();
- totalLoadingTime += transformation.getLoadingTime();
+
+ log("Import " + transformation.getModelName());
+ log("First phase (0-50%):");
+ log("\tTotal loading time: " + timeFormat(transformation.getLoadingTime()));
+ log("\tTotal Import UML-RT time: " + timeFormat(transformation.getImportRTTime()));
+ log("\tTotal Handle Dangling References time: " + timeFormat(transformation.getHandleDanglingRefTime()));
+ log("\tTotal execution time: " + timeFormat(transformation.getExecutionTime()));
+
+ Long loadingTime = loadingTimeV2.get(transformation);
+ Long repairProxiesTime = proxiesTime.get(transformation);
+ Long repairStereoTime = stereoTime.get(transformation);
+ Long totalPhase2 = totalTimeV2.get(transformation);
+
+ log("Second phase (50-100%):");
+ log("\tTotal loading time: " + timeFormat(loadingTime));
+ log("\tTotal fix proxies time: " + timeFormat(repairProxiesTime));
+ log("\tTotal fix stereotypes time: " + timeFormat(repairStereoTime));
+ log("\tTotal execution time: " + timeFormat(totalPhase2));
+
+ log("Total");
+ log("\tTotal execution time: " + timeFormat(transformation.getExecutionTime() + totalPhase2));
+ log("\n");
}
int nbThreads = Math.max(1, config.getMaxThreads());
log("First phase (0-50%) / " + nbThreads + " Threads");
log("\tCumulated Transformation Time: " + timeFormat(cumulatedTransformationTime));
- log("\tCumulated Loading Time: " + timeFormat(totalLoadingTime));
+ log("\tCumulated Loading Time: " + timeFormat(cumulatedLoadingTime));
+ log("\tCumulated Handle Dangling Refs Time: " + timeFormat(cumulatedHandleDanglingTime));
+ log("\tCumulated Import RT Time: " + timeFormat(cumulatedImportRTTime));
log("\tTotal Transformation Time: " + timeFormat(transformationsExecutionTime));
log("Second phase (50-100%) / " + nbThreads + " Threads");
+ log("\tTotal Handle all Dangling References: " + timeFormat(resolveAllDependencies));
log("\tCumulated Loading Time: " + timeFormat(ownLoadingTime));
+ log("\tCumulated Fix Libraries Time: " + timeFormat(ownRepairLibrariesTime));
+ log("\tCumulated Fix Stereotypes Time: " + timeFormat(ownRepairStereotypesTime));
log("\tTotal Fix Dependencies Time: " + timeFormat(ownExecutionTime));
log("Total");
@@ -271,8 +329,15 @@ public class ImportTransformationLauncher { return rsaConsole;
}
- protected String timeFormat(long nano) {
+ protected String timeFormat(Long nano) {
+ if (nano == null) {
+ return "?"; // FIXME: crash?
+ }
long seconds = nano / SECOND;
+ if (seconds < 1) {
+ long millis = nano / MILLIS;
+ return String.format("%s ms", millis);
+ }
return String.format("%d:%02d:%02d", seconds / 3600, (seconds % 3600) / 60, (seconds % 60));
}
@@ -335,7 +400,11 @@ public class ImportTransformationLauncher { profileUrisToReplace.putAll(transformation.getProfileURIMappings());
}
- filterKnownMappings(config.getMappingParameters(), urisToReplace, profileUrisToReplace);
+ monitor.subTask("Analysing unresolved references...");
+ long startResolveAll = System.nanoTime();
+ analysisHelper.resolveAllMappings(urisToReplace, profileUrisToReplace);
+ long endResolveAll = System.nanoTime();
+ resolveAllDependencies = endResolveAll - startResolveAll;
if (!config.getMappingParameters().getUriMappings().isEmpty() || !config.getMappingParameters().getProfileUriMappings().isEmpty()) {
@@ -358,7 +427,12 @@ public class ImportTransformationLauncher { Job transformationJob = new Job("Importing dependencies for " + transformation.getModelName()) {
@Override
protected IStatus run(IProgressMonitor monitor) {
+ long startFix = System.nanoTime();
fixDependencies(transformation, monitor, urisToReplace, profileUrisToReplace);
+ long endFix = System.nanoTime();
+ synchronized (ImportTransformationLauncher.this) {
+ totalTimeV2.put(transformation, endFix - startFix);
+ }
return Status.OK_STATUS;
}
@@ -375,6 +449,14 @@ public class ImportTransformationLauncher { ownExecutionTime = end - begin - timeToIgnore;
}
+ final protected Map<ImportTransformation, Long> loadingTimeV2 = new HashMap<ImportTransformation, Long>();
+
+ final protected Map<ImportTransformation, Long> proxiesTime = new HashMap<ImportTransformation, Long>();
+
+ final protected Map<ImportTransformation, Long> stereoTime = new HashMap<ImportTransformation, Long>();
+
+ final protected Map<ImportTransformation, Long> totalTimeV2 = new HashMap<ImportTransformation, Long>();
+
protected IStatus fixDependencies(ImportTransformation transformation, IProgressMonitor monitor, Map<URI, URI> urisToReplace, Map<URI, URI> profileUrisToReplace) {
monitor.subTask("Importing dependencies for " + transformation.getModelName());
final ModelSet modelSet = new DiResourceSet();
@@ -394,6 +476,7 @@ public class ImportTransformationLauncher { long endLoading = System.nanoTime();
synchronized (ImportTransformationLauncher.this) {
ownLoadingTime += endLoading - startLoading;
+ loadingTimeV2.put(transformation, endLoading - startLoading);
}
} catch (ModelMultiException e) {
Activator.log.error(e);
@@ -402,7 +485,13 @@ public class ImportTransformationLauncher { }
try {
+ long startProxies = System.nanoTime();
repairProxies(modelSet, resourcesToRepair, urisToReplace, monitor); // Repairing proxies first will change the Applied Profiles. This helps repairing stereotypes
+ long endProxies = System.nanoTime();
+ synchronized (ImportTransformationLauncher.this) {
+ ownRepairLibrariesTime += endProxies - startProxies;
+ proxiesTime.put(transformation, endProxies - startProxies);
+ }
} catch (Exception ex) {
Activator.log.error(ex);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "An exception occurred when repairing library dependencies", ex);
@@ -410,7 +499,13 @@ public class ImportTransformationLauncher { RepairStereotypes repairStereotypesAction = new RepairStereotypes(modelSet, resourcesToRepair, profileUrisToReplace);
try {
+ long startStereotypes = System.nanoTime();
repairStereotypesAction.execute();
+ long endStereotypes = System.nanoTime();
+ synchronized (ImportTransformationLauncher.this) {
+ ownRepairStereotypesTime += endStereotypes - startStereotypes;
+ stereoTime.put(transformation, endStereotypes - startStereotypes);
+ }
} catch (Exception ex) {
Activator.log.error(ex);
return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "An exception occurred when repairing profiles/stereotypes", ex);
@@ -552,39 +647,6 @@ public class ImportTransformationLauncher { }
}
- /**
- * Remove automatic mappings (When multiple files are imported simultaneously) and duplicates
- *
- * @param mappingParameters
- * All unresolved proxies
- * @param currentMappings
- * The map of known (automatic) mappings
- */
- protected void filterKnownMappings(final MappingParameters mappingParameters, final Map<URI, URI> currentMappings, final Map<URI, URI> currentProfileMappings) {
- filterKnownMappings(mappingParameters.getUriMappings(), currentMappings);
- filterKnownMappings(mappingParameters.getProfileUriMappings(), currentProfileMappings);
- }
-
- protected void filterKnownMappings(List<URIMapping> allMappings, Map<URI, URI> knownMappings) {
-
- Set<URI> userMappings = new HashSet<URI>();
-
- Iterator<URIMapping> mappings = allMappings.iterator();
- while (mappings.hasNext()) {
- URIMapping mapping = mappings.next();
- if (mapping == null) {
- continue;
- }
- URI sourceURI = URI.createURI(mapping.getSourceURI());
- if (knownMappings.containsKey(sourceURI) || userMappings.contains(sourceURI)) {
- mappings.remove();
- } else {
- userMappings.add(sourceURI);
- }
- }
-
- }
-
protected MappingParameters confirmURIMappings(final MappingParameters mappingParameters) {
if (config.isAlwaysAcceptSuggestedMappings()) {
return mappingParameters;
diff --git a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/RepairStereotypes.java b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/RepairStereotypes.java index ca28961f1f6..0d9f524b785 100644 --- a/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/RepairStereotypes.java +++ b/extraplugins/migration/org.eclipse.papyrus.migration.rsa/src/org/eclipse/papyrus/migration/rsa/transformation/RepairStereotypes.java @@ -1,5 +1,5 @@ /***************************************************************************** - * Copyright (c) 2014 CEA LIST. + * Copyright (c) 2014, 2015 CEA LIST, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation + * Christian W. Damus - bug 436666 *****************************************************************************/ package org.eclipse.papyrus.migration.rsa.transformation; @@ -17,6 +18,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.TreeIterator; @@ -148,7 +150,7 @@ public class RepairStereotypes { try { final BasicDiagnostic diagnostics = new BasicDiagnostic(Activator.PLUGIN_ID, 0, "Problems in repairing stereotypes", null); - for (EPackage packageToRepair : descriptor.getZombiePackages()) { + for (IAdaptable packageToRepair : descriptor.getZombieSchemas()) { IRepairAction action = descriptor.getRepairAction(packageToRepair, IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION); descriptor.repair(packageToRepair, action, diagnostics, new NullProgressMonitor()); } diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java index fa1a571dee0..dd9c392c172 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common/src/org/eclipse/papyrus/infra/gmfdiag/common/editpolicies/XYLayoutWithConstrainedResizedEditPolicy.java @@ -26,6 +26,7 @@ import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.NodeEditPart;
import org.eclipse.gef.SnapToHelper;
import org.eclipse.gef.commands.Command;
@@ -46,6 +47,7 @@ import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalC import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.gmfdiag.common.Activator;
import org.eclipse.papyrus.infra.gmfdiag.common.commands.FixEdgeAnchorsDeferredCommand;
+import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart;
import org.eclipse.papyrus.infra.gmfdiag.common.helper.FixAnchorHelper;
import org.eclipse.papyrus.infra.gmfdiag.common.utils.ServiceUtilsForEditPart;
@@ -59,6 +61,19 @@ public class XYLayoutWithConstrainedResizedEditPolicy extends XYLayoutEditPolicy private FixAnchorHelper helper = null;
/**
+ * Overrided {@link org.eclipse.gef.editpolicies.XYLayoutEditPolicy}#getCurrentConstraintFor()
+ * to the fixing NPE of parent.getLayoutManager().getConstraint(fig) row
+ * parent.getLayoutManager() can be null for edges
+ */
+ @Override
+ protected Rectangle getCurrentConstraintFor(GraphicalEditPart child) {
+ if (child instanceof ConnectionEditPart && child.getParent() instanceof DiagramRootEditPart) {
+ return null;
+ }
+ return super.getCurrentConstraintFor(child);
+ }
+
+ /**
* Called in response to a <tt>REQ_CREATE</tt> request. Returns a command
* to set each created element bounds and auto-size properties.
*
diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/.classpath b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/.classpath new file mode 100644 index 00000000000..ad32c83a788 --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/.project b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/.project new file mode 100644 index 00000000000..9ba40382a6e --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.papyrus.sysml14.diagram.blockdefinition</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/.settings/org.eclipse.jdt.core.prefs b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..c537b63063c --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/META-INF/MANIFEST.MF b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..d1f1366b7ec --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: BDD1.4 Configuration for Papyrus +Bundle-SymbolicName: org.eclipse.papyrus.sysml14.diagram.blockdefinition;singleton:=true +Bundle-Version: 1.1.0.qualifier +Bundle-Activator: org.eclipse.papyrus.sysml14.diagram.blockdefinition.Activator +Bundle-Vendor: Eclipse Modeling Project +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="1.1.0", + org.eclipse.papyrus.infra.newchild;bundle-version="1.1.0", + org.eclipse.papyrus.views.properties;bundle-version="1.1.0", + org.eclipse.uml2.uml, + org.eclipse.papyrus.infra.core;bundle-version="1.1.0", + org.eclipse.emf.ecore.editor, + org.eclipse.papyrus.infra.onefile;bundle-version="1.1.0", + com.google.guava;bundle-version="11.0.0", + org.eclipse.papyrus.infra.emf;bundle-version="1.1.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/about.html b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/about.html new file mode 100644 index 00000000000..d35d5aed64c --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 5, 2007</p> +<h3>License</h3> + +<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p> + +</body> +</html> diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/build.properties b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/build.properties new file mode 100644 index 00000000000..90aaca604a4 --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + about.html,\ + resources/ diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/plugin.xml b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/plugin.xml new file mode 100644 index 00000000000..180a79b9e47 --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/plugin.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + point="org.eclipse.papyrus.infra.viewpoints.policy.custom"> + <contribution + file="resources/configuration/BlockDefinitionDiagram.configuration" + original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration"> + </contribution> + </extension> +</plugin> diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/pom.xml b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/pom.xml new file mode 100644 index 00000000000..8e804a3891c --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/pom.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>org.eclipse.papyrus</artifactId> + <groupId>org.eclipse.papyrus</groupId> + <version>1.1.0-SNAPSHOT</version> + <relativePath>../../../releng/top-pom-extras.xml</relativePath> + </parent> + <groupId>org.eclipse.papyrus</groupId> + <artifactId>org.eclipse.papyrus.sysml14.diagram.blockdefinition</artifactId> + <version>1.1.0-SNAPSHOT</version> + <packaging>eclipse-plugin</packaging> +</project>
\ No newline at end of file diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/configuration/BlockDefinitionDiagram.configuration b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/configuration/BlockDefinitionDiagram.configuration new file mode 100644 index 00000000000..bd17be795b1 --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/configuration/BlockDefinitionDiagram.configuration @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<configuration:PapyrusConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:configuration="http://www.eclipse.org/papyrus/infra/viewpoints/configuration" xmi:id="_ko07IErbEeSdQKzSRatBjg"> + <viewpoints xsi:type="configuration:PapyrusViewpoint" xmi:id="_xogdoErbEeSdQKzSRatBjg" name="Default Papyrus Viewpoint"> + <modelKinds xsi:type="configuration:PapyrusDiagram" xmi:id="_ZrBf4JaBEeS8eNvSwD0lgA" name="Sysml 1.4" icon="platform:/plugin/org.eclipse.papyrus.sysml.diagram.blockdefinition/icons/obj16/Diagram_BlockDefinition.gif" implementationID="PapyrusUMLClassDiagram" customPalette="platform:/plugin/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/palette/sysmlBlockDiagram.palette"> + <profiles href="http://www.eclipse.org/papyrus/0.7.0/SysML#//blocks"/> + <profiles href="http://www.eclipse.org/papyrus/0.7.0/SysML#//portandflows"/> + <modelRules xmi:id="_ZrBf4ZaBEeS8eNvSwD0lgA"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </modelRules> + <owningRules xmi:id="_ZrBf45aBEeS8eNvSwD0lgA"> + <element href="http://www.eclipse.org/uml2/5.0.0/UML#//Package"/> + </owningRules> + <categories href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wNb49xhEeOqHvRyiN87hA"/> + <childRules xmi:id="_ZrBf5ZaBEeS8eNvSwD0lgA"/> + <paletteRules xmi:id="_N4GzIKFQEeSx6MYdei1rKA" permit="false" element="clazz.group.*"/> + </modelKinds> + </viewpoints> + <defaultStakeholder href="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration#_7wLmkdxhEeOqHvRyiN87hA"/> + <metamodel href="http://www.eclipse.org/uml2/5.0.0/UML#/"/> +</configuration:PapyrusConfiguration> diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/palette/sysmlBlockDiagram.palette b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/palette/sysmlBlockDiagram.palette new file mode 100644 index 00000000000..22536f400a8 --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/resources/palette/sysmlBlockDiagram.palette @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + Copyright (c) 2015 CEA. + + All rights reserved. This program and the accompanying materials + are made available under the terms of the Eclipse Public License v1.0 + which accompanies this distribution, and is available at + http://www.eclipse.org/legal/epl-v10.html + + Contributors: + CEA - Initial API and implementation + Benoit Maggi benoit.maggi@cea.fr + +--> +<paletteDefinition> + <content> + <!-- ASSOCIATIONS --> + + <drawer id="org.eclipse.papyrus.sysml.diagram.blockdefinition.SYSML_BlockDefinition__Associations" + iconpath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif" name="Associations"> + + <aspectTool description="Create a new Association" id="blockdefinition_associations.tool.association_none" name="Association" refToolId="clazz.tool.association"/> + <aspectTool description="Create a new DirectedAssociation" id="blockdefinition_associations.tool.association_none_directed" + iconpath="platform:/plugin/org.eclipse.papyrus.uml.service.types/icons/Association_none_directed.gif" + name="DirectedAssociation" refToolId="clazz.tool.association"> + </aspectTool> + + <aspectTool description="Create a new Composition" id="blockdefinition_associations.tool.association_composite" + iconpath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_composite.gif" + name="Composition" refToolId="clazz.tool.association"> + </aspectTool> + + <aspectTool description="Create a new DirectedComposition" id="blockdefinition_associations.tool.association_composite_directed" + iconpath="platform:/plugin/org.eclipse.papyrus.uml.service.types/icons/Association_composite_directed.gif" + name="DirectedComposition" refToolId="clazz.tool.association"> + </aspectTool> + + <aspectTool description="Create a new Aggregation" id="blockdefinition_associations.tool.association_shared" + iconpath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/Association_shared.gif" + name="Aggregation" refToolId="clazz.tool.association"> + </aspectTool> + + <aspectTool description="Create a new DirectedAggregation" id="blockdefinition_associations.tool.association_shared_directed" + iconpath="platform:/plugin/org.eclipse.papyrus.uml.service.types/icons/Association_shared_directed.gif" + name="DirectedAggregation" refToolId="clazz.tool.association"> + </aspectTool> + </drawer> + + <!-- MODEL ELEMENTS --> + <drawer id="org.eclipse.papyrus.sysml.diagram.blockdefinition.SYSML_BlockDefinition__ModelElements" + iconpath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif" name="ModelElements"> + + <aspectTool description="Create a new Package" id="blockdefinition_modelelements.tool.package" name="Package" refToolId="clazz.tool.package"/> + <aspectTool description="Create a new Actor" id="blockdefinition_modelelements.tool.actor" + name="Actor" refToolId="usecase.tool.actor"> + </aspectTool> + <aspectTool description="Create a new Block" id="blockdefinition_modelelements.tool.block" + name="Block" refToolId="clazz.tool.class"> + <postAction id="org.eclipse.papyrus.applystereotypeactionprovider"> + <stereotypesToApply> + <stereotype stereotypeName="SysML::Blocks::Block" /> + </stereotypesToApply> + </postAction> + </aspectTool> + + <aspectTool description="Create a new Signal" id="blockdefinition_modelelements.tool.signal" name="Signal" refToolId="clazz.tool.signal"/> + <aspectTool description="Create a new Operation" id="blockdefinition_modelelements.tool.operation" name="Operation" refToolId="clazz.tool.operation"/> + <aspectTool description="Create a new Reception" id="blockdefinition_modelelements.tool.reception" name="Reception" refToolId="clazz.tool.reception"/> + <aspectTool description="Create a new Property" id="blockdefinition_modelelements.tool.property" name="Property" refToolId="clazz.tool.property"/> + + <!-- + <aspectTool description="Create a new Part" id="blockdefinition_modelelements.tool.part" + name="Part" refToolId="blockdefinition.tool.part"> + </aspectTool> + <aspectTool description="Create a new Reference" id="blockdefinition_modelelements.tool.reference" + name="Reference" refToolId="blockdefinition.tool.reference"> + </aspectTool> + <aspectTool description="Create a new ActorPart" id="blockdefinition_modelelements.tool.actorpart" + name="ActorPart" refToolId="blockdefinition.tool.actorpart"> + </aspectTool> + <aspectTool description="Create a new Value" id="blockdefinition_modelelements.tool.value" + name="Value" refToolId="blockdefinition.tool.value"> + </aspectTool> + --> + <aspectTool description="Create a new InstanceSpecification" id="blockdefinition_modelelements.tool.instancespecification" name="InstanceSpecification" refToolId="clazz.tool.instancespecification"/> + <aspectTool description="Create a new Slot" id="blockdefinition_modelelements.tool.slot" name="Slot" refToolId="clazz.tool.slot"/> + <aspectTool description="Create a new Dependency" id="blockdefinition_modelelements.tool.dependency" name="Dependency" refToolId="clazz.tool.dependency"/> + <aspectTool description="Create a new Generalization" id="blockdefinition_modelelements.tool.generalization" name="Generalization" refToolId="clazz.tool.generalization"/> + + </drawer> + + <drawer id="org.eclipse.papyrus.sysml.diagram.blockdefinition.SYSML_BlockDefinition__PortAndFlowTools" + iconpath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif" name="PortAndFlows"> + <!-- + <aspectTool description="Create a new Port" id="blockdefinition_portandflows.tool.port" + name="Port" refToolId="blockdefinition.tool.port"> + </aspectTool> + <aspectTool description="Create a new FlowPort" id="blockdefinition_portandflows.tool.flowport" + name="FlowPort" refToolId="blockdefinition.tool.flowport"> + </aspectTool> + <aspectTool description="Create a new FlowSpecification" id="blockdefinition_portandflows.tool.flowspecification" + name="FlowSpecification" refToolId="blockdefinition.tool.flowspecification"> + </aspectTool> + <aspectTool description="Create a new FlowProperty" id="blockdefinition_portandflows.tool.flowproperty" + name="FlowProperty" refToolId="blockdefinition.tool.flowproperty"> + </aspectTool> + <aspectTool description="Create a new Interface" id="blockdefinition_portandflows.tool.interface" + name="Interface" refToolId="blockdefinition.tool.interface"> + </aspectTool> + <aspectTool description="Create a new InterfaceRealization" id="blockdefinition_portandflows.tool.interfacerealization" + name="InterfaceRealization" refToolId="blockdefinition.tool.interfacerealization"> + </aspectTool> + <aspectTool description="Create a new Usage" id="blockdefinition_portandflows.tool.usage" name="Usage" refToolId="blockdefinition.tool.usage"> + </aspectTool> + --> + </drawer> + + <drawer id="org.eclipse.papyrus.sysml.diagram.blockdefinition.SYSML_BlockDefinition__DataTypeTools" + iconpath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif" name="DataTypes"> + + <aspectTool description="Create a new DataType" id="blockdefinition_datatypes.tool.datatype" name="DataType" refToolId="clazz.tool.datatype"/> + <!-- + <aspectTool description="Create a new ValueType" id="blockdefinition_datatypes.tool.valuetype" + name="ValueType" refToolId="blockdefinition.tool.valuetype"> + </aspectTool> + --> + <aspectTool description="Create a new PrimitiveType" id="blockdefinition_datatypes.tool.primitivetype" name="PrimitiveType" refToolId="clazz.tool.primitivetype"/> + <aspectTool description="Create a new Enumeration" id="blockdefinition_datatypes.tool.enumeration" name="Enumeration" refToolId="clazz.tool.enumeration"/> + <aspectTool description="Create a new EnumerationLiteral" id="blockdefinition_datatypes.tool.enumerationliteral" name="EnumerationLiteral" refToolId="clazz.tool.enumerationliteral"/> + <!-- + <aspectTool description="Create a new Dimension" id="blockdefinition_datatypes.tool.dimension" + name="Dimension" refToolId="blockdefinition.tool.dimension"> + </aspectTool> + <aspectTool description="Create a new Unit" id="blockdefinition_datatypes.tool.unit" + name="Unit" refToolId="blockdefinition.tool.unit"> + </aspectTool> + --> + </drawer> + + <drawer id="org.eclipse.papyrus.sysml.diagram.blockdefinition.SYSML_BlockDefinition__ContraintTools" + iconpath="platform:/plugin/org.eclipse.gmf.runtime.diagram.ui/icons/group.gif" name="CommentAndConstraints"> + + <aspectTool description="Create a new ConstraintBlock" id="blockdefinition_constraints.tool.constraintblock" + name="ConstraintBlock" refToolId="clazz.tool.class"> + <postAction id="org.eclipse.papyrus.applystereotypeactionprovider"> + <stereotypesToApply> + <stereotype stereotypeName="SysML::Constraints::ConstraintBlock" /> + </stereotypesToApply> + </postAction> + </aspectTool> + + <aspectTool description="Create a new ConstraintProperty" id="blockdefinition_constraints.tool.constraintproperty" + name="ConstraintProperty" refToolId="clazz.tool.property"> + <postAction id="org.eclipse.papyrus.applystereotypeactionprovider"> + <stereotypesToApply> + <stereotype stereotypeName="SysML::Constraints::ConstraintProperty" /> + </stereotypesToApply> + </postAction> + </aspectTool> + <aspectTool description="Create a new Parameter (Property)" id="blockdefinition_constraints.tool.property" name="Parameter" refToolId="clazz.tool.property"/> + <aspectTool description="Create a new Constraint" id="blockdefinition_constraints.tool.constraint" name="Constraint" refToolId="clazz.tool.constraint"/> + <aspectTool description="Create a new Comment" id="blockdefinition_constraints.tool.comment" name="Comment" refToolId="clazz.tool.comment"/> + <aspectTool description="Create a new Comment / Constraint link" id="blockdefinition_constraints.tool.comment_constraint_link" name="Comment / Constraint link" refToolId="clazz.tool.contextlink"/> + </drawer> + </content> +</paletteDefinition>
\ No newline at end of file diff --git a/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/src/org/eclipse/papyrus/sysml14/diagram/blockdefinition/Activator.java b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/src/org/eclipse/papyrus/sysml14/diagram/blockdefinition/Activator.java new file mode 100644 index 00000000000..0062e596f9d --- /dev/null +++ b/plugins/sysml/sysml14/org.eclipse.papyrus.sysml14.diagram.blockdefinition/src/org/eclipse/papyrus/sysml14/diagram/blockdefinition/Activator.java @@ -0,0 +1,73 @@ +/***************************************************************************** + * Copyright (c) 2015 CEA LIST. + * + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Benoit Maggi benoit.maggi@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.sysml14.diagram.blockdefinition; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.papyrus.sysml14.diagram.blockdefinition"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/messages.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/messages.properties index 720a105b0f8..4dd9ecc72cc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/messages.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/messages.properties @@ -520,3 +520,5 @@ OpaqueAction1CreationTool_title=Opaque Action OpaqueAction1CreationTool_desc=Create an Opaque Action node ValueSpecificationAction2CreationTool_title=Value Specification Action ValueSpecificationAction2CreationTool_desc=Create a Value Specification Action node +StartObjectBehaviourAction6CreationTool_title=Start Object Behaviour Action +StartObjectBehaviourAction6CreationTool_desc=Create a Start Object Behaviour Action diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen index 31127e4cc38..e96de0dd269 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/model/activityDiagram.gmfgen @@ -9793,6 +9793,742 @@ </modelFacet> </labels> </childNodes> + <childNodes + visualID="3113" + editPartClassName="StartObjectBehavoiurActionEditPart" + itemSemanticEditPolicyClassName="StartObjectBehavoiurActionItemSemanticEditPolicy" + canonicalEditPolicyClassName="StartObjectBehavoiurActionCanonicalEditPolicy" + childNodes="/0/@diagram/@childNodes.95 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.101" + graphicalNodeEditPolicyClassName="StartObjectBehavoiurActionGraphicalNodeEditPolicy" + createCommandClassName="StartObjectBehavoiurActionCreateCommand" + containers="/0/@diagram/@compartments.14 /0/@diagram/@compartments.3 /0/@diagram/@compartments.5 /0/@diagram/@compartments.6 /0/@diagram/@compartments.7 /0/@diagram/@compartments.8 /0/@diagram/@compartments.9 /0/@diagram/@compartments.10"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType" + displayName="StartObjectBehaviourAction"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.182/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusRoundedNodeFigure"/> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_CREATE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.CreateActionLocalConditionEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.DeleteActionViewEditPolicy"/> + <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="org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityDiagramChangeStereotypedShapeEditpolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomDiagramDragDropEditPolicy"/> + <modelFacet> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StartObjectBehaviorAction"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Activity/ownedNode"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/Activity/ownedNode"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + visualID="5191" + editPartClassName="StartObjectBehaviorActionNameEditPart" + itemSemanticEditPolicyClassName="StartObjectBehaviorActionNameItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:ParentAssignedViewmap" + getterName="getNameLabel" + figureQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.figure.node.PapyrusWrappingLabel"/> + <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="5394" + editPartClassName="StartObjectBehaviorActionFloatingNameEditPart" + itemSemanticEditPolicyClassName="StartObjectBehaviorActionFloatingNameItemSemanticEditPolicy"> + <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"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.ExternalLabelPrimaryDragRoleEditPolicy"/> + <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 + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3125" + editPartClassName="OutputPinInStartObjectBehaviorActionEditPart" + itemSemanticEditPolicyClassName="OutputPinInStartObjectBehaviorActionItemSemanticEditPolicy" + canonicalEditPolicyClassName="OutputPinInStartObjectBehaviorActionCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="OutputPinInStartObjectBehaviorActionGraphicalNodeEditPolicy" + createCommandClassName="OutputPinInStartObjectBehaviorActionCreateCommand" + containers="/0/@diagram/@childNodes.94" + preferredSideName="EAST"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.76/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.OutputPinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/OutputPin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/CallAction/result"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/CallAction/result"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5203" + editPartClassName="OutputPinInStartObjectBehaviorActionLabelEditPart" + itemSemanticEditPolicyClassName="OutputPinInStartObjectBehaviorActionLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5204" + editPartClassName="OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <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.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3132" + editPartClassName="InputPinInStartObjectBehaviorActionAsObjectEditPart" + itemSemanticEditPolicyClassName="InputPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy" + canonicalEditPolicyClassName="InputPinInStartObjectBehaviorActionAsObjectCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="InputPinInStartObjectBehaviorActionAsObjectGraphicalNodeEditPolicy" + createCommandClassName="InputPinInStartObjectBehaviorActionAsObjectCreateCommand" + containers="/0/@diagram/@childNodes.94"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.75/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.88"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InputPin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StartObjectBehaviorAction/object"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StartObjectBehaviorAction/object"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5217" + editPartClassName="InputPinInStartObjectBehaviorActionAsObjectLabelEditPart" + itemSemanticEditPolicyClassName="InputPinInStartObjectBehaviorActionAsObjectLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5218" + editPartClassName="InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <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.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3145" + editPartClassName="ValuePinInStartObjectBehaviorActionAsObjectEditPart" + itemSemanticEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy" + canonicalEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsObjectCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsObjectGraphicalNodeEditPolicy" + createCommandClassName="ValuePinInStartObjectBehaviorActionAsObjectCreateCommand" + containers="/0/@diagram/@childNodes.94"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.191/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.90"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ValuePin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StartObjectBehaviorAction/object"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StartObjectBehaviorAction/object"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5245" + editPartClassName="ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart" + itemSemanticEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsObjectLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5246" + editPartClassName="ValuePinInStartObjectBehaviorActionAsObjectValueEditPart" + itemSemanticEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsObjectValueItemSemanticEditPolicy" + notationViewFactoryClassName="ValuePinLabelViewFactory"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.7"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5247" + editPartClassName="ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <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.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3158" + editPartClassName="ActionPinInStartObjectBehaviorActionAsObjectEditPart" + itemSemanticEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy" + canonicalEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsObjectCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsObjectGraphicalNodeEditPolicy" + createCommandClassName="ActionPinInStartObjectBehaviorActionAsObjectCreateCommand" + containers="/0/@diagram/@childNodes.94"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.91/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.92"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ActionInputPin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StartObjectBehaviorAction/object"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/StartObjectBehaviorAction/object"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5263" + editPartClassName="ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart" + itemSemanticEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsObjectLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5264" + editPartClassName="ActionPinInStartObjectBehaviorActionAsObjectValueEditPart" + itemSemanticEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsObjectValueItemSemanticEditPolicy" + notationViewFactoryClassName="ValuePinLabelViewFactory"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.7"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5265" + editPartClassName="ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <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.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3133" + editPartClassName="InputPinInStartObjectBehaviorActionAsArgumentEditPart" + itemSemanticEditPolicyClassName="InputPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy" + canonicalEditPolicyClassName="InputPinInStartObjectBehaviorActionAsArgumentCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="InputPinInStartObjectBehaviorActionAsArgumentGraphicalNodeEditPolicy" + createCommandClassName="InputPinInStartObjectBehaviorActionAsArgumentCreateCommand" + containers="/0/@diagram/@childNodes.94"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.75/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.87"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InputPin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InvocationAction/argument"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InvocationAction/argument"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5219" + editPartClassName="InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart" + itemSemanticEditPolicyClassName="InputPinInStartObjectBehaviorActionAsArgumentLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5220" + editPartClassName="InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <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.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.7"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3146" + editPartClassName="ValuePinInStartObjectBehaviorActionAsArgumentEditPart" + itemSemanticEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy" + canonicalEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsArgumentCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsArgumentGraphicalNodeEditPolicy" + createCommandClassName="ValuePinInStartObjectBehaviorActionAsArgumentCreateCommand" + containers="/0/@diagram/@childNodes.94"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.191/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.89"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ValuePin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InvocationAction/argument"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InvocationAction/argument"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5248" + editPartClassName="ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart" + itemSemanticEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsArgumentLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5249" + editPartClassName="ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart" + itemSemanticEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsArgumentValueItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.7"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5250" + editPartClassName="ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <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.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> + <childNodes + xsi:type="gmfgen:GenChildSideAffixedNode" + visualID="3159" + editPartClassName="ActionPinInStartObjectBehaviorActionAsArgumentEditPart" + itemSemanticEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy" + canonicalEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsArgumentCanonicalEditPolicy" + graphicalNodeEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsArgumentGraphicalNodeEditPolicy" + createCommandClassName="ActionPinInStartObjectBehaviorActionAsArgumentCreateCommand" + containers="/0/@diagram/@childNodes.94"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <elementType + xsi:type="gmfgen:SpecializationType"> + <metamodelType + href="../../org.eclipse.papyrus.uml.diagram.common/model/GenericUML.gmfgen#//@diagram/@topLevelNodes.91/@elementType"/> + </elementType> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure"> + <attributes + xsi:type="gmfgen:DefaultSizeAttributes" + width="16" + height="16"/> + </viewmap> + <behaviour + xsi:type="gmfgen:OpenDiagramBehaviour"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.EditPolicy.LAYOUT_ROLE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy"/> + <behaviour + xsi:type="gmfgen:CustomBehaviour" + key="org.eclipse.gef.RequestConstants.REQ_DELETE" + editPolicyQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy"/> + <modelFacet + modelElementSelector="/0/@expressionProviders/@providers.1/@expressions.91"> + <metaClass + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/ActionInputPin"/> + <containmentMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InvocationAction/argument"/> + <childMetaFeature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/InvocationAction/argument"/> + <modelElementInitializer + xsi:type="gmfgen:GenFeatureSeqInitializer"> + <initializers + xsi:type="gmfgen:GenFeatureValueSpec" + value="/0/@expressionProviders/@providers.0/@expressions.0"> + <feature + href="../../../plugin/org.eclipse.uml2.uml/model/UML.genmodel#//uml/NamedElement/name"/> + </initializers> + </modelElementInitializer> + </modelFacet> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5266" + editPartClassName="ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart" + itemSemanticEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsArgumentLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.6"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5267" + editPartClassName="ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart" + itemSemanticEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsArgumentValueItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel"/> + <modelFacet + parser="/0/@labelParsers/@implementations.7"/> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5268" + editPartClassName="ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart" + itemSemanticEditPolicyClassName="ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelItemSemanticEditPolicy"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure"/> + <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.AppliedStereotypeExternalNodeEditPolicy"/> + <modelFacet + parser="/0/@labelParsers/@implementations.1"/> + </labels> + </childNodes> <topLevelNodes visualID="2001" editPartClassName="ActivityEditPart" @@ -10490,7 +11226,7 @@ itemSemanticEditPolicyClassName="ActivityActivityContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="ActivityActivityContentCompartmentViewFactory" canonicalEditPolicyClassName="ActivityActivityContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.93" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94" title="ActivityFigureContentCompartment" canCollapse="false" needsTitle="false" @@ -10564,7 +11300,7 @@ itemSemanticEditPolicyClassName="ExpansionRegionStructuredActivityNodeContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="ExpansionRegionStructuredActivityNodeContentCompartmentViewFactory" canonicalEditPolicyClassName="ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94" title="StructuredActivityNodeContentCompartment" canCollapse="false" needsTitle="false" @@ -10599,7 +11335,7 @@ itemSemanticEditPolicyClassName="LoopNodeStructuredActivityNodeContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="LoopNodeStructuredActivityNodeContentCompartmentViewFactory" canonicalEditPolicyClassName="LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94" title="StructuredActivityNodeContentCompartment" canCollapse="false" needsTitle="false" @@ -10634,7 +11370,7 @@ itemSemanticEditPolicyClassName="SequenceNodeStructuredActivityNodeContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="SequenceNodeStructuredActivityNodeContentCompartmentViewFactory" canonicalEditPolicyClassName="SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94" title="StructuredActivityNodeContentCompartment" canCollapse="false" needsTitle="false" @@ -10669,7 +11405,7 @@ itemSemanticEditPolicyClassName="StructuredActivityNodeStructuredActivityNodeContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="StructuredActivityNodeStructuredActivityNodeContentCompartmentViewFactory" canonicalEditPolicyClassName="StructuredActivityNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94" title="StructuredActivityNodeContentCompartment" canCollapse="false" needsTitle="false" @@ -10704,7 +11440,7 @@ itemSemanticEditPolicyClassName="ActivityPartitionActivityPartitionContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="ActivityPartitionActivityPartitionContentCompartmentViewFactory" canonicalEditPolicyClassName="ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94" title="ActivityPartitionContentCompartment" canCollapse="false" needsTitle="false" @@ -10739,7 +11475,7 @@ itemSemanticEditPolicyClassName="InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentViewFactory" canonicalEditPolicyClassName="InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.93 /0/@diagram/@childNodes.94" title="InterruptibleActivityRegionContentCompartment" canCollapse="false" needsTitle="false" @@ -10859,7 +11595,7 @@ itemSemanticEditPolicyClassName="ActivityCNContentCompartmentItemSemanticEditPolicy" notationViewFactoryClassName="ActivityActivityContentCompartmentViewFactory" canonicalEditPolicyClassName="ActivityCNContentCompartmentCanonicalEditPolicy" - childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.51" + childNodes="/0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.26 /0/@diagram/@childNodes.27 /0/@diagram/@childNodes.28 /0/@diagram/@childNodes.29 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.51 /0/@diagram/@childNodes.94" title="ActivityFigureContentCompartment" canCollapse="false" needsTitle="false" @@ -11071,28 +11807,28 @@ description="Create an Output Pin" largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/OutputPin.gif" smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/OutputPin.gif" - genNodes="/0/@diagram/@childNodes.10 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.61 /0/@diagram/@childNodes.62 /0/@diagram/@childNodes.63"/> + genNodes="/0/@diagram/@childNodes.10 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.61 /0/@diagram/@childNodes.62 /0/@diagram/@childNodes.63 /0/@diagram/@childNodes.95"/> <entries xsi:type="gmfgen:ToolEntry" title="Input Pin" description="Create an Input Pin" largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InputPin.gif" smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InputPin.gif" - genNodes="/0/@diagram/@childNodes.9 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.66"/> + genNodes="/0/@diagram/@childNodes.9 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.66 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.99"/> <entries xsi:type="gmfgen:ToolEntry" title="Action Input Pin" description="Create an Action Input Pin" largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ActionInputPin.gif" smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ActionInputPin.gif" - genNodes="/0/@diagram/@childNodes.8 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.45"/> + genNodes="/0/@diagram/@childNodes.8 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.101"/> <entries xsi:type="gmfgen:ToolEntry" title="Value Pin" description="Create a Value Pin" largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ValuePin.gif" smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/ValuePin.gif" - genNodes="/0/@diagram/@childNodes.7 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.46"/> + genNodes="/0/@diagram/@childNodes.7 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.100"/> </entries> <entries xsi:type="gmfgen:ToolGroup" @@ -11169,6 +11905,14 @@ largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/SendSignalAction.gif" smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/SendSignalAction.gif" genNodes="/0/@diagram/@childNodes.44"/> + <entries + xsi:type="gmfgen:ToolEntry" + title="Start Object Behaviour Action " + description="Create a Start Object Behaviour Action" + largeIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/StartObjectBehaviorAction.gif" + smallIconPath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/StartObjectBehaviorAction.gif" + createMethodName="createStartObjectBehaviourAction6CreationTool" + genNodes="/0/@diagram/@childNodes.94"/> </entries> <entries xsi:type="gmfgen:ToolGroup" @@ -18481,16 +19225,34 @@ <expressions xsi:type="gmfgen:GenConstraint" body="((not self.handlerBody.oclIsUndefined()) and (not self.exceptionInput.oclIsUndefined())) implies( let pins : Collection(Element) = self.handlerBody.allOwnedElements()->select(e : Element | e.oclIsKindOf(Pin)) in pins->forAll(e : Element | e.oclIsKindOf(Pin) implies e = self.exceptionInput))"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(InputPin) then self.owner.oclAsType(StartObjectBehaviorAction).argument->includes(self) else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(InputPin)
then self.owner.oclAsType(StartObjectBehaviorAction).object = self
else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(ValuePin) then self.owner.oclAsType(StartObjectBehaviorAction).argument->includes(self) else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(ValuePin)
then self.owner.oclAsType(StartObjectBehaviorAction).object = self
else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(ActionInputPin) then self.owner.oclAsType(StartObjectBehaviorAction).argument->includes(self) else false endif"/> + <expressions + xsi:type="gmfgen:GenConstraint" + body="if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(ActionInputPin)
then self.owner.oclAsType(StartObjectBehaviorAction).object = self
else false endif"/> </providers> </expressionProviders> <labelParsers extensibleViaService="true"> <implementations xsi:type="gmfgen:PredefinedParser" - uses="/0/@diagram/@childNodes.6/@labels.0/@modelFacet /0/@diagram/@childNodes.24/@labels.0/@modelFacet /0/@diagram/@childNodes.25/@labels.0/@modelFacet /0/@diagram/@childNodes.26/@labels.0/@modelFacet /0/@diagram/@childNodes.27/@labels.0/@modelFacet /0/@diagram/@childNodes.28/@labels.0/@modelFacet /0/@diagram/@childNodes.29/@labels.0/@modelFacet /0/@diagram/@childNodes.30/@labels.0/@modelFacet /0/@diagram/@childNodes.31/@labels.0/@modelFacet /0/@diagram/@childNodes.37/@labels.0/@modelFacet /0/@diagram/@childNodes.44/@labels.0/@modelFacet /0/@diagram/@childNodes.54/@labels.0/@modelFacet /0/@diagram/@childNodes.67/@labels.0/@modelFacet /0/@diagram/@childNodes.70/@labels.0/@modelFacet /0/@diagram/@childNodes.73/@labels.0/@modelFacet /0/@diagram/@childNodes.76/@labels.0/@modelFacet /0/@diagram/@childNodes.79/@labels.0/@modelFacet /0/@diagram/@childNodes.83/@labels.0/@modelFacet /0/@diagram/@childNodes.85/@labels.0/@modelFacet /0/@diagram/@childNodes.87/@labels.0/@modelFacet /0/@diagram/@childNodes.90/@labels.0/@modelFacet /0/@diagram/@childNodes.72/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@links.2/@labels.0/@modelFacet /0/@diagram/@links.3/@labels.0/@modelFacet /0/@diagram/@childNodes.93/@labels.0/@modelFacet /0/@diagram/@childNodes.67/@labels.1/@modelFacet /0/@diagram/@childNodes.90/@labels.1/@modelFacet /0/@diagram/@childNodes.87/@labels.1/@modelFacet /0/@diagram/@childNodes.16/@labels.1/@modelFacet /0/@diagram/@childNodes.79/@labels.1/@modelFacet /0/@diagram/@childNodes.85/@labels.1/@modelFacet /0/@diagram/@childNodes.83/@labels.1/@modelFacet /0/@diagram/@childNodes.76/@labels.1/@modelFacet /0/@diagram/@childNodes.73/@labels.1/@modelFacet /0/@diagram/@childNodes.70/@labels.1/@modelFacet /0/@diagram/@childNodes.54/@labels.1/@modelFacet /0/@diagram/@childNodes.37/@labels.1/@modelFacet /0/@diagram/@childNodes.6/@labels.1/@modelFacet /0/@diagram/@childNodes.11/@labels.1/@modelFacet /0/@diagram/@childNodes.92/@labels.2/@modelFacet /0/@diagram/@childNodes.36/@labels.2/@modelFacet /0/@diagram/@childNodes.44/@labels.1/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.5/@labels.0/@modelFacet /0/@diagram/@childNodes.32/@labels.0/@modelFacet /0/@diagram/@childNodes.33/@labels.0/@modelFacet /0/@diagram/@childNodes.34/@labels.0/@modelFacet /0/@diagram/@childNodes.35/@labels.0/@modelFacet /0/@diagram/@childNodes.52/@labels.3/@modelFacet"/> + uses="/0/@diagram/@childNodes.6/@labels.0/@modelFacet /0/@diagram/@childNodes.24/@labels.0/@modelFacet /0/@diagram/@childNodes.25/@labels.0/@modelFacet /0/@diagram/@childNodes.26/@labels.0/@modelFacet /0/@diagram/@childNodes.27/@labels.0/@modelFacet /0/@diagram/@childNodes.28/@labels.0/@modelFacet /0/@diagram/@childNodes.29/@labels.0/@modelFacet /0/@diagram/@childNodes.30/@labels.0/@modelFacet /0/@diagram/@childNodes.31/@labels.0/@modelFacet /0/@diagram/@childNodes.37/@labels.0/@modelFacet /0/@diagram/@childNodes.44/@labels.0/@modelFacet /0/@diagram/@childNodes.54/@labels.0/@modelFacet /0/@diagram/@childNodes.67/@labels.0/@modelFacet /0/@diagram/@childNodes.70/@labels.0/@modelFacet /0/@diagram/@childNodes.73/@labels.0/@modelFacet /0/@diagram/@childNodes.76/@labels.0/@modelFacet /0/@diagram/@childNodes.79/@labels.0/@modelFacet /0/@diagram/@childNodes.83/@labels.0/@modelFacet /0/@diagram/@childNodes.85/@labels.0/@modelFacet /0/@diagram/@childNodes.87/@labels.0/@modelFacet /0/@diagram/@childNodes.90/@labels.0/@modelFacet /0/@diagram/@childNodes.72/@labels.0/@modelFacet /0/@diagram/@topLevelNodes.0/@labels.0/@modelFacet /0/@diagram/@links.2/@labels.0/@modelFacet /0/@diagram/@links.3/@labels.0/@modelFacet /0/@diagram/@childNodes.93/@labels.0/@modelFacet /0/@diagram/@childNodes.67/@labels.1/@modelFacet /0/@diagram/@childNodes.90/@labels.1/@modelFacet /0/@diagram/@childNodes.87/@labels.1/@modelFacet /0/@diagram/@childNodes.16/@labels.1/@modelFacet /0/@diagram/@childNodes.79/@labels.1/@modelFacet /0/@diagram/@childNodes.85/@labels.1/@modelFacet /0/@diagram/@childNodes.83/@labels.1/@modelFacet /0/@diagram/@childNodes.76/@labels.1/@modelFacet /0/@diagram/@childNodes.73/@labels.1/@modelFacet /0/@diagram/@childNodes.70/@labels.1/@modelFacet /0/@diagram/@childNodes.54/@labels.1/@modelFacet /0/@diagram/@childNodes.37/@labels.1/@modelFacet /0/@diagram/@childNodes.6/@labels.1/@modelFacet /0/@diagram/@childNodes.11/@labels.1/@modelFacet /0/@diagram/@childNodes.92/@labels.2/@modelFacet /0/@diagram/@childNodes.36/@labels.2/@modelFacet /0/@diagram/@childNodes.44/@labels.1/@modelFacet /0/@diagram/@childNodes.4/@labels.0/@modelFacet /0/@diagram/@childNodes.3/@labels.0/@modelFacet /0/@diagram/@childNodes.5/@labels.0/@modelFacet /0/@diagram/@childNodes.32/@labels.0/@modelFacet /0/@diagram/@childNodes.33/@labels.0/@modelFacet /0/@diagram/@childNodes.34/@labels.0/@modelFacet /0/@diagram/@childNodes.35/@labels.0/@modelFacet /0/@diagram/@childNodes.52/@labels.3/@modelFacet /0/@diagram/@childNodes.94/@labels.0/@modelFacet /0/@diagram/@childNodes.94/@labels.1/@modelFacet"/> <implementations xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@childNodes.89/@labels.1/@modelFacet /0/@diagram/@childNodes.49/@labels.2/@modelFacet /0/@diagram/@childNodes.82/@labels.1/@modelFacet /0/@diagram/@childNodes.53/@labels.1/@modelFacet /0/@diagram/@childNodes.81/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.2/@modelFacet /0/@diagram/@childNodes.22/@labels.2/@modelFacet /0/@diagram/@childNodes.45/@labels.2/@modelFacet /0/@diagram/@childNodes.47/@labels.1/@modelFacet /0/@diagram/@childNodes.23/@labels.1/@modelFacet /0/@diagram/@links.2/@labels.6/@modelFacet /0/@diagram/@childNodes.19/@labels.1/@modelFacet /0/@diagram/@childNodes.4/@labels.1/@modelFacet /0/@diagram/@childNodes.15/@labels.1/@modelFacet /0/@diagram/@childNodes.43/@labels.1/@modelFacet /0/@diagram/@childNodes.80/@labels.1/@modelFacet /0/@diagram/@childNodes.91/@labels.2/@modelFacet /0/@diagram/@childNodes.84/@labels.1/@modelFacet /0/@diagram/@childNodes.13/@labels.2/@modelFacet /0/@diagram/@childNodes.35/@labels.2/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@childNodes.33/@labels.1/@modelFacet /0/@diagram/@childNodes.88/@labels.1/@modelFacet /0/@diagram/@childNodes.20/@labels.1/@modelFacet /0/@diagram/@childNodes.52/@labels.2/@modelFacet /0/@diagram/@childNodes.41/@labels.2/@modelFacet /0/@diagram/@childNodes.32/@labels.2/@modelFacet /0/@diagram/@childNodes.77/@labels.1/@modelFacet /0/@diagram/@childNodes.8/@labels.2/@modelFacet /0/@diagram/@childNodes.34/@labels.1/@modelFacet /0/@diagram/@links.3/@labels.3/@modelFacet /0/@diagram/@childNodes.74/@labels.1/@modelFacet /0/@diagram/@childNodes.86/@labels.1/@modelFacet /0/@diagram/@childNodes.17/@labels.2/@modelFacet /0/@diagram/@childNodes.50/@labels.1/@modelFacet /0/@diagram/@childNodes.78/@labels.1/@modelFacet /0/@diagram/@childNodes.10/@labels.1/@modelFacet /0/@diagram/@childNodes.21/@labels.2/@modelFacet /0/@diagram/@childNodes.14/@labels.1/@modelFacet /0/@diagram/@childNodes.55/@labels.1/@modelFacet /0/@diagram/@childNodes.71/@labels.1/@modelFacet /0/@diagram/@childNodes.39/@labels.2/@modelFacet /0/@diagram/@childNodes.18/@labels.2/@modelFacet /0/@diagram/@childNodes.42/@labels.2/@modelFacet /0/@diagram/@childNodes.3/@labels.1/@modelFacet /0/@diagram/@childNodes.46/@labels.2/@modelFacet /0/@diagram/@childNodes.48/@labels.2/@modelFacet /0/@diagram/@childNodes.7/@labels.2/@modelFacet /0/@diagram/@childNodes.38/@labels.2/@modelFacet /0/@diagram/@childNodes.5/@labels.1/@modelFacet /0/@diagram/@childNodes.40/@labels.1/@modelFacet /0/@diagram/@childNodes.66/@labels.1/@modelFacet /0/@diagram/@childNodes.63/@labels.1/@modelFacet /0/@diagram/@childNodes.62/@labels.1/@modelFacet /0/@diagram/@childNodes.61/@labels.1/@modelFacet" + uses="/0/@diagram/@childNodes.89/@labels.1/@modelFacet /0/@diagram/@childNodes.49/@labels.2/@modelFacet /0/@diagram/@childNodes.82/@labels.1/@modelFacet /0/@diagram/@childNodes.53/@labels.1/@modelFacet /0/@diagram/@childNodes.81/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.2/@modelFacet /0/@diagram/@childNodes.22/@labels.2/@modelFacet /0/@diagram/@childNodes.45/@labels.2/@modelFacet /0/@diagram/@childNodes.47/@labels.1/@modelFacet /0/@diagram/@childNodes.23/@labels.1/@modelFacet /0/@diagram/@links.2/@labels.6/@modelFacet /0/@diagram/@childNodes.19/@labels.1/@modelFacet /0/@diagram/@childNodes.4/@labels.1/@modelFacet /0/@diagram/@childNodes.15/@labels.1/@modelFacet /0/@diagram/@childNodes.43/@labels.1/@modelFacet /0/@diagram/@childNodes.80/@labels.1/@modelFacet /0/@diagram/@childNodes.91/@labels.2/@modelFacet /0/@diagram/@childNodes.84/@labels.1/@modelFacet /0/@diagram/@childNodes.13/@labels.2/@modelFacet /0/@diagram/@childNodes.35/@labels.2/@modelFacet /0/@diagram/@childNodes.9/@labels.1/@modelFacet /0/@diagram/@childNodes.33/@labels.1/@modelFacet /0/@diagram/@childNodes.88/@labels.1/@modelFacet /0/@diagram/@childNodes.20/@labels.1/@modelFacet /0/@diagram/@childNodes.52/@labels.2/@modelFacet /0/@diagram/@childNodes.41/@labels.2/@modelFacet /0/@diagram/@childNodes.32/@labels.2/@modelFacet /0/@diagram/@childNodes.77/@labels.1/@modelFacet /0/@diagram/@childNodes.8/@labels.2/@modelFacet /0/@diagram/@childNodes.34/@labels.1/@modelFacet /0/@diagram/@links.3/@labels.3/@modelFacet /0/@diagram/@childNodes.74/@labels.1/@modelFacet /0/@diagram/@childNodes.86/@labels.1/@modelFacet /0/@diagram/@childNodes.17/@labels.2/@modelFacet /0/@diagram/@childNodes.50/@labels.1/@modelFacet /0/@diagram/@childNodes.78/@labels.1/@modelFacet /0/@diagram/@childNodes.10/@labels.1/@modelFacet /0/@diagram/@childNodes.21/@labels.2/@modelFacet /0/@diagram/@childNodes.14/@labels.1/@modelFacet /0/@diagram/@childNodes.55/@labels.1/@modelFacet /0/@diagram/@childNodes.71/@labels.1/@modelFacet /0/@diagram/@childNodes.39/@labels.2/@modelFacet /0/@diagram/@childNodes.18/@labels.2/@modelFacet /0/@diagram/@childNodes.42/@labels.2/@modelFacet /0/@diagram/@childNodes.3/@labels.1/@modelFacet /0/@diagram/@childNodes.46/@labels.2/@modelFacet /0/@diagram/@childNodes.48/@labels.2/@modelFacet /0/@diagram/@childNodes.7/@labels.2/@modelFacet /0/@diagram/@childNodes.38/@labels.2/@modelFacet /0/@diagram/@childNodes.5/@labels.1/@modelFacet /0/@diagram/@childNodes.40/@labels.1/@modelFacet /0/@diagram/@childNodes.66/@labels.1/@modelFacet /0/@diagram/@childNodes.63/@labels.1/@modelFacet /0/@diagram/@childNodes.62/@labels.1/@modelFacet /0/@diagram/@childNodes.61/@labels.1/@modelFacet /0/@diagram/@childNodes.95/@labels.1/@modelFacet /0/@diagram/@childNodes.96/@labels.1/@modelFacet /0/@diagram/@childNodes.97/@labels.2/@modelFacet /0/@diagram/@childNodes.98/@labels.2/@modelFacet /0/@diagram/@childNodes.100/@labels.2/@modelFacet /0/@diagram/@childNodes.101/@labels.2/@modelFacet" qualifiedName="org.eclipse.papyrus.uml.diagram.common.parser.stereotype.AppliedStereotypeParser"/> <implementations xsi:type="gmfgen:CustomParser" @@ -18510,11 +19272,11 @@ qualifiedName="org.eclipse.papyrus.uml.diagram.activity.parser.custom.CallBehaviorActionParser"/> <implementations xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@childNodes.15/@labels.0/@modelFacet /0/@diagram/@childNodes.71/@labels.0/@modelFacet /0/@diagram/@childNodes.10/@labels.0/@modelFacet /0/@diagram/@childNodes.42/@labels.0/@modelFacet /0/@diagram/@childNodes.14/@labels.0/@modelFacet /0/@diagram/@childNodes.21/@labels.0/@modelFacet /0/@diagram/@childNodes.88/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.47/@labels.0/@modelFacet /0/@diagram/@childNodes.50/@labels.0/@modelFacet /0/@diagram/@childNodes.86/@labels.0/@modelFacet /0/@diagram/@childNodes.78/@labels.0/@modelFacet /0/@diagram/@childNodes.89/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@childNodes.38/@labels.0/@modelFacet /0/@diagram/@childNodes.22/@labels.0/@modelFacet /0/@diagram/@childNodes.7/@labels.0/@modelFacet /0/@diagram/@childNodes.17/@labels.0/@modelFacet /0/@diagram/@childNodes.81/@labels.0/@modelFacet /0/@diagram/@childNodes.39/@labels.0/@modelFacet /0/@diagram/@childNodes.48/@labels.0/@modelFacet /0/@diagram/@childNodes.91/@labels.0/@modelFacet /0/@diagram/@childNodes.49/@labels.0/@modelFacet /0/@diagram/@childNodes.45/@labels.0/@modelFacet /0/@diagram/@childNodes.77/@labels.0/@modelFacet /0/@diagram/@childNodes.82/@labels.0/@modelFacet /0/@diagram/@childNodes.80/@labels.0/@modelFacet /0/@diagram/@childNodes.20/@labels.0/@modelFacet /0/@diagram/@childNodes.40/@labels.0/@modelFacet /0/@diagram/@childNodes.23/@labels.0/@modelFacet /0/@diagram/@childNodes.74/@labels.0/@modelFacet /0/@diagram/@childNodes.53/@labels.0/@modelFacet /0/@diagram/@childNodes.13/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet /0/@diagram/@childNodes.19/@labels.0/@modelFacet /0/@diagram/@childNodes.41/@labels.0/@modelFacet /0/@diagram/@childNodes.84/@labels.0/@modelFacet /0/@diagram/@childNodes.18/@labels.0/@modelFacet /0/@diagram/@childNodes.43/@labels.0/@modelFacet /0/@diagram/@childNodes.55/@labels.0/@modelFacet /0/@diagram/@childNodes.46/@labels.0/@modelFacet /0/@diagram/@childNodes.66/@labels.0/@modelFacet /0/@diagram/@childNodes.63/@labels.0/@modelFacet /0/@diagram/@childNodes.62/@labels.0/@modelFacet /0/@diagram/@childNodes.61/@labels.0/@modelFacet" + uses="/0/@diagram/@childNodes.15/@labels.0/@modelFacet /0/@diagram/@childNodes.71/@labels.0/@modelFacet /0/@diagram/@childNodes.10/@labels.0/@modelFacet /0/@diagram/@childNodes.42/@labels.0/@modelFacet /0/@diagram/@childNodes.14/@labels.0/@modelFacet /0/@diagram/@childNodes.21/@labels.0/@modelFacet /0/@diagram/@childNodes.88/@labels.0/@modelFacet /0/@diagram/@childNodes.8/@labels.0/@modelFacet /0/@diagram/@childNodes.47/@labels.0/@modelFacet /0/@diagram/@childNodes.50/@labels.0/@modelFacet /0/@diagram/@childNodes.86/@labels.0/@modelFacet /0/@diagram/@childNodes.78/@labels.0/@modelFacet /0/@diagram/@childNodes.89/@labels.0/@modelFacet /0/@diagram/@childNodes.12/@labels.0/@modelFacet /0/@diagram/@childNodes.38/@labels.0/@modelFacet /0/@diagram/@childNodes.22/@labels.0/@modelFacet /0/@diagram/@childNodes.7/@labels.0/@modelFacet /0/@diagram/@childNodes.17/@labels.0/@modelFacet /0/@diagram/@childNodes.81/@labels.0/@modelFacet /0/@diagram/@childNodes.39/@labels.0/@modelFacet /0/@diagram/@childNodes.48/@labels.0/@modelFacet /0/@diagram/@childNodes.91/@labels.0/@modelFacet /0/@diagram/@childNodes.49/@labels.0/@modelFacet /0/@diagram/@childNodes.45/@labels.0/@modelFacet /0/@diagram/@childNodes.77/@labels.0/@modelFacet /0/@diagram/@childNodes.82/@labels.0/@modelFacet /0/@diagram/@childNodes.80/@labels.0/@modelFacet /0/@diagram/@childNodes.20/@labels.0/@modelFacet /0/@diagram/@childNodes.40/@labels.0/@modelFacet /0/@diagram/@childNodes.23/@labels.0/@modelFacet /0/@diagram/@childNodes.74/@labels.0/@modelFacet /0/@diagram/@childNodes.53/@labels.0/@modelFacet /0/@diagram/@childNodes.13/@labels.0/@modelFacet /0/@diagram/@childNodes.9/@labels.0/@modelFacet /0/@diagram/@childNodes.19/@labels.0/@modelFacet /0/@diagram/@childNodes.41/@labels.0/@modelFacet /0/@diagram/@childNodes.84/@labels.0/@modelFacet /0/@diagram/@childNodes.18/@labels.0/@modelFacet /0/@diagram/@childNodes.43/@labels.0/@modelFacet /0/@diagram/@childNodes.55/@labels.0/@modelFacet /0/@diagram/@childNodes.46/@labels.0/@modelFacet /0/@diagram/@childNodes.66/@labels.0/@modelFacet /0/@diagram/@childNodes.63/@labels.0/@modelFacet /0/@diagram/@childNodes.62/@labels.0/@modelFacet /0/@diagram/@childNodes.61/@labels.0/@modelFacet /0/@diagram/@childNodes.95/@labels.0/@modelFacet /0/@diagram/@childNodes.96/@labels.0/@modelFacet /0/@diagram/@childNodes.97/@labels.0/@modelFacet /0/@diagram/@childNodes.98/@labels.0/@modelFacet /0/@diagram/@childNodes.99/@labels.0/@modelFacet /0/@diagram/@childNodes.100/@labels.0/@modelFacet /0/@diagram/@childNodes.101/@labels.0/@modelFacet" qualifiedName="org.eclipse.papyrus.uml.diagram.activity.parser.custom.PinParser"/> <implementations xsi:type="gmfgen:CustomParser" - uses="/0/@diagram/@childNodes.8/@labels.1/@modelFacet /0/@diagram/@childNodes.21/@labels.1/@modelFacet /0/@diagram/@childNodes.42/@labels.1/@modelFacet /0/@diagram/@childNodes.38/@labels.1/@modelFacet /0/@diagram/@childNodes.39/@labels.1/@modelFacet /0/@diagram/@childNodes.22/@labels.1/@modelFacet /0/@diagram/@childNodes.13/@labels.1/@modelFacet /0/@diagram/@childNodes.17/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.1/@modelFacet /0/@diagram/@childNodes.49/@labels.1/@modelFacet /0/@diagram/@childNodes.91/@labels.1/@modelFacet /0/@diagram/@childNodes.46/@labels.1/@modelFacet /0/@diagram/@childNodes.41/@labels.1/@modelFacet /0/@diagram/@childNodes.18/@labels.1/@modelFacet /0/@diagram/@childNodes.7/@labels.1/@modelFacet /0/@diagram/@childNodes.48/@labels.1/@modelFacet /0/@diagram/@childNodes.45/@labels.1/@modelFacet" + uses="/0/@diagram/@childNodes.8/@labels.1/@modelFacet /0/@diagram/@childNodes.21/@labels.1/@modelFacet /0/@diagram/@childNodes.42/@labels.1/@modelFacet /0/@diagram/@childNodes.38/@labels.1/@modelFacet /0/@diagram/@childNodes.39/@labels.1/@modelFacet /0/@diagram/@childNodes.22/@labels.1/@modelFacet /0/@diagram/@childNodes.13/@labels.1/@modelFacet /0/@diagram/@childNodes.17/@labels.1/@modelFacet /0/@diagram/@childNodes.12/@labels.1/@modelFacet /0/@diagram/@childNodes.49/@labels.1/@modelFacet /0/@diagram/@childNodes.91/@labels.1/@modelFacet /0/@diagram/@childNodes.46/@labels.1/@modelFacet /0/@diagram/@childNodes.41/@labels.1/@modelFacet /0/@diagram/@childNodes.18/@labels.1/@modelFacet /0/@diagram/@childNodes.7/@labels.1/@modelFacet /0/@diagram/@childNodes.48/@labels.1/@modelFacet /0/@diagram/@childNodes.45/@labels.1/@modelFacet /0/@diagram/@childNodes.97/@labels.1/@modelFacet /0/@diagram/@childNodes.98/@labels.1/@modelFacet /0/@diagram/@childNodes.99/@labels.1/@modelFacet /0/@diagram/@childNodes.100/@labels.1/@modelFacet /0/@diagram/@childNodes.101/@labels.1/@modelFacet" qualifiedName="org.eclipse.papyrus.uml.diagram.activity.parser.custom.PinValueParser"/> <implementations xsi:type="gmfgen:CustomParser" @@ -18601,13 +19363,13 @@ <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="add superclass for floating Label" - genView="/0/@diagram/@childNodes.67/@labels.1 /0/@diagram/@childNodes.87/@labels.1 /0/@diagram/@childNodes.90/@labels.1 /0/@diagram/@childNodes.16/@labels.1 /0/@diagram/@childNodes.6/@labels.1 /0/@diagram/@childNodes.37/@labels.1 /0/@diagram/@childNodes.54/@labels.1 /0/@diagram/@childNodes.70/@labels.1 /0/@diagram/@childNodes.73/@labels.1 /0/@diagram/@childNodes.76/@labels.1 /0/@diagram/@childNodes.79/@labels.1 /0/@diagram/@childNodes.83/@labels.1 /0/@diagram/@childNodes.85/@labels.1 /0/@diagram/@childNodes.11/@labels.1 /0/@diagram/@childNodes.92/@labels.2 /0/@diagram/@childNodes.36/@labels.2 /0/@diagram/@childNodes.44/@labels.1 /0/@diagram/@childNodes.3/@labels.0 /0/@diagram/@childNodes.4/@labels.0 /0/@diagram/@childNodes.5/@labels.0 /0/@diagram/@childNodes.32/@labels.0 /0/@diagram/@childNodes.33/@labels.0 /0/@diagram/@childNodes.34/@labels.0 /0/@diagram/@childNodes.35/@labels.0 /0/@diagram/@childNodes.52/@labels.3" + genView="/0/@diagram/@childNodes.67/@labels.1 /0/@diagram/@childNodes.87/@labels.1 /0/@diagram/@childNodes.90/@labels.1 /0/@diagram/@childNodes.16/@labels.1 /0/@diagram/@childNodes.6/@labels.1 /0/@diagram/@childNodes.37/@labels.1 /0/@diagram/@childNodes.54/@labels.1 /0/@diagram/@childNodes.70/@labels.1 /0/@diagram/@childNodes.73/@labels.1 /0/@diagram/@childNodes.76/@labels.1 /0/@diagram/@childNodes.79/@labels.1 /0/@diagram/@childNodes.83/@labels.1 /0/@diagram/@childNodes.85/@labels.1 /0/@diagram/@childNodes.11/@labels.1 /0/@diagram/@childNodes.92/@labels.2 /0/@diagram/@childNodes.36/@labels.2 /0/@diagram/@childNodes.44/@labels.1 /0/@diagram/@childNodes.3/@labels.0 /0/@diagram/@childNodes.4/@labels.0 /0/@diagram/@childNodes.5/@labels.0 /0/@diagram/@childNodes.32/@labels.0 /0/@diagram/@childNodes.33/@labels.0 /0/@diagram/@childNodes.34/@labels.0 /0/@diagram/@childNodes.35/@labels.0 /0/@diagram/@childNodes.52/@labels.3 /0/@diagram/@childNodes.94/@labels.1" name="FloatingLabelEditPart" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.FloatingLabelEditPart"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="Elements that inherits RoundedCompartmentEditPart" - genView="/0/@diagram/@childNodes.87 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.72 /0/@diagram/@topLevelNodes.0" + genView="/0/@diagram/@childNodes.87 /0/@diagram/@childNodes.67 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.72 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.94" name="Rounded Compartment EP inheritance" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.RoundedCompartmentEditPart"/> <extensionNodes @@ -18631,7 +19393,7 @@ xsi:type="papyrusgmfgenextension:SpecificLocator" comment="Affixed Pin locator for Actions" classpath="org.eclipse.papyrus.uml.diagram.activity.locator.PinPositionLocator" - genChildSideAffixedNode="/0/@diagram/@childNodes.38 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.66"/> + genChildSideAffixedNode="/0/@diagram/@childNodes.38 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.66 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.101"/> <extensionNodes xsi:type="papyrusgmfgenextension:SpecificLocator" comment="Affixed Activity Parameter Node locator for Activity" @@ -18644,16 +19406,6 @@ genChildSideAffixedNode="/0/@diagram/@childNodes.58 /0/@diagram/@childNodes.59"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" - comment="Node with label for named element" - name="NamedElementEditPart" - superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart"/> - <extensionNodes - xsi:type="papyrusgmfgenextension:ExtendedGenView" - comment="Node with no name" - name="NodeEditPart" - superOwnedEditPart="org.eclipse.papyrus.infra.gmfdiag.common.editpart.NodeEditPart"/> - <extensionNodes - xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="link that to intherits from UML specificities" genView="/0/@diagram/@links.3 /0/@diagram/@links.2" name="UML link inheritance" @@ -18677,16 +19429,6 @@ name="comment extended node" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.AbstractCommentEditPart"/> <extensionNodes - xsi:type="papyrusgmfgenextension:ExtendedGenView" - comment="elements that intherit form UMLNodeEditpart" - name="UMLNodeEditPart" - superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart"/> - <extensionNodes - xsi:type="papyrusgmfgenextension:ExtendedGenView" - comment="add inheritance to BorderNamedElementEditPart" - name="BorderNamedElementEditPart" - superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.BorderNamedElementEditPart"/> - <extensionNodes xsi:type="papyrusgmfgenextension:LabelVisibilityPreference" comment="HiddenName" role="Name" @@ -18743,12 +19485,7 @@ xsi:type="papyrusgmfgenextension:EditPartUsingDeleteService" comment="" name="Delete service elements" - genView="/0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.38 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.67 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.51 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.93 /0/@diagram/@links.3 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.66 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.75 /0/@diagram/@links.4 /0/@diagram/@links.2 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.61 /0/@diagram/@childNodes.63/@labels.0 /0/@diagram/@childNodes.62 /0/@diagram/@childNodes.63 /0/@diagram/@childNodes.58 /0/@diagram/@childNodes.59"/> - <extensionNodes - xsi:type="papyrusgmfgenextension:ExtendedGenView" - comment="elements that intherit form UMLNodeEditpart" - name="UMLNodeEditPart" - superOwnedEditPart="org.eclipse.papyrus.uml.diagram.common.editparts.UMLNodeEditPart"/> + genView="/0/@diagram/@childNodes.7 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.13 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.38 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.56 /0/@diagram/@childNodes.60 /0/@diagram/@childNodes.64 /0/@diagram/@childNodes.65 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.11 /0/@diagram/@childNodes.16 /0/@diagram/@childNodes.3 /0/@diagram/@childNodes.4 /0/@diagram/@childNodes.6 /0/@diagram/@childNodes.32 /0/@diagram/@childNodes.33 /0/@diagram/@childNodes.34 /0/@diagram/@childNodes.35 /0/@diagram/@childNodes.36 /0/@diagram/@childNodes.37 /0/@diagram/@childNodes.44 /0/@diagram/@childNodes.52 /0/@diagram/@childNodes.54 /0/@diagram/@childNodes.83 /0/@diagram/@childNodes.85 /0/@diagram/@childNodes.87 /0/@diagram/@childNodes.90 /0/@diagram/@childNodes.92 /0/@diagram/@childNodes.73 /0/@diagram/@childNodes.5 /0/@diagram/@childNodes.76 /0/@diagram/@childNodes.72 /0/@diagram/@childNodes.68 /0/@diagram/@childNodes.67 /0/@diagram/@topLevelNodes.0 /0/@diagram/@childNodes.51 /0/@diagram/@childNodes.79 /0/@diagram/@childNodes.69 /0/@diagram/@childNodes.31 /0/@diagram/@childNodes.30 /0/@diagram/@childNodes.2 /0/@diagram/@childNodes.1 /0/@diagram/@childNodes.93 /0/@diagram/@links.3 /0/@diagram/@childNodes.24 /0/@diagram/@childNodes.25 /0/@diagram/@childNodes.57 /0/@diagram/@childNodes.66 /0/@diagram/@childNodes.70 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.75 /0/@diagram/@links.4 /0/@diagram/@links.2 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.61 /0/@diagram/@childNodes.63/@labels.0 /0/@diagram/@childNodes.62 /0/@diagram/@childNodes.63 /0/@diagram/@childNodes.58 /0/@diagram/@childNodes.59 /0/@diagram/@childNodes.94 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.101"/> <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="set the super class as AbstractLabelEditPart" @@ -18758,14 +19495,14 @@ <extensionNodes xsi:type="papyrusgmfgenextension:ExtendedGenView" comment="contains methods to display arrows" - genView="/0/@diagram/@childNodes.13 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.38 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.71" + genView="/0/@diagram/@childNodes.13 /0/@diagram/@childNodes.22 /0/@diagram/@childNodes.17 /0/@diagram/@childNodes.8 /0/@diagram/@childNodes.39 /0/@diagram/@childNodes.42 /0/@diagram/@childNodes.49 /0/@diagram/@childNodes.45 /0/@diagram/@childNodes.80 /0/@diagram/@childNodes.81 /0/@diagram/@childNodes.88 /0/@diagram/@childNodes.89 /0/@diagram/@childNodes.91 /0/@diagram/@childNodes.14 /0/@diagram/@childNodes.23 /0/@diagram/@childNodes.19 /0/@diagram/@childNodes.84 /0/@diagram/@childNodes.9 /0/@diagram/@childNodes.77 /0/@diagram/@childNodes.40 /0/@diagram/@childNodes.43 /0/@diagram/@childNodes.50 /0/@diagram/@childNodes.47 /0/@diagram/@childNodes.53 /0/@diagram/@childNodes.82 /0/@diagram/@childNodes.15 /0/@diagram/@childNodes.20 /0/@diagram/@childNodes.74 /0/@diagram/@childNodes.10 /0/@diagram/@childNodes.78 /0/@diagram/@childNodes.86 /0/@diagram/@childNodes.55 /0/@diagram/@childNodes.12 /0/@diagram/@childNodes.21 /0/@diagram/@childNodes.18 /0/@diagram/@childNodes.7 /0/@diagram/@childNodes.38 /0/@diagram/@childNodes.41 /0/@diagram/@childNodes.48 /0/@diagram/@childNodes.46 /0/@diagram/@childNodes.71 /0/@diagram/@childNodes.95 /0/@diagram/@childNodes.96 /0/@diagram/@childNodes.97 /0/@diagram/@childNodes.98 /0/@diagram/@childNodes.99 /0/@diagram/@childNodes.100 /0/@diagram/@childNodes.101" name="AbstractPinEditPart" superOwnedEditPart="org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart"/> <extensionNodes xsi:type="papyrusgmfgenextension:SpecificLocatorExternalLabel" comment="locator for external label of pins" classpath="org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator" - genExternalNodeLabel="/0/@diagram/@childNodes.75/@labels.0 /0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.7/@labels.2 /0/@diagram/@childNodes.8/@labels.2 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@childNodes.12/@labels.2 /0/@diagram/@childNodes.13/@labels.2 /0/@diagram/@childNodes.14/@labels.1 /0/@diagram/@childNodes.15/@labels.1 /0/@diagram/@childNodes.17/@labels.2 /0/@diagram/@childNodes.18/@labels.2 /0/@diagram/@childNodes.19/@labels.1 /0/@diagram/@childNodes.20/@labels.1 /0/@diagram/@childNodes.21/@labels.2 /0/@diagram/@childNodes.22/@labels.2 /0/@diagram/@childNodes.23/@labels.1 /0/@diagram/@childNodes.32/@labels.2 /0/@diagram/@childNodes.33/@labels.1 /0/@diagram/@childNodes.34/@labels.1 /0/@diagram/@childNodes.35/@labels.2 /0/@diagram/@childNodes.38/@labels.2 /0/@diagram/@childNodes.39/@labels.2 /0/@diagram/@childNodes.40/@labels.1 /0/@diagram/@childNodes.41/@labels.2 /0/@diagram/@childNodes.42/@labels.2 /0/@diagram/@childNodes.43/@labels.1 /0/@diagram/@childNodes.45/@labels.2 /0/@diagram/@childNodes.46/@labels.2 /0/@diagram/@childNodes.47/@labels.1 /0/@diagram/@childNodes.48/@labels.2 /0/@diagram/@childNodes.49/@labels.2 /0/@diagram/@childNodes.50/@labels.1 /0/@diagram/@childNodes.52/@labels.2 /0/@diagram/@childNodes.53/@labels.1 /0/@diagram/@childNodes.55/@labels.1 /0/@diagram/@childNodes.71/@labels.1 /0/@diagram/@childNodes.74/@labels.1 /0/@diagram/@childNodes.77/@labels.1 /0/@diagram/@childNodes.80/@labels.1 /0/@diagram/@childNodes.81/@labels.1 /0/@diagram/@childNodes.82/@labels.1 /0/@diagram/@childNodes.84/@labels.1 /0/@diagram/@childNodes.86/@labels.1 /0/@diagram/@childNodes.88/@labels.1 /0/@diagram/@childNodes.89/@labels.1 /0/@diagram/@childNodes.91/@labels.2 /0/@diagram/@childNodes.63/@labels.0 /0/@diagram/@childNodes.61/@labels.1 /0/@diagram/@childNodes.62/@labels.1 /0/@diagram/@childNodes.63/@labels.1 /0/@diagram/@childNodes.66/@labels.1 /0/@diagram/@childNodes.53/@labels.0 /0/@diagram/@childNodes.7/@labels.0 /0/@diagram/@childNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.0 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@childNodes.9/@labels.0 /0/@diagram/@childNodes.10/@labels.0 /0/@diagram/@childNodes.12/@labels.0 /0/@diagram/@childNodes.12/@labels.1 /0/@diagram/@childNodes.13/@labels.0 /0/@diagram/@childNodes.13/@labels.1 /0/@diagram/@childNodes.14/@labels.0 /0/@diagram/@childNodes.15/@labels.0 /0/@diagram/@childNodes.17/@labels.0 /0/@diagram/@childNodes.17/@labels.1 /0/@diagram/@childNodes.18/@labels.0 /0/@diagram/@childNodes.18/@labels.1 /0/@diagram/@childNodes.19/@labels.0 /0/@diagram/@childNodes.20/@labels.0 /0/@diagram/@childNodes.21/@labels.0 /0/@diagram/@childNodes.21/@labels.1 /0/@diagram/@childNodes.22/@labels.0 /0/@diagram/@childNodes.22/@labels.1 /0/@diagram/@childNodes.23/@labels.0 /0/@diagram/@childNodes.32/@labels.1 /0/@diagram/@childNodes.35/@labels.1 /0/@diagram/@childNodes.36/@labels.1 /0/@diagram/@childNodes.38/@labels.0 /0/@diagram/@childNodes.38/@labels.1 /0/@diagram/@childNodes.39/@labels.0 /0/@diagram/@childNodes.39/@labels.1 /0/@diagram/@childNodes.40/@labels.0 /0/@diagram/@childNodes.41/@labels.0 /0/@diagram/@childNodes.41/@labels.1 /0/@diagram/@childNodes.42/@labels.0 /0/@diagram/@childNodes.42/@labels.1 /0/@diagram/@childNodes.43/@labels.0 /0/@diagram/@childNodes.45/@labels.0 /0/@diagram/@childNodes.45/@labels.1 /0/@diagram/@childNodes.46/@labels.0 /0/@diagram/@childNodes.46/@labels.1 /0/@diagram/@childNodes.47/@labels.0 /0/@diagram/@childNodes.48/@labels.0 /0/@diagram/@childNodes.48/@labels.1 /0/@diagram/@childNodes.49/@labels.0 /0/@diagram/@childNodes.49/@labels.1 /0/@diagram/@childNodes.50/@labels.0 /0/@diagram/@childNodes.52/@labels.1 /0/@diagram/@childNodes.55/@labels.0 /0/@diagram/@childNodes.61/@labels.0 /0/@diagram/@childNodes.62/@labels.0 /0/@diagram/@childNodes.66/@labels.0 /0/@diagram/@childNodes.71/@labels.0 /0/@diagram/@childNodes.74/@labels.0 /0/@diagram/@childNodes.77/@labels.0 /0/@diagram/@childNodes.78/@labels.0 /0/@diagram/@childNodes.78/@labels.1 /0/@diagram/@childNodes.80/@labels.0 /0/@diagram/@childNodes.81/@labels.0 /0/@diagram/@childNodes.82/@labels.0 /0/@diagram/@childNodes.84/@labels.0 /0/@diagram/@childNodes.86/@labels.0 /0/@diagram/@childNodes.88/@labels.0 /0/@diagram/@childNodes.89/@labels.0 /0/@diagram/@childNodes.91/@labels.0 /0/@diagram/@childNodes.91/@labels.1 /0/@diagram/@childNodes.92/@labels.1"/> + genExternalNodeLabel="/0/@diagram/@childNodes.75/@labels.0 /0/@diagram/@childNodes.3/@labels.1 /0/@diagram/@childNodes.4/@labels.1 /0/@diagram/@childNodes.5/@labels.1 /0/@diagram/@childNodes.7/@labels.2 /0/@diagram/@childNodes.8/@labels.2 /0/@diagram/@childNodes.9/@labels.1 /0/@diagram/@childNodes.10/@labels.1 /0/@diagram/@childNodes.12/@labels.2 /0/@diagram/@childNodes.13/@labels.2 /0/@diagram/@childNodes.14/@labels.1 /0/@diagram/@childNodes.15/@labels.1 /0/@diagram/@childNodes.17/@labels.2 /0/@diagram/@childNodes.18/@labels.2 /0/@diagram/@childNodes.19/@labels.1 /0/@diagram/@childNodes.20/@labels.1 /0/@diagram/@childNodes.21/@labels.2 /0/@diagram/@childNodes.22/@labels.2 /0/@diagram/@childNodes.23/@labels.1 /0/@diagram/@childNodes.32/@labels.2 /0/@diagram/@childNodes.33/@labels.1 /0/@diagram/@childNodes.34/@labels.1 /0/@diagram/@childNodes.35/@labels.2 /0/@diagram/@childNodes.38/@labels.2 /0/@diagram/@childNodes.39/@labels.2 /0/@diagram/@childNodes.40/@labels.1 /0/@diagram/@childNodes.41/@labels.2 /0/@diagram/@childNodes.42/@labels.2 /0/@diagram/@childNodes.43/@labels.1 /0/@diagram/@childNodes.45/@labels.2 /0/@diagram/@childNodes.46/@labels.2 /0/@diagram/@childNodes.47/@labels.1 /0/@diagram/@childNodes.48/@labels.2 /0/@diagram/@childNodes.49/@labels.2 /0/@diagram/@childNodes.50/@labels.1 /0/@diagram/@childNodes.52/@labels.2 /0/@diagram/@childNodes.53/@labels.1 /0/@diagram/@childNodes.55/@labels.1 /0/@diagram/@childNodes.71/@labels.1 /0/@diagram/@childNodes.74/@labels.1 /0/@diagram/@childNodes.77/@labels.1 /0/@diagram/@childNodes.80/@labels.1 /0/@diagram/@childNodes.81/@labels.1 /0/@diagram/@childNodes.82/@labels.1 /0/@diagram/@childNodes.84/@labels.1 /0/@diagram/@childNodes.86/@labels.1 /0/@diagram/@childNodes.88/@labels.1 /0/@diagram/@childNodes.89/@labels.1 /0/@diagram/@childNodes.91/@labels.2 /0/@diagram/@childNodes.63/@labels.0 /0/@diagram/@childNodes.61/@labels.1 /0/@diagram/@childNodes.62/@labels.1 /0/@diagram/@childNodes.63/@labels.1 /0/@diagram/@childNodes.66/@labels.1 /0/@diagram/@childNodes.53/@labels.0 /0/@diagram/@childNodes.7/@labels.0 /0/@diagram/@childNodes.7/@labels.1 /0/@diagram/@childNodes.8/@labels.0 /0/@diagram/@childNodes.8/@labels.1 /0/@diagram/@childNodes.9/@labels.0 /0/@diagram/@childNodes.10/@labels.0 /0/@diagram/@childNodes.12/@labels.0 /0/@diagram/@childNodes.12/@labels.1 /0/@diagram/@childNodes.13/@labels.0 /0/@diagram/@childNodes.13/@labels.1 /0/@diagram/@childNodes.14/@labels.0 /0/@diagram/@childNodes.15/@labels.0 /0/@diagram/@childNodes.17/@labels.0 /0/@diagram/@childNodes.17/@labels.1 /0/@diagram/@childNodes.18/@labels.0 /0/@diagram/@childNodes.18/@labels.1 /0/@diagram/@childNodes.19/@labels.0 /0/@diagram/@childNodes.20/@labels.0 /0/@diagram/@childNodes.21/@labels.0 /0/@diagram/@childNodes.21/@labels.1 /0/@diagram/@childNodes.22/@labels.0 /0/@diagram/@childNodes.22/@labels.1 /0/@diagram/@childNodes.23/@labels.0 /0/@diagram/@childNodes.32/@labels.1 /0/@diagram/@childNodes.35/@labels.1 /0/@diagram/@childNodes.36/@labels.1 /0/@diagram/@childNodes.38/@labels.0 /0/@diagram/@childNodes.38/@labels.1 /0/@diagram/@childNodes.39/@labels.0 /0/@diagram/@childNodes.39/@labels.1 /0/@diagram/@childNodes.40/@labels.0 /0/@diagram/@childNodes.41/@labels.0 /0/@diagram/@childNodes.41/@labels.1 /0/@diagram/@childNodes.42/@labels.0 /0/@diagram/@childNodes.42/@labels.1 /0/@diagram/@childNodes.43/@labels.0 /0/@diagram/@childNodes.45/@labels.0 /0/@diagram/@childNodes.45/@labels.1 /0/@diagram/@childNodes.46/@labels.0 /0/@diagram/@childNodes.46/@labels.1 /0/@diagram/@childNodes.47/@labels.0 /0/@diagram/@childNodes.48/@labels.0 /0/@diagram/@childNodes.48/@labels.1 /0/@diagram/@childNodes.49/@labels.0 /0/@diagram/@childNodes.49/@labels.1 /0/@diagram/@childNodes.50/@labels.0 /0/@diagram/@childNodes.52/@labels.1 /0/@diagram/@childNodes.55/@labels.0 /0/@diagram/@childNodes.61/@labels.0 /0/@diagram/@childNodes.62/@labels.0 /0/@diagram/@childNodes.66/@labels.0 /0/@diagram/@childNodes.71/@labels.0 /0/@diagram/@childNodes.74/@labels.0 /0/@diagram/@childNodes.77/@labels.0 /0/@diagram/@childNodes.78/@labels.0 /0/@diagram/@childNodes.78/@labels.1 /0/@diagram/@childNodes.80/@labels.0 /0/@diagram/@childNodes.81/@labels.0 /0/@diagram/@childNodes.82/@labels.0 /0/@diagram/@childNodes.84/@labels.0 /0/@diagram/@childNodes.86/@labels.0 /0/@diagram/@childNodes.88/@labels.0 /0/@diagram/@childNodes.89/@labels.0 /0/@diagram/@childNodes.91/@labels.0 /0/@diagram/@childNodes.91/@labels.1 /0/@diagram/@childNodes.92/@labels.1 /0/@diagram/@childNodes.95/@labels.0 /0/@diagram/@childNodes.95/@labels.1 /0/@diagram/@childNodes.96/@labels.0 /0/@diagram/@childNodes.96/@labels.1 /0/@diagram/@childNodes.97/@labels.0 /0/@diagram/@childNodes.97/@labels.1 /0/@diagram/@childNodes.97/@labels.2 /0/@diagram/@childNodes.98/@labels.0 /0/@diagram/@childNodes.98/@labels.1 /0/@diagram/@childNodes.98/@labels.2 /0/@diagram/@childNodes.99/@labels.0 /0/@diagram/@childNodes.99/@labels.1 /0/@diagram/@childNodes.100/@labels.0 /0/@diagram/@childNodes.100/@labels.1 /0/@diagram/@childNodes.100/@labels.2 /0/@diagram/@childNodes.101/@labels.0 /0/@diagram/@childNodes.101/@labels.1 /0/@diagram/@childNodes.101/@labels.2"/> <extensionNodes xsi:type="papyrusgmfgenextension:GenerateUsingElementTypeCreationCommand"/> </papyrusgmfgenextension:PapyrusExtensionRootNode> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.properties b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.properties index 8e765925e3b..4f53bf993ab 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.properties +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.properties @@ -154,3 +154,11 @@ metatype.name.OutputPin_3111=OutputPin metatype.name.InputPin_3105=InputPin metatype.name.Constraint_3112=Constraint metatype.name.ConstraintConstrainedElement_4007=Undefined +metatype.name.StartObjectBehaviorAction_3113=StartObjectBehaviourAction +metatype.name.OutputPin_3125=OutputPin +metatype.name.InputPin_3132=InputPin +metatype.name.ValuePin_3145=ValuePin +metatype.name.ActionInputPin_3158=ActionInputPin +metatype.name.InputPin_3133=InputPin +metatype.name.ValuePin_3146=ValuePin +metatype.name.ActionInputPin_3159=ActionInputPin diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml index c5e974a36cf..d003f90d007 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/plugin.xml @@ -64,20 +64,6 @@ label="UML Activity Diagram"> </creationCommand> </extension> - - - <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders"> - <modelingAssistantProvider - class="org.eclipse.papyrus.uml.diagram.activity.providers.UMLModelingAssistantProvider"> - <Priority - name="Lowest"> - </Priority> - </modelingAssistantProvider> - </extension> - - <?gmfgen generated="true"?> - - <?gmfgen generated="true"?> <extension point="org.eclipse.ui.preferencePages" id="prefpages"> <?gmfgen generated="true"?> @@ -180,7 +166,7 @@ <viewProvider class="org.eclipse.papyrus.uml.diagram.activity.providers.UMLViewProvider"> <Priority name="Lowest"/> <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="PapyrusUMLActivityDiagram"/> - <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2001,3001,3002,3003,3004,3005,3006,3007,3015,3016,3013,3014,3008,3017,3018,3019,3020,3010,3021,3022,3023,3024,3025,3026,3027,3034,3035,3036,3037,3032,3033,3011,3012,3038,3039,3040,3041,3078,3042,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3060,3061,3062,3059,3063,3064,3076,3077,3069,3070,3074,3075,3071,3109,3110,3111,3073,3065,3105,3067,3068,3080,3081,3084,3083,3086,3087,3085,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3112"/> + <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints="2001,3001,3002,3003,3004,3005,3006,3007,3015,3016,3013,3014,3008,3017,3018,3019,3020,3010,3021,3022,3023,3024,3025,3026,3027,3034,3035,3036,3037,3032,3033,3011,3012,3038,3039,3040,3041,3078,3042,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3060,3061,3062,3059,3063,3064,3076,3077,3069,3070,3074,3075,3071,3109,3110,3111,3073,3065,3105,3067,3068,3080,3081,3084,3083,3086,3087,3085,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3112,3113,3125,3132,3145,3158,3133,3146,3159"/> <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints="4001,4002,4003,4004,4005,4006,4007"/> </viewProvider> </extension> @@ -193,13 +179,13 @@ <method name="getType()" value="PapyrusUMLActivityDiagram"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes"> - <method name="getType()" value="2001,3001,3002,3003,3004,3005,3006,3007,3015,3016,3013,3014,3008,3017,3018,3019,3020,3010,3021,3022,3023,3024,3025,3026,3027,3034,3035,3036,3037,3032,3033,3011,3012,3038,3039,3040,3041,3078,3042,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3060,3061,3062,3059,3063,3064,3076,3077,3069,3070,3074,3075,3071,3109,3110,3111,3073,3065,3105,3067,3068,3080,3081,3084,3083,3086,3087,3085,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3112"/> + <method name="getType()" value="2001,3001,3002,3003,3004,3005,3006,3007,3015,3016,3013,3014,3008,3017,3018,3019,3020,3010,3021,3022,3023,3024,3025,3026,3027,3034,3035,3036,3037,3032,3033,3011,3012,3038,3039,3040,3041,3078,3042,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3060,3061,3062,3059,3063,3064,3076,3077,3069,3070,3074,3075,3071,3109,3110,3111,3073,3065,3105,3067,3068,3080,3081,3084,3083,3086,3087,3085,3088,3089,3090,3091,3092,3093,3094,3095,3096,3097,3098,3099,3100,3101,3102,3103,3104,3112,3113,3125,3132,3145,3158,3133,3146,3159"/> </object> <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links"> <method name="getType()" value="4001,4002,4003,4004,4005,4006,4007"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels"> - <method name="getType()" value="5001,5002,6034,5080,6033,5081,6035,5082,5003,6028,5011,5024,5083,5012,5025,5084,5009,5085,5010,5086,5004,6029,5013,5026,5087,5014,5027,5088,5015,5089,5016,5090,5006,6020,5017,5028,5091,5018,5029,5092,5019,5093,5020,5094,5021,5030,5095,5022,5031,5096,5023,5097,5038,5130,5039,5131,5040,5132,5041,5133,5036,5134,5037,5135,5007,5136,5008,5137,6036,5043,5098,6037,5099,6038,5100,6039,5042,5101,5127,5128,6031,5059,6027,5049,5050,5102,5051,5052,5103,5053,5104,5054,5055,5105,5056,5057,5106,5058,5107,5060,6032,5061,5062,5108,5063,5064,5109,5065,5110,5072,5073,5111,5074,5075,5112,5076,5113,5071,5078,5079,5115,6040,5077,5114,5126,6026,5124,5125,5119,5120,5121,5184,5185,5186,5183,5187,5188,5123,5117,5178,5179,5118,6016,5138,5139,6025,5144,5145,5142,5143,5148,6024,5146,5147,5129,5153,6023,5149,5150,5151,5152,5160,6019,5154,5155,5156,5157,5158,5159,5163,6022,5161,5162,5166,6021,5164,5165,5171,6018,5167,5168,5169,5170,5175,6017,5172,5173,5174,5176,5177,6030,5189,5190"/> + <method name="getType()" value="5001,5002,6034,5080,6033,5081,6035,5082,5003,6028,5011,5024,5083,5012,5025,5084,5009,5085,5010,5086,5004,6029,5013,5026,5087,5014,5027,5088,5015,5089,5016,5090,5006,6020,5017,5028,5091,5018,5029,5092,5019,5093,5020,5094,5021,5030,5095,5022,5031,5096,5023,5097,5038,5130,5039,5131,5040,5132,5041,5133,5036,5134,5037,5135,5007,5136,5008,5137,6036,5043,5098,6037,5099,6038,5100,6039,5042,5101,5127,5128,6031,5059,6027,5049,5050,5102,5051,5052,5103,5053,5104,5054,5055,5105,5056,5057,5106,5058,5107,5060,6032,5061,5062,5108,5063,5064,5109,5065,5110,5072,5073,5111,5074,5075,5112,5076,5113,5071,5078,5079,5115,6040,5077,5114,5126,6026,5124,5125,5119,5120,5121,5184,5185,5186,5183,5187,5188,5123,5117,5178,5179,5118,6016,5138,5139,6025,5144,5145,5142,5143,5148,6024,5146,5147,5129,5153,6023,5149,5150,5151,5152,5160,6019,5154,5155,5156,5157,5158,5159,5163,6022,5161,5162,5166,6021,5164,5165,5171,6018,5167,5168,5169,5170,5175,6017,5172,5173,5174,5176,5177,6030,5189,5190,5191,5394,5203,5204,5217,5218,5245,5246,5247,5263,5264,5265,5219,5220,5248,5249,5250,5266,5267,5268"/> </object> <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments"> <method name="getType()" value="7001,7002,7003,7004,7008,7009,7010,7012,7005,7006,7007,7014,7015,7016,7013"/> @@ -1080,6 +1066,78 @@ </metamodel> <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.StartObjectBehaviorAction_3113" + name="%metatype.name.StartObjectBehaviorAction_3113" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.StartObjectBehaviorAction"/> + <param name="semanticHint" value="3113"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.OutputPin_3125" + name="%metatype.name.OutputPin_3125" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.OutputPin"/> + <param name="semanticHint" value="3125"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.InputPin_3132" + name="%metatype.name.InputPin_3132" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.InputPin"/> + <param name="semanticHint" value="3132"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.ValuePin_3145" + name="%metatype.name.ValuePin_3145" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.ValuePin"/> + <param name="semanticHint" value="3145"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3158" + name="%metatype.name.ActionInputPin_3158" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.ActionInputPin"/> + <param name="semanticHint" value="3158"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.InputPin_3133" + name="%metatype.name.InputPin_3133" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.InputPin"/> + <param name="semanticHint" value="3133"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.ValuePin_3146" + name="%metatype.name.ValuePin_3146" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.ValuePin"/> + <param name="semanticHint" value="3146"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType + id="org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3159" + name="%metatype.name.ActionInputPin_3159" + kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> + <specializes id="org.eclipse.papyrus.uml.ActionInputPin"/> + <param name="semanticHint" value="3159"/> + </specializationType> + </metamodel> + <metamodel nsURI="http://www.eclipse.org/uml2/5.0.0/UML"> + <specializationType id="org.eclipse.papyrus.uml.diagram.activity.ActionLocalPrecondition_4001" name="%metatype.name.ActionLocalPrecondition_4001" kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"> @@ -1243,6 +1301,14 @@ <elementType ref="org.eclipse.papyrus.uml.diagram.activity.InputPin_3103"/> <elementType ref="org.eclipse.papyrus.uml.diagram.activity.CentralBufferNode_3104"/> <elementType ref="org.eclipse.papyrus.uml.diagram.activity.Constraint_3112"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.StartObjectBehaviorAction_3113"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.OutputPin_3125"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.InputPin_3132"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ValuePin_3145"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3158"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.InputPin_3133"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ValuePin_3146"/> + <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3159"/> <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ActionLocalPrecondition_4001"/> <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ActionLocalPostcondition_4002"/> <elementType ref="org.eclipse.papyrus.uml.diagram.activity.ObjectFlow_4003"/> @@ -2941,6 +3007,16 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]> </entry> <entry defineOnly="true" + description="Create a Start Object Behaviour Action" + id="createStartObjectBehaviourAction6CreationTool" + kind="tool" + label="Start Object Behaviour Action " + large_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/StartObjectBehaviorAction.gif" + path="" + small_icon="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/StartObjectBehaviorAction.gif"> + </entry> + <entry + defineOnly="true" description="Create a Create Object Action" id="createCreateObjectAction1CreationTool" kind="tool" @@ -3567,6 +3643,10 @@ self.structuralFeature.oclAsType(Property).opposite.type = self.object.type]]> id="createSendSignalAction5CreationTool" path="/createNodes1Group/InvocationActionsGroup"> </predefinedEntry> + <predefinedEntry + id="createStartObjectBehaviourAction6CreationTool" + path="/createNodes1Group/InvocationActionsGroup"> + </predefinedEntry> <entry description="ObjectActions" id="createObjectActionsGroup" diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInStartObjectBehaviorActionAsArgumentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInStartObjectBehaviorActionAsArgumentCreateCommand.java new file mode 100644 index 00000000000..cfbeca54b7a --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInStartObjectBehaviorActionAsArgumentCreateCommand.java @@ -0,0 +1,101 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.ActionInputPin; +import org.eclipse.uml2.uml.InvocationAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ActionPinInStartObjectBehaviorActionAsArgumentCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsArgumentCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + InvocationAction qualifiedTarget = (InvocationAction) target; + qualifiedTarget.getArguments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ActionInputPin_3159(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ActionInputPin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInStartObjectBehaviorActionAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInStartObjectBehaviorActionAsObjectCreateCommand.java new file mode 100644 index 00000000000..9a55668c583 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ActionPinInStartObjectBehaviorActionAsObjectCreateCommand.java @@ -0,0 +1,105 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.ActionInputPin; +import org.eclipse.uml2.uml.StartObjectBehaviorAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class ActionPinInStartObjectBehaviorActionAsObjectCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + StartObjectBehaviorAction container = (StartObjectBehaviorAction) getElementToEdit(); + if (container.getObject() != null) { + return false; + } + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getActionInputPin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ActionInputPin newElement = UMLFactory.eINSTANCE.createActionInputPin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + StartObjectBehaviorAction qualifiedTarget = (StartObjectBehaviorAction) target; + qualifiedTarget.setObject(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ActionInputPin_3158(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ActionInputPin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInStartObjectBehaviorActionAsArgumentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInStartObjectBehaviorActionAsArgumentCreateCommand.java new file mode 100644 index 00000000000..99e19e9136d --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInStartObjectBehaviorActionAsArgumentCreateCommand.java @@ -0,0 +1,101 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.InputPin; +import org.eclipse.uml2.uml.InvocationAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class InputPinInStartObjectBehaviorActionAsArgumentCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public InputPinInStartObjectBehaviorActionAsArgumentCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + InputPin newElement = UMLFactory.eINSTANCE.createInputPin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + InvocationAction qualifiedTarget = (InvocationAction) target; + qualifiedTarget.getArguments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_InputPin_3133(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(InputPin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInStartObjectBehaviorActionAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInStartObjectBehaviorActionAsObjectCreateCommand.java new file mode 100644 index 00000000000..e88665aff45 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/InputPinInStartObjectBehaviorActionAsObjectCreateCommand.java @@ -0,0 +1,105 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.InputPin; +import org.eclipse.uml2.uml.StartObjectBehaviorAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class InputPinInStartObjectBehaviorActionAsObjectCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public InputPinInStartObjectBehaviorActionAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + StartObjectBehaviorAction container = (StartObjectBehaviorAction) getElementToEdit(); + if (container.getObject() != null) { + return false; + } + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getInputPin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + InputPin newElement = UMLFactory.eINSTANCE.createInputPin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + StartObjectBehaviorAction qualifiedTarget = (StartObjectBehaviorAction) target; + qualifiedTarget.setObject(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_InputPin_3132(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(InputPin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInStartObjectBehaviorActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInStartObjectBehaviorActionCreateCommand.java new file mode 100644 index 00000000000..acd465c8d4c --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/OutputPinInStartObjectBehaviorActionCreateCommand.java @@ -0,0 +1,101 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.CallAction; +import org.eclipse.uml2.uml.OutputPin; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class OutputPinInStartObjectBehaviorActionCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public OutputPinInStartObjectBehaviorActionCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getOutputPin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + OutputPin newElement = UMLFactory.eINSTANCE.createOutputPin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + CallAction qualifiedTarget = (CallAction) target; + qualifiedTarget.getResults().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_OutputPin_3125(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(OutputPin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/StartObjectBehavoiurActionCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/StartObjectBehavoiurActionCreateCommand.java new file mode 100644 index 00000000000..f001a5f7c8e --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/StartObjectBehavoiurActionCreateCommand.java @@ -0,0 +1,101 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.Activity; +import org.eclipse.uml2.uml.StartObjectBehaviorAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class StartObjectBehavoiurActionCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public StartObjectBehavoiurActionCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getStartObjectBehaviorAction()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + StartObjectBehaviorAction newElement = UMLFactory.eINSTANCE.createStartObjectBehaviorAction(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + Activity qualifiedTarget = (Activity) target; + qualifiedTarget.getOwnedNodes().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_StartObjectBehaviorAction_3113(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(StartObjectBehaviorAction newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInStartObjectBehaviorActionAsArgumentCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInStartObjectBehaviorActionAsArgumentCreateCommand.java new file mode 100644 index 00000000000..c07fac9fe40 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInStartObjectBehaviorActionAsArgumentCreateCommand.java @@ -0,0 +1,101 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.InvocationAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValuePin; + +/** + * @generated + */ +public class ValuePinInStartObjectBehaviorActionAsArgumentCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsArgumentCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ValuePin newElement = UMLFactory.eINSTANCE.createValuePin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + InvocationAction qualifiedTarget = (InvocationAction) target; + qualifiedTarget.getArguments().add(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ValuePin_3146(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ValuePin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInStartObjectBehaviorActionAsObjectCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInStartObjectBehaviorActionAsObjectCreateCommand.java new file mode 100644 index 00000000000..74ea426d5d6 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/commands/ValuePinInStartObjectBehaviorActionAsObjectCreateCommand.java @@ -0,0 +1,105 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.commands; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gmf.runtime.common.core.command.CommandResult; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand; +import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.notation.Diagram; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.viewpoints.policy.ModelAddData; +import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker; +import org.eclipse.papyrus.uml.diagram.activity.providers.ElementInitializers; +import org.eclipse.uml2.uml.StartObjectBehaviorAction; +import org.eclipse.uml2.uml.UMLFactory; +import org.eclipse.uml2.uml.UMLPackage; +import org.eclipse.uml2.uml.ValuePin; + +/** + * @generated + */ +public class ValuePinInStartObjectBehaviorActionAsObjectCreateCommand extends EditElementCommand { + + /** + * @generated + */ + private Diagram diagram = null; + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsObjectCreateCommand(CreateElementRequest req, Diagram diagram) { + super(req.getLabel(), null, req); + this.diagram = diagram; + } + + /** + * FIXME: replace with setElementToEdit() + * + * @generated + */ + protected EObject getElementToEdit() { + EObject container = ((CreateElementRequest) getRequest()).getContainer(); + if (container instanceof View) { + container = ((View) container).getElement(); + } + return container; + } + + /** + * @generated + */ + public boolean canExecute() { + StartObjectBehaviorAction container = (StartObjectBehaviorAction) getElementToEdit(); + if (container.getObject() != null) { + return false; + } + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target.eClass(), UMLPackage.eINSTANCE.getValuePin()); + return data.isPermitted(); + } + + /** + * @generated + */ + protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + ValuePin newElement = UMLFactory.eINSTANCE.createValuePin(); + EObject target = getElementToEdit(); + ModelAddData data = PolicyChecker.getCurrent().getChildAddData(diagram, target, newElement); + if (data.isPermitted()) { + if (data.isPathDefined()) { + if (!data.execute(target, newElement)) { + return CommandResult.newErrorCommandResult("Failed to follow the policy-specified for the insertion of the new element"); + } + } else { + StartObjectBehaviorAction qualifiedTarget = (StartObjectBehaviorAction) target; + qualifiedTarget.setObject(newElement); + } + } else { + return CommandResult.newErrorCommandResult("The active policy restricts the addition of this element"); + } + ElementInitializers.getInstance().init_ValuePin_3145(newElement); + doConfigure(newElement, monitor, info); + ((CreateElementRequest) getRequest()).setNewElement(newElement); + return CommandResult.newOKCommandResult(newElement); + } + + /** + * @generated + */ + protected void doConfigure(ValuePin newElement, IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + IElementType elementType = ((CreateElementRequest) getRequest()).getElementType(); + ConfigureRequest configureRequest = new ConfigureRequest(getEditingDomain(), newElement, elementType); + configureRequest.setClientContext(((CreateElementRequest) getRequest()).getClientContext()); + configureRequest.addParameters(getRequest().getParameters()); + ICommand configureCommand = elementType.getEditCommand(configureRequest); + if (configureCommand != null && configureCommand.canExecute()) { + configureCommand.execute(monitor, info); + } + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..e5b698c5ed6 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +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 ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5268; + + /** + * @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.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart(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(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + 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.ActionInputPin_3159, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentEditPart.java new file mode 100644 index 00000000000..4ec771a08e5 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentEditPart.java @@ -0,0 +1,255 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +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.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.gef.ui.figures.NodeFigure; +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.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActionPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class ActionPinInStartObjectBehaviorActionAsArgumentEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3159; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsArgumentEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ActionPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // 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 ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.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 (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure + * + * @generated + */ + public PinFigure getPrimaryShape() { + return (PinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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() { + NodeFigure figure = createNodePlate(); + figure.setLayoutManager(new StackLayout()); + IFigure shape = createNodeShape(); + figure.add(shape); + contentPane = setupContentPane(shape); + return figure; + } + + /** + * 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) { + 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(ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.java new file mode 100644 index 00000000000..c9819d8c9a8 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5266; + + /** + * @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.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart(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.ActionInputPin_3159, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart.java new file mode 100644 index 00000000000..e5faeb06999 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5267; + + /** + * @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.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart(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.ActionInputPin_3159, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..72d3335cdc0 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +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 ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5265; + + /** + * @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.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart(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(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + 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.ActionInputPin_3158, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectEditPart.java new file mode 100644 index 00000000000..a97eed949b8 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectEditPart.java @@ -0,0 +1,255 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +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.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.gef.ui.figures.NodeFigure; +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.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActionPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class ActionPinInStartObjectBehaviorActionAsObjectEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3158; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsObjectEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ActionPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // 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 ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.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 (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure + * + * @generated + */ + public PinFigure getPrimaryShape() { + return (PinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ActionPinInStartObjectBehaviorActionAsObjectValueEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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() { + NodeFigure figure = createNodePlate(); + figure.setLayoutManager(new StackLayout()); + IFigure shape = createNodeShape(); + figure.add(shape); + contentPane = setupContentPane(shape); + return figure; + } + + /** + * 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) { + 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(ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.java new file mode 100644 index 00000000000..e4fa71c319e --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5263; + + /** + * @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.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart(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.ActionInputPin_3158, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectValueEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectValueEditPart.java new file mode 100644 index 00000000000..217b26ec744 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActionPinInStartObjectBehaviorActionAsObjectValueEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 ActionPinInStartObjectBehaviorActionAsObjectValueEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5264; + + /** + * @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.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsObjectValueEditPart(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.ActionInputPin_3158, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsObjectValueEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityContentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityContentCompartmentEditPart.java index 82327785c90..7dadcdafbe9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityContentCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityContentCompartmentEditPart.java @@ -36,8 +36,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomActivityActi import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomDiagramDragDropEditPolicy; import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated @@ -67,7 +67,7 @@ public class ActivityActivityContentCompartmentEditPart extends ShapeCompartment * @generated NOT (remove the top border) */ public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure(); + ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); result.setTitleVisibility(false); // remove the top border result.setBorder(null); @@ -83,8 +83,8 @@ public class ActivityActivityContentCompartmentEditPart extends ShapeCompartment installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy()); installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); - //in Papyrus diagrams are not strongly synchronised - //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityContentCompartmentCanonicalEditPolicy()); + // in Papyrus diagrams are not strongly synchronised + // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityContentCompartmentCanonicalEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); installEditPolicy(EditPolicyRoles.CREATION_ROLE, new ActivityParameterNodeInCompartmentCreationEditPolicy()); installEditPolicy("RemoveOrphanView", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ @@ -96,7 +96,7 @@ public class ActivityActivityContentCompartmentEditPart extends ShapeCompartment * @generated */ protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -113,7 +113,7 @@ public class ActivityActivityContentCompartmentEditPart extends ShapeCompartment */ protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -123,13 +123,13 @@ public class ActivityActivityContentCompartmentEditPart extends ShapeCompartment * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityParametersCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityParametersCompartmentEditPart.java index 37efce8c1b0..bc4908b2dae 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityParametersCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityParametersCompartmentEditPart.java @@ -32,8 +32,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityPa import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityParametersCompartmentItemSemanticEditPolicy; import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated @@ -70,7 +70,7 @@ public class ActivityActivityParametersCompartmentEditPart extends ListCompartme * @generated NOT (remove the top border) */ public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure(); + ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); result.setTitleVisibility(false); // remove the top border result.setBorder(null); @@ -86,8 +86,8 @@ public class ActivityActivityParametersCompartmentEditPart extends ListCompartme installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy()); installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); - //in Papyrus diagrams are not strongly synchronised - //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityParametersCompartmentCanonicalEditPolicy()); + // in Papyrus diagrams are not strongly synchronised + // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityParametersCompartmentCanonicalEditPolicy()); installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ActivityActivityParametersCompartmentCanonicalEditPolicy()); installEditPolicy("RemoveOrphanView", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ } @@ -96,7 +96,7 @@ public class ActivityActivityParametersCompartmentEditPart extends ListCompartme * @generated */ protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -113,7 +113,7 @@ public class ActivityActivityParametersCompartmentEditPart extends ListCompartme */ protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -123,13 +123,13 @@ public class ActivityActivityParametersCompartmentEditPart extends ListCompartme * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityPostConditionsCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityPostConditionsCompartmentEditPart.java index 5b697b09197..399da7a9172 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityPostConditionsCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityPostConditionsCompartmentEditPart.java @@ -32,8 +32,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityPo import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityPostConditionsCompartmentItemSemanticEditPolicy; import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated @@ -70,7 +70,7 @@ public class ActivityActivityPostConditionsCompartmentEditPart extends ListCompa * @generated NOT (remove the top border) */ public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure(); + ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); result.setTitleVisibility(false); // remove the top border result.setBorder(null); @@ -86,8 +86,8 @@ public class ActivityActivityPostConditionsCompartmentEditPart extends ListCompa installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy()); installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); - //in Papyrus diagrams are not strongly synchronised - //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityPostConditionsCompartmentCanonicalEditPolicy()); + // in Papyrus diagrams are not strongly synchronised + // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityPostConditionsCompartmentCanonicalEditPolicy()); installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ActivityActivityPostConditionsCompartmentCanonicalEditPolicy()); installEditPolicy("RemoveOrphanView", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ } @@ -96,7 +96,7 @@ public class ActivityActivityPostConditionsCompartmentEditPart extends ListCompa * @generated */ protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -113,7 +113,7 @@ public class ActivityActivityPostConditionsCompartmentEditPart extends ListCompa */ protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -123,13 +123,13 @@ public class ActivityActivityPostConditionsCompartmentEditPart extends ListCompa * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityPreConditionsCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityPreConditionsCompartmentEditPart.java index 431c510a935..f8a869a85cb 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityPreConditionsCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityActivityPreConditionsCompartmentEditPart.java @@ -34,8 +34,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPo import org.eclipse.papyrus.uml.diagram.activity.part.Messages; 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.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated @@ -72,7 +72,7 @@ public class ActivityActivityPreConditionsCompartmentEditPart extends ListCompar * @generated NOT (remove the top border) */ public IFigure createFigure() { - ResizableCompartmentFigure result = (ResizableCompartmentFigure)super.createFigure(); + ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure(); result.setTitleVisibility(false); // remove the top border result.setBorder(null); @@ -88,8 +88,8 @@ public class ActivityActivityPreConditionsCompartmentEditPart extends ListCompar installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy()); installEditPolicy(PasteEditPolicy.PASTE_ROLE, new PasteEditPolicy()); - //in Papyrus diagrams are not strongly synchronised - //installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityPreConditionsCompartmentCanonicalEditPolicy()); + // in Papyrus diagrams are not strongly synchronised + // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityPreConditionsCompartmentCanonicalEditPolicy()); installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new ActivityActivityPreConditionsCompartmentCanonicalEditPolicy()); installEditPolicy("RemoveOrphanView", new RemoveOrphanViewPolicy()); //$NON-NLS-1$ installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); @@ -99,7 +99,7 @@ public class ActivityActivityPreConditionsCompartmentEditPart extends ListCompar * @generated */ protected void setRatio(Double ratio) { - if(getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { + if (getFigure().getParent().getLayoutManager() instanceof ConstrainedToolbarLayout) { super.setRatio(ratio); } } @@ -116,7 +116,7 @@ public class ActivityActivityPreConditionsCompartmentEditPart extends ListCompar */ protected void handleNotificationEvent(Notification notification) { Object feature = notification.getFeature(); - if(NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { + if (NotationPackage.eINSTANCE.getSize_Width().equals(feature) || NotationPackage.eINSTANCE.getSize_Height().equals(feature) || NotationPackage.eINSTANCE.getLocation_X().equals(feature) || NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) { refreshBounds(); } super.handleNotificationEvent(notification); @@ -126,13 +126,13 @@ public class ActivityActivityPreConditionsCompartmentEditPart extends ListCompar * @generated */ protected void refreshBounds() { - int width = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); - int height = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); + int width = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Width())).intValue(); + int height = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getSize_Height())).intValue(); Dimension size = new Dimension(width, height); - int x = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); - int y = ((Integer)getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); + int x = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_X())).intValue(); + int y = ((Integer) getStructuralFeatureValue(NotationPackage.eINSTANCE.getLocation_Y())).intValue(); Point loc = new Point(x, y); - ((GraphicalEditPart)getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); + ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new Rectangle(loc, size)); } /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNContentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNContentCompartmentEditPart.java index 04d4e79e434..5e741479ff0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNContentCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNContentCompartmentEditPart.java @@ -22,8 +22,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CompartmentXYLayou import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomDiagramDragDropEditPolicy; import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNParametersCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNParametersCompartmentEditPart.java index 6bcfba9f676..773347e459d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNParametersCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNParametersCompartmentEditPart.java @@ -19,8 +19,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityPa import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityCNParametersCompartmentItemSemanticEditPolicy; import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNPostConditionsCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNPostConditionsCompartmentEditPart.java index a55da01f90d..f4e7c47e96b 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNPostConditionsCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNPostConditionsCompartmentEditPart.java @@ -19,8 +19,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityActivityPo import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityCNPostConditionsCompartmentItemSemanticEditPolicy; import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNPreConditionsCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNPreConditionsCompartmentEditPart.java index 479024ee1b7..4d285ade408 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNPreConditionsCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityCNPreConditionsCompartmentEditPart.java @@ -21,8 +21,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPo import org.eclipse.papyrus.uml.diagram.activity.part.Messages; 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.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityDiagramEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityDiagramEditPart.java index a7c60f7aefe..1a58a0cc13f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityDiagramEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityDiagramEditPart.java @@ -18,8 +18,8 @@ import org.eclipse.gmf.runtime.notation.View; import org.eclipse.papyrus.infra.gmfdiag.common.editpart.PapyrusDiagramEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityDiagramItemSemanticEditPolicy; import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityPartitionActivityPartitionContentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityPartitionActivityPartitionContentCompartmentEditPart.java index 924aea595bc..9fe4b6a23c7 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityPartitionActivityPartitionContentCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ActivityPartitionActivityPartitionContentCompartmentEditPart.java @@ -35,8 +35,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ActivityPartitionA import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomActivityPartitionActivityPartitionContentCompartmentItemSemanticEditPolicy; import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ConditionalNodeStructuredActivityNodeContentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ConditionalNodeStructuredActivityNodeContentCompartmentEditPart.java index bafba7f22d9..60aeeddf988 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ConditionalNodeStructuredActivityNodeContentCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ConditionalNodeStructuredActivityNodeContentCompartmentEditPart.java @@ -35,8 +35,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomConditionalN import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ExpansionRegionStructuredActivityNodeContentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ExpansionRegionStructuredActivityNodeContentCompartmentEditPart.java index 87f9eb4141a..f38b00ae6e9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ExpansionRegionStructuredActivityNodeContentCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ExpansionRegionStructuredActivityNodeContentCompartmentEditPart.java @@ -35,8 +35,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ExpansionRegionStr import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..bcd0caeb9dd --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +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 InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5220; + + /** + * @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.activity.edit.parts.InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart(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(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + 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.InputPin_3133, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsArgumentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsArgumentEditPart.java new file mode 100644 index 00000000000..25619e8f208 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsArgumentEditPart.java @@ -0,0 +1,251 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +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.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.gef.ui.figures.NodeFigure; +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.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.InputPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class InputPinInStartObjectBehaviorActionAsArgumentEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3133; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public InputPinInStartObjectBehaviorActionAsArgumentEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InputPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // 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 InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID: + case InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.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 (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new InputPinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure + * + * @generated + */ + public InputPinFigure getPrimaryShape() { + return (InputPinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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() { + NodeFigure figure = createNodePlate(); + figure.setLayoutManager(new StackLayout()); + IFigure shape = createNodeShape(); + figure.add(shape); + contentPane = setupContentPane(shape); + return figure; + } + + /** + * 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) { + 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(InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.java new file mode 100644 index 00000000000..7b6d7b687c6 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5219; + + /** + * @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.activity.edit.parts.InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart(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.InputPin_3133, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..9e3b5e92e34 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +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 InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5218; + + /** + * @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.activity.edit.parts.InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart(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(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + 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.InputPin_3132, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsObjectEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsObjectEditPart.java new file mode 100644 index 00000000000..78ca4ab290e --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsObjectEditPart.java @@ -0,0 +1,251 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +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.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.gef.ui.figures.NodeFigure; +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.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.InputPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class InputPinInStartObjectBehaviorActionAsObjectEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3132; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public InputPinInStartObjectBehaviorActionAsObjectEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new InputPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // 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 InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID: + case InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.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 (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new InputPinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.InputPinFigure + * + * @generated + */ + public InputPinFigure getPrimaryShape() { + return (InputPinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof InputPinInStartObjectBehaviorActionAsObjectLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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() { + NodeFigure figure = createNodePlate(); + figure.setLayoutManager(new StackLayout()); + IFigure shape = createNodeShape(); + figure.add(shape); + contentPane = setupContentPane(shape); + return figure; + } + + /** + * 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) { + 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(InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.java new file mode 100644 index 00000000000..df760f7ee16 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 InputPinInStartObjectBehaviorActionAsObjectLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5217; + + /** + * @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.activity.edit.parts.InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public InputPinInStartObjectBehaviorActionAsObjectLabelEditPart(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.InputPin_3132, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentEditPart.java index d3897c3929d..cc7305ff0b9 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentEditPart.java @@ -37,8 +37,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.InterruptibleActiv import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/LoopNodeStructuredActivityNodeContentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/LoopNodeStructuredActivityNodeContentCompartmentEditPart.java index b6ae5061ebc..603e4a5e5cc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/LoopNodeStructuredActivityNodeContentCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/LoopNodeStructuredActivityNodeContentCompartmentEditPart.java @@ -36,8 +36,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.LoopNodeStructured import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..2bd148fed78 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart.java @@ -0,0 +1,788 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +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 OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5204; + + /** + * @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.activity.edit.parts.OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart(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(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + 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.OutputPin_3125, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInStartObjectBehaviorActionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInStartObjectBehaviorActionEditPart.java new file mode 100644 index 00000000000..150cdb41eeb --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInStartObjectBehaviorActionEditPart.java @@ -0,0 +1,251 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +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.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.gef.ui.figures.NodeFigure; +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.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OutputPinInStartObjectBehaviorActionItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.OutputPinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class OutputPinInStartObjectBehaviorActionEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3125; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public OutputPinInStartObjectBehaviorActionEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new OutputPinInStartObjectBehaviorActionItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // 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 OutputPinInStartObjectBehaviorActionLabelEditPart.VISUAL_ID: + case OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart.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 (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new OutputPinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.OutputPinFigure + * + * @generated + */ + public OutputPinFigure getPrimaryShape() { + return (OutputPinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof OutputPinInStartObjectBehaviorActionLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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() { + NodeFigure figure = createNodePlate(); + figure.setLayoutManager(new StackLayout()); + IFigure shape = createNodeShape(); + figure.add(shape); + contentPane = setupContentPane(shape); + return figure; + } + + /** + * 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) { + 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(OutputPinInStartObjectBehaviorActionLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInStartObjectBehaviorActionLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInStartObjectBehaviorActionLabelEditPart.java new file mode 100644 index 00000000000..93a3f6a936f --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/OutputPinInStartObjectBehaviorActionLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 OutputPinInStartObjectBehaviorActionLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5203; + + /** + * @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.activity.edit.parts.OutputPinInStartObjectBehaviorActionLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public OutputPinInStartObjectBehaviorActionLabelEditPart(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.OutputPin_3125, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInStartObjectBehaviorActionLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/SequenceNodeStructuredActivityNodeContentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/SequenceNodeStructuredActivityNodeContentCompartmentEditPart.java index 07f381da912..0aadf36f8d1 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/SequenceNodeStructuredActivityNodeContentCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/SequenceNodeStructuredActivityNodeContentCompartmentEditPart.java @@ -36,8 +36,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPo import org.eclipse.papyrus.uml.diagram.activity.edit.policies.SequenceNodeStructuredActivityNodeContentCompartmentItemSemanticEditPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StartObjectBehaviorActionFloatingNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StartObjectBehaviorActionFloatingNameEditPart.java new file mode 100644 index 00000000000..da7dfa6937a --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StartObjectBehaviorActionFloatingNameEditPart.java @@ -0,0 +1,786 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 StartObjectBehaviorActionFloatingNameEditPart extends FloatingLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5394; + + /** + * @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.activity.edit.parts.StartObjectBehaviorActionFloatingNameEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public StartObjectBehaviorActionFloatingNameEditPart(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()); + 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.StartObjectBehaviorAction_3113, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartObjectBehaviorActionFloatingNameEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StartObjectBehaviorActionNameEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StartObjectBehaviorActionNameEditPart.java new file mode 100644 index 00000000000..76a68f118dc --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StartObjectBehaviorActionNameEditPart.java @@ -0,0 +1,797 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 StartObjectBehaviorActionNameEditPart extends PapyrusCompartmentEditPart implements ITextAwareEditPart, IControlParserForDirectEdit { + + /** + * @generated + */ + public static final int VISUAL_ID = 5191; + + /** + * @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 StartObjectBehaviorActionNameEditPart(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.StartObjectBehaviorAction_3113, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartObjectBehaviorActionNameEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StartObjectBehavoiurActionEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StartObjectBehavoiurActionEditPart.java new file mode 100644 index 00000000000..8b5c6a594a9 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StartObjectBehavoiurActionEditPart.java @@ -0,0 +1,396 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.RequestConstants; +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.DragDropEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; +import org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator; +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.Edge; +import org.eclipse.gmf.runtime.notation.NotationPackage; +import org.eclipse.gmf.runtime.notation.View; +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.activity.edit.policies.ActivityDiagramChangeStereotypedShapeEditpolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CreateActionLocalConditionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.CustomDiagramDragDropEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.DeleteActionViewEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.StartObjectBehavoiurActionItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.locator.PinPositionLocator; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +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.BorderItemResizableEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.ChangeStereotypedShapeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.figure.node.PapyrusRoundedNodeFigure; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class StartObjectBehavoiurActionEditPart extends RoundedCompartmentEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3113; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public StartObjectBehavoiurActionEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + installEditPolicy(EditPolicyRoles.CREATION_ROLE, new PapyrusCreationEditPolicy()); + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new StartObjectBehavoiurActionItemSemanticEditPolicy()); + installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy()); + // in Papyrus diagrams are not strongly synchronised + // installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new org.eclipse.papyrus.uml.diagram.activity.edit.policies.StartObjectBehavoiurActionCanonicalEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(RequestConstants.REQ_CREATE, new CreateActionLocalConditionEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new DeleteActionViewEditPolicy()); + installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeNodeLabelDisplayEditPolicy()); + installEditPolicy(ChangeStereotypedShapeEditPolicy.CHANGE_SHAPE_POLICY, new ActivityDiagramChangeStereotypedShapeEditpolicy()); + installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new CustomDiagramDragDropEditPolicy()); + // 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 StartObjectBehaviorActionFloatingNameEditPart.VISUAL_ID: + return new BorderItemSelectionEditPolicy() { + + @Override + protected List<?> createSelectionHandles() { + MoveHandle mh = new MoveHandle((GraphicalEditPart) getHost()); + mh.setBorder(null); + return Collections.singletonList(mh); + } + }; + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return new BorderItemResizableEditPolicy(); + } + 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 (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PapyrusRoundedNodeFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.common.figure.node.RoundedCompartmentFigure + * + * @generated + */ + public PapyrusRoundedNodeFigure getPrimaryShape() { + return (PapyrusRoundedNodeFigure) primaryShape; + } + + /** + * @generated + */ + protected boolean addFixedChild(EditPart childEditPart) { + if (childEditPart instanceof StartObjectBehaviorActionNameEditPart) { + ((StartObjectBehaviorActionNameEditPart) childEditPart).setLabel(getPrimaryShape().getNameLabel()); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof OutputPinInStartObjectBehaviorActionEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.EAST); + getBorderedFigure().getBorderItemContainer().add(((OutputPinInStartObjectBehaviorActionEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof InputPinInStartObjectBehaviorActionAsObjectEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((InputPinInStartObjectBehaviorActionAsObjectEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof ValuePinInStartObjectBehaviorActionAsObjectEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((ValuePinInStartObjectBehaviorActionAsObjectEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof ActionPinInStartObjectBehaviorActionAsObjectEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((ActionPinInStartObjectBehaviorActionAsObjectEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof InputPinInStartObjectBehaviorActionAsArgumentEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((InputPinInStartObjectBehaviorActionAsArgumentEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof ValuePinInStartObjectBehaviorActionAsArgumentEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((ValuePinInStartObjectBehaviorActionAsArgumentEditPart) childEditPart).getFigure(), locator); + return true; + } + // Papyrus Gencode :Affixed Pin locator for Actions + if (childEditPart instanceof ActionPinInStartObjectBehaviorActionAsArgumentEditPart) { + IBorderItemLocator locator = new PinPositionLocator(getMainFigure(), PositionConstants.NONE); + getBorderedFigure().getBorderItemContainer().add(((ActionPinInStartObjectBehaviorActionAsArgumentEditPart) childEditPart).getFigure(), locator); + return true; + } + return false; + } + + /** + * @generated + */ + protected boolean removeFixedChild(EditPart childEditPart) { + if (childEditPart instanceof StartObjectBehaviorActionNameEditPart) { + return true; + } + if (childEditPart instanceof OutputPinInStartObjectBehaviorActionEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((OutputPinInStartObjectBehaviorActionEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof InputPinInStartObjectBehaviorActionAsObjectEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((InputPinInStartObjectBehaviorActionAsObjectEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof ValuePinInStartObjectBehaviorActionAsObjectEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((ValuePinInStartObjectBehaviorActionAsObjectEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof ActionPinInStartObjectBehaviorActionAsObjectEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((ActionPinInStartObjectBehaviorActionAsObjectEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof InputPinInStartObjectBehaviorActionAsArgumentEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((InputPinInStartObjectBehaviorActionAsArgumentEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof ValuePinInStartObjectBehaviorActionAsArgumentEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((ValuePinInStartObjectBehaviorActionAsArgumentEditPart) childEditPart).getFigure()); + return true; + } + if (childEditPart instanceof ActionPinInStartObjectBehaviorActionAsArgumentEditPart) { + getBorderedFigure().getBorderItemContainer().remove(((ActionPinInStartObjectBehaviorActionAsArgumentEditPart) childEditPart).getFigure()); + 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 StartObjectBehaviorActionFloatingNameEditPart) { + 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(40, 40); + 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(StartObjectBehaviorActionNameEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StructuredActivityNodeStructuredActivityNodeContentCompartmentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StructuredActivityNodeStructuredActivityNodeContentCompartmentEditPart.java index 7d18ddba4ec..4ad9776d75c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StructuredActivityNodeStructuredActivityNodeContentCompartmentEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/StructuredActivityNodeStructuredActivityNodeContentCompartmentEditPart.java @@ -36,8 +36,8 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.policies.RemoveOrphanViewPo import org.eclipse.papyrus.uml.diagram.activity.edit.policies.StructuredActivityNodeStructuredActivityNodeContentCompartmentItemSemanticEditPolicy; import org.eclipse.papyrus.uml.diagram.activity.part.Messages; import org.eclipse.papyrus.uml.diagram.common.editpolicies.CustomContainerEditPolicy; -import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; import org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.PasteEditPolicy; /** * @generated diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/UMLEditPartFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/UMLEditPartFactory.java index b13233752b9..16c13f45b0c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/UMLEditPartFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/UMLEditPartFactory.java @@ -621,6 +621,62 @@ public class UMLEditPartFactory implements EditPartFactory { return new ConstraintNameEditPartCN(view); case ConstraintBodyEditPartCN.VISUAL_ID: return new ConstraintBodyEditPartCN(view); + case StartObjectBehavoiurActionEditPart.VISUAL_ID: + return new StartObjectBehavoiurActionEditPart(view); + case StartObjectBehaviorActionNameEditPart.VISUAL_ID: + return new StartObjectBehaviorActionNameEditPart(view); + case StartObjectBehaviorActionFloatingNameEditPart.VISUAL_ID: + return new StartObjectBehaviorActionFloatingNameEditPart(view); + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + return new OutputPinInStartObjectBehaviorActionEditPart(view); + case OutputPinInStartObjectBehaviorActionLabelEditPart.VISUAL_ID: + return new OutputPinInStartObjectBehaviorActionLabelEditPart(view); + case OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart.VISUAL_ID: + return new OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart(view); + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return new InputPinInStartObjectBehaviorActionAsObjectEditPart(view); + case InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID: + return new InputPinInStartObjectBehaviorActionAsObjectLabelEditPart(view); + case InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart(view); + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return new ValuePinInStartObjectBehaviorActionAsObjectEditPart(view); + case ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID: + return new ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart(view); + case ValuePinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID: + return new ValuePinInStartObjectBehaviorActionAsObjectValueEditPart(view); + case ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart(view); + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return new ActionPinInStartObjectBehaviorActionAsObjectEditPart(view); + case ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID: + return new ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart(view); + case ActionPinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID: + return new ActionPinInStartObjectBehaviorActionAsObjectValueEditPart(view); + case ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return new ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart(view); + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return new InputPinInStartObjectBehaviorActionAsArgumentEditPart(view); + case InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID: + return new InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart(view); + case InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID: + return new InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart(view); + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return new ValuePinInStartObjectBehaviorActionAsArgumentEditPart(view); + case ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID: + return new ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart(view); + case ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID: + return new ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart(view); + case ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID: + return new ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart(view); + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return new ActionPinInStartObjectBehaviorActionAsArgumentEditPart(view); + case ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID: + return new ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart(view); + case ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID: + return new ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart(view); + case ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID: + return new ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart(view); case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: return new ActivityActivityParametersCompartmentEditPart(view); case ActivityActivityPreConditionsCompartmentEditPart.VISUAL_ID: diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..fabb3204206 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +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 ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5250; + + /** + * @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.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart(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(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + 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.ValuePin_3146, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentEditPart.java new file mode 100644 index 00000000000..7aaec7c724c --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentEditPart.java @@ -0,0 +1,255 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +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.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.gef.ui.figures.NodeFigure; +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.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ValuePinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class ValuePinInStartObjectBehaviorActionAsArgumentEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3146; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsArgumentEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ValuePinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // 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 ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.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 (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure + * + * @generated + */ + public PinFigure getPrimaryShape() { + return (PinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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() { + NodeFigure figure = createNodePlate(); + figure.setLayoutManager(new StackLayout()); + IFigure shape = createNodeShape(); + figure.add(shape); + contentPane = setupContentPane(shape); + return figure; + } + + /** + * 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) { + 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(ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.java new file mode 100644 index 00000000000..e775977e39c --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5248; + + /** + * @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.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart(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.ValuePin_3146, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart.java new file mode 100644 index 00000000000..2ff03bdb87d --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5249; + + /** + * @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.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart(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.ValuePin_3146, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.java new file mode 100644 index 00000000000..dca3210a821 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.java @@ -0,0 +1,789 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +import org.eclipse.papyrus.uml.diagram.common.directedit.MultilineLabelDirectEditManager; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeExternalNodeEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.AppliedStereotypeLabelDisplayEditPolicy; +import org.eclipse.papyrus.uml.diagram.common.editpolicies.IDirectEdition; +import org.eclipse.papyrus.uml.diagram.common.figure.node.AppliedStereotypeWrappingLabelFigure; +import org.eclipse.papyrus.uml.diagram.common.figure.node.ILabelFigure; +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 ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5247; + + /** + * @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.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart(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(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeExternalNodeEditPolicy()); + 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.ValuePin_3145, getParserElement(), + UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 AppliedStereotypeWrappingLabelFigure(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectEditPart.java new file mode 100644 index 00000000000..b378f318240 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectEditPart.java @@ -0,0 +1,255 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.parts; + +import java.util.Collections; +import java.util.List; + +import org.eclipse.draw2d.IFigure; +import org.eclipse.draw2d.StackLayout; +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.RequestConstants; +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.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.gef.ui.figures.NodeFigure; +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.figure.node.IPapyrusNodeFigure; +import org.eclipse.papyrus.infra.gmfdiag.common.figure.node.RoundedRectangleNodePlateFigure; +import org.eclipse.papyrus.uml.diagram.activity.edit.part.AbstractPinEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.NoDeleteFromDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.OpenDiagramEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.PinLayoutEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.edit.policies.ValuePinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.common.locator.ExternalLabelPositionLocator; +import org.eclipse.swt.graphics.Color; + +/** + * @generated + */ +public class ValuePinInStartObjectBehaviorActionAsObjectEditPart extends AbstractPinEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 3145; + + /** + * @generated + */ + protected IFigure contentPane; + + /** + * @generated + */ + protected IFigure primaryShape; + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsObjectEditPart(View view) { + super(view); + } + + /** + * @generated + */ + protected void createDefaultEditPolicies() { + super.createDefaultEditPolicies(); + installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy()); + installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ValuePinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy()); + installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy()); + installEditPolicy(EditPolicy.LAYOUT_ROLE, new PinLayoutEditPolicy()); + installEditPolicy(RequestConstants.REQ_DELETE, new NoDeleteFromDiagramEditPolicy()); + // 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 ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.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 (!(notifier instanceof Edge)) { + if (modelChildren.contains(event.getNotifier())) { + return; + } + } + } + super.handleNotificationEvent(event); + } + + /** + * @generated + */ + protected IFigure createNodeShape() { + return primaryShape = new PinFigure(); + } + + /** + * org.eclipse.papyrus.uml.diagram.activity.figures.PinFigure + * + * @generated + */ + public PinFigure getPrimaryShape() { + return (PinFigure) primaryShape; + } + + /** + * @generated + */ + protected void addBorderItem(IFigure borderItemContainer, IBorderItemEditPart borderItemEditPart) { + if (borderItemEditPart instanceof ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ValuePinInStartObjectBehaviorActionAsObjectValueEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else if (borderItemEditPart instanceof ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart) { + IBorderItemLocator locator = new ExternalLabelPositionLocator(getMainFigure()); + borderItemContainer.add(borderItemEditPart.getFigure(), locator); + } else { + super.addBorderItem(borderItemContainer, borderItemEditPart); + } + } + + protected NodeFigure createNodePlate() { + RoundedRectangleNodePlateFigure result = new RoundedRectangleNodePlateFigure(16, 16); + 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() { + NodeFigure figure = createNodePlate(); + figure.setLayoutManager(new StackLayout()); + IFigure shape = createNodeShape(); + figure.add(shape); + contentPane = setupContentPane(shape); + return figure; + } + + /** + * 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) { + 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(ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID)); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.java new file mode 100644 index 00000000000..0a564ea8ee8 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5245; + + /** + * @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.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart(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.ValuePin_3145, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectValueEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectValueEditPart.java new file mode 100644 index 00000000000..58381e51fc8 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/parts/ValuePinInStartObjectBehaviorActionAsObjectValueEditPart.java @@ -0,0 +1,785 @@ +package org.eclipse.papyrus.uml.diagram.activity.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.editpart.PapyrusLabelEditPart; +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.uml.diagram.activity.edit.policies.UMLTextSelectionEditPolicy; +import org.eclipse.papyrus.uml.diagram.activity.figures.SimpleLabel; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLParserProvider; +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.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 ValuePinInStartObjectBehaviorActionAsObjectValueEditPart extends PapyrusLabelEditPart implements ITextAwareEditPart, IBorderItemEditPart { + + /** + * @generated + */ + public static final int VISUAL_ID = 5246; + + /** + * @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.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID), new Point(0, 0)); + } + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsObjectValueEditPart(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.ValuePin_3145, getParserElement(), UMLVisualIDRegistry.getType(org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsObjectValueEditPart.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().eClass().getInstanceClassName()); + } + 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().eClass().getInstanceClassName()); + } else { + configuration = DirectEditorsUtil.findEditorConfiguration(IDirectEditorsIds.UML_LANGUAGE, resolveSemanticElement().eClass().getInstanceClassName()); + } + } + } + + /** + * 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().eClass().getInstanceClassName()); + } else if (IDirectEditorsIds.SIMPLE_DIRECT_EDITOR.equals(languagePreferred)) { + configuration = null; + } + } + + /** + * Performs the direct edit usually used by GMF editors. + * + * @param theRequest + * the direct edit request that starts the direct edit system + * @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 SimpleLabel(); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy.java new file mode 100644 index 00000000000..8fe3e1a809e --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class ActionPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy() { + super(UMLElementTypes.ActionInputPin_3159); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + return null; + } + + /** + * Returns command to reorient EClass based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + switch (getVisualID(req)) { + case ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy.java new file mode 100644 index 00000000000..b2c204ea1ec --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActionPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class ActionPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ActionPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy() { + super(UMLElementTypes.ActionInputPin_3158); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + return null; + } + + /** + * Returns command to reorient EClass based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + switch (getVisualID(req)) { + case ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentCanonicalEditPolicy.java index 9c2765709ab..8f5a05308c0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentCanonicalEditPolicy.java @@ -83,6 +83,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEdi import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartObjectBehavoiurActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StructuredActivityNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPostcondEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPrecondEditPart; @@ -186,6 +187,7 @@ public class ActivityActivityContentCompartmentCanonicalEditPolicy extends Canon case BroadcastSignalActionEditPart.VISUAL_ID: case CentralBufferNodeEditPart.VISUAL_ID: case ConstraintEditPartCN.VISUAL_ID: + case StartObjectBehavoiurActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentItemSemanticEditPolicy.java index bd33399a05b..736a2093ba3 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityActivityContentCompartmentItemSemanticEditPolicy.java @@ -293,6 +293,12 @@ public class ActivityActivityContentCompartmentItemSemanticEditPolicy extends UM req.setContainmentFeature(containmentFeature); return getGEFWrapper(getSemanticCreationCommand(req)); } + if (UMLElementTypes.StartObjectBehaviorAction_3113 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getActivity_OwnedNode(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } return super.getCreateCommand(req); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentCanonicalEditPolicy.java index dc869b69321..0eacf7b510f 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentCanonicalEditPolicy.java @@ -70,6 +70,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEdi import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartObjectBehavoiurActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StructuredActivityNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPostcondEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPrecondEditPart; @@ -190,6 +191,7 @@ public class ActivityCNContentCompartmentCanonicalEditPolicy extends CanonicalEd case BroadcastSignalActionEditPart.VISUAL_ID: case CentralBufferNodeEditPart.VISUAL_ID: case ActivityParameterNodeEditPart.VISUAL_ID: + case StartObjectBehavoiurActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentItemSemanticEditPolicy.java index f1845610db2..d87bd59e30a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityCNContentCompartmentItemSemanticEditPolicy.java @@ -280,6 +280,12 @@ public class ActivityCNContentCompartmentItemSemanticEditPolicy extends UMLBaseI req.setContainmentFeature(containmentFeature); return getGEFWrapper(getSemanticCreationCommand(req)); } + if (UMLElementTypes.StartObjectBehaviorAction_3113 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getActivity_OwnedNode(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } return super.getCreateCommand(req); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityDiagramCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityDiagramCanonicalEditPolicy.java index f7eef8bbb11..609d87785b0 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityDiagramCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityDiagramCanonicalEditPolicy.java @@ -41,102 +41,7 @@ import org.eclipse.gmf.runtime.notation.Edge; import org.eclipse.gmf.runtime.notation.Node; import org.eclipse.gmf.runtime.notation.View; import org.eclipse.gmf.tooling.runtime.update.UpdaterLinkDescriptor; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.AcceptEventActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionInputPinInCallBeActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionInputPinInCallOpActAsTargetEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionInputPinInCallOpActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionInputPinInOpaqueActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionInputPinInSendObjActAsReqEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionInputPinInSendObjActAsTargetEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionInputPinInSendSigActAsTargetEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionInputPinInSendSigActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityDiagramEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityEditPartCN; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityFinalNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityParameterNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActivityPartitionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.AddStructuralFeatureValueActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.AddVariableValueActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.BroadcastSignalActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CallBehaviorActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CallOperationActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CentralBufferNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentEditPartCN; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConditionalNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintAsLocalPostcondEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintAsLocalPrecondEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintEditPartCN; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CreateObjectActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.DataStoreNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.DecisionNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.DestroyObjectActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.DurationConstraintAsLocalPostcondEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.DurationConstraintAsLocalPrecondEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExpansionNodeAsInEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExpansionNodeAsOutEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExpansionRegionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.FlowFinalNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ForkNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InitialNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInAddStructuralFeatureValueActionAsObjectEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInAddStructuralFeatureValueActionAsValueEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInAddVariableValueActionAsInsertAtEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInAddVariableValueActionAsValueEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInBroadcastSignalActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInCallBeActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInCallOpActAsTargetEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInCallOpActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInDestroyObjectActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInLoopNodeAsVariableEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInOpaqueActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInReadStructuralFeatureAsObjectEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInSendObjActAsReqEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInSendObjActAsTargetEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInSendSigActAsTargetEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInSendSigActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InterruptibleActivityRegionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.IntervalConstraintAsLocalPostcondEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.IntervalConstraintAsLocalPrecondEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.JoinNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.LoopNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.MergeNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OpaqueActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInAcceptEventActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInAddStructuralFeatureValueActionAsResultEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInCallBeActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInCallOpActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInCreateObjectActionAsResultEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInLoopNodeAsBodyOutputEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInLoopNodeAsLoopVariableEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInLoopNodeAsResultEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInOpaqueActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInReadStructuralFeatureAsResultEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInReadVariableActionAsResultEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInValSpecActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadSelfActionOutputPinEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadStructuralFeatureActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ShapeNamedElementEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StructuredActivityNodeEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPostcondEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPrecondEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInCallBeActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInCallOpActAsTargetEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInCallOpActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInOpaqueActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInSendObjActAsReqEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInSendObjActAsTargetEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInSendSigActAsTargetEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInSendSigActEditPart; -import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValueSpecificationActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.*; import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramUpdater; import org.eclipse.papyrus.uml.diagram.activity.part.UMLLinkDescriptor; import org.eclipse.papyrus.uml.diagram.activity.part.UMLNodeDescriptor; @@ -1038,6 +943,62 @@ public class ActivityDiagramCanonicalEditPolicy extends CanonicalEditPolicy { domain2NotationMap.putView(view.getElement(), view); break; } + case StartObjectBehavoiurActionEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getStartObjectBehaviorAction_3113ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getOutputPin_3125ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getInputPin_3132ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getValuePin_3145ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getActionInputPin_3158ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getInputPin_3133ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getValuePin_3146ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: { + if (!domain2NotationMap.containsKey(view.getElement())) { + result.addAll(UMLDiagramUpdater.INSTANCE.getActionInputPin_3159ContainedLinks(view)); + } + domain2NotationMap.putView(view.getElement(), view); + break; + } case ObjectFlowEditPart.VISUAL_ID: { if (!domain2NotationMap.containsKey(view.getElement())) { result.addAll(UMLDiagramUpdater.INSTANCE.getObjectFlow_4003ContainedLinks(view)); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPolicy.java index 71c4f5674d5..adafeedbf76 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPolicy.java @@ -81,6 +81,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEdi import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartObjectBehavoiurActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StructuredActivityNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPostcondEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPrecondEditPart; @@ -199,6 +200,7 @@ public class ActivityPartitionActivityPartitionContentCompartmentCanonicalEditPo case CentralBufferNodeEditPart.VISUAL_ID: case CommentEditPartCN.VISUAL_ID: case ConstraintEditPartCN.VISUAL_ID: + case StartObjectBehavoiurActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java index ef32163fc60..3d58f196edf 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java @@ -80,6 +80,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEdi import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartObjectBehavoiurActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StructuredActivityNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPostcondEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPrecondEditPart; @@ -197,6 +198,7 @@ public class ExpansionRegionStructuredActivityNodeContentCompartmentCanonicalEdi case CentralBufferNodeEditPart.VISUAL_ID: case CommentEditPartCN.VISUAL_ID: case ConstraintEditPartCN.VISUAL_ID: + case StartObjectBehavoiurActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy.java new file mode 100644 index 00000000000..5a5f3d5ea58 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class InputPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public InputPinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy() { + super(UMLElementTypes.InputPin_3133); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + return null; + } + + /** + * Returns command to reorient EClass based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + switch (getVisualID(req)) { + case ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy.java new file mode 100644 index 00000000000..2ed8b38130a --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InputPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class InputPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public InputPinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy() { + super(UMLElementTypes.InputPin_3132); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + return null; + } + + /** + * Returns command to reorient EClass based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + switch (getVisualID(req)) { + case ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy.java index 2168dec5f6f..f107f5b302e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentCanonicalEditPolicy.java @@ -80,6 +80,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEdi import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartObjectBehavoiurActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StructuredActivityNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPostcondEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPrecondEditPart; @@ -197,6 +198,7 @@ public class InterruptibleActivityRegionInterruptibleActivityRegionContentCompar case CentralBufferNodeEditPart.VISUAL_ID: case CommentEditPartCN.VISUAL_ID: case ConstraintEditPartCN.VISUAL_ID: + case StartObjectBehavoiurActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentItemSemanticEditPolicy.java index 80a4b0b1c10..77e5035240d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentItemSemanticEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentItemSemanticEditPolicy.java @@ -275,6 +275,12 @@ public class InterruptibleActivityRegionInterruptibleActivityRegionContentCompar req.setContainmentFeature(containmentFeature); return getGEFWrapper(getSemanticCreationCommand(req)); } + if (UMLElementTypes.StartObjectBehaviorAction_3113 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getActivity_OwnedNode(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } return super.getCreateCommand(req); } } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java index d20a827ffb5..00bc9f0a291 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java @@ -80,6 +80,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEdi import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartObjectBehavoiurActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StructuredActivityNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPostcondEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPrecondEditPart; @@ -197,6 +198,7 @@ public class LoopNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy case CentralBufferNodeEditPart.VISUAL_ID: case CommentEditPartCN.VISUAL_ID: case ConstraintEditPartCN.VISUAL_ID: + case StartObjectBehavoiurActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/OutputPinInStartObjectBehaviorActionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/OutputPinInStartObjectBehaviorActionItemSemanticEditPolicy.java new file mode 100644 index 00000000000..e5fa37ce8e6 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/OutputPinInStartObjectBehaviorActionItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class OutputPinInStartObjectBehaviorActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public OutputPinInStartObjectBehaviorActionItemSemanticEditPolicy() { + super(UMLElementTypes.OutputPin_3125); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + return null; + } + + /** + * Returns command to reorient EClass based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + switch (getVisualID(req)) { + case ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java index ba544beae20..aafeffd0fcd 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java @@ -80,6 +80,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEdi import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartObjectBehavoiurActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StructuredActivityNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPostcondEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPrecondEditPart; @@ -197,6 +198,7 @@ public class SequenceNodeStructuredActivityNodeContentCompartmentCanonicalEditPo case CentralBufferNodeEditPart.VISUAL_ID: case CommentEditPartCN.VISUAL_ID: case ConstraintEditPartCN.VISUAL_ID: + case StartObjectBehavoiurActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StartObjectBehavoiurActionCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StartObjectBehavoiurActionCanonicalEditPolicy.java new file mode 100644 index 00000000000..7c3e9a13dc6 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StartObjectBehavoiurActionCanonicalEditPolicy.java @@ -0,0 +1,227 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.draw2d.geometry.Dimension; +import org.eclipse.draw2d.geometry.Point; +import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.gef.EditPart; +import org.eclipse.gef.commands.Command; +import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; +import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.diagram.ui.commands.SetBoundsCommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.SetViewMutabilityCommand; +import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy; +import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; +import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; +import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; +import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter; +import org.eclipse.gmf.runtime.notation.Bounds; +import org.eclipse.gmf.runtime.notation.Location; +import org.eclipse.gmf.runtime.notation.Node; +import org.eclipse.gmf.runtime.notation.Size; +import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsArgumentEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionPinInStartObjectBehaviorActionAsObjectEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInStartObjectBehaviorActionAsArgumentEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.InputPinInStartObjectBehaviorActionAsObjectEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.OutputPinInStartObjectBehaviorActionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsArgumentEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ValuePinInStartObjectBehaviorActionAsObjectEditPart; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLDiagramUpdater; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLNodeDescriptor; +import org.eclipse.papyrus.uml.diagram.activity.part.UMLVisualIDRegistry; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class StartObjectBehavoiurActionCanonicalEditPolicy extends CanonicalEditPolicy { + + /** + * @generated + */ + private Set<EStructuralFeature> myFeaturesToSynchronize; + + /** + * @generated + */ + protected void refreshOnActivate() { + // Need to activate editpart children before invoking the canonical refresh for EditParts to add event listeners + List<?> c = getHost().getChildren(); + for (int i = 0; i < c.size(); i++) { + ((EditPart) c.get(i)).activate(); + } + super.refreshOnActivate(); + } + + /** + * @generated + */ + protected Set<EStructuralFeature> getFeaturesToSynchronize() { + if (myFeaturesToSynchronize == null) { + myFeaturesToSynchronize = new HashSet<EStructuralFeature>(); + myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getCallAction_Result()); + myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getStartObjectBehaviorAction_Object()); + myFeaturesToSynchronize.add(UMLPackage.eINSTANCE.getInvocationAction_Argument()); + } + return myFeaturesToSynchronize; + } + + /** + * @generated + */ + protected List<EObject> getSemanticChildrenList() { + View viewObject = (View) getHost().getModel(); + LinkedList<EObject> result = new LinkedList<EObject>(); + List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getStartObjectBehaviorAction_3113SemanticChildren(viewObject); + for (UMLNodeDescriptor d : childDescriptors) { + result.add(d.getModelElement()); + } + return result; + } + + /** + * @generated + */ + protected boolean isOrphaned(Collection<EObject> semanticChildren, final View view) { + return isMyDiagramElement(view) && !semanticChildren.contains(view.getElement()); + } + + /** + * @generated + */ + private boolean isMyDiagramElement(View view) { + int visualID = UMLVisualIDRegistry.getVisualID(view); + switch (visualID) { + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return true; + } + return false; + } + + /** + * @generated + */ + protected void refreshSemantic() { + if (resolveSemanticElement() == null) { + return; + } + LinkedList<IAdaptable> createdViews = new LinkedList<IAdaptable>(); + List<UMLNodeDescriptor> childDescriptors = UMLDiagramUpdater.INSTANCE.getStartObjectBehaviorAction_3113SemanticChildren((View) getHost().getModel()); + LinkedList<View> orphaned = new LinkedList<View>(); + // we care to check only views we recognize as ours + LinkedList<View> knownViewChildren = new LinkedList<View>(); + for (View v : getViewChildren()) { + if (isMyDiagramElement(v)) { + knownViewChildren.add(v); + } + } + // alternative to #cleanCanonicalSemanticChildren(getViewChildren(), semanticChildren) + HashMap<UMLNodeDescriptor, LinkedList<View>> potentialViews = new HashMap<UMLNodeDescriptor, LinkedList<View>>(); + // + // iteration happens over list of desired semantic elements, trying to find best matching View, while original CEP + // iterates views, potentially losing view (size/bounds) information - i.e. if there are few views to reference same EObject, only last one + // to answer isOrphaned == true will be used for the domain element representation, see #cleanCanonicalSemanticChildren() + for (Iterator<UMLNodeDescriptor> descriptorsIterator = childDescriptors.iterator(); descriptorsIterator.hasNext();) { + UMLNodeDescriptor next = descriptorsIterator.next(); + String hint = UMLVisualIDRegistry.getType(next.getVisualID()); + LinkedList<View> perfectMatch = new LinkedList<View>(); // both semanticElement and hint match that of NodeDescriptor + LinkedList<View> potentialMatch = new LinkedList<View>(); // semanticElement matches, hint does not + for (View childView : getViewChildren()) { + EObject semanticElement = childView.getElement(); + if (next.getModelElement().equals(semanticElement)) { + if (hint.equals(childView.getType())) { + perfectMatch.add(childView); + // actually, can stop iteration over view children here, but + // may want to use not the first view but last one as a 'real' match (the way original CEP does + // with its trick with viewToSemanticMap inside #cleanCanonicalSemanticChildren + } else { + potentialMatch.add(childView); + } + } + } + if (perfectMatch.size() > 0) { + descriptorsIterator.remove(); // precise match found no need to create anything for the NodeDescriptor + // use only one view (first or last?), keep rest as orphaned for further consideration + knownViewChildren.remove(perfectMatch.getFirst()); + } else if (potentialMatch.size() > 0) { + potentialViews.put(next, potentialMatch); + } + } + // those left in knownViewChildren are subject to removal - they are our diagram elements we didn't find match to, + // or those we have potential matches to, and thus need to be recreated, preserving size/location information. + orphaned.addAll(knownViewChildren); + // + CompositeTransactionalCommand boundsCommand = new CompositeTransactionalCommand(host().getEditingDomain(), DiagramUIMessages.SetLocationCommand_Label_Resize); + ArrayList<CreateViewRequest.ViewDescriptor> viewDescriptors = new ArrayList<CreateViewRequest.ViewDescriptor>(childDescriptors.size()); + for (UMLNodeDescriptor next : childDescriptors) { + String hint = UMLVisualIDRegistry.getType(next.getVisualID()); + IAdaptable elementAdapter = new CanonicalElementAdapter(next.getModelElement(), hint); + CreateViewRequest.ViewDescriptor descriptor = new CreateViewRequest.ViewDescriptor(elementAdapter, Node.class, hint, ViewUtil.APPEND, false, host().getDiagramPreferencesHint()); + viewDescriptors.add(descriptor); + LinkedList<View> possibleMatches = potentialViews.get(next); + if (possibleMatches != null) { + // from potential matches, leave those that were not eventually used for some other NodeDescriptor (i.e. those left as orphaned) + possibleMatches.retainAll(knownViewChildren); + } + if (possibleMatches != null && !possibleMatches.isEmpty()) { + View originalView = possibleMatches.getFirst(); + knownViewChildren.remove(originalView); // remove not to copy properties of the same view again and again + // add command to copy properties + if (originalView instanceof Node) { + if (((Node) originalView).getLayoutConstraint() instanceof Bounds) { + Bounds b = (Bounds) ((Node) originalView).getLayoutConstraint(); + boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Rectangle(b.getX(), b.getY(), b.getWidth(), b.getHeight()))); + } else if (((Node) originalView).getLayoutConstraint() instanceof Location) { + Location l = (Location) ((Node) originalView).getLayoutConstraint(); + boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Point(l.getX(), l.getY()))); + } else if (((Node) originalView).getLayoutConstraint() instanceof Size) { + Size s = (Size) ((Node) originalView).getLayoutConstraint(); + boundsCommand.add(new SetBoundsCommand(boundsCommand.getEditingDomain(), boundsCommand.getLabel(), descriptor, new Dimension(s.getWidth(), s.getHeight()))); + } + } + } + } + boolean changed = deleteViews(orphaned.iterator()); + // + CreateViewRequest request = getCreateViewRequest(viewDescriptors); + Command cmd = getCreateViewCommand(request); + if (cmd != null && cmd.canExecute()) { + SetViewMutabilityCommand.makeMutable(new EObjectAdapter(host().getNotationView())).execute(); + executeCommand(cmd); + if (boundsCommand.canExecute()) { + executeCommand(new ICommandProxy(boundsCommand.reduce())); + } + @SuppressWarnings("unchecked") + List<IAdaptable> nl = (List<IAdaptable>) request.getNewObject(); + createdViews.addAll(nl); + } + if (changed || createdViews.size() > 0) { + postProcessRefreshSemantic(createdViews); + } + if (createdViews.size() > 1) { + // perform a layout of the container + DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host()); + executeCommand(new ICommandProxy(layoutCmd)); + } + makeViewsImmutable(createdViews); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StartObjectBehavoiurActionItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StartObjectBehavoiurActionItemSemanticEditPolicy.java new file mode 100644 index 00000000000..0b5f301857e --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StartObjectBehavoiurActionItemSemanticEditPolicy.java @@ -0,0 +1,276 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPostconditionCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPostconditionReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPreconditionCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ActionLocalPreconditionReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionLocalPostconditionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ActionLocalPreconditionEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; +import org.eclipse.uml2.uml.UMLPackage; + +/** + * @generated + */ +public class StartObjectBehavoiurActionItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public StartObjectBehavoiurActionItemSemanticEditPolicy() { + super(UMLElementTypes.StartObjectBehaviorAction_3113); + } + + /** + * @generated + */ + protected Command getCreateCommand(CreateElementRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return super.getCreateCommand(req); + } + if (UMLElementTypes.OutputPin_3125 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getCallAction_Result(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.InputPin_3132 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getStartObjectBehaviorAction_Object(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ValuePin_3145 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getStartObjectBehaviorAction_Object(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ActionInputPin_3158 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getStartObjectBehaviorAction_Object(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.InputPin_3133 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getInvocationAction_Argument(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ValuePin_3146 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getInvocationAction_Argument(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + if (UMLElementTypes.ActionInputPin_3159 == requestElementType) { + // adjust the containment feature + EReference containmentFeature = UMLPackage.eINSTANCE.getInvocationAction_Argument(); + req.setContainmentFeature(containmentFeature); + return getGEFWrapper(getSemanticCreationCommand(req)); + } + return super.getCreateCommand(req); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ActionLocalPrecondition_4001 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ActionLocalPreconditionCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ActionLocalPostcondition_4002 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ActionLocalPostconditionCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ActionLocalPrecondition_4001 == baseElementType) { + return null; + } + if (UMLElementTypes.ActionLocalPostcondition_4002 == baseElementType) { + return null; + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + return null; + } + + /** + * Returns command to reorient EClass based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + switch (getVisualID(req)) { + case ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case ActionLocalPreconditionEditPart.VISUAL_ID: + return getGEFWrapper(new ActionLocalPreconditionReorientCommand(req)); + case ActionLocalPostconditionEditPart.VISUAL_ID: + return getGEFWrapper(new ActionLocalPostconditionReorientCommand(req)); + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StructuredActivityNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StructuredActivityNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java index 4079939c000..b628a949d84 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StructuredActivityNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/StructuredActivityNodeStructuredActivityNodeContentCompartmentCanonicalEditPolicy.java @@ -80,6 +80,7 @@ import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ReadVariableActionEdi import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendObjectActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SendSignalActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.SequenceNodeEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StartObjectBehavoiurActionEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.StructuredActivityNodeEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPostcondEditPart; import org.eclipse.papyrus.uml.diagram.activity.edit.parts.TimeConstraintAsLocalPrecondEditPart; @@ -197,6 +198,7 @@ public class StructuredActivityNodeStructuredActivityNodeContentCompartmentCanon case CentralBufferNodeEditPart.VISUAL_ID: case CommentEditPartCN.VISUAL_ID: case ConstraintEditPartCN.VISUAL_ID: + case StartObjectBehavoiurActionEditPart.VISUAL_ID: return true; } return false; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy.java new file mode 100644 index 00000000000..c6efa70a566 --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class ValuePinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsArgumentItemSemanticEditPolicy() { + super(UMLElementTypes.ValuePin_3146); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + return null; + } + + /** + * Returns command to reorient EClass based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + switch (getVisualID(req)) { + case ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy.java new file mode 100644 index 00000000000..fc23c07e01b --- /dev/null +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/edit/policies/ValuePinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy.java @@ -0,0 +1,192 @@ +package org.eclipse.papyrus.uml.diagram.activity.edit.policies; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.gef.commands.Command; +import org.eclipse.gef.commands.UnexecutableCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; +import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; +import org.eclipse.gmf.runtime.emf.type.core.IElementType; +import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest; +import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest; +import org.eclipse.papyrus.infra.extendedtypes.types.IExtendedHintedElementType; +import org.eclipse.papyrus.infra.extendedtypes.util.ElementTypeUtils; +import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils; +import org.eclipse.papyrus.infra.services.edit.service.IElementEditService; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.CommentLinkReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ConstraintConstrainedElementReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ControlFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ExceptionHandlerReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowCreateCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.commands.ObjectFlowReorientCommand; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.CommentLinkEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ConstraintConstrainedElementEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ControlFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ExceptionHandlerEditPart; +import org.eclipse.papyrus.uml.diagram.activity.edit.parts.ObjectFlowEditPart; +import org.eclipse.papyrus.uml.diagram.activity.providers.UMLElementTypes; + +/** + * @generated + */ +public class ValuePinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy extends UMLBaseItemSemanticEditPolicy { + + /** + * @generated + */ + public ValuePinInStartObjectBehaviorActionAsObjectItemSemanticEditPolicy() { + super(UMLElementTypes.ValuePin_3145); + } + + /** + * @generated + */ + protected Command getDestroyElementCommand(DestroyElementRequest req) { + EObject selectedEObject = req.getElementToDestroy(); + IElementEditService provider = ElementEditServiceUtils.getCommandProvider(selectedEObject); + if (provider != null) { + // Retrieve delete command from the Element Edit service + ICommand deleteCommand = provider.getEditCommand(req); + if (deleteCommand != null) { + return new ICommandProxy(deleteCommand); + } + } + return UnexecutableCommand.INSTANCE; + } + + /** + * @generated + */ + protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedStartCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + return null; + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + return null; + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + return null; + } + return null; + } + + /** + * @generated + */ + protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) { + IElementType requestElementType = req.getElementType(); + if (requestElementType == null) { + return null; + } + IElementType baseElementType = requestElementType; + boolean isExtendedType = false; + if (requestElementType instanceof IExtendedHintedElementType) { + baseElementType = ElementTypeUtils.getClosestDiagramType(requestElementType); + if (baseElementType != null) { + isExtendedType = true; + } else { + // no reference element type ID. using the closest super element type to give more opportunities, but can lead to bugs. + baseElementType = ElementTypeUtils.findClosestNonExtendedElementType((IExtendedHintedElementType) requestElementType); + isExtendedType = true; + } + } + if (UMLElementTypes.ObjectFlow_4003 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ObjectFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ControlFlow_4004 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ControlFlowCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ExceptionHandler_4005 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ExceptionHandlerCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.CommentAnnotatedElement_4006 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new CommentLinkCreateCommand(req, req.getSource(), req.getTarget())); + } + if (UMLElementTypes.ConstraintConstrainedElement_4007 == baseElementType) { + if (isExtendedType) { + return getExtendedCompleteCreateRelationshipCommand(req, (IExtendedHintedElementType) requestElementType); + } + return getGEFWrapper(new ConstraintConstrainedElementCreateCommand(req, req.getSource(), req.getTarget())); + } + return null; + } + + /** + * Returns command to reorient EClass based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) { + switch (getVisualID(req)) { + case ObjectFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ObjectFlowReorientCommand(req)); + case ControlFlowEditPart.VISUAL_ID: + return getGEFWrapper(new ControlFlowReorientCommand(req)); + case ExceptionHandlerEditPart.VISUAL_ID: + return getGEFWrapper(new ExceptionHandlerReorientCommand(req)); + } + return super.getReorientRelationshipCommand(req); + } + + /** + * Returns command to reorient EReference based link. New link target or source + * should be the domain model element associated with this node. + * + * @generated + */ + protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) { + switch (getVisualID(req)) { + case CommentLinkEditPart.VISUAL_ID: + return getGEFWrapper(new CommentLinkReorientCommand(req)); + case ConstraintConstrainedElementEditPart.VISUAL_ID: + return getGEFWrapper(new ConstraintConstrainedElementReorientCommand(req)); + } + return super.getReorientReferenceRelationshipCommand(req); + } +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/expressions/UMLOCLFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/expressions/UMLOCLFactory.java index 0bcfb436cbc..13ae9a62340 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/expressions/UMLOCLFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/expressions/UMLOCLFactory.java @@ -49,7 +49,7 @@ public class UMLOCLFactory { * @generated */ protected UMLOCLFactory() { - this.expressions = new UMLAbstractExpression[87]; + this.expressions = new UMLAbstractExpression[93]; this.expressionBodies = new String[] { "if self.owner.oclIsKindOf(CallOperationAction)\r\nthen self.owner.oclAsType(CallOperationAction).argument->includes(self)\r\nelse false endif", //$NON-NLS-1$ "if self.owner.oclIsKindOf(CallOperationAction)\r\nthen self.owner.oclAsType(CallOperationAction).argument->includes(self)\r\nelse false endif", //$NON-NLS-1$ @@ -138,6 +138,12 @@ public class UMLOCLFactory { "self.result.type =self.variable.type and self.result.isOrdered = self.variable.isOrdered", //$NON-NLS-1$ "(self.result.lowerBound() <= self.variable.lowerBound()) and (self.result.upperBound() >= self.variable.lowerBound())", //$NON-NLS-1$ "((not self.handlerBody.oclIsUndefined()) and (not self.exceptionInput.oclIsUndefined())) implies( let pins : Collection(Element) = self.handlerBody.allOwnedElements()->select(e : Element | e.oclIsKindOf(Pin)) in pins->forAll(e : Element | e.oclIsKindOf(Pin) implies e = self.exceptionInput))", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(InputPin) then self.owner.oclAsType(StartObjectBehaviorAction).argument->includes(self) else false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(InputPin)\r\nthen self.owner.oclAsType(StartObjectBehaviorAction).object = self\r\nelse false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(ValuePin) then self.owner.oclAsType(StartObjectBehaviorAction).argument->includes(self) else false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(ValuePin)\r\nthen self.owner.oclAsType(StartObjectBehaviorAction).object = self\r\nelse false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(ActionInputPin) then self.owner.oclAsType(StartObjectBehaviorAction).argument->includes(self) else false endif", //$NON-NLS-1$ + "if self.owner.oclIsKindOf(StartObjectBehaviorAction) and self.oclIsTypeOf(ActionInputPin)\r\nthen self.owner.oclAsType(StartObjectBehaviorAction).object = self\r\nelse false endif", //$NON-NLS-1$ }; } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/Messages.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/Messages.java index 8aa8b87dba6..066603440ab 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/Messages.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/Messages.java @@ -776,6 +776,16 @@ public class Messages extends NLS { /** * @generated */ + public static String StartObjectBehaviourAction6CreationTool_title; + + /** + * @generated + */ + public static String StartObjectBehaviourAction6CreationTool_desc; + + /** + * @generated + */ public static String CreateObjectAction1CreationTool_title; /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramUpdater.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramUpdater.java index 91ed94d11a6..16da0673033 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramUpdater.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLDiagramUpdater.java @@ -80,6 +80,7 @@ import org.eclipse.uml2.uml.ReadVariableAction; import org.eclipse.uml2.uml.SendObjectAction; import org.eclipse.uml2.uml.SendSignalAction; import org.eclipse.uml2.uml.SequenceNode; +import org.eclipse.uml2.uml.StartObjectBehaviorAction; import org.eclipse.uml2.uml.StructuredActivityNode; import org.eclipse.uml2.uml.TimeConstraint; import org.eclipse.uml2.uml.UMLPackage; @@ -148,6 +149,8 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getAddVariableValueAction_3099SemanticChildren(view); case BroadcastSignalActionEditPart.VISUAL_ID: return getBroadcastSignalAction_3102SemanticChildren(view); + case StartObjectBehavoiurActionEditPart.VISUAL_ID: + return getStartObjectBehaviorAction_3113SemanticChildren(view); case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: return getActivityActivityFigureParameterCompartment_7001SemanticChildren(view); case ActivityActivityPreConditionsCompartmentEditPart.VISUAL_ID: @@ -721,6 +724,55 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ + public List<UMLNodeDescriptor> getStartObjectBehaviorAction_3113SemanticChildren(View view) { + if (!view.isSetElement()) { + return Collections.emptyList(); + } + StartObjectBehaviorAction modelElement = (StartObjectBehaviorAction) view.getElement(); + LinkedList<UMLNodeDescriptor> result = new LinkedList<UMLNodeDescriptor>(); + for (Iterator<?> it = modelElement.getResults().iterator(); it.hasNext();) { + OutputPin childElement = (OutputPin) it.next(); + int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); + if (visualID == OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } + } + { + InputPin childElement = modelElement.getObject(); + int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); + if (visualID == InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + if (visualID == ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + if (visualID == ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + } + } + for (Iterator<?> it = modelElement.getArguments().iterator(); it.hasNext();) { + InputPin childElement = (InputPin) it.next(); + int visualID = UMLVisualIDRegistry.getNodeVisualID(view, childElement); + if (visualID == InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } + if (visualID == ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } + if (visualID == ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID) { + result.add(new UMLNodeDescriptor(childElement, visualID)); + continue; + } + } + return result; + } + + /** + * @generated + */ public List<UMLNodeDescriptor> getActivityActivityFigureParameterCompartment_7001SemanticChildren(View view) { if (false == view.eContainer() instanceof View) { return Collections.emptyList(); @@ -2736,6 +2788,22 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getCentralBufferNode_3104ContainedLinks(view); case ConstraintEditPartCN.VISUAL_ID: return getConstraint_3112ContainedLinks(view); + case StartObjectBehavoiurActionEditPart.VISUAL_ID: + return getStartObjectBehaviorAction_3113ContainedLinks(view); + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + return getOutputPin_3125ContainedLinks(view); + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return getInputPin_3132ContainedLinks(view); + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return getValuePin_3145ContainedLinks(view); + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return getActionInputPin_3158ContainedLinks(view); + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return getInputPin_3133ContainedLinks(view); + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return getValuePin_3146ContainedLinks(view); + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return getActionInputPin_3159ContainedLinks(view); case ObjectFlowEditPart.VISUAL_ID: return getObjectFlow_4003ContainedLinks(view); case ControlFlowEditPart.VISUAL_ID: @@ -2941,6 +3009,22 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getCentralBufferNode_3104IncomingLinks(view); case ConstraintEditPartCN.VISUAL_ID: return getConstraint_3112IncomingLinks(view); + case StartObjectBehavoiurActionEditPart.VISUAL_ID: + return getStartObjectBehaviorAction_3113IncomingLinks(view); + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + return getOutputPin_3125IncomingLinks(view); + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return getInputPin_3132IncomingLinks(view); + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return getValuePin_3145IncomingLinks(view); + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return getActionInputPin_3158IncomingLinks(view); + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return getInputPin_3133IncomingLinks(view); + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return getValuePin_3146IncomingLinks(view); + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return getActionInputPin_3159IncomingLinks(view); case ObjectFlowEditPart.VISUAL_ID: return getObjectFlow_4003IncomingLinks(view); case ControlFlowEditPart.VISUAL_ID: @@ -3146,6 +3230,22 @@ public class UMLDiagramUpdater implements DiagramUpdater { return getCentralBufferNode_3104OutgoingLinks(view); case ConstraintEditPartCN.VISUAL_ID: return getConstraint_3112OutgoingLinks(view); + case StartObjectBehavoiurActionEditPart.VISUAL_ID: + return getStartObjectBehaviorAction_3113OutgoingLinks(view); + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + return getOutputPin_3125OutgoingLinks(view); + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return getInputPin_3132OutgoingLinks(view); + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return getValuePin_3145OutgoingLinks(view); + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return getActionInputPin_3158OutgoingLinks(view); + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return getInputPin_3133OutgoingLinks(view); + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return getValuePin_3146OutgoingLinks(view); + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return getActionInputPin_3159OutgoingLinks(view); case ObjectFlowEditPart.VISUAL_ID: return getObjectFlow_4003OutgoingLinks(view); case ControlFlowEditPart.VISUAL_ID: @@ -3806,6 +3906,67 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ + public List<UMLLinkDescriptor> getStartObjectBehaviorAction_3113ContainedLinks(View view) { + StartObjectBehaviorAction modelElement = (StartObjectBehaviorAction) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPrecondition_4001(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPostcondition_4002(modelElement)); + result.addAll(getContainedTypeModelFacetLinks_ExceptionHandler_4005(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getOutputPin_3125ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3132ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3145ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3158ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3133ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3146ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3159ContainedLinks(View view) { + return Collections.emptyList(); + } + + /** + * @generated + */ public List<UMLLinkDescriptor> getValueSpecificationAction_3076ContainedLinks(View view) { ValueSpecificationAction modelElement = (ValueSpecificationAction) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); @@ -5084,6 +5245,125 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ + public List<UMLLinkDescriptor> getStartObjectBehaviorAction_3113IncomingLinks(View view) { + StartObjectBehaviorAction modelElement = (StartObjectBehaviorAction) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getOutputPin_3125IncomingLinks(View view) { + OutputPin modelElement = (OutputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3132IncomingLinks(View view) { + InputPin modelElement = (InputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3145IncomingLinks(View view) { + ValuePin modelElement = (ValuePin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3158IncomingLinks(View view) { + ActionInputPin modelElement = (ActionInputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3133IncomingLinks(View view) { + InputPin modelElement = (InputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3146IncomingLinks(View view) { + ValuePin modelElement = (ValuePin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3159IncomingLinks(View view) { + ActionInputPin modelElement = (ActionInputPin) view.getElement(); + CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getIncomingTypeModelFacetLinks_ObjectFlow_4003(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ControlFlow_4004(modelElement, crossReferencer)); + result.addAll(getIncomingTypeModelFacetLinks_ExceptionHandler_4005(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Comment_AnnotatedElement_4006(modelElement, crossReferencer)); + result.addAll(getIncomingFeatureModelFacetLinks_Constraint_ConstrainedElement_4007(modelElement, crossReferencer)); + return result; + } + + /** + * @generated + */ public List<UMLLinkDescriptor> getValueSpecificationAction_3076IncomingLinks(View view) { ValueSpecificationAction modelElement = (ValueSpecificationAction) view.getElement(); CrossReferenceAdapter crossReferencer = CrossReferenceAdapter.getCrossReferenceAdapter(view.eResource().getResourceSet()); @@ -6235,6 +6515,97 @@ public class UMLDiagramUpdater implements DiagramUpdater { /** * @generated */ + public List<UMLLinkDescriptor> getStartObjectBehaviorAction_3113OutgoingLinks(View view) { + StartObjectBehaviorAction modelElement = (StartObjectBehaviorAction) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPrecondition_4001(modelElement)); + result.addAll(getOutgoingFeatureModelFacetLinks_Action_LocalPostcondition_4002(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ExceptionHandler_4005(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getOutputPin_3125OutgoingLinks(View view) { + OutputPin modelElement = (OutputPin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3132OutgoingLinks(View view) { + InputPin modelElement = (InputPin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3145OutgoingLinks(View view) { + ValuePin modelElement = (ValuePin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3158OutgoingLinks(View view) { + ActionInputPin modelElement = (ActionInputPin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getInputPin_3133OutgoingLinks(View view) { + InputPin modelElement = (InputPin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getValuePin_3146OutgoingLinks(View view) { + ValuePin modelElement = (ValuePin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ + public List<UMLLinkDescriptor> getActionInputPin_3159OutgoingLinks(View view) { + ActionInputPin modelElement = (ActionInputPin) view.getElement(); + LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); + result.addAll(getOutgoingTypeModelFacetLinks_ObjectFlow_4003(modelElement)); + result.addAll(getOutgoingTypeModelFacetLinks_ControlFlow_4004(modelElement)); + return result; + } + + /** + * @generated + */ public List<UMLLinkDescriptor> getValueSpecificationAction_3076OutgoingLinks(View view) { ValueSpecificationAction modelElement = (ValueSpecificationAction) view.getElement(); LinkedList<UMLLinkDescriptor> result = new LinkedList<UMLLinkDescriptor>(); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLPaletteFactory.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLPaletteFactory.java index 1f58f259b79..6a455f02e82 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLPaletteFactory.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLPaletteFactory.java @@ -226,6 +226,11 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { /** * @generated */ + private final static String CREATESTARTOBJECTBEHAVIOURACTION6CREATIONTOOL = "createStartObjectBehaviourAction6CreationTool";//$NON-NLS-1$ + + /** + * @generated + */ private final static String CREATECREATEOBJECTACTION1CREATIONTOOL = "createCreateObjectAction1CreationTool"; //$NON-NLS-1$ /** @@ -426,6 +431,9 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { if (toolId.equals(CREATESENDSIGNALACTION5CREATIONTOOL)) { return createSendSignalAction5CreationTool(); } + if (toolId.equals(CREATESTARTOBJECTBEHAVIOURACTION6CREATIONTOOL)) { + return createStartObjectBehaviourAction6CreationTool(); + } if (toolId.equals(CREATECREATEOBJECTACTION1CREATIONTOOL)) { return createCreateObjectAction1CreationTool(); } @@ -757,7 +765,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { * @generated */ private Tool createOutputPin1CreationTool() { - List<IElementType> types = new ArrayList<IElementType>(9); + List<IElementType> types = new ArrayList<IElementType>(10); types.add(UMLElementTypes.OutputPin_3014); types.add(UMLElementTypes.OutputPin_3020); types.add(UMLElementTypes.OutputPin_3024); @@ -767,6 +775,7 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { types.add(UMLElementTypes.OutputPin_3109); types.add(UMLElementTypes.OutputPin_3110); types.add(UMLElementTypes.OutputPin_3111); + types.add(UMLElementTypes.OutputPin_3125); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -775,12 +784,14 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { * @generated */ private Tool createInputPin2CreationTool() { - List<IElementType> types = new ArrayList<IElementType>(5); + List<IElementType> types = new ArrayList<IElementType>(7); types.add(UMLElementTypes.InputPin_3013); types.add(UMLElementTypes.InputPin_3019); types.add(UMLElementTypes.InputPin_3023); types.add(UMLElementTypes.InputPin_3055); types.add(UMLElementTypes.InputPin_3105); + types.add(UMLElementTypes.InputPin_3132); + types.add(UMLElementTypes.InputPin_3133); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -789,11 +800,13 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { * @generated */ private Tool createActionInputPin3CreationTool() { - List<IElementType> types = new ArrayList<IElementType>(4); + List<IElementType> types = new ArrayList<IElementType>(6); types.add(UMLElementTypes.ActionInputPin_3016); types.add(UMLElementTypes.ActionInputPin_3018); types.add(UMLElementTypes.ActionInputPin_3021); types.add(UMLElementTypes.ActionInputPin_3053); + types.add(UMLElementTypes.ActionInputPin_3158); + types.add(UMLElementTypes.ActionInputPin_3159); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -802,11 +815,13 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { * @generated */ private Tool createValuePin4CreationTool() { - List<IElementType> types = new ArrayList<IElementType>(4); + List<IElementType> types = new ArrayList<IElementType>(6); types.add(UMLElementTypes.ValuePin_3015); types.add(UMLElementTypes.ValuePin_3017); types.add(UMLElementTypes.ValuePin_3022); types.add(UMLElementTypes.ValuePin_3054); + types.add(UMLElementTypes.ValuePin_3145); + types.add(UMLElementTypes.ValuePin_3146); Tool tool = new AspectUnspecifiedTypeCreationTool(types); return tool; } @@ -894,6 +909,16 @@ public class UMLPaletteFactory extends PaletteFactory.Adapter { /** * @generated */ + private Tool createStartObjectBehaviourAction6CreationTool() { + List<IElementType> types = new ArrayList<IElementType>(1); + types.add(UMLElementTypes.StartObjectBehaviorAction_3113); + Tool tool = new AspectUnspecifiedTypeCreationTool(types); + return tool; + } + + /** + * @generated + */ private Tool createCreateObjectAction1CreationTool() { List<IElementType> types = new ArrayList<IElementType>(1); types.add(UMLElementTypes.CreateObjectAction_3086); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java index 25ad77a0479..bc66b64a387 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/part/UMLVisualIDRegistry.java @@ -313,6 +313,29 @@ public class UMLVisualIDRegistry { return InputPinInBroadcastSignalActionEditPart.VISUAL_ID; } break; + case StartObjectBehavoiurActionEditPart.VISUAL_ID: + if (UMLPackage.eINSTANCE.getOutputPin().isSuperTypeOf(domainElement.eClass())) { + return OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getInputPin().isSuperTypeOf(domainElement.eClass()) && isInputPin_3132((InputPin) domainElement)) { + return InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getValuePin().isSuperTypeOf(domainElement.eClass()) && isValuePin_3145((ValuePin) domainElement)) { + return ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getActionInputPin().isSuperTypeOf(domainElement.eClass()) && isActionInputPin_3158((ActionInputPin) domainElement)) { + return ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getInputPin().isSuperTypeOf(domainElement.eClass()) && isInputPin_3133((InputPin) domainElement)) { + return InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getValuePin().isSuperTypeOf(domainElement.eClass()) && isValuePin_3146((ValuePin) domainElement)) { + return ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID; + } + if (UMLPackage.eINSTANCE.getActionInputPin().isSuperTypeOf(domainElement.eClass()) && isActionInputPin_3159((ActionInputPin) domainElement)) { + return ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID; + } + break; case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getParameter().isSuperTypeOf(domainElement.eClass())) { return ParameterEditPart.VISUAL_ID; @@ -455,6 +478,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getStartObjectBehaviorAction().isSuperTypeOf(domainElement.eClass())) { + return StartObjectBehavoiurActionEditPart.VISUAL_ID; + } break; case ConditionalNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -690,6 +716,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getStartObjectBehaviorAction().isSuperTypeOf(domainElement.eClass())) { + return StartObjectBehavoiurActionEditPart.VISUAL_ID; + } break; case LoopNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -809,6 +838,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getStartObjectBehaviorAction().isSuperTypeOf(domainElement.eClass())) { + return StartObjectBehavoiurActionEditPart.VISUAL_ID; + } break; case SequenceNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -928,6 +960,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getStartObjectBehaviorAction().isSuperTypeOf(domainElement.eClass())) { + return StartObjectBehavoiurActionEditPart.VISUAL_ID; + } break; case StructuredActivityNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1047,6 +1082,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getStartObjectBehaviorAction().isSuperTypeOf(domainElement.eClass())) { + return StartObjectBehavoiurActionEditPart.VISUAL_ID; + } break; case ActivityPartitionActivityPartitionContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1169,6 +1207,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getStartObjectBehaviorAction().isSuperTypeOf(domainElement.eClass())) { + return StartObjectBehavoiurActionEditPart.VISUAL_ID; + } break; case InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getInitialNode().isSuperTypeOf(domainElement.eClass())) { @@ -1288,6 +1329,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getConstraint().isSuperTypeOf(domainElement.eClass())) { return ConstraintEditPartCN.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getStartObjectBehaviorAction().isSuperTypeOf(domainElement.eClass())) { + return StartObjectBehavoiurActionEditPart.VISUAL_ID; + } break; case ActivityCNParametersCompartmentEditPart.VISUAL_ID: if (UMLPackage.eINSTANCE.getParameter().isSuperTypeOf(domainElement.eClass())) { @@ -1431,6 +1475,9 @@ public class UMLVisualIDRegistry { if (UMLPackage.eINSTANCE.getActivityParameterNode().isSuperTypeOf(domainElement.eClass())) { return ActivityParameterNodeEditPart.VISUAL_ID; } + if (UMLPackage.eINSTANCE.getStartObjectBehaviorAction().isSuperTypeOf(domainElement.eClass())) { + return StartObjectBehavoiurActionEditPart.VISUAL_ID; + } break; } return -1; @@ -2663,6 +2710,103 @@ public class UMLVisualIDRegistry { return true; } break; + case StartObjectBehavoiurActionEditPart.VISUAL_ID: + if (StartObjectBehaviorActionNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (StartObjectBehaviorActionFloatingNameEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + if (OutputPinInStartObjectBehaviorActionLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + if (InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + if (ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + if (ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + if (InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + if (ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + if (ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + if (ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID == nodeVisualID) { + return true; + } + break; case ActivityActivityParametersCompartmentEditPart.VISUAL_ID: if (ParameterEditPart.VISUAL_ID == nodeVisualID) { return true; @@ -2805,6 +2949,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (StartObjectBehavoiurActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ConditionalNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -3040,6 +3187,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (StartObjectBehavoiurActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case LoopNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -3159,6 +3309,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (StartObjectBehavoiurActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case SequenceNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -3278,6 +3431,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (StartObjectBehavoiurActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case StructuredActivityNodeStructuredActivityNodeContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -3397,6 +3553,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (StartObjectBehavoiurActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ActivityPartitionActivityPartitionContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -3519,6 +3678,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (StartObjectBehavoiurActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case InterruptibleActivityRegionInterruptibleActivityRegionContentCompartmentEditPart.VISUAL_ID: if (InitialNodeEditPart.VISUAL_ID == nodeVisualID) { @@ -3638,6 +3800,9 @@ public class UMLVisualIDRegistry { if (ConstraintEditPartCN.VISUAL_ID == nodeVisualID) { return true; } + if (StartObjectBehavoiurActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ActivityCNParametersCompartmentEditPart.VISUAL_ID: if (ParameterEditPart.VISUAL_ID == nodeVisualID) { @@ -3781,6 +3946,9 @@ public class UMLVisualIDRegistry { if (ActivityParameterNodeEditPart.VISUAL_ID == nodeVisualID) { return true; } + if (StartObjectBehavoiurActionEditPart.VISUAL_ID == nodeVisualID) { + return true; + } break; case ObjectFlowEditPart.VISUAL_ID: if (ObjectFlowNameEditPart.VISUAL_ID == nodeVisualID) { @@ -4152,6 +4320,54 @@ public class UMLVisualIDRegistry { /** * @generated */ + private static boolean isInputPin_3132(InputPin domainElement) { + Object result = UMLOCLFactory.getExpression(88, UMLPackage.eINSTANCE.getInputPin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isValuePin_3145(ValuePin domainElement) { + Object result = UMLOCLFactory.getExpression(90, UMLPackage.eINSTANCE.getValuePin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isActionInputPin_3158(ActionInputPin domainElement) { + Object result = UMLOCLFactory.getExpression(92, UMLPackage.eINSTANCE.getActionInputPin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isInputPin_3133(InputPin domainElement) { + Object result = UMLOCLFactory.getExpression(87, UMLPackage.eINSTANCE.getInputPin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isValuePin_3146(ValuePin domainElement) { + Object result = UMLOCLFactory.getExpression(89, UMLPackage.eINSTANCE.getValuePin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ + private static boolean isActionInputPin_3159(ActionInputPin domainElement) { + Object result = UMLOCLFactory.getExpression(91, UMLPackage.eINSTANCE.getActionInputPin(), null).evaluate(domainElement); + return result instanceof Boolean && ((Boolean) result).booleanValue(); + } + + /** + * @generated + */ public static boolean checkNodeVisualID(View containerView, EObject domainElement, int candidate) { if (candidate == -1) { // unrecognized id is always bad @@ -4266,6 +4482,13 @@ public class UMLVisualIDRegistry { case OutputPinInLoopNodeAsLoopVariableEditPart.VISUAL_ID: case OutputPinInLoopNodeAsResultEditPart.VISUAL_ID: case ConstraintEditPartCN.VISUAL_ID: + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: return true; default: break; diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/ElementInitializers.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/ElementInitializers.java index 1dd65cc9d37..ff12c45a90d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/ElementInitializers.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/ElementInitializers.java @@ -50,6 +50,7 @@ import org.eclipse.uml2.uml.ReadVariableAction; import org.eclipse.uml2.uml.SendObjectAction; import org.eclipse.uml2.uml.SendSignalAction; import org.eclipse.uml2.uml.SequenceNode; +import org.eclipse.uml2.uml.StartObjectBehaviorAction; import org.eclipse.uml2.uml.StructuredActivityNode; import org.eclipse.uml2.uml.TimeConstraint; import org.eclipse.uml2.uml.TimeInterval; @@ -1429,6 +1430,118 @@ public class ElementInitializers { /** * @generated */ + public void init_StartObjectBehaviorAction_3113(StartObjectBehaviorAction instance) { + try { + Object value_0 = name_StartObjectBehaviorAction_3113(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_OutputPin_3125(OutputPin instance) { + try { + Object value_0 = name_OutputPin_3125(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_InputPin_3132(InputPin instance) { + try { + Object value_0 = name_InputPin_3132(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_ValuePin_3145(ValuePin instance) { + try { + Object value_0 = name_ValuePin_3145(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_ActionInputPin_3158(ActionInputPin instance) { + try { + Object value_0 = name_ActionInputPin_3158(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_InputPin_3133(InputPin instance) { + try { + Object value_0 = name_InputPin_3133(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_ValuePin_3146(ValuePin instance) { + try { + Object value_0 = name_ValuePin_3146(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ + public void init_ActionInputPin_3159(ActionInputPin instance) { + try { + Object value_0 = name_ActionInputPin_3159(instance); + if (value_0 != null) { + instance.setName((String) value_0); + } + } catch (RuntimeException e) { + UMLDiagramEditorPlugin.getInstance().logError("Element initialization failed", e); //$NON-NLS-1$ + } + } + + /** + * @generated + */ public void init_ObjectFlow_4003(ObjectFlow instance) { try { Object value_0 = name_ObjectFlow_4003(instance); @@ -2179,6 +2292,62 @@ public class ElementInitializers { /** * @generated */ + private String name_StartObjectBehaviorAction_3113(StartObjectBehaviorAction it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_OutputPin_3125(OutputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_InputPin_3132(InputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_ValuePin_3145(ValuePin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_ActionInputPin_3158(ActionInputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_InputPin_3133(InputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_ValuePin_3146(ValuePin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ + private String name_ActionInputPin_3159(ActionInputPin it) { + return LabelHelper.INSTANCE.findName(it.eContainer(), it); + } + + /** + * @generated + */ private String name_ObjectFlow_4003(ObjectFlow it) { return LabelHelper.INSTANCE.findName(it.eContainer(), it); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLElementTypes.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLElementTypes.java index d578b281726..07fc2cc6b03 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLElementTypes.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLElementTypes.java @@ -449,6 +449,46 @@ public class UMLElementTypes { /** * @generated */ + public static final IElementType StartObjectBehaviorAction_3113 = getElementType("org.eclipse.papyrus.uml.diagram.activity.StartObjectBehaviorAction_3113"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType OutputPin_3125 = getElementType("org.eclipse.papyrus.uml.diagram.activity.OutputPin_3125"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType InputPin_3132 = getElementType("org.eclipse.papyrus.uml.diagram.activity.InputPin_3132"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType ValuePin_3145 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ValuePin_3145"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType ActionInputPin_3158 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3158"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType InputPin_3133 = getElementType("org.eclipse.papyrus.uml.diagram.activity.InputPin_3133"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType ValuePin_3146 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ValuePin_3146"); //$NON-NLS-1$ + + /** + * @generated + */ + public static final IElementType ActionInputPin_3159 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ActionInputPin_3159"); //$NON-NLS-1$ + + /** + * @generated + */ public static final IElementType ValueSpecificationAction_3076 = getElementType("org.eclipse.papyrus.uml.diagram.activity.ValueSpecificationAction_3076"); //$NON-NLS-1$ /** @@ -704,6 +744,14 @@ public class UMLElementTypes { elements.put(InputPin_3103, UMLPackage.eINSTANCE.getInputPin()); elements.put(CentralBufferNode_3104, UMLPackage.eINSTANCE.getCentralBufferNode()); elements.put(Constraint_3112, UMLPackage.eINSTANCE.getConstraint()); + elements.put(StartObjectBehaviorAction_3113, UMLPackage.eINSTANCE.getStartObjectBehaviorAction()); + elements.put(OutputPin_3125, UMLPackage.eINSTANCE.getOutputPin()); + elements.put(InputPin_3132, UMLPackage.eINSTANCE.getInputPin()); + elements.put(ValuePin_3145, UMLPackage.eINSTANCE.getValuePin()); + elements.put(ActionInputPin_3158, UMLPackage.eINSTANCE.getActionInputPin()); + elements.put(InputPin_3133, UMLPackage.eINSTANCE.getInputPin()); + elements.put(ValuePin_3146, UMLPackage.eINSTANCE.getValuePin()); + elements.put(ActionInputPin_3159, UMLPackage.eINSTANCE.getActionInputPin()); elements.put(ActionLocalPrecondition_4001, UMLPackage.eINSTANCE.getAction_LocalPrecondition()); elements.put(ActionLocalPostcondition_4002, UMLPackage.eINSTANCE.getAction_LocalPostcondition()); elements.put(ObjectFlow_4003, UMLPackage.eINSTANCE.getObjectFlow()); @@ -824,6 +872,14 @@ public class UMLElementTypes { KNOWN_ELEMENT_TYPES.add(InputPin_3103); KNOWN_ELEMENT_TYPES.add(CentralBufferNode_3104); KNOWN_ELEMENT_TYPES.add(Constraint_3112); + KNOWN_ELEMENT_TYPES.add(StartObjectBehaviorAction_3113); + KNOWN_ELEMENT_TYPES.add(OutputPin_3125); + KNOWN_ELEMENT_TYPES.add(InputPin_3132); + KNOWN_ELEMENT_TYPES.add(ValuePin_3145); + KNOWN_ELEMENT_TYPES.add(ActionInputPin_3158); + KNOWN_ELEMENT_TYPES.add(InputPin_3133); + KNOWN_ELEMENT_TYPES.add(ValuePin_3146); + KNOWN_ELEMENT_TYPES.add(ActionInputPin_3159); KNOWN_ELEMENT_TYPES.add(ActionLocalPrecondition_4001); KNOWN_ELEMENT_TYPES.add(ActionLocalPostcondition_4002); KNOWN_ELEMENT_TYPES.add(ObjectFlow_4003); @@ -1032,6 +1088,22 @@ public class UMLElementTypes { return CentralBufferNode_3104; case ConstraintEditPartCN.VISUAL_ID: return Constraint_3112; + case StartObjectBehavoiurActionEditPart.VISUAL_ID: + return StartObjectBehaviorAction_3113; + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + return OutputPin_3125; + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return InputPin_3132; + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return ValuePin_3145; + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return ActionInputPin_3158; + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return InputPin_3133; + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return ValuePin_3146; + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return ActionInputPin_3159; case ActionLocalPreconditionEditPart.VISUAL_ID: return ActionLocalPrecondition_4001; case ActionLocalPostconditionEditPart.VISUAL_ID: diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLParserProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLParserProvider.java index 802b5a2874b..6e568ebd4ad 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLParserProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLParserProvider.java @@ -2538,6 +2538,310 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid /** * @generated */ + private IParser startObjectBehaviorActionName_5191Parser; + + /** + * @generated + */ + private IParser getStartObjectBehaviorActionName_5191Parser() { + if (startObjectBehaviorActionName_5191Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; + MessageFormatParser parser = new MessageFormatParser(features); + startObjectBehaviorActionName_5191Parser = parser; + } + return startObjectBehaviorActionName_5191Parser; + } + + /** + * @generated + */ + private IParser startObjectBehaviorActionName_5394Parser; + + /** + * @generated + */ + private IParser getStartObjectBehaviorActionName_5394Parser() { + if (startObjectBehaviorActionName_5394Parser == null) { + EAttribute[] features = new EAttribute[] { UMLPackage.eINSTANCE.getNamedElement_Name() }; + MessageFormatParser parser = new MessageFormatParser(features); + startObjectBehaviorActionName_5394Parser = parser; + } + return startObjectBehaviorActionName_5394Parser; + } + + /** + * @generated + */ + private PinParser outputPinLabel_5203Parser; + + /** + * @generated + */ + private IParser getOutputPinLabel_5203Parser() { + if (outputPinLabel_5203Parser == null) { + outputPinLabel_5203Parser = new PinParser(); + } + return outputPinLabel_5203Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser outputPinLabel_5204Parser; + + /** + * @generated + */ + private IParser getOutputPinLabel_5204Parser() { + if (outputPinLabel_5204Parser == null) { + outputPinLabel_5204Parser = new AppliedStereotypeParser(); + } + return outputPinLabel_5204Parser; + } + + /** + * @generated + */ + private PinParser inputPinLabel_5217Parser; + + /** + * @generated + */ + private IParser getInputPinLabel_5217Parser() { + if (inputPinLabel_5217Parser == null) { + inputPinLabel_5217Parser = new PinParser(); + } + return inputPinLabel_5217Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser inputPinLabel_5218Parser; + + /** + * @generated + */ + private IParser getInputPinLabel_5218Parser() { + if (inputPinLabel_5218Parser == null) { + inputPinLabel_5218Parser = new AppliedStereotypeParser(); + } + return inputPinLabel_5218Parser; + } + + /** + * @generated + */ + private PinParser valuePinLabel_5245Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5245Parser() { + if (valuePinLabel_5245Parser == null) { + valuePinLabel_5245Parser = new PinParser(); + } + return valuePinLabel_5245Parser; + } + + /** + * @generated + */ + private PinValueParser valuePinLabel_5246Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5246Parser() { + if (valuePinLabel_5246Parser == null) { + valuePinLabel_5246Parser = new PinValueParser(); + } + return valuePinLabel_5246Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser valuePinLabel_5247Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5247Parser() { + if (valuePinLabel_5247Parser == null) { + valuePinLabel_5247Parser = new AppliedStereotypeParser(); + } + return valuePinLabel_5247Parser; + } + + /** + * @generated + */ + private PinParser actionInputPinLabel_5263Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5263Parser() { + if (actionInputPinLabel_5263Parser == null) { + actionInputPinLabel_5263Parser = new PinParser(); + } + return actionInputPinLabel_5263Parser; + } + + /** + * @generated + */ + private PinValueParser actionInputPinLabel_5264Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5264Parser() { + if (actionInputPinLabel_5264Parser == null) { + actionInputPinLabel_5264Parser = new PinValueParser(); + } + return actionInputPinLabel_5264Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser actionInputPinLabel_5265Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5265Parser() { + if (actionInputPinLabel_5265Parser == null) { + actionInputPinLabel_5265Parser = new AppliedStereotypeParser(); + } + return actionInputPinLabel_5265Parser; + } + + /** + * @generated + */ + private PinParser inputPinLabel_5219Parser; + + /** + * @generated + */ + private IParser getInputPinLabel_5219Parser() { + if (inputPinLabel_5219Parser == null) { + inputPinLabel_5219Parser = new PinParser(); + } + return inputPinLabel_5219Parser; + } + + /** + * @generated + */ + private PinValueParser inputPinLabel_5220Parser; + + /** + * @generated + */ + private IParser getInputPinLabel_5220Parser() { + if (inputPinLabel_5220Parser == null) { + inputPinLabel_5220Parser = new PinValueParser(); + } + return inputPinLabel_5220Parser; + } + + /** + * @generated + */ + private PinParser valuePinLabel_5248Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5248Parser() { + if (valuePinLabel_5248Parser == null) { + valuePinLabel_5248Parser = new PinParser(); + } + return valuePinLabel_5248Parser; + } + + /** + * @generated + */ + private PinValueParser valuePinLabel_5249Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5249Parser() { + if (valuePinLabel_5249Parser == null) { + valuePinLabel_5249Parser = new PinValueParser(); + } + return valuePinLabel_5249Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser valuePinLabel_5250Parser; + + /** + * @generated + */ + private IParser getValuePinLabel_5250Parser() { + if (valuePinLabel_5250Parser == null) { + valuePinLabel_5250Parser = new AppliedStereotypeParser(); + } + return valuePinLabel_5250Parser; + } + + /** + * @generated + */ + private PinParser actionInputPinLabel_5266Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5266Parser() { + if (actionInputPinLabel_5266Parser == null) { + actionInputPinLabel_5266Parser = new PinParser(); + } + return actionInputPinLabel_5266Parser; + } + + /** + * @generated + */ + private PinValueParser actionInputPinLabel_5267Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5267Parser() { + if (actionInputPinLabel_5267Parser == null) { + actionInputPinLabel_5267Parser = new PinValueParser(); + } + return actionInputPinLabel_5267Parser; + } + + /** + * @generated + */ + private AppliedStereotypeParser actionInputPinLabel_5268Parser; + + /** + * @generated + */ + private IParser getActionInputPinLabel_5268Parser() { + if (actionInputPinLabel_5268Parser == null) { + actionInputPinLabel_5268Parser = new AppliedStereotypeParser(); + } + return actionInputPinLabel_5268Parser; + } + + /** + * @generated + */ private CommentParser commentBody_5138Parser; /** @@ -3680,6 +3984,46 @@ public class UMLParserProvider extends AbstractProvider implements IParserProvid return getConstraintName_5189Parser(); case ConstraintBodyEditPartCN.VISUAL_ID: return getConstraintSpecification_5190Parser(); + case StartObjectBehaviorActionNameEditPart.VISUAL_ID: + return getStartObjectBehaviorActionName_5191Parser(); + case StartObjectBehaviorActionFloatingNameEditPart.VISUAL_ID: + return getStartObjectBehaviorActionName_5394Parser(); + case OutputPinInStartObjectBehaviorActionLabelEditPart.VISUAL_ID: + return getOutputPinLabel_5203Parser(); + case OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart.VISUAL_ID: + return getOutputPinLabel_5204Parser(); + case InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID: + return getInputPinLabel_5217Parser(); + case InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return getInputPinLabel_5218Parser(); + case ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID: + return getValuePinLabel_5245Parser(); + case ValuePinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID: + return getValuePinLabel_5246Parser(); + case ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return getValuePinLabel_5247Parser(); + case ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID: + return getActionInputPinLabel_5263Parser(); + case ActionPinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID: + return getActionInputPinLabel_5264Parser(); + case ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID: + return getActionInputPinLabel_5265Parser(); + case InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID: + return getInputPinLabel_5219Parser(); + case InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID: + return getInputPinLabel_5220Parser(); + case ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID: + return getValuePinLabel_5248Parser(); + case ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID: + return getValuePinLabel_5249Parser(); + case ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID: + return getValuePinLabel_5250Parser(); + case ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID: + return getActionInputPinLabel_5266Parser(); + case ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID: + return getActionInputPinLabel_5267Parser(); + case ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID: + return getActionInputPinLabel_5268Parser(); case ObjectFlowNameEditPart.VISUAL_ID: return getObjectFlowName_6001Parser(); case ObjectFlowWeightEditPart.VISUAL_ID: diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLViewProvider.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLViewProvider.java index 1ab8fd45c31..85cc0d2811e 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLViewProvider.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.activity/src/org/eclipse/papyrus/uml/diagram/activity/providers/UMLViewProvider.java @@ -277,6 +277,14 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { case InputPinInBroadcastSignalActionEditPart.VISUAL_ID: case CentralBufferNodeEditPart.VISUAL_ID: case ConstraintEditPartCN.VISUAL_ID: + case StartObjectBehavoiurActionEditPart.VISUAL_ID: + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: if (domainElement == null || visualID != UMLVisualIDRegistry.getNodeVisualID(op.getContainerView(), domainElement)) { return false; // visual id in semantic hint should match visual id for domain element } @@ -539,6 +547,22 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { return createCentralBufferNode_3104(domainElement, containerView, index, persisted, preferencesHint); case ConstraintEditPartCN.VISUAL_ID: return createConstraint_3112(domainElement, containerView, index, persisted, preferencesHint); + case StartObjectBehavoiurActionEditPart.VISUAL_ID: + return createStartObjectBehaviorAction_3113(domainElement, containerView, index, persisted, preferencesHint); + case OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID: + return createOutputPin_3125(domainElement, containerView, index, persisted, preferencesHint); + case InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return createInputPin_3132(domainElement, containerView, index, persisted, preferencesHint); + case ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return createValuePin_3145(domainElement, containerView, index, persisted, preferencesHint); + case ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID: + return createActionInputPin_3158(domainElement, containerView, index, persisted, preferencesHint); + case InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return createInputPin_3133(domainElement, containerView, index, persisted, preferencesHint); + case ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return createValuePin_3146(domainElement, containerView, index, persisted, preferencesHint); + case ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID: + return createActionInputPin_3159(domainElement, containerView, index, persisted, preferencesHint); } // can't happen, provided #provides(CreateNodeViewOperation) is correct return null; @@ -2615,6 +2639,230 @@ public class UMLViewProvider extends AbstractProvider implements IViewProvider { /** * @generated */ + public Node createStartObjectBehaviorAction_3113(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle()); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(StartObjectBehavoiurActionEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "StartObjectBehaviourAction"); + Node label5191 = createLabel(node, UMLVisualIDRegistry.getType(StartObjectBehaviorActionNameEditPart.VISUAL_ID)); + Node label5394 = createLabel(node, UMLVisualIDRegistry.getType(StartObjectBehaviorActionFloatingNameEditPart.VISUAL_ID)); + label5394.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5394 = (Location) label5394.getLayoutConstraint(); + location5394.setX(0); + location5394.setY(5); + return node; + } + + /** + * @generated + */ + public Node createOutputPin_3125(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle()); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(OutputPinInStartObjectBehaviorActionEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "OutputPin"); + Node label5203 = createLabel(node, UMLVisualIDRegistry.getType(OutputPinInStartObjectBehaviorActionLabelEditPart.VISUAL_ID)); + label5203.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5203 = (Location) label5203.getLayoutConstraint(); + location5203.setX(0); + location5203.setY(5); + Node label5204 = createLabel(node, UMLVisualIDRegistry.getType(OutputPinInStartObjectBehaviorActionAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5204.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5204 = (Location) label5204.getLayoutConstraint(); + location5204.setX(0); + location5204.setY(5); + return node; + } + + /** + * @generated + */ + public Node createInputPin_3132(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle()); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(InputPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "InputPin"); + Node label5217 = createLabel(node, UMLVisualIDRegistry.getType(InputPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID)); + label5217.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5217 = (Location) label5217.getLayoutConstraint(); + location5217.setX(0); + location5217.setY(5); + Node label5218 = createLabel(node, UMLVisualIDRegistry.getType(InputPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5218.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5218 = (Location) label5218.getLayoutConstraint(); + location5218.setX(0); + location5218.setY(5); + return node; + } + + /** + * @generated + */ + public Node createValuePin_3145(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle()); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(ValuePinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ValuePin"); + Node label5245 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID)); + label5245.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5245 = (Location) label5245.getLayoutConstraint(); + location5245.setX(0); + location5245.setY(5); + Node label5246 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID)); + label5246.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5246 = (Location) label5246.getLayoutConstraint(); + location5246.setX(0); + location5246.setY(5); + Node label5247 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5247.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5247 = (Location) label5247.getLayoutConstraint(); + location5247.setX(0); + location5247.setY(5); + return node; + } + + /** + * @generated + */ + public Node createActionInputPin_3158(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle()); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(ActionPinInStartObjectBehaviorActionAsObjectEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ActionInputPin"); + Node label5263 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInStartObjectBehaviorActionAsObjectLabelEditPart.VISUAL_ID)); + label5263.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5263 = (Location) label5263.getLayoutConstraint(); + location5263.setX(0); + location5263.setY(5); + Node label5264 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInStartObjectBehaviorActionAsObjectValueEditPart.VISUAL_ID)); + label5264.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5264 = (Location) label5264.getLayoutConstraint(); + location5264.setX(0); + location5264.setY(5); + Node label5265 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInStartObjectBehaviorActionAsObjectAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5265.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5265 = (Location) label5265.getLayoutConstraint(); + location5265.setX(0); + location5265.setY(5); + return node; + } + + /** + * @generated + */ + public Node createInputPin_3133(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle()); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(InputPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "InputPin"); + Node label5219 = createLabel(node, UMLVisualIDRegistry.getType(InputPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID)); + label5219.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5219 = (Location) label5219.getLayoutConstraint(); + location5219.setX(0); + location5219.setY(5); + Node label5220 = createLabel(node, UMLVisualIDRegistry.getType(InputPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5220.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5220 = (Location) label5220.getLayoutConstraint(); + location5220.setX(0); + location5220.setY(5); + return node; + } + + /** + * @generated + */ + public Node createValuePin_3146(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle()); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(ValuePinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ValuePin"); + Node label5248 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID)); + label5248.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5248 = (Location) label5248.getLayoutConstraint(); + location5248.setX(0); + location5248.setY(5); + Node label5249 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID)); + label5249.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5249 = (Location) label5249.getLayoutConstraint(); + location5249.setX(0); + location5249.setY(5); + Node label5250 = createLabel(node, UMLVisualIDRegistry.getType(ValuePinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5250.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5250 = (Location) label5250.getLayoutConstraint(); + location5250.setX(0); + location5250.setY(5); + return node; + } + + /** + * @generated + */ + public Node createActionInputPin_3159(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { + Shape node = NotationFactory.eINSTANCE.createShape(); + node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle()); + node.setLayoutConstraint(NotationFactory.eINSTANCE.createBounds()); + node.setType(UMLVisualIDRegistry.getType(ActionPinInStartObjectBehaviorActionAsArgumentEditPart.VISUAL_ID)); + ViewUtil.insertChildView(containerView, node, index, persisted); + node.setElement(domainElement); + // initializeFromPreferences + final IPreferenceStore prefStore = (IPreferenceStore) preferencesHint.getPreferenceStore(); + PreferenceInitializerForElementHelper.initFontStyleFromPrefs(node, prefStore, "ActionInputPin"); + Node label5266 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInStartObjectBehaviorActionAsArgumentLabelEditPart.VISUAL_ID)); + label5266.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5266 = (Location) label5266.getLayoutConstraint(); + location5266.setX(0); + location5266.setY(5); + Node label5267 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInStartObjectBehaviorActionAsArgumentValueEditPart.VISUAL_ID)); + label5267.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5267 = (Location) label5267.getLayoutConstraint(); + location5267.setX(0); + location5267.setY(5); + Node label5268 = createLabel(node, UMLVisualIDRegistry.getType(ActionPinInStartObjectBehaviorActionAsArgumentAppliedStereotypeLabelEditPart.VISUAL_ID)); + label5268.setLayoutConstraint(NotationFactory.eINSTANCE.createLocation()); + Location location5268 = (Location) label5268.getLayoutConstraint(); + location5268.setX(0); + location5268.setY(5); + return node; + } + + /** + * @generated + */ public Node createValueSpecificationAction_3076(EObject domainElement, View containerView, int index, boolean persisted, PreferencesHint preferencesHint) { Shape node = NotationFactory.eINSTANCE.createShape(); node.getStyles().add(NotationFactory.eINSTANCE.createHintedDiagramLinkStyle()); diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen index 72015cebe5a..080bf160b92 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/model/classdiagram.gmfgen @@ -5325,6 +5325,10 @@ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.clazz.custom.figure.AssociationFigure"/>
<behaviour
xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy"/>
+ <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.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
<behaviour
@@ -5895,6 +5899,10 @@ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.InterfaceRealizationFigure"/>
<behaviour
xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy"/>
+ <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.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
<behaviour
@@ -6186,6 +6194,10 @@ figureQualifiedClassName="org.eclipse.papyrus.uml.diagram.common.figure.edge.DashedEdgeFigure"/>
<behaviour
xsi:type="gmfgen:CustomBehaviour"
+ key="org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE"
+ editPolicyQualifiedClassName="org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy"/>
+ <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.AppliedStereotypeLinkLabelDisplayEditPolicy"/>
<behaviour
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/AssociationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/AssociationEditPart.java index a8129e3dc24..c81a69f768a 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/AssociationEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/AssociationEditPart.java @@ -15,6 +15,7 @@ import org.eclipse.draw2d.Connection; import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.clazz.custom.edit.part.AbstractAssociationEditPart;
@@ -48,6 +49,7 @@ public class AssociationEditPart extends AbstractAssociationEditPart implements @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new AssociationItemSemanticEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new CustomAssociationItemSemanticEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/DependencyEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/DependencyEditPart.java index c92e5219fb8..e03c0e41d6d 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/DependencyEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/DependencyEditPart.java @@ -15,6 +15,7 @@ import org.eclipse.draw2d.Connection; import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.clazz.custom.policies.CustomGraphicalNodeEditPolicy;
@@ -47,6 +48,7 @@ public class DependencyEditPart extends UMLConnectionNodeEditPart implements ITr @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new DependencyItemSemanticEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/RealizationEditPart.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/RealizationEditPart.java index 4679a2ad4db..2e255020658 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/RealizationEditPart.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/src/org/eclipse/papyrus/uml/diagram/clazz/edit/parts/RealizationEditPart.java @@ -15,6 +15,7 @@ import org.eclipse.draw2d.Connection; import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.clazz.custom.policies.CustomGraphicalNodeEditPolicy;
@@ -48,6 +49,7 @@ public class RealizationEditPart extends UMLConnectionNodeEditPart implements IT @Override
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new RealizationItemSemanticEditPolicy());
installEditPolicy(AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY, new AppliedStereotypeLinkLabelDisplayEditPolicy());
installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new CustomGraphicalNodeEditPolicy());
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/PapyrusCreationEditPolicy.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/PapyrusCreationEditPolicy.java index 5d9b311bf1e..bfaeaf35be4 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/PapyrusCreationEditPolicy.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/editpolicies/PapyrusCreationEditPolicy.java @@ -19,17 +19,21 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.gef.commands.Command; import org.eclipse.gef.commands.UnexecutableCommand; import org.eclipse.gmf.runtime.common.core.command.CompositeCommand; +import org.eclipse.gmf.runtime.common.core.command.ICommand; import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter; import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil; import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy; import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy; import org.eclipse.gmf.runtime.diagram.ui.commands.SemanticCreateCommand; +import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart; +import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; import org.eclipse.gmf.runtime.diagram.ui.requests.RefreshConnectionsRequest; import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest; import org.eclipse.gmf.runtime.notation.View; +import org.eclipse.papyrus.infra.gmfdiag.common.editpart.ConnectionEditPart; /** * Specific creation edit policy for Papyrus. It checks that the view creation @@ -103,4 +107,17 @@ public class PapyrusCreationEditPolicy extends CreationEditPolicy { return new ICommandProxy(cc); } + + /** + * @return the command to reparent the supplied non connectable editpart's view only + * or an {@link org.eclipse.papyrus.uml.diagram.common.editpolicies.PapyrusCreationEditPolicy.EmptyExecutableCommand} for all connectable editpart's. + * + */ + @Override + protected ICommand getReparentViewCommand(IGraphicalEditPart gep) { + if (gep instanceof ConnectionEditPart && gep.getParent() instanceof DiagramRootEditPart) { + return null; + } + return super.getReparentViewCommand(gep); + } } diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/IStereotypeOrphanGroup.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/IStereotypeOrphanGroup.java new file mode 100644 index 00000000000..1287de538cf --- /dev/null +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/IStereotypeOrphanGroup.java @@ -0,0 +1,28 @@ +/***************************************************************************** + * Copyright (c) 2015 Christian W. Damus and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Christian W. Damus - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes; + +import org.eclipse.emf.ecore.EPackage; + +/** + * Protocol for a grouping of stereotype instances of some schema that are orphaned (no longer attached to any UML elements). + */ +public interface IStereotypeOrphanGroup { + /** + * Queries the schema of the orphaned stereotype instances. + * + * @return the profile schema + */ + EPackage getSchema(); +} diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/ZombieStereotypesDescriptor.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/ZombieStereotypesDescriptor.java index a1acffa90aa..1cc14a00c2c 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/ZombieStereotypesDescriptor.java +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/ZombieStereotypesDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 CEA, Christian W. Damus, and others. + * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -10,6 +10,7 @@ * Christian W. Damus (CEA) - Initial API and implementation * Christian W. Damus - bug 399859 * Christian W. Damus - bug 451338 + * Christian W. Damus - bug 436666 * */ package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes; @@ -22,6 +23,7 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.emf.common.util.DiagnosticChain; import org.eclipse.emf.common.util.EList; @@ -36,6 +38,7 @@ import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.FeatureMapUtil; +import org.eclipse.papyrus.infra.core.utils.AdapterUtils; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; import org.eclipse.papyrus.uml.modelrepair.internal.participants.StereotypesUtil; import org.eclipse.papyrus.uml.tools.helper.IProfileApplicationDelegate; @@ -81,11 +84,11 @@ public class ZombieStereotypesDescriptor { private final Multimap<ProfileContext, EObject> zombies = ArrayListMultimap.create(); - private final Map<EPackage, IRepairAction> suggestedActions = Maps.newHashMap(); + private final Map<IAdaptable, IRepairAction> suggestedActions = Maps.newHashMap(); private final Function<? super EPackage, Profile> dynamicProfileSupplier; - private Map<EPackage, Map<IRepairAction.Kind, IRepairAction>> repairActions = Maps.newHashMap(); + private Map<IAdaptable, Map<IRepairAction.Kind, IRepairAction>> repairActions = Maps.newHashMap(); private Map<EPackage, Profile> definitionToProfileMap = Maps.newHashMap(); @@ -123,7 +126,10 @@ public class ZombieStereotypesDescriptor { public void analyze(EObject stereotypeApplication) { EPackage schema = getEPackage(stereotypeApplication); - if ((schema == null) || (!appliedProfileDefinitions.contains(schema) && couldBeProfileDefinition(schema, stereotypeApplication))) { + if ((schema == null) + || (!appliedProfileDefinitions.contains(schema) && couldBeProfileDefinition(schema, stereotypeApplication)) + || (appliedProfileDefinitions.contains(schema) && (UMLUtil.getBaseElement(stereotypeApplication) == null))) { + // It's a zombie. Determine the profile-application context that covers this stereotype instance ProfileContext context = getProfileContext(stereotypeApplication, schema); @@ -131,11 +137,12 @@ public class ZombieStereotypesDescriptor { zombies.put(context, stereotypeApplication); if (newContext && (schema != null)) { - if (!suggestedActions.containsKey(schema)) { - suggestedActions.put(schema, computeSuggestedAction(schema)); + IAdaptable schemaAdaptable = context.getSchemaAdaptable(); + if (!suggestedActions.containsKey(schemaAdaptable)) { + suggestedActions.put(schemaAdaptable, computeSuggestedAction(schemaAdaptable)); } else { // Already computed the actions previously, but we need to add this new package to the apply-profile action - ApplyProfileAction applyProfile = (ApplyProfileAction) getRepairAction(schema, IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION); + ApplyProfileAction applyProfile = (ApplyProfileAction) getRepairAction(schemaAdaptable, IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION); if (applyProfile != null) { applyProfile.addPackage(context.getApplyingPackage()); } @@ -164,40 +171,61 @@ public class ZombieStereotypesDescriptor { return resource; } - public Collection<? extends EPackage> getZombiePackages() { - return ImmutableSet.copyOf(Iterables.transform(zombies.keySet(), new Function<ProfileContext, EPackage>() { + /** + * Obtains a collection of zombie schemas detected by the stereotype repair analysis and for which {@link IRepairAction}s + * are available to remedy problems. Every resulting adaptable + * <ul> + * <li>adapts to {@link EPackage} to provide the EMF schema that is unresolved or otherwise broken</li> + * <li>may possibly adapt to {@link IStereotypeOrphanGroup} representing stereotype applications from a broken schema that are not repairable by profile migration and so are treated separately with a distinct set of available actions + * </ul> + * + * @return the zombie schemas that are detected + */ + public Collection<? extends IAdaptable> getZombieSchemas() { + return ImmutableSet.copyOf(Iterables.transform(zombies.keySet(), new Function<ProfileContext, IAdaptable>() { - public EPackage apply(ProfileContext input) { - return input.getSchema(); + public IAdaptable apply(ProfileContext input) { + return input.getSchemaAdaptable(); } })); } - public int getZombieCount(EPackage schema) { + public int getZombieCount(IAdaptable schema) { int result = 0; - for (Map.Entry<ProfileContext, Collection<EObject>> next : zombies.asMap().entrySet()) { - if (equal(next.getKey().getSchema(), schema, root)) { - result = result + next.getValue().size(); - } + + for (Map.Entry<ProfileContext, Collection<EObject>> next : Iterables.filter(zombies.asMap().entrySet(), matches(schema))) { + result = result + next.getValue().size(); } return result; } - public Collection<? extends EObject> getZombies(EPackage schema) { - ImmutableList.Builder<EObject> result = ImmutableList.builder(); + private Predicate<Map.Entry<ProfileContext, ?>> matches(IAdaptable schema) { + IStereotypeOrphanGroup orphans = AdapterUtils.adapt(schema, IStereotypeOrphanGroup.class, null); + final boolean isOrphanGroup = orphans != null; + final EPackage targetSchema = isOrphanGroup ? orphans.getSchema() : AdapterUtils.adapt(schema, EPackage.class, null); - for (Map.Entry<ProfileContext, Collection<EObject>> next : zombies.asMap().entrySet()) { - if (equal(next.getKey().getSchema(), schema, root)) { - result.addAll(next.getValue()); + return new Predicate<Map.Entry<ProfileContext, ?>>() { + public boolean apply(Map.Entry<ProfileContext, ?> input) { + ProfileContext context = input.getKey(); + return (context.isOrphanGroup() == isOrphanGroup) && equal(context.getSchema(), targetSchema, root); } + }; + } + + public Collection<? extends EObject> getZombies(IAdaptable schema) { + ImmutableList.Builder<EObject> result = ImmutableList.builder(); + + for (Map.Entry<ProfileContext, Collection<EObject>> next : Iterables.filter(zombies.asMap().entrySet(), matches(schema))) { + result.addAll(next.getValue()); } return result.build(); } - public boolean repair(EPackage schema, IRepairAction repairAction, DiagnosticChain diagnostics, IProgressMonitor monitor) { - return repairAction.repair(resource, schema, getZombies(schema), diagnostics, monitor); + public boolean repair(IAdaptable schema, IRepairAction repairAction, DiagnosticChain diagnostics, IProgressMonitor monitor) { + EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get(); // Fails if not present + return !repairAction.isNull() && repairAction.repair(resource, ePackage, getZombies(schema), diagnostics, monitor); } protected EPackage getEPackage(EObject object) { @@ -205,18 +233,27 @@ public class ZombieStereotypesDescriptor { return (eclass == null) ? null : eclass.getEPackage(); } - protected IRepairAction computeSuggestedAction(EPackage schema) { + protected IRepairAction computeSuggestedAction(IAdaptable schema) { // Try options in our preferred order IRepairAction result = getRepairAction(schema, IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION); + if (result.isNull()) { - // This one is always available - result = getRepairAction(schema, IRepairAction.Kind.NO_OP); + IStereotypeOrphanGroup orphanGroup = AdapterUtils.adapt(schema, IStereotypeOrphanGroup.class, null); + if (orphanGroup != null) { + // Prefer to just delete orphans + result = getRepairAction(schema, IRepairAction.Kind.DELETE); + } + + if (result.isNull()) { + // This one is always available + result = getRepairAction(schema, IRepairAction.Kind.NO_OP); + } } return result; } - protected Map<IRepairAction.Kind, IRepairAction> computeFeasibleRepairActions(EPackage schema) { + protected Map<IRepairAction.Kind, IRepairAction> computeFeasibleRepairActions(IAdaptable schema) { Map<IRepairAction.Kind, IRepairAction> result = Maps.newEnumMap(IRepairAction.Kind.class); // Always available @@ -224,15 +261,21 @@ public class ZombieStereotypesDescriptor { result.put(DeleteAction.INSTANCE.kind(), DeleteAction.INSTANCE); result.put(CreateMarkersAction.INSTANCE.kind(), CreateMarkersAction.INSTANCE); - IRepairAction applyProfile; - Collection<Package> packages = getContextPackages(schema); - Profile profile = findProfile(schema); - if (profile == null) { - applyProfile = new ApplyProfileAction(resource, packages, curry(schema, dynamicProfileSupplier)); + IStereotypeOrphanGroup orphanGroup = AdapterUtils.adapt(schema, IStereotypeOrphanGroup.class, null); + if (orphanGroup != null) { + // Easy case. Nothing more to add! } else { - applyProfile = new ApplyProfileAction(resource, packages, profile, labelProviderService); + EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class, null); + IRepairAction applyProfile; + Collection<Package> packages = getContextPackages(ePackage); + Profile profile = findProfile(ePackage); + if (profile == null) { + applyProfile = new ApplyProfileAction(resource, packages, curry(ePackage, dynamicProfileSupplier)); + } else { + applyProfile = new ApplyProfileAction(resource, packages, profile, labelProviderService); + } + result.put(applyProfile.kind(), applyProfile); } - result.put(applyProfile.kind(), applyProfile); return result; } @@ -259,21 +302,34 @@ public class ZombieStereotypesDescriptor { return Suppliers.compose(function, Suppliers.ofInstance(input)); } - public IRepairAction getSuggestedRepairAction(EPackage schema) { + public IRepairAction getSuggestedRepairAction(IAdaptable schema) { return suggestedActions.get(schema); } - public IRepairAction getRepairAction(EPackage schema, IRepairAction.Kind kind) { + /** + * Obtains a repair action of the specified {@code kind} for a broken {@code schema}, if it is available. + * + * @param schema + * a schema to repair + * @param kind + * the kind of repair action to obtain + * @return the requested {@code kind} of action, or {@link IRepairAction#NULL} if the requested {@code kind} is not available for this {@code schema} + */ + public IRepairAction getRepairAction(IAdaptable schema, IRepairAction.Kind kind) { Map<IRepairAction.Kind, IRepairAction> available = repairActions.get(schema); if (available == null) { available = computeFeasibleRepairActions(schema); repairActions.put(schema, available); } - return available.get(kind); + IRepairAction result = available.get(kind); + if (result == null) { + result = IRepairAction.NULL; + } + return result; } - public List<IRepairAction> getAvailableRepairActions(EPackage schema) { + public List<IRepairAction> getAvailableRepairActions(IAdaptable schema) { Map<IRepairAction.Kind, IRepairAction> actions = repairActions.get(schema); return (actions == null) ? Collections.<IRepairAction> emptyList() : ImmutableList.copyOf(Iterables.filter(actions.values(), IRepairAction.NOT_NULL)); } @@ -300,8 +356,8 @@ public class ZombieStereotypesDescriptor { } else { Element base = getBaseElement(stereotypeApplication); if (base == null) { - // Can't make any inference about package context - result = new ProfileContext(root, schema); + // These are orphans + result = new ProfileContext(schema); } else { // Find the profile application result = null; @@ -453,7 +509,7 @@ public class ZombieStereotypesDescriptor { // Nested types // - static class ProfileContext { + static class ProfileContext implements IAdaptable { private final Package applyingPackage; @@ -471,6 +527,18 @@ public class ZombieStereotypesDescriptor { this(profileApplication.getApplyingPackage(), schema); } + /** + * Creates a descriptor for a group of orphaned stereotype instances of the given {@code schema}. + * An orphan group is distinct from the stereotype instances of the same schema that are attached + * to base UML elements, because those can be properly managed by the UML2 API. + * + * @param schema + * the XML/Ecore schema of the orphaned stereotype instances + */ + ProfileContext(EPackage schema) { + this(null, schema); + } + private void init() { String schemaHash = (schema == null) ? null : schema.getNsURI(); hash = Objects.hashCode(applyingPackage, schemaHash); @@ -484,6 +552,37 @@ public class ZombieStereotypesDescriptor { return schema; } + public IAdaptable getSchemaAdaptable() { + return isOrphanGroup() ? this : new EPackageAdapter(getSchema()); + } + + /** + * Queries whether I represent a group of orphaned stereotype instances. + * An orphan group is distinct from the stereotype instances of the same schema that are attached + * to base UML elements, because those can be properly managed by the UML2 API. + * + * @return whether I represent orphaned stereotype instances of some schema + */ + public boolean isOrphanGroup() { + return getApplyingPackage() == null; + } + + public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + Object result = null; + + if (adapter == EPackage.class) { + result = getSchema(); + } else if ((adapter == IStereotypeOrphanGroup.class) && isOrphanGroup()) { + result = new IStereotypeOrphanGroup() { + public EPackage getSchema() { + return ProfileContext.this.getSchema(); + } + }; + } + + return result; + } + @Override public boolean equals(Object obj) { boolean result = false; @@ -505,4 +604,28 @@ public class ZombieStereotypesDescriptor { return hash; } } + + private static final class EPackageAdapter implements IAdaptable { + private final EPackage ePackage; + + EPackageAdapter(EPackage ePackage) { + super(); + + this.ePackage = ePackage; + } + + public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + return (adapter == EPackage.class) ? ePackage : null; + } + + @Override + public boolean equals(Object obj) { + return (obj instanceof EPackageAdapter) && (((EPackageAdapter) obj).ePackage == ePackage); + } + + @Override + public int hashCode() { + return ePackage.hashCode(); + } + } } diff --git a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java index df95dbcb284..8d63b45aec1 100644 --- a/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java +++ b/plugins/uml/org.eclipse.papyrus.uml.modelrepair/src/org/eclipse/papyrus/uml/modelrepair/ui/ZombieStereotypesDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014 CEA, Christian W. Damus, and others. + * Copyright (c) 2013, 2015 CEA, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -12,6 +12,7 @@ * Christian W. Damus - bug 451338 * Christian W. Damus - bug 451557 * Gabriel Pascual (ALL4TEC) gabriel.pascual@all4tec.net - bug 454997 + * Christian W. Damus - bug 436666 * */ package org.eclipse.papyrus.uml.modelrepair.ui; @@ -25,6 +26,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -59,8 +61,10 @@ import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.jface.window.IShellProvider; import org.eclipse.jface.window.SameShellProvider; import org.eclipse.jface.wizard.ProgressMonitorPart; +import org.eclipse.osgi.util.NLS; import org.eclipse.papyrus.infra.core.resource.ModelSet; import org.eclipse.papyrus.infra.core.services.ServiceException; +import org.eclipse.papyrus.infra.core.utils.AdapterUtils; import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResourceSet; import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService; @@ -68,6 +72,7 @@ import org.eclipse.papyrus.infra.services.markerlistener.dialogs.DiagnosticDialo import org.eclipse.papyrus.infra.tools.util.UIUtil; import org.eclipse.papyrus.uml.modelrepair.Activator; import org.eclipse.papyrus.uml.modelrepair.internal.stereotypes.IRepairAction; +import org.eclipse.papyrus.uml.modelrepair.internal.stereotypes.IStereotypeOrphanGroup; import org.eclipse.papyrus.uml.modelrepair.internal.stereotypes.ZombieStereotypesDescriptor; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Cursor; @@ -217,7 +222,7 @@ public class ZombieStereotypesDialog extends TrayDialog { missingSchemas = Lists.newArrayList(); for (ZombieStereotypesDescriptor next : zombieDescriptors) { - for (EPackage schema : next.getZombiePackages()) { + for (IAdaptable schema : next.getZombieSchemas()) { missingSchemas.add(new MissingSchema(schema, next)); } } @@ -434,8 +439,14 @@ public class ZombieStereotypesDialog extends TrayDialog { } void updateAffected(ViewerCell cell) { - int count = ((MissingSchema) cell.getElement()).getAffectedCount(); - cell.setText(Integer.toString(count)); + MissingSchema schema = (MissingSchema) cell.getElement(); + int count = schema.getAffectedCount(); + + String text = Integer.toString(count); + if (schema.isOrphanGroup()) { + text = NLS.bind("{0} dangling stereotypes", text); + } + cell.setText(text); } void updateSchema(ViewerCell cell) { @@ -453,16 +464,16 @@ public class ZombieStereotypesDialog extends TrayDialog { private class MissingSchema { - private final EPackage ePackage; + private final IAdaptable schema; private final ZombieStereotypesDescriptor descriptor; private IRepairAction selectedAction; - MissingSchema(EPackage ePackage, ZombieStereotypesDescriptor descriptor) { - this.ePackage = ePackage; + MissingSchema(IAdaptable schema, ZombieStereotypesDescriptor descriptor) { + this.schema = schema; this.descriptor = descriptor; - this.selectedAction = descriptor.getSuggestedRepairAction(ePackage); + this.selectedAction = descriptor.getSuggestedRepairAction(schema); } void initialiseRepairAction(Map<String, Profile> brokenNsProfileMap) { @@ -477,15 +488,19 @@ public class ZombieStereotypesDialog extends TrayDialog { } int getAffectedCount() { - return descriptor.getZombieCount(getSchema()); + return descriptor.getZombieCount(schema); } EPackage getSchema() { - return ePackage; + return AdapterUtils.adapt(schema, EPackage.class, null); + } + + boolean isOrphanGroup() { + return AdapterUtils.adapt(schema, IStereotypeOrphanGroup.class).isPresent(); } List<IRepairAction> getRepairActions() { - return descriptor.getAvailableRepairActions(ePackage); + return descriptor.getAvailableRepairActions(schema); } IRepairAction getSelectedRepairAction() { @@ -497,7 +512,7 @@ public class ZombieStereotypesDialog extends TrayDialog { } boolean apply(DiagnosticChain diagnostics, IProgressMonitor monitor) { - return descriptor.repair(getSchema(), getSelectedRepairAction(), diagnostics, monitor); + return descriptor.repair(schema, getSelectedRepairAction(), diagnostics, monitor); } } diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter.documentation/META-INF/MANIFEST.MF b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter.documentation/META-INF/MANIFEST.MF index 4c919741cb0..d42b0689cbd 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter.documentation/META-INF/MANIFEST.MF +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter.documentation/META-INF/MANIFEST.MF @@ -2,6 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.papyrus.uml.profile.drafter.documentation -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.1.0.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-Vendor: %providerName +Bundle-Localization: plugin diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF index 6f8ab7982b8..bac811c5208 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/META-INF/MANIFEST.MF @@ -36,3 +36,4 @@ Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Export-Package: org.eclipse.papyrus.uml.profile.drafter.exceptions, org.eclipse.papyrus.uml.profile.drafter.ui.handler +Bundle-Localization: plugin diff --git a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/build.properties b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/build.properties index f2b13090d59..9bf79af851e 100644 --- a/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/build.properties +++ b/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter/build.properties @@ -6,4 +6,4 @@ bin.includes = META-INF/,\ plugin.properties,\ about.html,\ icons/ -src.includes = about.html,icons/ +src.includes = about.html diff --git a/releng/org.eclipse.papyrus.oomph/setups/papyrus.setup b/releng/org.eclipse.papyrus.oomph/setups/papyrus.setup index 3c7b2a48905..8a8ca32a000 100644 --- a/releng/org.eclipse.papyrus.oomph/setups/papyrus.setup +++ b/releng/org.eclipse.papyrus.oomph/setups/papyrus.setup @@ -2019,6 +2019,8 @@ <sourceLocator rootFolder="${papyrus.git.clone.location/extraplugins}/${papyrus.extraplugins.folder}"/> <sourceLocator + rootFolder="${papyrus.git.clone.location/tests/junit/extraplugins}/${papyrus.extratests.folder}"/> + <sourceLocator rootFolder="${papyrus.git.clone.location/features/papyrus-extra-features}"> <predicate xsi:type="predicates:NamePredicate" @@ -2098,11 +2100,6 @@ xsi:type="setup:VariableTask" name="papyrus.extraplugins.folder" value="cdo"/> - <setupTask - xsi:type="projects:ProjectsImportTask"> - <sourceLocator - rootFolder="${papyrus.git.clone.location/tests/junit/extraplugins}/${papyrus.extratests.folder}"/> - </setupTask> <stream name="master" label="master (Mars/1.1)"> @@ -2180,11 +2177,6 @@ xsi:type="setup:VariableTask" name="papyrus.extratestsfeature" value="tests.extra.codegen.cpp"/> - <setupTask - xsi:type="projects:ProjectsImportTask"> - <sourceLocator - rootFolder="${papyrus.git.clone.location/tests/junit/extraplugins}/${papyrus.extratests.folder}"/> - </setupTask> <stream name="master" label="master (Mars/1.1)"> @@ -2405,9 +2397,12 @@ name="papyrus.extraplugins.folder" value="migration"/> <setupTask - xsi:type="projects:ProjectsImportTask"> - <sourceLocator - rootFolder="${papyrus.git.clone.location/tests/junit/extraplugins}/${papyrus.extratests.folder}"/> + xsi:type="setup.targlets:TargletTask"> + <targlet + name="Papyrus Model Migration Dependencies"> + <requirement + name="org.eclipse.papyrus.umlrt"/> + </targlet> </setupTask> <stream name="master" @@ -2434,11 +2429,6 @@ xsi:type="setup:VariableTask" name="papyrus.extraplugins.folder" value="moka"/> - <setupTask - xsi:type="projects:ProjectsImportTask"> - <sourceLocator - rootFolder="${papyrus.git.clone.location/tests/junit/extraplugins}/${papyrus.extratests.folder}"/> - </setupTask> <stream name="master" label="master (Mars/1.1)"> @@ -2522,11 +2512,6 @@ xsi:type="setup:VariableTask" name="papyrus.extrafeature" value="extra.uml.compare"/> - <setupTask - xsi:type="projects:ProjectsImportTask"> - <sourceLocator - rootFolder="${papyrus.git.clone.location/tests/junit/extraplugins}/${papyrus.extratests.folder}"/> - </setupTask> <stream name="master" label="master (Mars/1.1)"> @@ -2581,11 +2566,6 @@ xsi:type="setup:VariableTask" name="papyrus.extraplugins.folder" value="umlrt"/> - <setupTask - xsi:type="projects:ProjectsImportTask"> - <sourceLocator - rootFolder="${papyrus.git.clone.location/tests/junit/extraplugins}/${papyrus.extratests.folder}"/> - </setupTask> <stream name="master" label="master (Mars/1.1)"> diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/org.eclipse.papyrus.migration.rsa.tests.launch b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/org.eclipse.papyrus.migration.rsa.tests.launch index 9ccdfb31e31..dc0c7a5baf3 100644 --- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/org.eclipse.papyrus.migration.rsa.tests.launch +++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/org.eclipse.papyrus.migration.rsa.tests.launch @@ -23,7 +23,7 @@ <booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.eclipse.papyrus.migration.rsa.tests.AllTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.eclipse.papyrus.migration.rsa.tests"/>
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/parameters/TestParameters.emx b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/parameters/TestParameters.emx new file mode 100644 index 00000000000..92daa923958 --- /dev/null +++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/resources/parameters/TestParameters.emx @@ -0,0 +1,193 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--xtools2_universal_type_manager-->
+<?com.ibm.xtools.emf.core.signature <signature id="com.ibm.xtools.uml.msl.model" version="7.0.0"><feature description="" name="com.ibm.xtools.ruml.feature" url="" version="7.0.0"/></signature>?>
+<?com.ibm.xtools.emf.core.signature <signature id="com.ibm.xtools.mmi.ui.signatures.diagram" version="7.0.0"><feature description="" name="Rational Modeling Platform (com.ibm.xtools.rmp)" url="" version="7.0.0"/></signature>?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:Default="http:///schemas/Default/_fNm3AAqoEd6-N_NOT9vsCA/2" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:uml="http://www.eclipse.org/uml2/3.0.0/UML" xmlns:umlnotation="http://www.ibm.com/xtools/1.5.3/Umlnotation" xsi:schemaLocation="http:///schemas/Default/_fNm3AAqoEd6-N_NOT9vsCA/2 pathmap://UML2_MSL_PROFILES/Default.epx#_fNwoAAqoEd6-N_NOT9vsCA?Default/Default?">
+ <uml:Model xmi:id="_78anwp_dEeSMStbbPSeZNQ" name="TestParameters">
+ <eAnnotations xmi:id="_78anw5_dEeSMStbbPSeZNQ" source="uml2.diagrams" references="_78anxJ_dEeSMStbbPSeZNQ">
+ <contents xmi:type="umlnotation:UMLDiagram" xmi:id="_78anxJ_dEeSMStbbPSeZNQ" type="Class" name="Main">
+ <children xmi:type="umlnotation:UMLShape" xmi:id="_8rc4AJ_dEeSMStbbPSeZNQ" element="_8rYmkJ_dEeSMStbbPSeZNQ" fontName="Segoe UI" fontHeight="8" transparency="0" lineColor="14263149" lineWidth="1" showStereotype="Label">
+ <children xmi:type="notation:DecorationNode" xmi:id="_8rdfEJ_dEeSMStbbPSeZNQ" type="ImageCompartment">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_8rdfEZ_dEeSMStbbPSeZNQ" width="1320" height="1320"/>
+ </children>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_8rdfEp_dEeSMStbbPSeZNQ" type="Stereotype"/>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_8reGIJ_dEeSMStbbPSeZNQ" type="Name"/>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_8reGIZ_dEeSMStbbPSeZNQ" type="Parent"/>
+ <children xmi:type="notation:SemanticListCompartment" xmi:id="_8reGIp_dEeSMStbbPSeZNQ" type="AttributeCompartment"/>
+ <children xmi:type="notation:SemanticListCompartment" xmi:id="_8reGI5_dEeSMStbbPSeZNQ" type="OperationCompartment"/>
+ <children xmi:type="notation:SemanticListCompartment" xmi:id="_8retMJ_dEeSMStbbPSeZNQ" visible="false" type="SignalCompartment"/>
+ <children xmi:type="umlnotation:UMLShapeCompartment" xmi:id="_8retMZ_dEeSMStbbPSeZNQ" visible="false" type="StructureCompartment"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_8rc4AZ_dEeSMStbbPSeZNQ" x="5544" y="4884"/>
+ </children>
+ <children xmi:type="umlnotation:UMLShape" xmi:id="_J30ysJ_eEeSMStbbPSeZNQ" element="_J3whQJ_eEeSMStbbPSeZNQ" fontName="Segoe UI" fontHeight="8" transparency="0" lineColor="14263149" lineWidth="1" showStereotype="Label">
+ <children xmi:type="notation:DecorationNode" xmi:id="_J31ZwJ_eEeSMStbbPSeZNQ" type="ImageCompartment">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_J31ZwZ_eEeSMStbbPSeZNQ" width="1320" height="1320"/>
+ </children>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_J31Zwp_eEeSMStbbPSeZNQ" type="Stereotype"/>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_J31Zw5_eEeSMStbbPSeZNQ" type="Name"/>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_J31ZxJ_eEeSMStbbPSeZNQ" type="Parent"/>
+ <children xmi:type="notation:SemanticListCompartment" xmi:id="_J32A0J_eEeSMStbbPSeZNQ" type="AttributeCompartment"/>
+ <children xmi:type="notation:SemanticListCompartment" xmi:id="_J32A0Z_eEeSMStbbPSeZNQ" type="OperationCompartment"/>
+ <children xmi:type="notation:SemanticListCompartment" xmi:id="_J32A0p_eEeSMStbbPSeZNQ" visible="false" type="SignalCompartment"/>
+ <children xmi:type="umlnotation:UMLShapeCompartment" xmi:id="_J32A05_eEeSMStbbPSeZNQ" visible="false" type="StructureCompartment"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_J30ysZ_eEeSMStbbPSeZNQ" x="15557" y="4868"/>
+ </children>
+ <children xmi:type="umlnotation:UMLShape" xmi:id="_ocsqQJ_eEeSMStbbPSeZNQ" element="_ocpm8J_eEeSMStbbPSeZNQ" fontName="Segoe UI" fontHeight="8" fillColor="14277119" transparency="0" lineColor="12632258" lineWidth="1" showStereotype="Label">
+ <children xmi:type="notation:DecorationNode" xmi:id="_octRUJ_eEeSMStbbPSeZNQ" type="ImageCompartment">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_octRUZ_eEeSMStbbPSeZNQ" width="1320" height="1320"/>
+ </children>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_octRUp_eEeSMStbbPSeZNQ" type="Name"/>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_octRU5_eEeSMStbbPSeZNQ" type="Stereotype"/>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_octRVJ_eEeSMStbbPSeZNQ" type="ValueSpecification"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_ocsqQZ_eEeSMStbbPSeZNQ" x="11484" y="7920" width="6719" height="1824"/>
+ </children>
+ </contents>
+ </eAnnotations>
+ <eAnnotations xmi:id="_78anxZ_dEeSMStbbPSeZNQ" source="com.ibm.xtools.common.ui.reduction.editingCapabilities">
+ <details xmi:id="_78anxp_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBFunctionTemplateParameter" value="1"/>
+ <details xmi:id="_78anx5_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBPrimitiveTypeTemplateParameter" value="1"/>
+ <details xmi:id="_78anyJ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBElementImport1" value="1"/>
+ <details xmi:id="_78anyZ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBFragment" value="1"/>
+ <details xmi:id="_78anyp_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBElementImport2" value="1"/>
+ <details xmi:id="_78any5_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBArtifact" value="1"/>
+ <details xmi:id="_78anzJ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBInterfaceTemplateParameter" value="1"/>
+ <details xmi:id="_78anzZ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBFunction" value="1"/>
+ <details xmi:id="_78anzp_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBProfile" value="1"/>
+ <details xmi:id="_78anz5_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBInteractionOverview" value="1"/>
+ <details xmi:id="_78an0J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBStructureDiagram" value="1"/>
+ <details xmi:id="_78an0Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBSubsystem" value="1"/>
+ <details xmi:id="_78an0p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBSignal" value="1"/>
+ <details xmi:id="_78an05_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBInteractionOverviewDiagram" value="1"/>
+ <details xmi:id="_78an1J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBClass" value="1"/>
+ <details xmi:id="_78an1Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBRelationship1" value="1"/>
+ <details xmi:id="_78an1p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBRelationship2" value="1"/>
+ <details xmi:id="_78an15_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBStateMachine1" value="1"/>
+ <details xmi:id="_78an2J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBRelationship3" value="1"/>
+ <details xmi:id="_78an2Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBStateMachine2" value="1"/>
+ <details xmi:id="_78an2p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBComponent" value="1"/>
+ <details xmi:id="_78an25_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBDeploymentSpecification" value="1"/>
+ <details xmi:id="_78an3J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBActivity1" value="1"/>
+ <details xmi:id="_78an3Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBAbstractionRelation" value="1"/>
+ <details xmi:id="_78an3p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBActivity2" value="1"/>
+ <details xmi:id="_78an35_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBActivity3" value="1"/>
+ <details xmi:id="_78an4J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBAction" value="1"/>
+ <details xmi:id="_78an4Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBActivityDiagram" value="1"/>
+ <details xmi:id="_78an4p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBClassTemplateParameter" value="1"/>
+ <details xmi:id="_78an45_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBActivity4" value="1"/>
+ <details xmi:id="_78an5J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBPackage" value="1"/>
+ <details xmi:id="_78an5Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBTemplate" value="1"/>
+ <details xmi:id="_78an5p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBStereotypedDeployment1" value="1"/>
+ <details xmi:id="_78an55_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBSpecificInstanceType1" value="1"/>
+ <details xmi:id="_78an6J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBSequence1" value="1"/>
+ <details xmi:id="_78an6Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBCollaborationUse" value="1"/>
+ <details xmi:id="_78an6p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBSpecificInstanceType2" value="1"/>
+ <details xmi:id="_78an65_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBSequence2" value="1"/>
+ <details xmi:id="_78an7J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBSequenceDiagram" value="1"/>
+ <details xmi:id="_78an7Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBObjectDiagram" value="1"/>
+ <details xmi:id="_78an7p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBTiming" value="1"/>
+ <details xmi:id="_78an75_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBDependancy" value="1"/>
+ <details xmi:id="_78an8J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBLifeLine" value="1"/>
+ <details xmi:id="_78an8Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBComponentTemplateParameter" value="1"/>
+ <details xmi:id="_78an8p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBUsage" value="1"/>
+ <details xmi:id="_78an85_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBFreeFormDiagram" value="1"/>
+ <details xmi:id="_78an9J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBInstance" value="1"/>
+ <details xmi:id="_78an9Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBStereotypedArtifact" value="1"/>
+ <details xmi:id="_78an9p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBComponentDiagram" value="1"/>
+ <details xmi:id="_78an95_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBEvent1" value="1"/>
+ <details xmi:id="_78an-J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBTypes1" value="1"/>
+ <details xmi:id="_78an-Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBEvent2" value="1"/>
+ <details xmi:id="_78an-p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBTypes2" value="1"/>
+ <details xmi:id="_78an-5_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBTypes3" value="1"/>
+ <details xmi:id="_78an_J_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBTypes4" value="1"/>
+ <details xmi:id="_78an_Z_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBTimingDiagram" value="1"/>
+ <details xmi:id="_78an_p_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBCommunicationDiagram" value="1"/>
+ <details xmi:id="_78an_5_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBConstraint" value="1"/>
+ <details xmi:id="_78aoAJ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBStereotypedClass" value="1"/>
+ <details xmi:id="_78aoAZ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBProfileApplication" value="1"/>
+ <details xmi:id="_78aoAp_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBPackageTemplateParameter" value="1"/>
+ <details xmi:id="_78aoA5_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBStereotypedComponent" value="1"/>
+ <details xmi:id="_78aoBJ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBInterface" value="1"/>
+ <details xmi:id="_78aoBZ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBInformationFlow" value="1"/>
+ <details xmi:id="_78aoBp_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBComment1" value="1"/>
+ <details xmi:id="_78aoB5_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBComment2" value="1"/>
+ <details xmi:id="_78aoCJ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBComment3" value="1"/>
+ <details xmi:id="_78aoCZ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBCollaboration" value="1"/>
+ <details xmi:id="_78aoCp_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBCompositeStructure1" value="1"/>
+ <details xmi:id="_78aoC5_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBRealization" value="1"/>
+ <details xmi:id="_78aoDJ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBStateChartDiagram" value="1"/>
+ <details xmi:id="_78aoDZ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBCompositeStructure2" value="1"/>
+ <details xmi:id="_78aoDp_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBUseCase1" value="1"/>
+ <details xmi:id="_78aoD5_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBUseCase2" value="1"/>
+ <details xmi:id="_78aoEJ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBClassDiagram" value="1"/>
+ <details xmi:id="_78aoEZ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBUseCaseDiagram" value="1"/>
+ <details xmi:id="_78aoEp_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBDeployment1" value="1"/>
+ <details xmi:id="_78aoE5_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBDeployment2" value="1"/>
+ <details xmi:id="_78aoFJ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBDeploymentDiagram" value="1"/>
+ <details xmi:id="_78aoFZ_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBInteraction" value="1"/>
+ <details xmi:id="_78aoFp_dEeSMStbbPSeZNQ" key="com.ibm.xtools.activities.umlBBCommunication" value="1"/>
+ </eAnnotations>
+ <packageImport xmi:id="_78aoF5_dEeSMStbbPSeZNQ">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <ownedRule xmi:id="_ocpm8J_eEeSMStbbPSeZNQ">
+ <specification xmi:type="uml:OpaqueExpression" xmi:id="_ocqOAJ_eEeSMStbbPSeZNQ">
+ <language></language>
+ <body>Opaque Specification without language</body>
+ </specification>
+ </ownedRule>
+ <packagedElement xmi:type="uml:Class" xmi:id="_8rYmkJ_dEeSMStbbPSeZNQ" name="Class1">
+ <eAnnotations xmi:id="_QWzBQJ_eEeSMStbbPSeZNQ" source="uml2.diagrams">
+ <contents xmi:type="umlnotation:UMLDiagram" xmi:id="_QWzoUJ_eEeSMStbbPSeZNQ" type="Object" name="ObjectDiagram1">
+ <children xmi:type="umlnotation:UMLShape" xmi:id="_RkHI8J_eEeSMStbbPSeZNQ" element="_RkCQcJ_eEeSMStbbPSeZNQ" fontName="Segoe UI" fontHeight="8" transparency="0" lineColor="14263149" lineWidth="1" showStereotype="Label">
+ <children xmi:type="notation:DecorationNode" xmi:id="_RkHwAJ_eEeSMStbbPSeZNQ" type="ImageCompartment">
+ <layoutConstraint xmi:type="notation:Size" xmi:id="_RkHwAZ_eEeSMStbbPSeZNQ" width="1320" height="1320"/>
+ </children>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_RkHwAp_eEeSMStbbPSeZNQ" type="Stereotype"/>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_RkHwA5_eEeSMStbbPSeZNQ" type="Name"/>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_RkHwBJ_eEeSMStbbPSeZNQ" type="Parent"/>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_RkIXEJ_eEeSMStbbPSeZNQ" type="ValueSpecification"/>
+ <children xmi:type="notation:BasicDecorationNode" xmi:id="_RkIXEZ_eEeSMStbbPSeZNQ" visible="false" type="TaggedValueSet"/>
+ <children xmi:type="notation:ListCompartment" xmi:id="_RkIXEp_eEeSMStbbPSeZNQ" type="SlotCompartment"/>
+ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_RkHI8Z_eEeSMStbbPSeZNQ" x="8572" y="5847"/>
+ </children>
+ <element xsi:nil="true"/>
+ </contents>
+ </eAnnotations>
+ <ownedAttribute xmi:id="_-pTr0J_dEeSMStbbPSeZNQ" name="attribute1" visibility="private" type="_J3whQJ_eEeSMStbbPSeZNQ">
+ <defaultValue xmi:type="uml:InstanceValue" xmi:id="_ZK1CsJ_eEeSMStbbPSeZNQ" type="_J3whQJ_eEeSMStbbPSeZNQ" instance="_RkCQcJ_eEeSMStbbPSeZNQ"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Class" xmi:id="_J3whQJ_eEeSMStbbPSeZNQ" name="Class2">
+ <ownedAttribute xmi:id="_KSLzcJ_eEeSMStbbPSeZNQ" name="attribute1" visibility="private">
+ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/>
+ </ownedAttribute>
+ </packagedElement>
+ <packagedElement xmi:type="uml:InstanceSpecification" xmi:id="_RkCQcJ_eEeSMStbbPSeZNQ" name="Class2Instance" classifier="_J3whQJ_eEeSMStbbPSeZNQ">
+ <slot xmi:id="_WdM-0J_eEeSMStbbPSeZNQ" definingFeature="_KSLzcJ_eEeSMStbbPSeZNQ">
+ <value xmi:type="uml:OpaqueExpression" xmi:id="_XNd-IJ_eEeSMStbbPSeZNQ">
+ <language></language>
+ <body>Hello, World!</body>
+ </value>
+ </slot>
+ </packagedElement>
+ <profileApplication xmi:id="_78aoGJ_dEeSMStbbPSeZNQ">
+ <eAnnotations xmi:id="_78aoGZ_dEeSMStbbPSeZNQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://UML_PROFILES/Standard.profile.uml#_yzU58YinEdqtvbnfB2L_5w"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://UML_PROFILES/Standard.profile.uml#_0"/>
+ </profileApplication>
+ <profileApplication xmi:id="_78aoGp_dEeSMStbbPSeZNQ">
+ <eAnnotations xmi:id="_78aoG5_dEeSMStbbPSeZNQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://UML2_MSL_PROFILES/Default.epx#_fNwoAAqoEd6-N_NOT9vsCA?Default/Default?"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://UML2_MSL_PROFILES/Default.epx#_a_S3wNWLEdiy4IqP8whjFA?Default?"/>
+ </profileApplication>
+ <profileApplication xmi:id="_78aoHJ_dEeSMStbbPSeZNQ">
+ <eAnnotations xmi:id="_78aoHZ_dEeSMStbbPSeZNQ" source="http://www.eclipse.org/uml2/2.0.0/UML">
+ <references xmi:type="ecore:EPackage" href="pathmap://UML2_MSL_PROFILES/Deployment.epx#_IrdAUMmBEdqBcN1R6EvWUw?Deployment/Deployment?"/>
+ </eAnnotations>
+ <appliedProfile href="pathmap://UML2_MSL_PROFILES/Deployment.epx#_vjbuwOvHEdiDX5bji0iVSA?Deployment?"/>
+ </profileApplication>
+ </uml:Model>
+ <Default:MetaConstraint xmi:id="_0-Mb8J_eEeSMStbbPSeZNQ" base_Constraint="_ocpm8J_eEeSMStbbPSeZNQ"/>
+</xmi:XMI>
diff --git a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/AbstractTransformationTest.java b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/AbstractTransformationTest.java index 816720e43ae..1f67fed5697 100644 --- a/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/AbstractTransformationTest.java +++ b/tests/junit/extraplugins/migration/org.eclipse.papyrus.migration.rsa.tests/src/org/eclipse/papyrus/migration/rsa/tests/qvt/AbstractTransformationTest.java @@ -75,6 +75,8 @@ public class AbstractTransformationTest extends AbstractPapyrusTest { launcher.run(Collections.singletonList(sourceURI)); launcher.waitForCompletion(); + + Assert.assertTrue("The transformation didn't complete normally", launcher.getResult().isOK()); } else { ImportTransformation transformation = new ImportTransformation(sourceURI); transformation.run(false); diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model-no-j2ee-constraints.uml b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model-no-j2ee-constraints.uml index 895a76456b7..9891f8006a8 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model-no-j2ee-constraints.uml +++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model-no-j2ee-constraints.uml @@ -1,31 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?> -<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ActionLanguage="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:j2ee="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1 j2ee-no-constraints.profile.uml#_jFgSINOFEeO2iNKjb11rWg"> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:j2ee="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1 j2ee-no-constraints.profile.uml#_jFgSINOFEeO2iNKjb11rWg"> <uml:Model xmi:id="_J4wuULjVEeOUcroamP8z5w" name="Model"> - <packageImport xmi:type="uml:PackageImport" xmi:id="_J4wuUbjVEeOUcroamP8z5w"> + <packageImport xmi:id="_J4wuUbjVEeOUcroamP8z5w"> <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> </packageImport> <packagedElement xmi:type="uml:Class" xmi:id="_Kzml8LjVEeOUcroamP8z5w" name="Person"> - <ownedAttribute xmi:type="uml:Property" xmi:id="_nMtwkLjVEeOUcroamP8z5w" name="name" visibility="public"> + <ownedAttribute xmi:id="_nMtwkLjVEeOUcroamP8z5w" name="name" visibility="public"> <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_rLtVsLjVEeOUcroamP8z5w" value="1"/> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_rLuj0LjVEeOUcroamP8z5w" value="1"/> </ownedAttribute> - <ownedOperation xmi:type="uml:Operation" xmi:id="_mDkXMLjVEeOUcroamP8z5w" name="lookup"/> + <ownedOperation xmi:id="_mDkXMLjVEeOUcroamP8z5w" name="lookup"/> </packagedElement> - <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_XFt30LjVEeOUcroamP8z5w"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_XGDPALjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <profileApplication xmi:id="_XFt30LjVEeOUcroamP8z5w"> + <eAnnotations xmi:id="_XGDPALjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML"> <references xmi:type="ecore:EPackage" href="j2ee-no-constraints.profile.uml#_jFgSINOFEeO2iNKjb11rWg"/> </eAnnotations> - <appliedProfile xmi:type="uml:Profile" href="j2ee-no-constraints.profile.uml#_ONhZ8JKHEeOKCcahrNz4pQ"/> - </profileApplication> - <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_npoWELjVEeOUcroamP8z5w"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_np6p8LjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML"> - <references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"/> - </eAnnotations> - <appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/> + <appliedProfile href="j2ee-no-constraints.profile.uml#_ONhZ8JKHEeOKCcahrNz4pQ"/> </profileApplication> </uml:Model> - <ActionLanguage:TextualRepresentation xmi:id="_np74ELjVEeOUcroamP8z5w" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/> <j2ee:Bean xmi:id="_WG5mgLtDEeOsE9GQnSNONw" comment="This is a comment." disposition="happy" base_Class="_Kzml8LjVEeOUcroamP8z5w" finder="_mDkXMLjVEeOUcroamP8z5w"> <tag>gold</tag> <tag>p1</tag> diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model.uml b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model.uml index 5a4dbe9d880..42136560022 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model.uml +++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/profile/model.uml @@ -1,31 +1,24 @@ <?xml version="1.0" encoding="UTF-8"?> -<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ActionLanguage="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:j2ee="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1 j2ee.profile.uml#_jFgSINOFEeO2iNKjb11rWg"> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:j2ee="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http:///schemas/j2ee/_jFbZoNOFEeO2iNKjb11rWg/1 j2ee.profile.uml#_jFgSINOFEeO2iNKjb11rWg"> <uml:Model xmi:id="_J4wuULjVEeOUcroamP8z5w" name="Model"> - <packageImport xmi:type="uml:PackageImport" xmi:id="_J4wuUbjVEeOUcroamP8z5w"> + <packageImport xmi:id="_J4wuUbjVEeOUcroamP8z5w"> <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> </packageImport> <packagedElement xmi:type="uml:Class" xmi:id="_Kzml8LjVEeOUcroamP8z5w" name="Person"> - <ownedAttribute xmi:type="uml:Property" xmi:id="_nMtwkLjVEeOUcroamP8z5w" name="name" visibility="public"> + <ownedAttribute xmi:id="_nMtwkLjVEeOUcroamP8z5w" name="name" visibility="public"> <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_rLtVsLjVEeOUcroamP8z5w" value="1"/> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_rLuj0LjVEeOUcroamP8z5w" value="1"/> </ownedAttribute> - <ownedOperation xmi:type="uml:Operation" xmi:id="_mDkXMLjVEeOUcroamP8z5w" name="lookup"/> + <ownedOperation xmi:id="_mDkXMLjVEeOUcroamP8z5w" name="lookup"/> </packagedElement> - <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_XFt30LjVEeOUcroamP8z5w"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_XGDPALjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <profileApplication xmi:id="_XFt30LjVEeOUcroamP8z5w"> + <eAnnotations xmi:id="_XGDPALjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML"> <references xmi:type="ecore:EPackage" href="j2ee.profile.uml#_jFgSINOFEeO2iNKjb11rWg"/> </eAnnotations> - <appliedProfile xmi:type="uml:Profile" href="j2ee.profile.uml#_ONhZ8JKHEeOKCcahrNz4pQ"/> - </profileApplication> - <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_npoWELjVEeOUcroamP8z5w"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_np6p8LjVEeOUcroamP8z5w" source="http://www.eclipse.org/uml2/2.0.0/UML"> - <references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"/> - </eAnnotations> - <appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/> + <appliedProfile href="j2ee.profile.uml#_ONhZ8JKHEeOKCcahrNz4pQ"/> </profileApplication> </uml:Model> - <ActionLanguage:TextualRepresentation xmi:id="_np74ELjVEeOUcroamP8z5w" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/> <j2ee:Bean xmi:id="_WG5mgLtDEeOsE9GQnSNONw" comment="This is a comment." disposition="happy" base_Class="_Kzml8LjVEeOUcroamP8z5w" finder="_mDkXMLjVEeOUcroamP8z5w"> <tag>gold</tag> <tag>p1</tag> diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/banking.uml b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/banking.uml index ed2c9d13f1b..aa426b736e7 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/banking.uml +++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/banking.uml @@ -1,46 +1,35 @@ <?xml version="1.0" encoding="UTF-8"?> -<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ActionLanguage="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"> - <uml:Model xmi:id="_vtQUwPlAEeOEp7Wro2yWpw" name="banking"> - <packageImport xmi:type="uml:PackageImport" xmi:id="_vtQUwflAEeOEp7Wro2yWpw"> - <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> - </packageImport> - <packagedElement xmi:type="uml:Class" xmi:id="_5wJWAPlAEeOEp7Wro2yWpw" name="Account"> - <ownedAttribute xmi:type="uml:Property" xmi:id="_CCiC8PlBEeOEp7Wro2yWpw" name="id" visibility="public" isUnique="false"> - <type xmi:type="uml:PrimitiveType" href="library.uml#_9VhhQPlAEeOEp7Wro2yWpw"/> - <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_X0ky8PlBEeOEp7Wro2yWpw" value="1"/> - <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_X0laAPlBEeOEp7Wro2yWpw" value="1"/> - </ownedAttribute> - <ownedAttribute xmi:type="uml:Property" xmi:id="_kF-TIPlBEeOEp7Wro2yWpw" name="signatory" type="_YVg80PlBEeOEp7Wro2yWpw" association="_kF-6MPlBEeOEp7Wro2yWpw"> - <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_kF-TIflBEeOEp7Wro2yWpw"/> - <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_kF-TIvlBEeOEp7Wro2yWpw" value="*"/> - </ownedAttribute> - </packagedElement> - <packagedElement xmi:type="uml:Class" xmi:id="_YVg80PlBEeOEp7Wro2yWpw" name="Person"> - <ownedAttribute xmi:type="uml:Property" xmi:id="_amdrwPlBEeOEp7Wro2yWpw" name="ssn" visibility="public" isUnique="false"> - <type xmi:type="uml:DataType" href="library.uml#_AtaNAPJEEeOWJr1T78jdJA"/> - <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_cTywQPlBEeOEp7Wro2yWpw" value="1"/> - <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_cUEdEPlBEeOEp7Wro2yWpw" value="1"/> - </ownedAttribute> - <ownedAttribute xmi:type="uml:Property" xmi:id="_cxZ5UPlBEeOEp7Wro2yWpw" name="name" visibility="public" isUnique="false"> - <type xmi:type="uml:DataType" href="library.uml#_vCcKoPJEEeOWJr1T78jdJA"/> - <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_jHClsPlBEeOEp7Wro2yWpw" value="1"/> - <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_jHLIkPlBEeOEp7Wro2yWpw" value="1"/> - </ownedAttribute> - </packagedElement> - <packagedElement xmi:type="uml:Association" xmi:id="_kF-6MPlBEeOEp7Wro2yWpw" name="A_account_person_1" memberEnd="_kF-6MflBEeOEp7Wro2yWpw _kF-TIPlBEeOEp7Wro2yWpw" navigableOwnedEnd="_kF-6MflBEeOEp7Wro2yWpw"> - <ownedEnd xmi:type="uml:Property" xmi:id="_kF-6MflBEeOEp7Wro2yWpw" name="account" type="_5wJWAPlAEeOEp7Wro2yWpw" association="_kF-6MPlBEeOEp7Wro2yWpw"> - <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_kF-6MvlBEeOEp7Wro2yWpw"/> - <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_kF-6M_lBEeOEp7Wro2yWpw" value="*"/> - </ownedEnd> - </packagedElement> - <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_FFYv8PlBEeOEp7Wro2yWpw"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_FGT9APlBEeOEp7Wro2yWpw" source="http://www.eclipse.org/uml2/2.0.0/UML"> - <references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"/> - </eAnnotations> - <appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/> - </profileApplication> - </uml:Model> - <ActionLanguage:TextualRepresentation xmi:id="_FJGyUPlBEeOEp7Wro2yWpw" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/> - <ActionLanguage:TextualRepresentation xmi:id="_QzhLAPlBEeOEp7Wro2yWpw" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/> - <ActionLanguage:TextualRepresentation xmi:id="_fuKlYPlBEeOEp7Wro2yWpw" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/> -</xmi:XMI> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_vtQUwPlAEeOEp7Wro2yWpw" name="banking"> + <packageImport xmi:id="_vtQUwflAEeOEp7Wro2yWpw"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Class" xmi:id="_5wJWAPlAEeOEp7Wro2yWpw" name="Account"> + <ownedAttribute xmi:id="_CCiC8PlBEeOEp7Wro2yWpw" name="id" visibility="public" isUnique="false"> + <type xmi:type="uml:PrimitiveType" href="library.uml#_9VhhQPlAEeOEp7Wro2yWpw"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_X0ky8PlBEeOEp7Wro2yWpw" value="1"/> + <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_X0laAPlBEeOEp7Wro2yWpw" value="1"/> + </ownedAttribute> + <ownedAttribute xmi:id="_kF-TIPlBEeOEp7Wro2yWpw" name="signatory" type="_YVg80PlBEeOEp7Wro2yWpw" association="_kF-6MPlBEeOEp7Wro2yWpw"> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_kF-TIflBEeOEp7Wro2yWpw"/> + <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_kF-TIvlBEeOEp7Wro2yWpw" value="*"/> + </ownedAttribute> + </packagedElement> + <packagedElement xmi:type="uml:Class" xmi:id="_YVg80PlBEeOEp7Wro2yWpw" name="Person"> + <ownedAttribute xmi:id="_amdrwPlBEeOEp7Wro2yWpw" name="ssn" visibility="public" isUnique="false"> + <type xmi:type="uml:DataType" href="library.uml#_AtaNAPJEEeOWJr1T78jdJA"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_cTywQPlBEeOEp7Wro2yWpw" value="1"/> + <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_cUEdEPlBEeOEp7Wro2yWpw" value="1"/> + </ownedAttribute> + <ownedAttribute xmi:id="_cxZ5UPlBEeOEp7Wro2yWpw" name="name" visibility="public" isUnique="false"> + <type xmi:type="uml:DataType" href="library.uml#_vCcKoPJEEeOWJr1T78jdJA"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_jHClsPlBEeOEp7Wro2yWpw" value="1"/> + <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_jHLIkPlBEeOEp7Wro2yWpw" value="1"/> + </ownedAttribute> + </packagedElement> + <packagedElement xmi:type="uml:Association" xmi:id="_kF-6MPlBEeOEp7Wro2yWpw" name="A_account_person_1" memberEnd="_kF-6MflBEeOEp7Wro2yWpw _kF-TIPlBEeOEp7Wro2yWpw" navigableOwnedEnd="_kF-6MflBEeOEp7Wro2yWpw"> + <ownedEnd xmi:id="_kF-6MflBEeOEp7Wro2yWpw" name="account" type="_5wJWAPlAEeOEp7Wro2yWpw" association="_kF-6MPlBEeOEp7Wro2yWpw"> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_kF-6MvlBEeOEp7Wro2yWpw"/> + <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_kF-6M_lBEeOEp7Wro2yWpw" value="*"/> + </ownedEnd> + </packagedElement> +</uml:Model> diff --git a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/library.uml b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/library.uml index 3be4c8d6dc4..06f7daf5a6a 100644 --- a/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/library.uml +++ b/tests/junit/plugins/core/org.eclipse.papyrus.editor.integration.tests/model/reload/library.uml @@ -1,35 +1,26 @@ <?xml version="1.0" encoding="UTF-8"?> -<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ActionLanguage="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"> - <uml:Model xmi:id="__mBuMPJDEeOWJr1T78jdJA" name="types"> - <packageImport xmi:type="uml:PackageImport" xmi:id="__mBuMfJDEeOWJr1T78jdJA"> - <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> - </packageImport> - <packagedElement xmi:type="uml:DataType" xmi:id="_AtaNAPJEEeOWJr1T78jdJA" name="SSN"> - <ownedAttribute xmi:type="uml:Property" xmi:id="_eThWQPJEEeOWJr1T78jdJA" name="ssn" visibility="public" isUnique="false"> - <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> - <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_gmTRMPJEEeOWJr1T78jdJA" value="1"/> - <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_gmcbIPJEEeOWJr1T78jdJA" value="1"/> - </ownedAttribute> - </packagedElement> - <packagedElement xmi:type="uml:DataType" xmi:id="_vCcKoPJEEeOWJr1T78jdJA" name="Name"> - <ownedAttribute xmi:type="uml:Property" xmi:id="_W65OYPlAEeOEp7Wro2yWpw" name="lastName" visibility="public" isUnique="false"> - <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> - <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_YAKNUPlAEeOEp7Wro2yWpw" value="1"/> - <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_YAWakPlAEeOEp7Wro2yWpw" value="1"/> - </ownedAttribute> - <ownedAttribute xmi:type="uml:Property" xmi:id="_YtJ2MPlAEeOEp7Wro2yWpw" name="firstName" visibility="public" isUnique="false"> - <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> - <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_b6Vj4PlAEeOEp7Wro2yWpw" value="1"/> - <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_b6kNYPlAEeOEp7Wro2yWpw" value="1"/> - </ownedAttribute> - </packagedElement> - <packagedElement xmi:type="uml:PrimitiveType" xmi:id="_9VhhQPlAEeOEp7Wro2yWpw" name="Identifier"/> - <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_ZdS5sPlAEeOEp7Wro2yWpw"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_ZeInMPlAEeOEp7Wro2yWpw" source="http://www.eclipse.org/uml2/2.0.0/UML"> - <references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"/> - </eAnnotations> - <appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/> - </profileApplication> - </uml:Model> - <ActionLanguage:TextualRepresentation xmi:id="_ZeLDcPlAEeOEp7Wro2yWpw" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/> -</xmi:XMI> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="__mBuMPJDEeOWJr1T78jdJA" name="types"> + <packageImport xmi:id="__mBuMfJDEeOWJr1T78jdJA"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:DataType" xmi:id="_AtaNAPJEEeOWJr1T78jdJA" name="SSN"> + <ownedAttribute xmi:id="_eThWQPJEEeOWJr1T78jdJA" name="ssn" visibility="public" isUnique="false"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_gmTRMPJEEeOWJr1T78jdJA" value="1"/> + <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_gmcbIPJEEeOWJr1T78jdJA" value="1"/> + </ownedAttribute> + </packagedElement> + <packagedElement xmi:type="uml:DataType" xmi:id="_vCcKoPJEEeOWJr1T78jdJA" name="Name"> + <ownedAttribute xmi:id="_W65OYPlAEeOEp7Wro2yWpw" name="lastName" visibility="public" isUnique="false"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_YAKNUPlAEeOEp7Wro2yWpw" value="1"/> + <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_YAWakPlAEeOEp7Wro2yWpw" value="1"/> + </ownedAttribute> + <ownedAttribute xmi:id="_YtJ2MPlAEeOEp7Wro2yWpw" name="firstName" visibility="public" isUnique="false"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> + <lowerValue xmi:type="uml:LiteralInteger" xmi:id="_b6Vj4PlAEeOEp7Wro2yWpw" value="1"/> + <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_b6kNYPlAEeOEp7Wro2yWpw" value="1"/> + </ownedAttribute> + </packagedElement> + <packagedElement xmi:type="uml:PrimitiveType" xmi:id="_9VhhQPlAEeOEp7Wro2yWpw" name="Identifier"/> +</uml:Model> diff --git a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/StereotypeApplicationRepairTest.java b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/StereotypeApplicationRepairTest.java index 209265b22ee..1b25b93e04a 100644 --- a/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/StereotypeApplicationRepairTest.java +++ b/tests/junit/plugins/uml/decoratormodel/org.eclipse.papyrus.uml.decoratormodel.tests/src/org/eclipse/papyrus/uml/decoratormodel/tests/StereotypeApplicationRepairTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 CEA, Christian W. Damus, and others. + * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -9,6 +9,7 @@ * Contributors: * Christian W. Damus (CEA) - Initial API and implementation * Christian W. Damus - bug 399859 + * Christian W. Damus - bug 436666 * */ package org.eclipse.papyrus.uml.decoratormodel.tests; @@ -22,12 +23,14 @@ import static org.junit.Assert.fail; import java.util.Collection; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.util.ExtendedMetaData; import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.papyrus.infra.core.utils.AdapterUtils; import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; import org.eclipse.papyrus.junit.utils.rules.PluginResource; @@ -69,9 +72,10 @@ public class StereotypeApplicationRepairTest extends AbstractProfileExternalizat public void wrongProfileVersion() { assertThat("Should have found zombie stereotypes", zombies, notNullValue()); - EPackage schema = getOnlyZombieSchema(); - assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(schema), is((EObject) getTestProfile())); - assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(schema))); + IAdaptable schema = getOnlyZombieSchema(); + EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get(); + assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(ePackage), is((EObject) getTestProfile())); + assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(ePackage))); IRepairAction action = zombies.getSuggestedRepairAction(schema); assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION)); @@ -89,9 +93,10 @@ public class StereotypeApplicationRepairTest extends AbstractProfileExternalizat public void missingProfileApplication() { assertThat("Should have found zombie stereotypes", zombies, notNullValue()); - EPackage schema = getOnlyZombieSchema(); - assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(schema), is((EObject) getTestProfile())); - assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(schema))); + IAdaptable schema = getOnlyZombieSchema(); + EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get(); + assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(ePackage), is((EObject) getTestProfile())); + assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(ePackage))); IRepairAction action = zombies.getSuggestedRepairAction(schema); assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION)); @@ -109,8 +114,9 @@ public class StereotypeApplicationRepairTest extends AbstractProfileExternalizat public void missingSchema() { assertThat("Should have found zombie stereotypes", zombies, notNullValue()); - EPackage schema = getOnlyZombieSchema(); - assertThat("EPackage is not an unknown schema", getExtendedMetadata().demandedPackages(), hasItem(schema)); + IAdaptable schema = getOnlyZombieSchema(); + EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get(); + assertThat("EPackage is not an unknown schema", getExtendedMetadata().demandedPackages(), hasItem(ePackage)); IRepairAction action = zombies.getSuggestedRepairAction(schema); assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION)); @@ -135,7 +141,7 @@ public class StereotypeApplicationRepairTest extends AbstractProfileExternalizat houseKeeper.setField("zombies", snippet.getZombieStereotypes(decoratorModelResource)); } - void repair(final EPackage schema, final IRepairAction action) { + void repair(final IAdaptable schema, final IRepairAction action) { try { TransactionHelper.run(modelSet.getEditingDomain(), new Runnable() { @@ -150,8 +156,8 @@ public class StereotypeApplicationRepairTest extends AbstractProfileExternalizat } } - EPackage getOnlyZombieSchema() { - Collection<? extends EPackage> schemata = zombies.getZombiePackages(); + IAdaptable getOnlyZombieSchema() { + Collection<? extends IAdaptable> schemata = zombies.getZombieSchemas(); assertThat("Wrong number of zombie packages", schemata.size(), is(1)); return schemata.iterator().next(); } diff --git a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/resources/adv_mode.uml b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/resources/adv_mode.uml index 2f74f16776f..a06d55939f7 100644 --- a/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/resources/adv_mode.uml +++ b/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/resources/adv_mode.uml @@ -1,28 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> -<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ActionLanguage="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http://www.omg.org/spec/ALF/20120827/ActionLanguage-Profile pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"> - <uml:Model xmi:id="_IXDeQBf8EeSLM5AVoLTKwA" name="Model"> - <packageImport xmi:type="uml:PackageImport" xmi:id="_IXEFUBf8EeSLM5AVoLTKwA"> - <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> - </packageImport> - <packagedElement xmi:type="uml:Class" xmi:id="_JOhRwBf8EeSLM5AVoLTKwA" name="Container"> - <ownedTemplateSignature xmi:type="uml:RedefinableTemplateSignature" xmi:id="_LkcAQBf8EeSLM5AVoLTKwA" name="RedefinableTemplateSignature1" parameter="_T3jF8Bf8EeSLM5AVoLTKwA"> - <ownedParameter xmi:type="uml:ClassifierTemplateParameter" xmi:id="_T3jF8Bf8EeSLM5AVoLTKwA" parameteredElement="_WiCWQBf8EeSLM5AVoLTKwA"> - <ownedParameteredElement xmi:type="uml:Class" xmi:id="_WiCWQBf8EeSLM5AVoLTKwA" name="T" templateParameter="_T3jF8Bf8EeSLM5AVoLTKwA"/> - </ownedParameter> - </ownedTemplateSignature> - <ownedAttribute xmi:type="uml:Property" xmi:id="_dG048Bf8EeSLM5AVoLTKwA" name="size" isReadOnly="true" isDerived="true"> - <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Integer"/> - </ownedAttribute> - <ownedOperation xmi:type="uml:Operation" xmi:id="_qsvVABf8EeSLM5AVoLTKwA" name="add"> - <ownedParameter xmi:type="uml:Parameter" xmi:id="_29UV0Bf8EeSLM5AVoLTKwA" name="element" type="_WiCWQBf8EeSLM5AVoLTKwA" effect="read"/> - </ownedOperation> - </packagedElement> - <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_ex7I0Bf8EeSLM5AVoLTKwA"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_eyRHEBf8EeSLM5AVoLTKwA" source="http://www.eclipse.org/uml2/2.0.0/UML"> - <references xmi:type="ecore:EPackage" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#_sYse0YZLEeKyw49uR6nx3g"/> - </eAnnotations> - <appliedProfile xmi:type="uml:Profile" href="pathmap://PAPYRUS_ACTIONLANGUAGE_PROFILE/ActionLanguage-Profile.profile.uml#ActionLanguage"/> - </profileApplication> - </uml:Model> - <ActionLanguage:TextualRepresentation xmi:id="_e56nMBf8EeSLM5AVoLTKwA" language="org.eclipse.papyrus.uml.textedit.property.xtext.UmlProperty"/> -</xmi:XMI> +<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_IXDeQBf8EeSLM5AVoLTKwA" name="Model"> + <packageImport xmi:id="_IXEFUBf8EeSLM5AVoLTKwA"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Class" xmi:id="_JOhRwBf8EeSLM5AVoLTKwA" name="Container"> + <ownedTemplateSignature xmi:type="uml:RedefinableTemplateSignature" xmi:id="_LkcAQBf8EeSLM5AVoLTKwA" name="RedefinableTemplateSignature1" parameter="_T3jF8Bf8EeSLM5AVoLTKwA"> + <ownedParameter xmi:type="uml:ClassifierTemplateParameter" xmi:id="_T3jF8Bf8EeSLM5AVoLTKwA" parameteredElement="_WiCWQBf8EeSLM5AVoLTKwA"> + <ownedParameteredElement xmi:type="uml:Class" xmi:id="_WiCWQBf8EeSLM5AVoLTKwA" name="T" templateParameter="_T3jF8Bf8EeSLM5AVoLTKwA"/> + </ownedParameter> + </ownedTemplateSignature> + <ownedAttribute xmi:id="_dG048Bf8EeSLM5AVoLTKwA" name="size" isReadOnly="true" isDerived="true"> + <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Integer"/> + </ownedAttribute> + <ownedOperation xmi:id="_qsvVABf8EeSLM5AVoLTKwA" name="add"> + <ownedParameter xmi:id="_29UV0Bf8EeSLM5AVoLTKwA" name="element" type="_WiCWQBf8EeSLM5AVoLTKwA" effect="read"/> + </ownedOperation> + </packagedElement> +</uml:Model> diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-valid-schema.uml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-valid-schema.uml new file mode 100644 index 00000000000..8e3c20b8fc2 --- /dev/null +++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-valid-schema.uml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:MyProfile="http:///schemas/MyProfile/_V3GxoMASEeOtPYrql1dzPg/0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http:///schemas/MyProfile/_V3GxoMASEeOtPYrql1dzPg/0 platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_7ruGMMA6EeONOZU5O_ye6g"> + <uml:Model xmi:id="_dvVSIMASEeOtPYrql1dzPg" name="Model"> + <packageImport xmi:type="uml:PackageImport" xmi:id="_dvVSIcASEeOtPYrql1dzPg"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Class" xmi:id="_eiqzkMASEeOtPYrql1dzPg" name="Class1"> + <ownedAttribute xmi:type="uml:Property" xmi:id="_gM4SoMASEeOtPYrql1dzPg" name="Attribute1"/> + <ownedAttribute xmi:type="uml:Property" xmi:id="_xMJ3MMASEeOtPYrql1dzPg" name="Attribute2"/> + </packagedElement> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_kovZ8MASEeOtPYrql1dzPg"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_ko_4oMASEeOtPYrql1dzPg" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_7ruGMMA6EeONOZU5O_ye6g"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_GdQvQMAREeOtPYrql1dzPg"/> + </profileApplication> + </uml:Model> + <MyProfile:Stereo xmi:id="_mPac0MASEeOtPYrql1dzPg" alertLevel="yellow" appliesTo="_gM4SoMASEeOtPYrql1dzPg _xMJ3MMASEeOtPYrql1dzPg"> + <tag>p2</tag> + <tag>silver</tag> + <name xmi:type="MyProfile:Name" xmi:id="_2vm4sMASEeOtPYrql1dzPg" lastName="Damus" firstName="Christian"> + <initials>W</initials> + </name> + </MyProfile:Stereo> +</xmi:XMI> diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-wrong-profile-version.uml b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-wrong-profile-version.uml new file mode 100644 index 00000000000..c26ab64a5dd --- /dev/null +++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/resources/regression/bug436666/orphans-of-wrong-profile-version.uml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:MyProfile="http:///schemas/MyProfile/_V3GxoMASEeOtPYrql1dzPg/0" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xsi:schemaLocation="http:///schemas/MyProfile/_V3GxoMASEeOtPYrql1dzPg/0 platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_V3LqIMASEeOtPYrql1dzPg"> + <uml:Model xmi:id="_dvVSIMASEeOtPYrql1dzPg" name="Model"> + <packageImport xmi:type="uml:PackageImport" xmi:id="_dvVSIcASEeOtPYrql1dzPg"> + <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/> + </packageImport> + <packagedElement xmi:type="uml:Class" xmi:id="_eiqzkMASEeOtPYrql1dzPg" name="Class1"> + <ownedAttribute xmi:type="uml:Property" xmi:id="_gM4SoMASEeOtPYrql1dzPg" name="Attribute1"/> + <ownedAttribute xmi:type="uml:Property" xmi:id="_xMJ3MMASEeOtPYrql1dzPg" name="Attribute2"/> + </packagedElement> + <profileApplication xmi:type="uml:ProfileApplication" xmi:id="_kovZ8MASEeOtPYrql1dzPg"> + <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_ko_4oMASEeOtPYrql1dzPg" source="http://www.eclipse.org/uml2/2.0.0/UML"> + <references xmi:type="ecore:EPackage" href="platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_7ruGMMA6EeONOZU5O_ye6g"/> + </eAnnotations> + <appliedProfile xmi:type="uml:Profile" href="platform:/plugin/org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml#_GdQvQMAREeOtPYrql1dzPg"/> + </profileApplication> + </uml:Model> + <MyProfile:Stereo xmi:id="_mPac0MASEeOtPYrql1dzPg" alertLevel="yellow" appliesTo="_gM4SoMASEeOtPYrql1dzPg _xMJ3MMASEeOtPYrql1dzPg"> + <tag>p2</tag> + <tag>silver</tag> + <name xmi:type="MyProfile:Name" xmi:id="_2vm4sMASEeOtPYrql1dzPg" lastName="Damus" firstName="Christian"> + <initials>W</initials> + </name> + </MyProfile:Stereo> +</xmi:XMI> diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java index e0030b067e3..8052e7b85ea 100644 --- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java +++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeApplicationRepairSnippetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 CEA and others. + * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -8,6 +8,7 @@ * * Contributors: * Christian W. Damus (CEA) - Initial API and implementation + * Christian W. Damus - bug 436666 * */ package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes; @@ -24,6 +25,7 @@ import static org.junit.Assert.fail; import java.util.Arrays; import java.util.Collection; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.Enumerator; import org.eclipse.emf.common.util.URI; @@ -33,6 +35,7 @@ import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.util.ExtendedMetaData; import org.eclipse.emf.ecore.xmi.XMLResource; +import org.eclipse.papyrus.infra.core.utils.AdapterUtils; import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; import org.eclipse.papyrus.junit.utils.rules.HouseKeeper; @@ -95,9 +98,10 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest public void wrongProfileVersion() { assertThat("Should have found zombie stereotypes", zombies, notNullValue()); - EPackage schema = getOnlyZombieSchema(); - assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(schema), is((EObject)profile)); - assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(schema))); + IAdaptable schema = getOnlyZombieSchema(); + EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get(); + assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(ePackage), is((EObject) profile)); + assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(ePackage))); IRepairAction action = zombies.getSuggestedRepairAction(schema); assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION)); @@ -115,9 +119,10 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest public void missingProfileApplication() { assertThat("Should have found zombie stereotypes", zombies, notNullValue()); - EPackage schema = getOnlyZombieSchema(); - assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(schema), is((EObject)profile)); - assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(schema))); + IAdaptable schema = getOnlyZombieSchema(); + EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get(); + assertThat("Did not match schema to loaded profile", EcoreUtil.getRootContainer(ePackage), is((EObject) profile)); + assertThat("EPackage is an unknown schema", getExtendedMetadata().demandedPackages(), not(hasItem(ePackage))); IRepairAction action = zombies.getSuggestedRepairAction(schema); assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION)); @@ -135,8 +140,9 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest public void missingSchema() { assertThat("Should have found zombie stereotypes", zombies, notNullValue()); - EPackage schema = getOnlyZombieSchema(); - assertThat("EPackage is not an unknown schema", getExtendedMetadata().demandedPackages(), hasItem(schema)); + IAdaptable schema = getOnlyZombieSchema(); + EPackage ePackage = AdapterUtils.adapt(schema, EPackage.class).get(); + assertThat("EPackage is not an unknown schema", getExtendedMetadata().demandedPackages(), hasItem(ePackage)); IRepairAction action = zombies.getSuggestedRepairAction(schema); assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION)); @@ -153,7 +159,7 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest public void deleteStereotypes() { assertThat("Should have found zombie stereotypes", zombies, notNullValue()); - EPackage schema = getOnlyZombieSchema(); + IAdaptable schema = getOnlyZombieSchema(); IRepairAction action = zombies.getRepairAction(schema, IRepairAction.Kind.DELETE); assertThat("Wrong repair action", action.kind(), is(IRepairAction.Kind.DELETE)); @@ -172,14 +178,14 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest URI profileURI = URI.createPlatformPluginURI("org.eclipse.papyrus.uml.modelrepair.tests/resources/profile/myprofile.profile.uml", true); profile = UML2Util.load(modelSet.getResourceSet(), profileURI, UMLPackage.Literals.PROFILE); stereotype = profile.getOwnedStereotype("Stereo"); - class1 = (Class)modelSet.getModel().getOwnedType("Class1"); + class1 = (Class) modelSet.getModel().getOwnedType("Class1"); fixture = houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(Functions.constant(profile)), "dispose", modelSet.getResourceSet()); fixture.start(modelSet.getResourceSet()); houseKeeper.setField("zombies", fixture.getZombieStereotypes(modelSet.getModelResource(), modelSet.getModel())); } - void repair(final EPackage schema, final IRepairAction action) { + void repair(final IAdaptable schema, final IRepairAction action) { try { TransactionHelper.run(modelSet.getEditingDomain(), new Runnable() { @@ -194,8 +200,8 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest } } - EPackage getOnlyZombieSchema() { - Collection<? extends EPackage> schemata = zombies.getZombiePackages(); + IAdaptable getOnlyZombieSchema() { + Collection<? extends IAdaptable> schemata = zombies.getZombieSchemas(); assertThat("Wrong number of zombie packages", schemata.size(), is(1)); return schemata.iterator().next(); } @@ -207,41 +213,41 @@ public class StereotypeApplicationRepairSnippetTest extends AbstractPapyrusTest // Verify an Enumeration value stored as an XML attribute Object value = application.eGet(eclass.getEStructuralFeature("alertLevel")); - assertThat("Alert level is not yellow", (value instanceof Enumerator) && ((Enumerator)value).getLiteral().equals("yellow"), is(true)); + assertThat("Alert level is not yellow", (value instanceof Enumerator) && ((Enumerator) value).getLiteral().equals("yellow"), is(true)); // Verify a multi-valued attribute stored as XML elements value = application.eGet(eclass.getEStructuralFeature("tag")); - assertThat("Wrong tags found", value, is((Object)Arrays.asList("p2", "silver"))); + assertThat("Wrong tags found", value, is((Object) Arrays.asList("p2", "silver"))); // Verify a reference value stored as an XML IDREFS attribute value = application.eGet(eclass.getEStructuralFeature("appliesTo")); - assertThat("Wrong appliesTo found", value, is((Object)class1.getOwnedAttributes())); + assertThat("Wrong appliesTo found", value, is((Object) class1.getOwnedAttributes())); // Verify a contained EObject that is a complex DataType value value = application.eGet(eclass.getEStructuralFeature("name")); { assertThat("Value is not an EList", value, instanceOf(EList.class)); - EList<?> list = (EList<?>)value; + EList<?> list = (EList<?>) value; assertThat("List has wrong number of elements", list.size(), is(1)); value = list.get(0); assertThat("Value is not an EObject", value, instanceOf(EObject.class)); - EObject name = (EObject)value; + EObject name = (EObject) value; EClass dataType = name.eClass(); - assertThat("Wrong firstName", name.eGet(dataType.getEStructuralFeature("firstName")), is((Object)"Christian")); - assertThat("Wrong lastName", name.eGet(dataType.getEStructuralFeature("lastName")), is((Object)"Damus")); - assertThat("Wrong initials", name.eGet(dataType.getEStructuralFeature("initials")), is((Object)Arrays.asList("W"))); + assertThat("Wrong firstName", name.eGet(dataType.getEStructuralFeature("firstName")), is((Object) "Christian")); + assertThat("Wrong lastName", name.eGet(dataType.getEStructuralFeature("lastName")), is((Object) "Damus")); + assertThat("Wrong initials", name.eGet(dataType.getEStructuralFeature("initials")), is((Object) Arrays.asList("W"))); } } ExtendedMetaData getExtendedMetadata() { ExtendedMetaData result = ExtendedMetaData.INSTANCE; - Object option = ((XMLResource)modelSet.getModelResource()).getDefaultSaveOptions().get(XMLResource.OPTION_EXTENDED_META_DATA); - if(option instanceof ExtendedMetaData) { - result = (ExtendedMetaData)option; + Object option = ((XMLResource) modelSet.getModelResource()).getDefaultSaveOptions().get(XMLResource.OPTION_EXTENDED_META_DATA); + if (option instanceof ExtendedMetaData) { + result = (ExtendedMetaData) option; } return result; diff --git a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java index b80a274cd72..8ec42f5237b 100644 --- a/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java +++ b/tests/junit/plugins/uml/org.eclipse.papyrus.uml.modelrepair.tests/src/org/eclipse/papyrus/uml/modelrepair/internal/stereotypes/StereotypeRepairRegressionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 CEA, Christian W. Damus, and others. + * Copyright (c) 2014, 2015 CEA, Christian W. Damus, and others. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -10,6 +10,7 @@ * Christian W. Damus (CEA) - Initial API and implementation * Christian W. Damus - bug 455248 * Christian W. Damus - bug 455329 + * Christian W. Damus - bug 436666 * */ package org.eclipse.papyrus.uml.modelrepair.internal.stereotypes; @@ -27,6 +28,9 @@ import java.lang.reflect.Method; import java.util.Collection; import java.util.Set; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.emf.common.util.ECollections; +import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.papyrus.infra.core.utils.TransactionHelper; import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest; @@ -90,7 +94,7 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest { @Test @PluginResource("/resources/regression/bug434302/nested-profiles-nonamespace.uml") public void nestedProfileApplicationsMissingNamespace_bug434302() { - EPackage schema = getOnlyZombieSchema(); + IAdaptable schema = getOnlyZombieSchema(); IRepairAction action = zombies.getSuggestedRepairAction(schema); assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION)); @@ -119,7 +123,7 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest { @Test @PluginResource("/resources/regression/bug434302/nested-profiles-2pkgs1profile.uml") public void nestedProfileApplications2Pkgs1Profile_bug434302() { - EPackage schema = getOnlyZombieSchema(); + IAdaptable schema = getOnlyZombieSchema(); IRepairAction action = zombies.getSuggestedRepairAction(schema); assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION)); @@ -173,7 +177,7 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest { @Bug("436666") @PluginResource("/resources/regression/bug436666/model2-missing-schemalocation.uml") public void nestedPackageSchemaMissing_bug436666() { - EPackage schema = getOnlyZombieSchema(); + IAdaptable schema = getOnlyZombieSchema(); IRepairAction action = zombies.getSuggestedRepairAction(schema); assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.APPLY_LATEST_PROFILE_DEFINITION)); @@ -232,6 +236,44 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest { assertThat("Should not have found zombie stereotypes", zombies, nullValue()); } + /** + * Tests that orphaned stereotype instances are correctly detected where they are of the currently applied profile schema. + * + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=436666 + */ + @Test + @Bug("436666") + @PluginResource("/resources/regression/bug436666/orphans-of-valid-schema.uml") + public void orphansOfValidSchema_bug436666() { + IAdaptable schema = getOnlyZombieSchema(); + IRepairAction action = zombies.getSuggestedRepairAction(schema); + assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.DELETE)); + + repair(schema, action); + + // The stereotype applications were deleted + assertThat(model.eResource().getContents(), is(ECollections.singletonEList((EObject) model))); + } + + /** + * Tests that orphaned stereotype instances are correctly detected where they are of a profile version that is not currently applied. + * + * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=436666 + */ + @Test + @Bug("436666") + @PluginResource("/resources/regression/bug436666/orphans-of-wrong-profile-version.uml") + public void orphansOfWrongProfileVersion_bug436666() { + IAdaptable schema = getOnlyZombieSchema(); + IRepairAction action = zombies.getSuggestedRepairAction(schema); + assertThat("Wrong suggested repair action", action.kind(), is(IRepairAction.Kind.DELETE)); + + repair(schema, action); + + // The stereotype applications were deleted + assertThat(model.eResource().getContents(), is(ECollections.singletonEList((EObject) model))); + } + // // Test framework // @@ -319,7 +361,7 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest { return houseKeeper.cleanUpLater(new StereotypeApplicationRepairSnippet(Functions.constant((Profile) null)), "dispose", modelSet.getResourceSet()); } - void repair(final EPackage schema, final IRepairAction action) { + void repair(final IAdaptable schema, final IRepairAction action) { try { TransactionHelper.run(modelSet.getEditingDomain(), new Runnable() { @@ -334,8 +376,8 @@ public class StereotypeRepairRegressionTest extends AbstractPapyrusTest { } } - EPackage getOnlyZombieSchema() { - Collection<? extends EPackage> schemata = zombies.getZombiePackages(); + IAdaptable getOnlyZombieSchema() { + Collection<? extends IAdaptable> schemata = zombies.getZombieSchemas(); assertThat("Wrong number of zombie packages", schemata.size(), is(1)); return schemata.iterator().next(); } diff --git a/tests/junit/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter.tests/META-INF/MANIFEST.MF index 385732611f4..6da61e52ed7 100644 --- a/tests/junit/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter.tests/META-INF/MANIFEST.MF +++ b/tests/junit/plugins/uml/profile/org.eclipse.papyrus.uml.profile.drafter.tests/META-INF/MANIFEST.MF @@ -9,3 +9,4 @@ Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="1.1.0" Export-Package: org.eclipse.papyrus.uml.profile.drafter.tests, org.eclipse.papyrus.uml.profile.drafter.tests.exception Bundle-Vendor: %providerName +Bundle-Localization: plugin |